diff --git a/.stats.yml b/.stats.yml index 4ec196df..a6f08a5a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 167 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury/modern-treasury-f04294e2bfc5c480201c19a78feff5c8ebd61e829458cecb7fb38450a41081c4.yml -openapi_spec_hash: e9934332e71cb231d3eb5e728f735393 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/modern-treasury/modern-treasury-c8dbb2e761df242bb7cf8105cc386cfbd53fcc6c71dce41f5716122b15b569f7.yml +openapi_spec_hash: 5c00f7dd5c6bb70dabd75589ffc999ea config_hash: 55a5583c24314820a65f792e2ebab57b diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReport.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReport.kt index 7150b069..86ea7116 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReport.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReport.kt @@ -869,7 +869,7 @@ private constructor( /** * 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`, or `us_bank`. + * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, or `us_bank`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1218,8 +1218,8 @@ private constructor( /** * 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`, - * or `us_bank`. + * `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, or + * `us_bank`. */ fun vendorCodeType(vendorCodeType: String?) = vendorCodeType(JsonField.ofNullable(vendorCodeType)) diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReportCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReportCreateParams.kt index 56c88291..70465e42 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReportCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BalanceReportCreateParams.kt @@ -905,7 +905,7 @@ private constructor( /** * 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`, or `us_bank`. + * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, or `us_bank`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1038,8 +1038,8 @@ private constructor( /** * 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`, - * or `us_bank`. + * `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, or + * `us_bank`. */ fun vendorCodeType(vendorCodeType: String?) = vendorCodeType(JsonField.ofNullable(vendorCodeType)) diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BankSettings.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BankSettings.kt new file mode 100644 index 00000000..2c97d31f --- /dev/null +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BankSettings.kt @@ -0,0 +1,644 @@ +// 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.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.checkRequired +import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class BankSettings +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val backupWithholdingPercentage: JsonField, + private val createdAt: JsonField, + private val discardedAt: JsonField, + private val enableBackupWithholding: JsonField, + private val liveMode: JsonField, + private val object_: JsonField, + private val privacyOptOut: JsonField, + private val regulationO: JsonField, + private val updatedAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("backup_withholding_percentage") + @ExcludeMissing + backupWithholdingPercentage: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("discarded_at") + @ExcludeMissing + discardedAt: JsonField = JsonMissing.of(), + @JsonProperty("enable_backup_withholding") + @ExcludeMissing + enableBackupWithholding: JsonField = JsonMissing.of(), + @JsonProperty("live_mode") @ExcludeMissing liveMode: JsonField = JsonMissing.of(), + @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), + @JsonProperty("privacy_opt_out") + @ExcludeMissing + privacyOptOut: JsonField = JsonMissing.of(), + @JsonProperty("regulation_o") + @ExcludeMissing + regulationO: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + ) : this( + id, + backupWithholdingPercentage, + createdAt, + discardedAt, + enableBackupWithholding, + liveMode, + object_, + privacyOptOut, + regulationO, + updatedAt, + mutableMapOf(), + ) + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The percentage of backup withholding to apply to the legal entity. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun backupWithholdingPercentage(): Optional = + backupWithholdingPercentage.getOptional("backup_withholding_percentage") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") + + /** + * Whether backup withholding is enabled. See more here - + * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun enableBackupWithholding(): Optional = + enableBackupWithholding.getOptional("enable_backup_withholding") + + /** + * This field will be true if this object exists in the live environment or false if it exists + * in the test environment. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun liveMode(): Boolean = liveMode.getRequired("live_mode") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun object_(): String = object_.getRequired("object") + + /** + * Cross River Bank specific setting to opt out of privacy policy. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + + /** + * It covers, among other types of insider loans, extensions of credit by a member bank to an + * executive officer, director, or principal shareholder of the member bank; a bank holding + * company of which the member bank is a subsidiary; and any other subsidiary of that bank + * holding company. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun regulationO(): Optional = regulationO.getOptional("regulation_o") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [backupWithholdingPercentage]. + * + * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("backup_withholding_percentage") + @ExcludeMissing + fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [discardedAt]. + * + * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("discarded_at") + @ExcludeMissing + fun _discardedAt(): JsonField = discardedAt + + /** + * Returns the raw JSON value of [enableBackupWithholding]. + * + * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("enable_backup_withholding") + @ExcludeMissing + fun _enableBackupWithholding(): JsonField = enableBackupWithholding + + /** + * Returns the raw JSON value of [liveMode]. + * + * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + + /** + * Returns the raw JSON value of [object_]. + * + * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + + /** + * Returns the raw JSON value of [privacyOptOut]. + * + * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("privacy_opt_out") + @ExcludeMissing + fun _privacyOptOut(): JsonField = privacyOptOut + + /** + * Returns the raw JSON value of [regulationO]. + * + * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("regulation_o") + @ExcludeMissing + fun _regulationO(): JsonField = regulationO + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [BankSettings]. + * + * The following fields are required: + * ```java + * .id() + * .backupWithholdingPercentage() + * .createdAt() + * .discardedAt() + * .enableBackupWithholding() + * .liveMode() + * .object_() + * .privacyOptOut() + * .regulationO() + * .updatedAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BankSettings]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var backupWithholdingPercentage: JsonField? = null + private var createdAt: JsonField? = null + private var discardedAt: JsonField? = null + private var enableBackupWithholding: JsonField? = null + private var liveMode: JsonField? = null + private var object_: JsonField? = null + private var privacyOptOut: JsonField? = null + private var regulationO: JsonField? = null + private var updatedAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(bankSettings: BankSettings) = apply { + id = bankSettings.id + backupWithholdingPercentage = bankSettings.backupWithholdingPercentage + createdAt = bankSettings.createdAt + discardedAt = bankSettings.discardedAt + enableBackupWithholding = bankSettings.enableBackupWithholding + liveMode = bankSettings.liveMode + object_ = bankSettings.object_ + privacyOptOut = bankSettings.privacyOptOut + regulationO = bankSettings.regulationO + updatedAt = bankSettings.updatedAt + additionalProperties = bankSettings.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The percentage of backup withholding to apply to the legal entity. */ + fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = + backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) + + /** + * Alias for [Builder.backupWithholdingPercentage]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = + backupWithholdingPercentage(backupWithholdingPercentage as Long?) + + /** + * Alias for calling [Builder.backupWithholdingPercentage] with + * `backupWithholdingPercentage.orElse(null)`. + */ + fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = + backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) + + /** + * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. + * + * You should usually call [Builder.backupWithholdingPercentage] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { + this.backupWithholdingPercentage = backupWithholdingPercentage + } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun discardedAt(discardedAt: OffsetDateTime?) = + discardedAt(JsonField.ofNullable(discardedAt)) + + /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ + fun discardedAt(discardedAt: Optional) = + discardedAt(discardedAt.getOrNull()) + + /** + * Sets [Builder.discardedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun discardedAt(discardedAt: JsonField) = apply { + this.discardedAt = discardedAt + } + + /** + * Whether backup withholding is enabled. See more here - + * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. + */ + fun enableBackupWithholding(enableBackupWithholding: Boolean?) = + enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) + + /** + * Alias for [Builder.enableBackupWithholding]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun enableBackupWithholding(enableBackupWithholding: Boolean) = + enableBackupWithholding(enableBackupWithholding as Boolean?) + + /** + * Alias for calling [Builder.enableBackupWithholding] with + * `enableBackupWithholding.orElse(null)`. + */ + fun enableBackupWithholding(enableBackupWithholding: Optional) = + enableBackupWithholding(enableBackupWithholding.getOrNull()) + + /** + * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. + * + * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { + this.enableBackupWithholding = enableBackupWithholding + } + + /** + * 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)) + + /** + * Sets [Builder.liveMode] to an arbitrary JSON value. + * + * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + + fun object_(object_: String) = object_(JsonField.of(object_)) + + /** + * Sets [Builder.object_] to an arbitrary JSON value. + * + * You should usually call [Builder.object_] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun object_(object_: JsonField) = apply { this.object_ = object_ } + + /** Cross River Bank specific setting to opt out of privacy policy. */ + fun privacyOptOut(privacyOptOut: Boolean?) = + privacyOptOut(JsonField.ofNullable(privacyOptOut)) + + /** + * Alias for [Builder.privacyOptOut]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) + + /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ + fun privacyOptOut(privacyOptOut: Optional) = + privacyOptOut(privacyOptOut.getOrNull()) + + /** + * Sets [Builder.privacyOptOut] to an arbitrary JSON value. + * + * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun privacyOptOut(privacyOptOut: JsonField) = apply { + this.privacyOptOut = privacyOptOut + } + + /** + * It covers, among other types of insider loans, extensions of credit by a member bank to + * an executive officer, director, or principal shareholder of the member bank; a bank + * holding company of which the member bank is a subsidiary; and any other subsidiary of + * that bank holding company. + */ + fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) + + /** + * Alias for [Builder.regulationO]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + + /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ + fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) + + /** + * Sets [Builder.regulationO] to an arbitrary JSON value. + * + * You should usually call [Builder.regulationO] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun regulationO(regulationO: JsonField) = apply { this.regulationO = regulationO } + + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [BankSettings]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .backupWithholdingPercentage() + * .createdAt() + * .discardedAt() + * .enableBackupWithholding() + * .liveMode() + * .object_() + * .privacyOptOut() + * .regulationO() + * .updatedAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BankSettings = + BankSettings( + checkRequired("id", id), + checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), + checkRequired("createdAt", createdAt), + checkRequired("discardedAt", discardedAt), + checkRequired("enableBackupWithholding", enableBackupWithholding), + checkRequired("liveMode", liveMode), + checkRequired("object_", object_), + checkRequired("privacyOptOut", privacyOptOut), + checkRequired("regulationO", regulationO), + checkRequired("updatedAt", updatedAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): BankSettings = apply { + if (validated) { + return@apply + } + + id() + backupWithholdingPercentage() + createdAt() + discardedAt() + enableBackupWithholding() + liveMode() + object_() + privacyOptOut() + regulationO() + updatedAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (discardedAt.asKnown().isPresent) 1 else 0) + + (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + + (if (liveMode.asKnown().isPresent) 1 else 0) + + (if (object_.asKnown().isPresent) 1 else 0) + + (if (privacyOptOut.asKnown().isPresent) 1 else 0) + + (if (regulationO.asKnown().isPresent) 1 else 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is BankSettings && + id == other.id && + backupWithholdingPercentage == other.backupWithholdingPercentage && + createdAt == other.createdAt && + discardedAt == other.discardedAt && + enableBackupWithholding == other.enableBackupWithholding && + liveMode == other.liveMode && + object_ == other.object_ && + privacyOptOut == other.privacyOptOut && + regulationO == other.regulationO && + updatedAt == other.updatedAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + backupWithholdingPercentage, + createdAt, + discardedAt, + enableBackupWithholding, + liveMode, + object_, + privacyOptOut, + regulationO, + updatedAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "BankSettings{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" +} diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BulkRequestCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BulkRequestCreateParams.kt index a846168f..052f0e4d 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BulkRequestCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/BulkRequestCreateParams.kt @@ -283,6 +283,14 @@ private constructor( ledgerTransactionUpdateRequestWithId: Resource.LedgerTransactionUpdateRequestWithId ) = apply { body.addResource(ledgerTransactionUpdateRequestWithId) } + /** + * Alias for calling [addResource] with + * `Resource.ofLedgerAccountUpdateRequestWithId(ledgerAccountUpdateRequestWithId)`. + */ + fun addResource( + ledgerAccountUpdateRequestWithId: Resource.LedgerAccountUpdateRequestWithId + ) = apply { body.addResource(ledgerAccountUpdateRequestWithId) } + /** * Additional data represented as key-value pairs. Both the key and value must be strings. */ @@ -730,6 +738,17 @@ private constructor( ) ) + /** + * Alias for calling [addResource] with + * `Resource.ofLedgerAccountUpdateRequestWithId(ledgerAccountUpdateRequestWithId)`. + */ + fun addResource( + ledgerAccountUpdateRequestWithId: Resource.LedgerAccountUpdateRequestWithId + ) = + addResource( + Resource.ofLedgerAccountUpdateRequestWithId(ledgerAccountUpdateRequestWithId) + ) + /** * Additional data represented as key-value pairs. Both the key and value must be * strings. @@ -1185,6 +1204,7 @@ private constructor( private val transactionUpdateRequestWithId: TransactionUpdateRequestWithId? = null, private val ledgerTransactionUpdateRequestWithId: LedgerTransactionUpdateRequestWithId? = null, + private val ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId? = null, private val _json: JsonValue? = null, ) { @@ -1217,6 +1237,9 @@ private constructor( fun ledgerTransactionUpdateRequestWithId(): Optional = Optional.ofNullable(ledgerTransactionUpdateRequestWithId) + fun ledgerAccountUpdateRequestWithId(): Optional = + Optional.ofNullable(ledgerAccountUpdateRequestWithId) + fun isPaymentOrderAsyncCreateRequest(): Boolean = paymentOrderAsyncCreateRequest != null fun isExpectedPaymentCreateRequest(): Boolean = expectedPaymentCreateRequest != null @@ -1239,6 +1262,8 @@ private constructor( fun isLedgerTransactionUpdateRequestWithId(): Boolean = ledgerTransactionUpdateRequestWithId != null + fun isLedgerAccountUpdateRequestWithId(): Boolean = ledgerAccountUpdateRequestWithId != null + fun asPaymentOrderAsyncCreateRequest(): PaymentOrderAsyncCreateRequest = paymentOrderAsyncCreateRequest.getOrThrow("paymentOrderAsyncCreateRequest") @@ -1268,6 +1293,9 @@ private constructor( fun asLedgerTransactionUpdateRequestWithId(): LedgerTransactionUpdateRequestWithId = ledgerTransactionUpdateRequestWithId.getOrThrow("ledgerTransactionUpdateRequestWithId") + fun asLedgerAccountUpdateRequestWithId(): LedgerAccountUpdateRequestWithId = + ledgerAccountUpdateRequestWithId.getOrThrow("ledgerAccountUpdateRequestWithId") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -1324,6 +1352,8 @@ private constructor( visitor.visitLedgerTransactionUpdateRequestWithId( ledgerTransactionUpdateRequestWithId ) + ledgerAccountUpdateRequestWithId != null -> + visitor.visitLedgerAccountUpdateRequestWithId(ledgerAccountUpdateRequestWithId) else -> visitor.unknown(_json) } @@ -1402,6 +1432,12 @@ private constructor( ) { ledgerTransactionUpdateRequestWithId.validate() } + + override fun visitLedgerAccountUpdateRequestWithId( + ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId + ) { + ledgerAccountUpdateRequestWithId.validate() + } } ) validated = true @@ -1463,6 +1499,10 @@ private constructor( ledgerTransactionUpdateRequestWithId: LedgerTransactionUpdateRequestWithId ) = ledgerTransactionUpdateRequestWithId.validity() + override fun visitLedgerAccountUpdateRequestWithId( + ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId + ) = ledgerAccountUpdateRequestWithId.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1482,7 +1522,9 @@ private constructor( paymentOrderUpdateRequestWithId == other.paymentOrderUpdateRequestWithId && expectedPaymentUpdateRequestWithId == other.expectedPaymentUpdateRequestWithId && transactionUpdateRequestWithId == other.transactionUpdateRequestWithId && - ledgerTransactionUpdateRequestWithId == other.ledgerTransactionUpdateRequestWithId + ledgerTransactionUpdateRequestWithId == + other.ledgerTransactionUpdateRequestWithId && + ledgerAccountUpdateRequestWithId == other.ledgerAccountUpdateRequestWithId } override fun hashCode(): Int = @@ -1497,6 +1539,7 @@ private constructor( expectedPaymentUpdateRequestWithId, transactionUpdateRequestWithId, ledgerTransactionUpdateRequestWithId, + ledgerAccountUpdateRequestWithId, ) override fun toString(): String = @@ -1520,6 +1563,8 @@ private constructor( "Resource{transactionUpdateRequestWithId=$transactionUpdateRequestWithId}" ledgerTransactionUpdateRequestWithId != null -> "Resource{ledgerTransactionUpdateRequestWithId=$ledgerTransactionUpdateRequestWithId}" + ledgerAccountUpdateRequestWithId != null -> + "Resource{ledgerAccountUpdateRequestWithId=$ledgerAccountUpdateRequestWithId}" _json != null -> "Resource{_unknown=$_json}" else -> throw IllegalStateException("Invalid Resource") } @@ -1574,6 +1619,11 @@ private constructor( Resource( ledgerTransactionUpdateRequestWithId = ledgerTransactionUpdateRequestWithId ) + + @JvmStatic + fun ofLedgerAccountUpdateRequestWithId( + ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId + ) = Resource(ledgerAccountUpdateRequestWithId = ledgerAccountUpdateRequestWithId) } /** @@ -1617,6 +1667,10 @@ private constructor( ledgerTransactionUpdateRequestWithId: LedgerTransactionUpdateRequestWithId ): T + fun visitLedgerAccountUpdateRequestWithId( + ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId + ): T + /** * Maps an unknown variant of [Resource] to a value of type [T]. * @@ -1682,6 +1736,10 @@ private constructor( _json = json, ) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { + Resource(ledgerAccountUpdateRequestWithId = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1726,6 +1784,8 @@ private constructor( generator.writeObject(value.transactionUpdateRequestWithId) value.ledgerTransactionUpdateRequestWithId != null -> generator.writeObject(value.ledgerTransactionUpdateRequestWithId) + value.ledgerAccountUpdateRequestWithId != null -> + generator.writeObject(value.ledgerAccountUpdateRequestWithId) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Resource") } @@ -1976,9 +2036,8 @@ private constructor( originatingAccountId.getRequired("originating_account_id") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an unexpected @@ -2921,9 +2980,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, - * `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, - * `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, + * `bacs`, `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(JsonField.of(type)) @@ -7213,11 +7271,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField - val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -7260,8 +7313,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7296,8 +7347,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7334,8 +7383,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -7370,8 +7417,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -7493,10 +7538,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -7509,26 +7550,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -7551,24 +7582,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7597,24 +7621,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7645,24 +7662,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -7691,24 +7701,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -8841,8 +8844,7 @@ private constructor( statementDescriptor.getOptional("statement_descriptor") /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -9687,10 +9689,7 @@ private constructor( this.statementDescriptor = statementDescriptor } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, - * sepa, signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -11048,7 +11047,7 @@ private constructor( /** * 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`, + * `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, * `us_bank`, or others. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type @@ -11075,7 +11074,7 @@ private constructor( /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * or `book`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -11346,8 +11345,8 @@ private constructor( /** * 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. + * `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, + * `us_bank`, or others. */ fun vendorCodeType(vendorCodeType: String?) = vendorCodeType(JsonField.ofNullable(vendorCodeType)) @@ -11398,7 +11397,7 @@ private constructor( /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, - * `rtp`, `book`, or `sen`. + * `rtp`, or `book`. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) @@ -11696,7 +11695,7 @@ private constructor( /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * or `book`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -11735,10 +11734,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -11751,26 +11746,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -11795,24 +11780,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -11840,24 +11818,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -11888,24 +11859,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -11935,24 +11899,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -12720,9 +12677,8 @@ private constructor( fun subtype(): Optional = subtype.getOptional("subtype") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -13910,9 +13866,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, - * `sepa`, `bacs`, `au_becs`, `interac`, `neft`, `nics`, - * `nz_national_clearing_code`, `sic`, `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, + * `bacs`, `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(JsonField.of(type)) @@ -17525,11 +17480,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField - val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -17572,8 +17522,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -17608,8 +17556,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -17646,8 +17592,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -17682,8 +17626,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -17805,10 +17747,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -17821,26 +17759,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -17863,24 +17791,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -17909,24 +17830,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -17957,24 +17871,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -18003,24 +17910,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -18966,8 +18866,7 @@ private constructor( fun status(): Optional = status.getOptional("status") /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). @@ -19757,10 +19656,7 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, - * sepa, signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -22009,6 +21905,460 @@ private constructor( override fun toString() = "LedgerTransactionUpdateRequestWithId{id=$id, description=$description, effectiveAt=$effectiveAt, externalId=$externalId, ledgerEntries=$ledgerEntries, ledgerableId=$ledgerableId, ledgerableType=$ledgerableType, metadata=$metadata, status=$status, additionalProperties=$additionalProperties}" } + + class LedgerAccountUpdateRequestWithId + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val id: JsonField, + private val description: JsonField, + private val externalId: JsonField, + private val metadata: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("external_id") + @ExcludeMissing + externalId: JsonField = JsonMissing.of(), + @JsonProperty("metadata") + @ExcludeMissing + metadata: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(id, description, externalId, metadata, name, mutableMapOf()) + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun id(): Optional = id.getOptional("id") + + /** + * The description of the ledger account. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun description(): Optional = description.getOptional("description") + + /** + * An optional user-defined 180 character unique identifier. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun externalId(): Optional = externalId.getOptional("external_id") + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun metadata(): Optional = metadata.getOptional("metadata") + + /** + * The name of the ledger account. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [description]. + * + * Unlike [description], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("description") + @ExcludeMissing + fun _description(): JsonField = description + + /** + * Returns the raw JSON value of [externalId]. + * + * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("external_id") + @ExcludeMissing + fun _externalId(): JsonField = externalId + + /** + * Returns the raw JSON value of [metadata]. + * + * Unlike [metadata], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("metadata") + @ExcludeMissing + fun _metadata(): JsonField = metadata + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [LedgerAccountUpdateRequestWithId]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LedgerAccountUpdateRequestWithId]. */ + class Builder internal constructor() { + + private var id: JsonField = JsonMissing.of() + private var description: JsonField = JsonMissing.of() + private var externalId: JsonField = JsonMissing.of() + private var metadata: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + ledgerAccountUpdateRequestWithId: LedgerAccountUpdateRequestWithId + ) = apply { + id = ledgerAccountUpdateRequestWithId.id + description = ledgerAccountUpdateRequestWithId.description + externalId = ledgerAccountUpdateRequestWithId.externalId + metadata = ledgerAccountUpdateRequestWithId.metadata + name = ledgerAccountUpdateRequestWithId.name + additionalProperties = + ledgerAccountUpdateRequestWithId.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The description of the ledger account. */ + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = + description(description.getOrNull()) + + /** + * Sets [Builder.description] to an arbitrary JSON value. + * + * You should usually call [Builder.description] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun description(description: JsonField) = apply { + this.description = description + } + + /** An optional user-defined 180 character unique identifier. */ + fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) + + /** Alias for calling [Builder.externalId] with `externalId.orElse(null)`. */ + fun externalId(externalId: Optional) = externalId(externalId.getOrNull()) + + /** + * Sets [Builder.externalId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun externalId(externalId: JsonField) = apply { + this.externalId = externalId + } + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + + /** + * Sets [Builder.metadata] to an arbitrary JSON value. + * + * You should usually call [Builder.metadata] with a well-typed [Metadata] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun metadata(metadata: JsonField) = apply { this.metadata = metadata } + + /** The name of the ledger account. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [LedgerAccountUpdateRequestWithId]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): LedgerAccountUpdateRequestWithId = + LedgerAccountUpdateRequestWithId( + id, + description, + externalId, + metadata, + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LedgerAccountUpdateRequestWithId = apply { + if (validated) { + return@apply + } + + id() + description() + externalId() + metadata().ifPresent { it.validate() } + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (externalId.asKnown().isPresent) 1 else 0) + + (metadata.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** + * Additional data represented as key-value pairs. Both the key and value must be + * strings. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Metadata]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Metadata]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): Metadata = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Metadata && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LedgerAccountUpdateRequestWithId && + id == other.id && + description == other.description && + externalId == other.externalId && + metadata == other.metadata && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(id, description, externalId, metadata, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "LedgerAccountUpdateRequestWithId{id=$id, description=$description, externalId=$externalId, metadata=$metadata, name=$name, additionalProperties=$additionalProperties}" + } } /** Additional data represented as key-value pairs. Both the key and value must be strings. */ diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntity.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntity.kt index 182184b3..b9262582 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntity.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntity.kt @@ -27,7 +27,7 @@ class ChildLegalEntity private constructor( private val id: JsonField, private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -70,7 +70,7 @@ private constructor( private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, private val updatedAt: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -83,7 +83,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -195,7 +195,7 @@ private constructor( updatedAt: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( id, @@ -266,7 +266,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -613,7 +613,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -647,7 +647,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -1021,7 +1021,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -1107,7 +1107,7 @@ private constructor( private var id: JsonField? = null private var addresses: JsonField>? = null - private var bankSettings: JsonField? = null + private var bankSettings: JsonField? = null private var businessDescription: JsonField? = null private var businessName: JsonField? = null private var citizenshipCountry: JsonField? = null @@ -1152,7 +1152,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField? = null private var updatedAt: JsonField? = null - private var wealthAndEmploymentDetails: JsonField? = null + private var wealthAndEmploymentDetails: JsonField? = null private var website: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1249,21 +1249,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed [LegalEntityBankSetting] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -2098,27 +2098,26 @@ private constructor( */ fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } - fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? - ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) + fun wealthAndEmploymentDetails(wealthAndEmploymentDetails: WealthAndEmploymentDetails?) = + wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** * Alias for calling [Builder.wealthAndEmploymentDetails] with * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -2417,6 +2416,7 @@ private constructor( private val locality: JsonField, private val object_: JsonField, private val postalCode: JsonField, + private val primary: JsonField, private val region: JsonField, private val updatedAt: JsonField, private val additionalProperties: MutableMap, @@ -2447,6 +2447,7 @@ private constructor( @JsonProperty("postal_code") @ExcludeMissing postalCode: JsonField = JsonMissing.of(), + @JsonProperty("primary") @ExcludeMissing primary: JsonField = JsonMissing.of(), @JsonProperty("region") @ExcludeMissing region: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing @@ -2463,6 +2464,7 @@ private constructor( locality, object_, postalCode, + primary, region, updatedAt, mutableMapOf(), @@ -2545,6 +2547,14 @@ private constructor( */ fun postalCode(): Optional = postalCode.getOptional("postal_code") + /** + * Whether this address is the primary address for the legal entity. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun primary(): Optional = primary.getOptional("primary") + /** * Region or State. * @@ -2645,6 +2655,13 @@ private constructor( @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [primary]. + * + * Unlike [primary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("primary") @ExcludeMissing fun _primary(): JsonField = primary + /** * Returns the raw JSON value of [region]. * @@ -2691,6 +2708,7 @@ private constructor( * .locality() * .object_() * .postalCode() + * .primary() * .region() * .updatedAt() * ``` @@ -2712,6 +2730,7 @@ private constructor( private var locality: JsonField? = null private var object_: JsonField? = null private var postalCode: JsonField? = null + private var primary: JsonField? = null private var region: JsonField? = null private var updatedAt: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -2729,6 +2748,7 @@ private constructor( locality = legalEntityAddress.locality object_ = legalEntityAddress.object_ postalCode = legalEntityAddress.postalCode + primary = legalEntityAddress.primary region = legalEntityAddress.region updatedAt = legalEntityAddress.updatedAt additionalProperties = legalEntityAddress.additionalProperties.toMutableMap() @@ -2902,6 +2922,28 @@ private constructor( */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + /** Whether this address is the primary address for the legal entity. */ + fun primary(primary: Boolean?) = primary(JsonField.ofNullable(primary)) + + /** + * Alias for [Builder.primary]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun primary(primary: Boolean) = primary(primary as Boolean?) + + /** Alias for calling [Builder.primary] with `primary.orElse(null)`. */ + fun primary(primary: Optional) = primary(primary.getOrNull()) + + /** + * Sets [Builder.primary] to an arbitrary JSON value. + * + * You should usually call [Builder.primary] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun primary(primary: JsonField) = apply { this.primary = primary } + /** Region or State. */ fun region(region: String?) = region(JsonField.ofNullable(region)) @@ -2967,6 +3009,7 @@ private constructor( * .locality() * .object_() * .postalCode() + * .primary() * .region() * .updatedAt() * ``` @@ -2986,6 +3029,7 @@ private constructor( checkRequired("locality", locality), checkRequired("object_", object_), checkRequired("postalCode", postalCode), + checkRequired("primary", primary), checkRequired("region", region), checkRequired("updatedAt", updatedAt), additionalProperties.toMutableMap(), @@ -3019,6 +3063,7 @@ private constructor( locality() object_() postalCode() + primary() region() updatedAt() validated = true @@ -3051,6 +3096,7 @@ private constructor( (if (locality.asKnown().isPresent) 1 else 0) + (if (object_.asKnown().isPresent) 1 else 0) + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (primary.asKnown().isPresent) 1 else 0) + (if (region.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) @@ -3236,6 +3282,7 @@ private constructor( locality == other.locality && object_ == other.object_ && postalCode == other.postalCode && + primary == other.primary && region == other.region && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties @@ -3254,6 +3301,7 @@ private constructor( locality, object_, postalCode, + primary, region, updatedAt, additionalProperties, @@ -3263,21 +3311,22 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "LegalEntityAddress{id=$id, addressTypes=$addressTypes, country=$country, createdAt=$createdAt, discardedAt=$discardedAt, line1=$line1, line2=$line2, liveMode=$liveMode, locality=$locality, object_=$object_, postalCode=$postalCode, region=$region, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "LegalEntityAddress{id=$id, addressTypes=$addressTypes, country=$country, createdAt=$createdAt, discardedAt=$discardedAt, line1=$line1, line2=$line2, liveMode=$liveMode, locality=$locality, object_=$object_, postalCode=$postalCode, primary=$primary, region=$region, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" } - class LegalEntityBankSetting + class Identification @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, - private val backupWithholdingPercentage: JsonField, private val createdAt: JsonField, private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, + private val documents: JsonField>, + private val expirationDate: JsonField, + private val idType: JsonField, + private val issuingCountry: JsonField, + private val issuingRegion: JsonField, private val liveMode: JsonField, private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, private val updatedAt: JsonField, private val additionalProperties: MutableMap, ) { @@ -3285,41 +3334,43 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), @JsonProperty("discarded_at") @ExcludeMissing discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") + @JsonProperty("documents") + @ExcludeMissing + documents: JsonField> = JsonMissing.of(), + @JsonProperty("expiration_date") @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), + expirationDate: JsonField = JsonMissing.of(), + @JsonProperty("id_type") @ExcludeMissing idType: JsonField = JsonMissing.of(), + @JsonProperty("issuing_country") + @ExcludeMissing + issuingCountry: JsonField = JsonMissing.of(), + @JsonProperty("issuing_region") + @ExcludeMissing + issuingRegion: JsonField = JsonMissing.of(), @JsonProperty("live_mode") @ExcludeMissing liveMode: JsonField = JsonMissing.of(), @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") - @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") - @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), ) : this( id, - backupWithholdingPercentage, createdAt, discardedAt, - enableBackupWithholding, + documents, + expirationDate, + idType, + issuingCountry, + issuingRegion, liveMode, object_, - privacyOptOut, - regulationO, updatedAt, mutableMapOf(), ) @@ -3330,15 +3381,6 @@ private constructor( */ fun id(): String = id.getRequired("id") - /** - * The percentage of backup withholding to apply to the legal entity. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -3352,48 +3394,57 @@ private constructor( fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun documents(): List = documents.getRequired("documents") + + /** + * The date when the Identification is no longer considered valid by the issuing authority. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun expirationDate(): Optional = expirationDate.getOptional("expiration_date") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * The type of ID number. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") + fun idType(): IdType = idType.getRequired("id_type") /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * The ISO 3166-1 alpha-2 country code of the country that issued the identification + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun object_(): String = object_.getRequired("object") + fun issuingCountry(): Optional = issuingCountry.getOptional("issuing_country") /** - * Cross River Bank specific setting to opt out of privacy policy. + * The region in which the identifcation was issued. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun issuingRegion(): Optional = issuingRegion.getOptional("issuing_region") /** - * It covers, among other types of insider loans, extensions of credit by a member bank to - * an executive officer, director, or principal shareholder of the member bank; a bank - * holding company of which the member bank is a subsidiary; and any other subsidiary of - * that bank holding company. + * This field will be true if this object exists in the live environment or false if it + * exists in the test environment. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun liveMode(): Boolean = liveMode.getRequired("live_mode") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") + fun object_(): String = object_.getRequired("object") /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is @@ -3408,16 +3459,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - /** * Returns the raw JSON value of [createdAt]. * @@ -3437,47 +3478,64 @@ private constructor( fun _discardedAt(): JsonField = discardedAt /** - * Returns the raw JSON value of [enableBackupWithholding]. + * Returns the raw JSON value of [documents]. * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [documents], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("enable_backup_withholding") + @JsonProperty("documents") @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding + fun _documents(): JsonField> = documents /** - * Returns the raw JSON value of [liveMode]. + * Returns the raw JSON value of [expirationDate]. * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [expirationDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + @JsonProperty("expiration_date") + @ExcludeMissing + fun _expirationDate(): JsonField = expirationDate /** - * Returns the raw JSON value of [object_]. + * Returns the raw JSON value of [idType]. * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [idType], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + @JsonProperty("id_type") @ExcludeMissing fun _idType(): JsonField = idType /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [issuingCountry]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [issuingCountry], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("issuing_country") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _issuingCountry(): JsonField = issuingCountry /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [issuingRegion]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [issuingRegion], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("regulation_o") + @JsonProperty("issuing_region") @ExcludeMissing - fun _regulationO(): JsonField = regulationO + fun _issuingRegion(): JsonField = issuingRegion + + /** + * Returns the raw JSON value of [liveMode]. + * + * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + + /** + * Returns the raw JSON value of [object_]. + * + * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ /** * Returns the raw JSON value of [updatedAt]. @@ -3503,53 +3561,56 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Identification]. * * The following fields are required: * ```java * .id() - * .backupWithholdingPercentage() * .createdAt() * .discardedAt() - * .enableBackupWithholding() + * .documents() + * .expirationDate() + * .idType() + * .issuingCountry() + * .issuingRegion() * .liveMode() * .object_() - * .privacyOptOut() - * .regulationO() * .updatedAt() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Identification]. */ class Builder internal constructor() { private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null private var createdAt: JsonField? = null private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null + private var documents: JsonField>? = null + private var expirationDate: JsonField? = null + private var idType: JsonField? = null + private var issuingCountry: JsonField? = null + private var issuingRegion: JsonField? = null private var liveMode: JsonField? = null private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null private var updatedAt: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = legalEntityBankSetting.additionalProperties.toMutableMap() + internal fun from(identification: Identification) = apply { + id = identification.id + createdAt = identification.createdAt + discardedAt = identification.discardedAt + documents = identification.documents.map { it.toMutableList() } + expirationDate = identification.expirationDate + idType = identification.idType + issuingCountry = identification.issuingCountry + issuingRegion = identification.issuingRegion + liveMode = identification.liveMode + object_ = identification.object_ + updatedAt = identification.updatedAt + additionalProperties = identification.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3563,36 +3624,6 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { - this.backupWithholdingPercentage = backupWithholdingPercentage - } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** @@ -3624,119 +3655,128 @@ private constructor( this.discardedAt = discardedAt } - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) + fun documents(documents: List) = documents(JsonField.of(documents)) /** - * Alias for [Builder.enableBackupWithholding]. + * Sets [Builder.documents] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. + * You should usually call [Builder.documents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) + fun documents(documents: JsonField>) = apply { + this.documents = documents.map { it.toMutableList() } + } /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. + * Adds a single [Document] to [documents]. * - * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun addDocument(document: Document) = apply { + documents = + (documents ?: JsonField.of(mutableListOf())).also { + checkKnown("documents", it).add(document) + } } /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * The date when the Identification is no longer considered valid by the issuing + * authority. */ - fun liveMode(liveMode: Boolean) = liveMode(JsonField.of(liveMode)) + fun expirationDate(expirationDate: LocalDate?) = + expirationDate(JsonField.ofNullable(expirationDate)) + + /** Alias for calling [Builder.expirationDate] with `expirationDate.orElse(null)`. */ + fun expirationDate(expirationDate: Optional) = + expirationDate(expirationDate.getOrNull()) /** - * Sets [Builder.liveMode] to an arbitrary JSON value. + * Sets [Builder.expirationDate] to an arbitrary JSON value. * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.expirationDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + fun expirationDate(expirationDate: JsonField) = apply { + this.expirationDate = expirationDate + } - fun object_(object_: String) = object_(JsonField.of(object_)) + /** The type of ID number. */ + fun idType(idType: IdType) = idType(JsonField.of(idType)) /** - * Sets [Builder.object_] to an arbitrary JSON value. + * Sets [Builder.idType] to an arbitrary JSON value. * - * You should usually call [Builder.object_] with a well-typed [String] value instead. + * You should usually call [Builder.idType] with a well-typed [IdType] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) + fun idType(idType: JsonField) = apply { this.idType = idType } - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) + /** The ISO 3166-1 alpha-2 country code of the country that issued the identification */ + fun issuingCountry(issuingCountry: String?) = + issuingCountry(JsonField.ofNullable(issuingCountry)) - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) + /** Alias for calling [Builder.issuingCountry] with `issuingCountry.orElse(null)`. */ + fun issuingCountry(issuingCountry: Optional) = + issuingCountry(issuingCountry.getOrNull()) /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. + * Sets [Builder.issuingCountry] to an arbitrary JSON value. * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value + * You should usually call [Builder.issuingCountry] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut + fun issuingCountry(issuingCountry: JsonField) = apply { + this.issuingCountry = issuingCountry } + /** The region in which the identifcation was issued. */ + fun issuingRegion(issuingRegion: String?) = + issuingRegion(JsonField.ofNullable(issuingRegion)) + + /** Alias for calling [Builder.issuingRegion] with `issuingRegion.orElse(null)`. */ + fun issuingRegion(issuingRegion: Optional) = + issuingRegion(issuingRegion.getOrNull()) + /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. + * Sets [Builder.issuingRegion] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * You should usually call [Builder.issuingRegion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + fun issuingRegion(issuingRegion: JsonField) = apply { + this.issuingRegion = issuingRegion + } - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) + /** + * 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)) /** - * Sets [Builder.regulationO] to an arbitrary JSON value. + * Sets [Builder.liveMode] to an arbitrary JSON value. * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } + fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + + fun object_(object_: String) = object_(JsonField.of(object_)) + + /** + * Sets [Builder.object_] to an arbitrary JSON value. + * + * You should usually call [Builder.object_] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun object_(object_: JsonField) = apply { this.object_ = object_ } fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) @@ -3771,37 +3811,39 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Identification]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .id() - * .backupWithholdingPercentage() * .createdAt() * .discardedAt() - * .enableBackupWithholding() + * .documents() + * .expirationDate() + * .idType() + * .issuingCountry() + * .issuingRegion() * .liveMode() * .object_() - * .privacyOptOut() - * .regulationO() * .updatedAt() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( + fun build(): Identification = + Identification( checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), checkRequired("createdAt", createdAt), checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), + checkRequired("documents", documents).map { it.toImmutable() }, + checkRequired("expirationDate", expirationDate), + checkRequired("idType", idType), + checkRequired("issuingCountry", issuingCountry), + checkRequired("issuingRegion", issuingRegion), checkRequired("liveMode", liveMode), checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), checkRequired("updatedAt", updatedAt), additionalProperties.toMutableMap(), ) @@ -3818,20 +3860,21 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Identification = apply { if (validated) { return@apply } id() - backupWithholdingPercentage() createdAt() discardedAt() - enableBackupWithholding() + documents().forEach { it.validate() } + expirationDate() + idType().validate() + issuingCountry() + issuingRegion() liveMode() object_() - privacyOptOut() - regulationO() updatedAt() validated = true } @@ -3853,710 +3896,215 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + + (documents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (expirationDate.asKnown().isPresent) 1 else 0) + + (idType.asKnown().getOrNull()?.validity() ?: 0) + + (if (issuingCountry.asKnown().isPresent) 1 else 0) + + (if (issuingRegion.asKnown().isPresent) 1 else 0) + (if (liveMode.asKnown().isPresent) 1 else 0) + (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The type of ID number. */ + class IdType @JsonCreator private constructor(private val value: JsonField) : Enum { - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } + companion object { - override fun hashCode(): Int = hashCode + @JvmField val AR_CUIL = of("ar_cuil") - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } + @JvmField val AR_CUIT = of("ar_cuit") - class Identification - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val documents: JsonField>, - private val expirationDate: JsonField, - private val idType: JsonField, - private val issuingCountry: JsonField, - private val issuingRegion: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val updatedAt: JsonField, - private val additionalProperties: MutableMap, - ) { + @JvmField val AT_ATIN = of("at_atin") - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("documents") - @ExcludeMissing - documents: JsonField> = JsonMissing.of(), - @JsonProperty("expiration_date") - @ExcludeMissing - expirationDate: JsonField = JsonMissing.of(), - @JsonProperty("id_type") @ExcludeMissing idType: JsonField = JsonMissing.of(), - @JsonProperty("issuing_country") - @ExcludeMissing - issuingCountry: JsonField = JsonMissing.of(), - @JsonProperty("issuing_region") - @ExcludeMissing - issuingRegion: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - createdAt, - discardedAt, - documents, - expirationDate, - idType, - issuingCountry, - issuingRegion, - liveMode, - object_, - updatedAt, - mutableMapOf(), - ) + @JvmField val AT_VAT = of("at_vat") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") + @JvmField val AU_ABN = of("au_abn") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + @JvmField val AU_TFN = of("au_tfn") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") + @JvmField val BE_ENT = of("be_ent") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun documents(): List = documents.getRequired("documents") + @JvmField val BE_NRN = of("be_nrn") - /** - * The date when the Identification is no longer considered valid by the issuing authority. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun expirationDate(): Optional = expirationDate.getOptional("expiration_date") + @JvmField val BR_CNPJ = of("br_cnpj") - /** - * The type of ID number. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun idType(): IdType = idType.getRequired("id_type") + @JvmField val BR_CPF = of("br_cpf") - /** - * The ISO 3166-1 alpha-2 country code of the country that issued the identification - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun issuingCountry(): Optional = issuingCountry.getOptional("issuing_country") + @JvmField val CA_BN = of("ca_bn") - /** - * The region in which the identifcation was issued. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun issuingRegion(): Optional = issuingRegion.getOptional("issuing_region") + @JvmField val CA_SIN = of("ca_sin") - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") + @JvmField val CH_AHV = of("ch_ahv") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") + @JvmField val CH_UID = of("ch_uid") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") + @JvmField val CL_RUN = of("cl_run") - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JvmField val CL_RUT = of("cl_rut") - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt + @JvmField val CO_CEDULAS = of("co_cedulas") - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt + @JvmField val CO_NIT = of("co_nit") - /** - * Returns the raw JSON value of [documents]. - * - * Unlike [documents], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("documents") - @ExcludeMissing - fun _documents(): JsonField> = documents + @JvmField val CY_TIN = of("cy_tin") - /** - * Returns the raw JSON value of [expirationDate]. - * - * Unlike [expirationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("expiration_date") - @ExcludeMissing - fun _expirationDate(): JsonField = expirationDate + @JvmField val CZ_ICO = of("cz_ico") - /** - * Returns the raw JSON value of [idType]. - * - * Unlike [idType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id_type") @ExcludeMissing fun _idType(): JsonField = idType + @JvmField val CZ_RC = of("cz_rc") - /** - * Returns the raw JSON value of [issuingCountry]. - * - * Unlike [issuingCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("issuing_country") - @ExcludeMissing - fun _issuingCountry(): JsonField = issuingCountry + @JvmField val DE_STID = of("de_stid") - /** - * Returns the raw JSON value of [issuingRegion]. - * - * Unlike [issuingRegion], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("issuing_region") - @ExcludeMissing - fun _issuingRegion(): JsonField = issuingRegion + @JvmField val DE_STNR = of("de_stnr") - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + @JvmField val DE_VAT = of("de_vat") - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + @JvmField val DK_CPR = of("dk_cpr") - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JvmField val DK_CVR = of("dk_cvr") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + @JvmField val DRIVERS_LICENSE = of("drivers_license") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + @JvmField val EE_IK = of("ee_ik") - fun toBuilder() = Builder().from(this) + @JvmField val EE_RK = of("ee_rk") - companion object { + @JvmField val ES_NIE = of("es_nie") - /** - * Returns a mutable builder for constructing an instance of [Identification]. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .discardedAt() - * .documents() - * .expirationDate() - * .idType() - * .issuingCountry() - * .issuingRegion() - * .liveMode() - * .object_() - * .updatedAt() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + @JvmField val ES_NIF = of("es_nif") - /** A builder for [Identification]. */ - class Builder internal constructor() { + @JvmField val FI_HETU = of("fi_hetu") - private var id: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var documents: JsonField>? = null - private var expirationDate: JsonField? = null - private var idType: JsonField? = null - private var issuingCountry: JsonField? = null - private var issuingRegion: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var updatedAt: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmField val FI_YTJ = of("fi_ytj") - @JvmSynthetic - internal fun from(identification: Identification) = apply { - id = identification.id - createdAt = identification.createdAt - discardedAt = identification.discardedAt - documents = identification.documents.map { it.toMutableList() } - expirationDate = identification.expirationDate - idType = identification.idType - issuingCountry = identification.issuingCountry - issuingRegion = identification.issuingRegion - liveMode = identification.liveMode - object_ = identification.object_ - updatedAt = identification.updatedAt - additionalProperties = identification.additionalProperties.toMutableMap() - } + @JvmField val FR_NIF = of("fr_nif") - fun id(id: String) = id(JsonField.of(id)) + @JvmField val FR_SIREN = of("fr_siren") - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } + @JvmField val FR_VAT = of("fr_vat") - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + @JvmField val GB_NINO = of("gb_nino") - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } + @JvmField val GB_UTR = of("gb_utr") - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) + @JvmField val GB_VAT = of("gb_vat") - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) + @JvmField val GR_VAT = of("gr_vat") - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } + @JvmField val HN_ID = of("hn_id") - fun documents(documents: List) = documents(JsonField.of(documents)) + @JvmField val HN_RTN = of("hn_rtn") - /** - * Sets [Builder.documents] to an arbitrary JSON value. - * - * You should usually call [Builder.documents] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun documents(documents: JsonField>) = apply { - this.documents = documents.map { it.toMutableList() } - } + @JvmField val HR_OIB = of("hr_oib") - /** - * Adds a single [Document] to [documents]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDocument(document: Document) = apply { - documents = - (documents ?: JsonField.of(mutableListOf())).also { - checkKnown("documents", it).add(document) - } - } + @JvmField val HU_ADJ = of("hu_adj") - /** - * The date when the Identification is no longer considered valid by the issuing - * authority. - */ - fun expirationDate(expirationDate: LocalDate?) = - expirationDate(JsonField.ofNullable(expirationDate)) + @JvmField val HU_ANUM = of("hu_anum") - /** Alias for calling [Builder.expirationDate] with `expirationDate.orElse(null)`. */ - fun expirationDate(expirationDate: Optional) = - expirationDate(expirationDate.getOrNull()) + @JvmField val IE_PPS = of("ie_pps") - /** - * Sets [Builder.expirationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expirationDate] with a well-typed [LocalDate] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun expirationDate(expirationDate: JsonField) = apply { - this.expirationDate = expirationDate - } + @JvmField val IE_TRN = of("ie_trn") - /** The type of ID number. */ - fun idType(idType: IdType) = idType(JsonField.of(idType)) + @JvmField val IN_LEI = of("in_lei") - /** - * Sets [Builder.idType] to an arbitrary JSON value. - * - * You should usually call [Builder.idType] with a well-typed [IdType] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun idType(idType: JsonField) = apply { this.idType = idType } + @JvmField val IS_KNT = of("is_knt") - /** The ISO 3166-1 alpha-2 country code of the country that issued the identification */ - fun issuingCountry(issuingCountry: String?) = - issuingCountry(JsonField.ofNullable(issuingCountry)) + @JvmField val IT_CF = of("it_cf") - /** Alias for calling [Builder.issuingCountry] with `issuingCountry.orElse(null)`. */ - fun issuingCountry(issuingCountry: Optional) = - issuingCountry(issuingCountry.getOrNull()) + @JvmField val IT_PIVA = of("it_piva") - /** - * Sets [Builder.issuingCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.issuingCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun issuingCountry(issuingCountry: JsonField) = apply { - this.issuingCountry = issuingCountry - } + @JvmField val JP_HB = of("jp_hb") - /** The region in which the identifcation was issued. */ - fun issuingRegion(issuingRegion: String?) = - issuingRegion(JsonField.ofNullable(issuingRegion)) + @JvmField val JP_MN = of("jp_mn") - /** Alias for calling [Builder.issuingRegion] with `issuingRegion.orElse(null)`. */ - fun issuingRegion(issuingRegion: Optional) = - issuingRegion(issuingRegion.getOrNull()) + @JvmField val KR_BRN = of("kr_brn") - /** - * Sets [Builder.issuingRegion] to an arbitrary JSON value. - * - * You should usually call [Builder.issuingRegion] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun issuingRegion(issuingRegion: JsonField) = apply { - this.issuingRegion = issuingRegion - } + @JvmField val KR_CRN = of("kr_crn") - /** - * 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)) + @JvmField val KR_RRN = of("kr_rrn") - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val LI_PEID = of("li_peid") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmField val LT_AK = of("lt_ak") - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + @JvmField val LT_JAK = of("lt_jak") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmField val LU_MTC = of("lu_mtc") - /** - * Returns an immutable instance of [Identification]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .discardedAt() - * .documents() - * .expirationDate() - * .idType() - * .issuingCountry() - * .issuingRegion() - * .liveMode() - * .object_() - * .updatedAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Identification = - Identification( - checkRequired("id", id), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("documents", documents).map { it.toImmutable() }, - checkRequired("expirationDate", expirationDate), - checkRequired("idType", idType), - checkRequired("issuingCountry", issuingCountry), - checkRequired("issuingRegion", issuingRegion), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("updatedAt", updatedAt), - additionalProperties.toMutableMap(), - ) - } + @JvmField val LU_VAT = of("lu_vat") - private var validated: Boolean = false + @JvmField val LV_PK = of("lv_pk") - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): Identification = apply { - if (validated) { - return@apply - } + @JvmField val LV_RN = of("lv_rn") - id() - createdAt() - discardedAt() - documents().forEach { it.validate() } - expirationDate() - idType().validate() - issuingCountry() - issuingRegion() - liveMode() - object_() - updatedAt() - validated = true - } + @JvmField val MT_TIN = of("mt_tin") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + @JvmField val MT_VAT = of("mt_vat") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (documents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (expirationDate.asKnown().isPresent) 1 else 0) + - (idType.asKnown().getOrNull()?.validity() ?: 0) + - (if (issuingCountry.asKnown().isPresent) 1 else 0) + - (if (issuingRegion.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + @JvmField val MX_CURP = of("mx_curp") - /** The type of ID number. */ - class IdType @JsonCreator private constructor(private val value: JsonField) : Enum { + @JvmField val MX_INE = of("mx_ine") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val MX_RFC = of("mx_rfc") - companion object { + @JvmField val NL_BSN = of("nl_bsn") - @JvmField val AR_CUIL = of("ar_cuil") + @JvmField val NL_BTW = of("nl_btw") - @JvmField val AR_CUIT = of("ar_cuit") + @JvmField val NL_RSIN = of("nl_rsin") - @JvmField val BR_CNPJ = of("br_cnpj") + @JvmField val NO_FDN = of("no_fdn") - @JvmField val BR_CPF = of("br_cpf") + @JvmField val NO_MVA = of("no_mva") - @JvmField val CA_SIN = of("ca_sin") + @JvmField val NO_ORGNR = of("no_orgnr") - @JvmField val CL_RUN = of("cl_run") + @JvmField val NZ_IRD = of("nz_ird") - @JvmField val CL_RUT = of("cl_rut") + @JvmField val PASSPORT = of("passport") - @JvmField val CO_CEDULAS = of("co_cedulas") + @JvmField val PL_NIP = of("pl_nip") - @JvmField val CO_NIT = of("co_nit") + @JvmField val PL_PESEL = of("pl_pesel") - @JvmField val DRIVERS_LICENSE = of("drivers_license") + @JvmField val PT_NIF = of("pt_nif") - @JvmField val HN_ID = of("hn_id") + @JvmField val RO_CNP = of("ro_cnp") - @JvmField val HN_RTN = of("hn_rtn") + @JvmField val RO_CUI = of("ro_cui") - @JvmField val IE_PPS = of("ie_pps") + @JvmField val SA_TIN = of("sa_tin") - @JvmField val IN_LEI = of("in_lei") + @JvmField val SA_VAT = of("sa_vat") - @JvmField val KR_BRN = of("kr_brn") + @JvmField val SE_ORGNR = of("se_orgnr") - @JvmField val KR_CRN = of("kr_crn") + @JvmField val SE_PNMR = of("se_pnmr") - @JvmField val KR_RRN = of("kr_rrn") + @JvmField val SG_FIN = of("sg_fin") - @JvmField val MX_CURP = of("mx_curp") + @JvmField val SG_NRIC = of("sg_nric") - @JvmField val MX_INE = of("mx_ine") + @JvmField val SG_UEN = of("sg_uen") - @JvmField val MX_RFC = of("mx_rfc") + @JvmField val SI_DAV = of("si_dav") - @JvmField val PASSPORT = of("passport") + @JvmField val SI_TIN = of("si_tin") - @JvmField val SA_TIN = of("sa_tin") + @JvmField val SK_ICO = of("sk_ico") - @JvmField val SA_VAT = of("sa_vat") + @JvmField val SK_RC = of("sk_rc") @JvmField val US_EIN = of("us_ein") @@ -4575,27 +4123,96 @@ private constructor( enum class Known { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -4615,27 +4232,96 @@ private constructor( enum class Value { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -4658,27 +4344,96 @@ private constructor( when (this) { AR_CUIL -> Value.AR_CUIL AR_CUIT -> Value.AR_CUIT + AT_ATIN -> Value.AT_ATIN + AT_VAT -> Value.AT_VAT + AU_ABN -> Value.AU_ABN + AU_TFN -> Value.AU_TFN + BE_ENT -> Value.BE_ENT + BE_NRN -> Value.BE_NRN BR_CNPJ -> Value.BR_CNPJ BR_CPF -> Value.BR_CPF + CA_BN -> Value.CA_BN CA_SIN -> Value.CA_SIN + CH_AHV -> Value.CH_AHV + CH_UID -> Value.CH_UID CL_RUN -> Value.CL_RUN CL_RUT -> Value.CL_RUT CO_CEDULAS -> Value.CO_CEDULAS CO_NIT -> Value.CO_NIT + CY_TIN -> Value.CY_TIN + CZ_ICO -> Value.CZ_ICO + CZ_RC -> Value.CZ_RC + DE_STID -> Value.DE_STID + DE_STNR -> Value.DE_STNR + DE_VAT -> Value.DE_VAT + DK_CPR -> Value.DK_CPR + DK_CVR -> Value.DK_CVR DRIVERS_LICENSE -> Value.DRIVERS_LICENSE + EE_IK -> Value.EE_IK + EE_RK -> Value.EE_RK + ES_NIE -> Value.ES_NIE + ES_NIF -> Value.ES_NIF + FI_HETU -> Value.FI_HETU + FI_YTJ -> Value.FI_YTJ + FR_NIF -> Value.FR_NIF + FR_SIREN -> Value.FR_SIREN + FR_VAT -> Value.FR_VAT + GB_NINO -> Value.GB_NINO + GB_UTR -> Value.GB_UTR + GB_VAT -> Value.GB_VAT + GR_VAT -> Value.GR_VAT HN_ID -> Value.HN_ID HN_RTN -> Value.HN_RTN + HR_OIB -> Value.HR_OIB + HU_ADJ -> Value.HU_ADJ + HU_ANUM -> Value.HU_ANUM IE_PPS -> Value.IE_PPS + IE_TRN -> Value.IE_TRN IN_LEI -> Value.IN_LEI + IS_KNT -> Value.IS_KNT + IT_CF -> Value.IT_CF + IT_PIVA -> Value.IT_PIVA + JP_HB -> Value.JP_HB + JP_MN -> Value.JP_MN KR_BRN -> Value.KR_BRN KR_CRN -> Value.KR_CRN KR_RRN -> Value.KR_RRN + LI_PEID -> Value.LI_PEID + LT_AK -> Value.LT_AK + LT_JAK -> Value.LT_JAK + LU_MTC -> Value.LU_MTC + LU_VAT -> Value.LU_VAT + LV_PK -> Value.LV_PK + LV_RN -> Value.LV_RN + MT_TIN -> Value.MT_TIN + MT_VAT -> Value.MT_VAT MX_CURP -> Value.MX_CURP MX_INE -> Value.MX_INE MX_RFC -> Value.MX_RFC + NL_BSN -> Value.NL_BSN + NL_BTW -> Value.NL_BTW + NL_RSIN -> Value.NL_RSIN + NO_FDN -> Value.NO_FDN + NO_MVA -> Value.NO_MVA + NO_ORGNR -> Value.NO_ORGNR + NZ_IRD -> Value.NZ_IRD PASSPORT -> Value.PASSPORT + PL_NIP -> Value.PL_NIP + PL_PESEL -> Value.PL_PESEL + PT_NIF -> Value.PT_NIF + RO_CNP -> Value.RO_CNP + RO_CUI -> Value.RO_CUI SA_TIN -> Value.SA_TIN SA_VAT -> Value.SA_VAT + SE_ORGNR -> Value.SE_ORGNR + SE_PNMR -> Value.SE_PNMR + SG_FIN -> Value.SG_FIN + SG_NRIC -> Value.SG_NRIC + SG_UEN -> Value.SG_UEN + SI_DAV -> Value.SI_DAV + SI_TIN -> Value.SI_TIN + SK_ICO -> Value.SK_ICO + SK_RC -> Value.SK_RC US_EIN -> Value.US_EIN US_ITIN -> Value.US_ITIN US_SSN -> Value.US_SSN @@ -4700,27 +4455,96 @@ private constructor( when (this) { AR_CUIL -> Known.AR_CUIL AR_CUIT -> Known.AR_CUIT + AT_ATIN -> Known.AT_ATIN + AT_VAT -> Known.AT_VAT + AU_ABN -> Known.AU_ABN + AU_TFN -> Known.AU_TFN + BE_ENT -> Known.BE_ENT + BE_NRN -> Known.BE_NRN BR_CNPJ -> Known.BR_CNPJ BR_CPF -> Known.BR_CPF + CA_BN -> Known.CA_BN CA_SIN -> Known.CA_SIN + CH_AHV -> Known.CH_AHV + CH_UID -> Known.CH_UID CL_RUN -> Known.CL_RUN CL_RUT -> Known.CL_RUT CO_CEDULAS -> Known.CO_CEDULAS CO_NIT -> Known.CO_NIT + CY_TIN -> Known.CY_TIN + CZ_ICO -> Known.CZ_ICO + CZ_RC -> Known.CZ_RC + DE_STID -> Known.DE_STID + DE_STNR -> Known.DE_STNR + DE_VAT -> Known.DE_VAT + DK_CPR -> Known.DK_CPR + DK_CVR -> Known.DK_CVR DRIVERS_LICENSE -> Known.DRIVERS_LICENSE + EE_IK -> Known.EE_IK + EE_RK -> Known.EE_RK + ES_NIE -> Known.ES_NIE + ES_NIF -> Known.ES_NIF + FI_HETU -> Known.FI_HETU + FI_YTJ -> Known.FI_YTJ + FR_NIF -> Known.FR_NIF + FR_SIREN -> Known.FR_SIREN + FR_VAT -> Known.FR_VAT + GB_NINO -> Known.GB_NINO + GB_UTR -> Known.GB_UTR + GB_VAT -> Known.GB_VAT + GR_VAT -> Known.GR_VAT HN_ID -> Known.HN_ID HN_RTN -> Known.HN_RTN + HR_OIB -> Known.HR_OIB + HU_ADJ -> Known.HU_ADJ + HU_ANUM -> Known.HU_ANUM IE_PPS -> Known.IE_PPS + IE_TRN -> Known.IE_TRN IN_LEI -> Known.IN_LEI + IS_KNT -> Known.IS_KNT + IT_CF -> Known.IT_CF + IT_PIVA -> Known.IT_PIVA + JP_HB -> Known.JP_HB + JP_MN -> Known.JP_MN KR_BRN -> Known.KR_BRN KR_CRN -> Known.KR_CRN KR_RRN -> Known.KR_RRN + LI_PEID -> Known.LI_PEID + LT_AK -> Known.LT_AK + LT_JAK -> Known.LT_JAK + LU_MTC -> Known.LU_MTC + LU_VAT -> Known.LU_VAT + LV_PK -> Known.LV_PK + LV_RN -> Known.LV_RN + MT_TIN -> Known.MT_TIN + MT_VAT -> Known.MT_VAT MX_CURP -> Known.MX_CURP MX_INE -> Known.MX_INE MX_RFC -> Known.MX_RFC + NL_BSN -> Known.NL_BSN + NL_BTW -> Known.NL_BTW + NL_RSIN -> Known.NL_RSIN + NO_FDN -> Known.NO_FDN + NO_MVA -> Known.NO_MVA + NO_ORGNR -> Known.NO_ORGNR + NZ_IRD -> Known.NZ_IRD PASSPORT -> Known.PASSPORT + PL_NIP -> Known.PL_NIP + PL_PESEL -> Known.PL_PESEL + PT_NIF -> Known.PT_NIF + RO_CNP -> Known.RO_CNP + RO_CUI -> Known.RO_CUI SA_TIN -> Known.SA_TIN SA_VAT -> Known.SA_VAT + SE_ORGNR -> Known.SE_ORGNR + SE_PNMR -> Known.SE_PNMR + SG_FIN -> Known.SG_FIN + SG_NRIC -> Known.SG_NRIC + SG_UEN -> Known.SG_UEN + SI_DAV -> Known.SI_DAV + SI_TIN -> Known.SI_TIN + SK_ICO -> Known.SK_ICO + SK_RC -> Known.SK_RC US_EIN -> Known.US_EIN US_ITIN -> Known.US_ITIN US_SSN -> Known.US_SSN @@ -5970,2339 +5794,6 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) - } - - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IncomeSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") - - @JvmField val MINING = of("mining") - - @JvmField val PERFORMING_ARTS = of("performing_arts") - - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") - - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") - - @JvmField val PUBLISHING = of("publishing") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") - - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") - - @JvmField val RENTAL_SERVICES = of("rental_services") - - @JvmField val RETAIL_CLOTHING = of("retail_clothing") - - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") - - @JvmField val RETAIL_FOOD = of("retail_food") - - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") - - @JvmField val RETAIL_HOME = of("retail_home") - - @JvmField val RETAIL_NON_STORE = of("retail_non_store") - - @JvmField val RETAIL_SPORTING = of("retail_sporting") - - @JvmField val TRANSPORTATION = of("transportation") - - @JvmField val TRAVEL = of("travel") - - @JvmField val UTILITIES = of("utilities") - - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) - } - - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - } - - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Industry && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The occupation of the individual. */ - class Occupation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONSULTING = of("consulting") - - @JvmField val EXECUTIVE = of("executive") - - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") - - @JvmField val FOOD_SERVICES = of("food_services") - - @JvmField val GOVERNMENT = of("government") - - @JvmField val HEALTHCARE = of("healthcare") - - @JvmField val LEGAL_SERVICES = of("legal_services") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val OTHER = of("other") - - @JvmField val SALES = of("sales") - - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") - - @JvmField val TECHNOLOGY = of("technology") - - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } - - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } - - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Occupation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's funds. */ - class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") - - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") - - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") - - @JvmField val INVESTMENT = of("investment") - - @JvmField val INVESTOR_FUNDING = of("investor_funding") - - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") - - @JvmField val LOTTERY = of("lottery") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") - - @JvmField val RETIRED = of("retired") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") - - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") - - @JvmField val TRUST_INCOME = of("trust_income") - - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } - - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } - - /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SourceOfFunds && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS_SALE = of("business_sale") - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val OTHER = of("other") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } - - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WealthSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreate.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreate.kt index 5fadd8c3..2c173dfc 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreate.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreate.kt @@ -16,7 +16,6 @@ import com.moderntreasury.api.core.checkRequired import com.moderntreasury.api.core.toImmutable import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException import java.time.LocalDate -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -26,7 +25,7 @@ class ChildLegalEntityCreate @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -64,7 +63,7 @@ private constructor( private val thirdPartyVerification: JsonField, private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -76,7 +75,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -180,7 +179,7 @@ private constructor( tickerSymbol: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( addresses, @@ -240,7 +239,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -562,7 +561,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -589,7 +588,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -924,7 +923,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -956,7 +955,7 @@ private constructor( class Builder internal constructor() { private var addresses: JsonField>? = null - private var bankSettings: JsonField = JsonMissing.of() + private var bankSettings: JsonField = JsonMissing.of() private var businessDescription: JsonField = JsonMissing.of() private var businessName: JsonField = JsonMissing.of() private var citizenshipCountry: JsonField = JsonMissing.of() @@ -998,7 +997,7 @@ private constructor( private var thirdPartyVerification: JsonField = JsonMissing.of() private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField = JsonMissing.of() - private var wealthAndEmploymentDetails: JsonField = + private var wealthAndEmploymentDetails: JsonField = JsonMissing.of() private var website: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1082,21 +1081,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed [LegalEntityBankSetting] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -1878,27 +1877,26 @@ private constructor( this.tickerSymbol = tickerSymbol } - fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? - ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) + fun wealthAndEmploymentDetails(wealthAndEmploymentDetails: WealthAndEmploymentDetails?) = + wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** * Alias for calling [Builder.wealthAndEmploymentDetails] with * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -2100,227 +2098,73 @@ private constructor( (wealthAndEmploymentDetails.asKnown().getOrNull()?.validity() ?: 0) + (if (website.asKnown().isPresent) 1 else 0) - class LegalEntityBankSetting + class Document @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val id: JsonField, - private val backupWithholdingPercentage: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, - private val updatedAt: JsonField, + private val documentType: JsonField, + private val fileData: JsonField, + private val filename: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") - @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") + @JsonProperty("document_type") @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") + documentType: JsonField = JsonMissing.of(), + @JsonProperty("file_data") @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") + fileData: JsonField = JsonMissing.of(), + @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), + ) : this(documentType, fileData, filename, mutableMapOf()) /** - * The percentage of backup withholding to apply to the legal entity. + * A category given to the document, can be `null`. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun documentType(): DocumentType = documentType.getRequired("document_type") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * Base64-encoded file content for the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * Cross River Bank specific setting to opt out of privacy policy. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun fileData(): String = fileData.getRequired("file_data") /** - * It covers, among other types of insider loans, extensions of credit by a member bank to - * an executive officer, director, or principal shareholder of the member bank; a bank - * holding company of which the member bank is a subsidiary; and any other subsidiary of - * that bank holding company. + * The original filename of the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [enableBackupWithholding]. - * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + fun filename(): Optional = filename.getOptional("filename") /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [documentType]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _documentType(): JsonField = documentType /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [fileData]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("regulation_o") - @ExcludeMissing - fun _regulationO(): JsonField = regulationO + @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData /** - * Returns the raw JSON value of [updatedAt]. + * Returns the raw JSON value of [filename]. * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [filename], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -2337,253 +2181,70 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Document]. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Document]. */ class Builder internal constructor() { - private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null - private var updatedAt: JsonField? = null + private var documentType: JsonField? = null + private var fileData: JsonField? = null + private var filename: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = legalEntityBankSetting.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { - this.backupWithholdingPercentage = backupWithholdingPercentage + internal fun from(document: Document) = apply { + documentType = document.documentType + fileData = document.fileData + filename = document.filename + additionalProperties = document.additionalProperties.toMutableMap() } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + /** A category given to the document, can be `null`. */ + fun documentType(documentType: DocumentType) = documentType(JsonField.of(documentType)) /** - * Sets [Builder.createdAt] to an arbitrary JSON value. + * Sets [Builder.documentType] to an arbitrary JSON value. * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * You should usually call [Builder.documentType] with a well-typed [DocumentType] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) - - /** - * Alias for [Builder.enableBackupWithholding]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. - */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) - - /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. - * - * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun documentType(documentType: JsonField) = apply { + this.documentType = documentType } - /** - * 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)) + /** Base64-encoded file content for the document. */ + fun fileData(fileData: String) = fileData(JsonField.of(fileData)) /** - * Sets [Builder.liveMode] to an arbitrary JSON value. + * Sets [Builder.fileData] to an arbitrary JSON value. * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * You should usually call [Builder.fileData] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - fun object_(object_: String) = object_(JsonField.of(object_)) + /** The original filename of the document. */ + fun filename(filename: String) = filename(JsonField.of(filename)) /** - * Sets [Builder.object_] to an arbitrary JSON value. + * Sets [Builder.filename] to an arbitrary JSON value. * - * You should usually call [Builder.object_] with a well-typed [String] value instead. + * You should usually call [Builder.filename] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) - - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) - - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) - - /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. - * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut - } - - /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) - - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) - - /** - * Sets [Builder.regulationO] to an arbitrary JSON value. - * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } + fun filename(filename: JsonField) = apply { this.filename = filename } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -2605,38 +2266,23 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Document]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( - checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), - checkRequired("updatedAt", updatedAt), + fun build(): Document = + Document( + checkRequired("documentType", documentType), + checkRequired("fileData", fileData), + filename, additionalProperties.toMutableMap(), ) } @@ -2652,21 +2298,14 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Document = apply { if (validated) { return@apply } - id() - backupWithholdingPercentage() - createdAt() - discardedAt() - enableBackupWithholding() - liveMode() - object_() - privacyOptOut() - regulationO() - updatedAt() + documentType().validate() + fileData() + filename() validated = true } @@ -2686,302 +2325,23 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + (documentType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fileData.asKnown().isPresent) 1 else 0) + + (if (filename.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** A category given to the document, can be `null`. */ + class DocumentType @JsonCreator private constructor(private val value: JsonField) : + Enum { - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } - - class Document - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val documentType: JsonField, - private val fileData: JsonField, - private val filename: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("document_type") - @ExcludeMissing - documentType: JsonField = JsonMissing.of(), - @JsonProperty("file_data") - @ExcludeMissing - fileData: JsonField = JsonMissing.of(), - @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), - ) : this(documentType, fileData, filename, mutableMapOf()) - - /** - * A category given to the document, can be `null`. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun documentType(): DocumentType = documentType.getRequired("document_type") - - /** - * Base64-encoded file content for the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileData(): String = fileData.getRequired("file_data") - - /** - * The original filename of the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun filename(): Optional = filename.getOptional("filename") - - /** - * Returns the raw JSON value of [documentType]. - * - * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("document_type") - @ExcludeMissing - fun _documentType(): JsonField = documentType - - /** - * Returns the raw JSON value of [fileData]. - * - * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData - - /** - * Returns the raw JSON value of [filename]. - * - * Unlike [filename], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Document]. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Document]. */ - class Builder internal constructor() { - - private var documentType: JsonField? = null - private var fileData: JsonField? = null - private var filename: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(document: Document) = apply { - documentType = document.documentType - fileData = document.fileData - filename = document.filename - additionalProperties = document.additionalProperties.toMutableMap() - } - - /** A category given to the document, can be `null`. */ - fun documentType(documentType: DocumentType) = documentType(JsonField.of(documentType)) - - /** - * Sets [Builder.documentType] to an arbitrary JSON value. - * - * You should usually call [Builder.documentType] with a well-typed [DocumentType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun documentType(documentType: JsonField) = apply { - this.documentType = documentType - } - - /** Base64-encoded file content for the document. */ - fun fileData(fileData: String) = fileData(JsonField.of(fileData)) - - /** - * Sets [Builder.fileData] to an arbitrary JSON value. - * - * You should usually call [Builder.fileData] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - - /** The original filename of the document. */ - fun filename(filename: String) = filename(JsonField.of(filename)) - - /** - * Sets [Builder.filename] to an arbitrary JSON value. - * - * You should usually call [Builder.filename] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun filename(filename: JsonField) = apply { this.filename = filename } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Document]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Document = - Document( - checkRequired("documentType", documentType), - checkRequired("fileData", fileData), - filename, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): Document = apply { - if (validated) { - return@apply - } - - documentType().validate() - fileData() - filename() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (documentType.asKnown().getOrNull()?.validity() ?: 0) + - (if (fileData.asKnown().isPresent) 1 else 0) + - (if (filename.asKnown().isPresent) 1 else 0) - - /** A category given to the document, can be `null`. */ - class DocumentType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { @@ -4142,2339 +3502,6 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) - } - - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IncomeSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") - - @JvmField val MINING = of("mining") - - @JvmField val PERFORMING_ARTS = of("performing_arts") - - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") - - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") - - @JvmField val PUBLISHING = of("publishing") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") - - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") - - @JvmField val RENTAL_SERVICES = of("rental_services") - - @JvmField val RETAIL_CLOTHING = of("retail_clothing") - - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") - - @JvmField val RETAIL_FOOD = of("retail_food") - - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") - - @JvmField val RETAIL_HOME = of("retail_home") - - @JvmField val RETAIL_NON_STORE = of("retail_non_store") - - @JvmField val RETAIL_SPORTING = of("retail_sporting") - - @JvmField val TRANSPORTATION = of("transportation") - - @JvmField val TRAVEL = of("travel") - - @JvmField val UTILITIES = of("utilities") - - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) - } - - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - } - - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Industry && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The occupation of the individual. */ - class Occupation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONSULTING = of("consulting") - - @JvmField val EXECUTIVE = of("executive") - - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") - - @JvmField val FOOD_SERVICES = of("food_services") - - @JvmField val GOVERNMENT = of("government") - - @JvmField val HEALTHCARE = of("healthcare") - - @JvmField val LEGAL_SERVICES = of("legal_services") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val OTHER = of("other") - - @JvmField val SALES = of("sales") - - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") - - @JvmField val TECHNOLOGY = of("technology") - - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } - - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } - - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Occupation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's funds. */ - class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") - - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") - - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") - - @JvmField val INVESTMENT = of("investment") - - @JvmField val INVESTOR_FUNDING = of("investor_funding") - - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") - - @JvmField val LOTTERY = of("lottery") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") - - @JvmField val RETIRED = of("retired") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") - - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") - - @JvmField val TRUST_INCOME = of("trust_income") - - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } - - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } - - /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SourceOfFunds && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS_SALE = of("business_sale") - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val OTHER = of("other") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } - - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WealthSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParams.kt index 4ff56da1..ee5bdece 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParams.kt @@ -19,7 +19,6 @@ import com.moderntreasury.api.core.http.QueryParams import com.moderntreasury.api.core.toImmutable import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException import java.time.LocalDate -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -586,7 +585,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -624,7 +623,7 @@ private constructor( private val thirdPartyVerification: JsonField, private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -636,7 +635,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -746,8 +745,7 @@ private constructor( tickerSymbol: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = - JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( addresses, @@ -807,8 +805,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun bankSettings(): Optional = - bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -1132,7 +1129,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -1160,7 +1157,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -1508,7 +1505,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -1540,7 +1537,7 @@ private constructor( class Builder internal constructor() { private var addresses: JsonField>? = null - private var bankSettings: JsonField = JsonMissing.of() + private var bankSettings: JsonField = JsonMissing.of() private var businessDescription: JsonField = JsonMissing.of() private var businessName: JsonField = JsonMissing.of() private var citizenshipCountry: JsonField = JsonMissing.of() @@ -1583,7 +1580,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField = JsonMissing.of() - private var wealthAndEmploymentDetails: JsonField = + private var wealthAndEmploymentDetails: JsonField = JsonMissing.of() private var website: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -1666,21 +1663,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed - * [LegalEntityBankSetting] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -2489,7 +2486,7 @@ private constructor( } fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? + wealthAndEmploymentDetails: WealthAndEmploymentDetails? ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** @@ -2497,18 +2494,18 @@ private constructor( * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -2716,241 +2713,79 @@ private constructor( (wealthAndEmploymentDetails.asKnown().getOrNull()?.validity() ?: 0) + (if (website.asKnown().isPresent) 1 else 0) - class LegalEntityBankSetting + class Document @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val id: JsonField, - private val backupWithholdingPercentage: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, - private val updatedAt: JsonField, + private val documentType: JsonField, + private val fileData: JsonField, + private val filename: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") - @ExcludeMissing - object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") + documentType: JsonField = JsonMissing.of(), + @JsonProperty("file_data") @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") + fileData: JsonField = JsonMissing.of(), + @JsonProperty("filename") @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") + filename: JsonField = JsonMissing.of(), + ) : this(documentType, fileData, filename, mutableMapOf()) /** - * The percentage of backup withholding to apply to the legal entity. + * A category given to the document, can be `null`. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun documentType(): DocumentType = documentType.getRequired("document_type") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * Base64-encoded file content for the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * Cross River Bank specific setting to opt out of privacy policy. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun fileData(): String = fileData.getRequired("file_data") /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. + * The original filename of the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [enableBackupWithholding]. - * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("live_mode") - @ExcludeMissing - fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + fun filename(): Optional = filename.getOptional("filename") /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [documentType]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _documentType(): JsonField = documentType /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [fileData]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected + * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("regulation_o") - @ExcludeMissing - fun _regulationO(): JsonField = regulationO + @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData /** - * Returns the raw JSON value of [updatedAt]. + * Returns the raw JSON value of [filename]. * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected + * Unlike [filename], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -2967,258 +2802,71 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Document]. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Document]. */ class Builder internal constructor() { - private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null - private var updatedAt: JsonField? = null + private var documentType: JsonField? = null + private var fileData: JsonField? = null + private var filename: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = - legalEntityBankSetting.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = - apply { - this.backupWithholdingPercentage = backupWithholdingPercentage - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + internal fun from(document: Document) = apply { + documentType = document.documentType + fileData = document.fileData + filename = document.filename + additionalProperties = document.additionalProperties.toMutableMap() } - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) + /** A category given to the document, can be `null`. */ + fun documentType(documentType: DocumentType) = + documentType(JsonField.of(documentType)) /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. + * Sets [Builder.documentType] to an arbitrary JSON value. * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] + * You should usually call [Builder.documentType] with a well-typed [DocumentType] * value instead. This method is primarily for setting the field to an undocumented * or not yet supported value. */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) - - /** - * Alias for [Builder.enableBackupWithholding]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. - */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) - - /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. - * - * You should usually call [Builder.enableBackupWithholding] with a well-typed - * [Boolean] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun documentType(documentType: JsonField) = apply { + this.documentType = documentType } - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) - - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) - - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) + /** Base64-encoded file content for the document. */ + fun fileData(fileData: String) = fileData(JsonField.of(fileData)) /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. + * Sets [Builder.fileData] to an arbitrary JSON value. * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value + * You should usually call [Builder.fileData] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut - } - - /** - * It covers, among other types of insider loans, extensions of credit by a member - * bank to an executive officer, director, or principal shareholder of the member - * bank; a bank holding company of which the member bank is a subsidiary; and any - * other subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = - regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = - regulationO(regulationO.getOrNull()) + /** The original filename of the document. */ + fun filename(filename: String) = filename(JsonField.of(filename)) /** - * Sets [Builder.regulationO] to an arbitrary JSON value. + * Sets [Builder.filename] to an arbitrary JSON value. * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value + * You should usually call [Builder.filename] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } + fun filename(filename: JsonField) = apply { this.filename = filename } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3243,38 +2891,23 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Document]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( - checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), - checkRequired("updatedAt", updatedAt), + fun build(): Document = + Document( + checkRequired("documentType", documentType), + checkRequired("fileData", fileData), + filename, additionalProperties.toMutableMap(), ) } @@ -3291,21 +2924,14 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't * match its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Document = apply { if (validated) { return@apply } - id() - backupWithholdingPercentage() - createdAt() - discardedAt() - enableBackupWithholding() - liveMode() - object_() - privacyOptOut() - regulationO() - updatedAt() + documentType().validate() + fileData() + filename() validated = true } @@ -3325,2649 +2951,14 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + (documentType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fileData.asKnown().isPresent) 1 else 0) + + (if (filename.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } - - class Document - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val documentType: JsonField, - private val fileData: JsonField, - private val filename: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("document_type") - @ExcludeMissing - documentType: JsonField = JsonMissing.of(), - @JsonProperty("file_data") - @ExcludeMissing - fileData: JsonField = JsonMissing.of(), - @JsonProperty("filename") - @ExcludeMissing - filename: JsonField = JsonMissing.of(), - ) : this(documentType, fileData, filename, mutableMapOf()) - - /** - * A category given to the document, can be `null`. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun documentType(): DocumentType = documentType.getRequired("document_type") - - /** - * Base64-encoded file content for the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun fileData(): String = fileData.getRequired("file_data") - - /** - * The original filename of the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun filename(): Optional = filename.getOptional("filename") - - /** - * Returns the raw JSON value of [documentType]. - * - * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("document_type") - @ExcludeMissing - fun _documentType(): JsonField = documentType - - /** - * Returns the raw JSON value of [fileData]. - * - * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData - - /** - * Returns the raw JSON value of [filename]. - * - * Unlike [filename], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Document]. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Document]. */ - class Builder internal constructor() { - - private var documentType: JsonField? = null - private var fileData: JsonField? = null - private var filename: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(document: Document) = apply { - documentType = document.documentType - fileData = document.fileData - filename = document.filename - additionalProperties = document.additionalProperties.toMutableMap() - } - - /** A category given to the document, can be `null`. */ - fun documentType(documentType: DocumentType) = - documentType(JsonField.of(documentType)) - - /** - * Sets [Builder.documentType] to an arbitrary JSON value. - * - * You should usually call [Builder.documentType] with a well-typed [DocumentType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun documentType(documentType: JsonField) = apply { - this.documentType = documentType - } - - /** Base64-encoded file content for the document. */ - fun fileData(fileData: String) = fileData(JsonField.of(fileData)) - - /** - * Sets [Builder.fileData] to an arbitrary JSON value. - * - * You should usually call [Builder.fileData] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - - /** The original filename of the document. */ - fun filename(filename: String) = filename(JsonField.of(filename)) - - /** - * Sets [Builder.filename] to an arbitrary JSON value. - * - * You should usually call [Builder.filename] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun filename(filename: JsonField) = apply { this.filename = filename } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Document]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Document = - Document( - checkRequired("documentType", documentType), - checkRequired("fileData", fileData), - filename, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Document = apply { - if (validated) { - return@apply - } - - documentType().validate() - fileData() - filename() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (documentType.asKnown().getOrNull()?.validity() ?: 0) + - (if (fileData.asKnown().isPresent) 1 else 0) + - (if (filename.asKnown().isPresent) 1 else 0) - - /** A category given to the document, can be `null`. */ - class DocumentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ARTICLES_OF_INCORPORATION = of("articles_of_incorporation") - - @JvmField val CERTIFICATE_OF_GOOD_STANDING = of("certificate_of_good_standing") - - @JvmField val EIN_LETTER = of("ein_letter") - - @JvmField val GENERIC = of("generic") - - @JvmField val IDENTIFICATION_BACK = of("identification_back") - - @JvmField val IDENTIFICATION_FRONT = of("identification_front") - - @JvmField val PROOF_OF_ADDRESS = of("proof_of_address") - - @JvmStatic fun of(value: String) = DocumentType(JsonField.of(value)) - } - - /** An enum containing [DocumentType]'s known values. */ - enum class Known { - ARTICLES_OF_INCORPORATION, - CERTIFICATE_OF_GOOD_STANDING, - EIN_LETTER, - GENERIC, - IDENTIFICATION_BACK, - IDENTIFICATION_FRONT, - PROOF_OF_ADDRESS, - } - - /** - * An enum containing [DocumentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DocumentType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ARTICLES_OF_INCORPORATION, - CERTIFICATE_OF_GOOD_STANDING, - EIN_LETTER, - GENERIC, - IDENTIFICATION_BACK, - IDENTIFICATION_FRONT, - PROOF_OF_ADDRESS, - /** - * An enum member indicating that [DocumentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ARTICLES_OF_INCORPORATION -> Value.ARTICLES_OF_INCORPORATION - CERTIFICATE_OF_GOOD_STANDING -> Value.CERTIFICATE_OF_GOOD_STANDING - EIN_LETTER -> Value.EIN_LETTER - GENERIC -> Value.GENERIC - IDENTIFICATION_BACK -> Value.IDENTIFICATION_BACK - IDENTIFICATION_FRONT -> Value.IDENTIFICATION_FRONT - PROOF_OF_ADDRESS -> Value.PROOF_OF_ADDRESS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ARTICLES_OF_INCORPORATION -> Known.ARTICLES_OF_INCORPORATION - CERTIFICATE_OF_GOOD_STANDING -> Known.CERTIFICATE_OF_GOOD_STANDING - EIN_LETTER -> Known.EIN_LETTER - GENERIC -> Known.GENERIC - IDENTIFICATION_BACK -> Known.IDENTIFICATION_BACK - IDENTIFICATION_FRONT -> Known.IDENTIFICATION_FRONT - PROOF_OF_ADDRESS -> Known.PROOF_OF_ADDRESS - else -> - throw ModernTreasuryInvalidDataException("Unknown DocumentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): DocumentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Document && - documentType == other.documentType && - fileData == other.fileData && - filename == other.filename && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(documentType, fileData, filename, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Document{documentType=$documentType, fileData=$fileData, filename=$filename, additionalProperties=$additionalProperties}" - } - - /** The type of legal entity. */ - class LegalEntityType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS = of("business") - - @JvmField val INDIVIDUAL = of("individual") - - @JvmStatic fun of(value: String) = LegalEntityType(JsonField.of(value)) - } - - /** An enum containing [LegalEntityType]'s known values. */ - enum class Known { - BUSINESS, - INDIVIDUAL, - } - - /** - * An enum containing [LegalEntityType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [LegalEntityType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS, - INDIVIDUAL, - /** - * An enum member indicating that [LegalEntityType] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS -> Value.BUSINESS - INDIVIDUAL -> Value.INDIVIDUAL - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS -> Known.BUSINESS - INDIVIDUAL -> Known.INDIVIDUAL - else -> - throw ModernTreasuryInvalidDataException("Unknown LegalEntityType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalEntityType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The business's legal structure. */ - class LegalStructure - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CORPORATION = of("corporation") - - @JvmField val LLC = of("llc") - - @JvmField val NON_PROFIT = of("non_profit") - - @JvmField val PARTNERSHIP = of("partnership") - - @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - - @JvmField val TRUST = of("trust") - - @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) - } - - /** An enum containing [LegalStructure]'s known values. */ - enum class Known { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - } - - /** - * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [LegalStructure] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - /** - * An enum member indicating that [LegalStructure] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CORPORATION -> Value.CORPORATION - LLC -> Value.LLC - NON_PROFIT -> Value.NON_PROFIT - PARTNERSHIP -> Value.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP - TRUST -> Value.TRUST - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CORPORATION -> Known.CORPORATION - LLC -> Known.LLC - NON_PROFIT -> Known.NON_PROFIT - PARTNERSHIP -> Known.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP - TRUST -> Known.TRUST - else -> - throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalStructure = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalStructure && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Additional data represented as key-value pairs. Both the key and value must be strings. - */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Metadata]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Metadata]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Metadata]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Metadata && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - /** A list of phone numbers in E.164 format. */ - class PhoneNumber - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val phoneNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("phone_number") - @ExcludeMissing - phoneNumber: JsonField = JsonMissing.of() - ) : this(phoneNumber, mutableMapOf()) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - - /** - * Returns the raw JSON value of [phoneNumber]. - * - * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("phone_number") - @ExcludeMissing - fun _phoneNumber(): JsonField = phoneNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PhoneNumber]. */ - class Builder internal constructor() { - - private var phoneNumber: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(phoneNumber: PhoneNumber) = apply { - this.phoneNumber = phoneNumber.phoneNumber - additionalProperties = phoneNumber.additionalProperties.toMutableMap() - } - - fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) - - /** - * Sets [Builder.phoneNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.phoneNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun phoneNumber(phoneNumber: JsonField) = apply { - this.phoneNumber = phoneNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [PhoneNumber]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): PhoneNumber = - PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - phoneNumber() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is PhoneNumber && - phoneNumber == other.phoneNumber && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" - } - - class LegalEntityRegulator - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val jurisdiction: JsonField, - private val name: JsonField, - private val registrationNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("jurisdiction") - @ExcludeMissing - jurisdiction: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("registration_number") - @ExcludeMissing - registrationNumber: JsonField = JsonMissing.of(), - ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., - * "US", "CA", "GB"). - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - - /** - * Full name of the regulatory body. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun name(): String = name.getRequired("name") - - /** - * Registration or identification number with the regulator. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - - /** - * Returns the raw JSON value of [jurisdiction]. - * - * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("jurisdiction") - @ExcludeMissing - fun _jurisdiction(): JsonField = jurisdiction - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [registrationNumber]. - * - * Unlike [registrationNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("registration_number") - @ExcludeMissing - fun _registrationNumber(): JsonField = registrationNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityRegulator]. */ - class Builder internal constructor() { - - private var jurisdiction: JsonField? = null - private var name: JsonField? = null - private var registrationNumber: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { - jurisdiction = legalEntityRegulator.jurisdiction - name = legalEntityRegulator.name - registrationNumber = legalEntityRegulator.registrationNumber - additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() - } - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format - * (e.g., "US", "CA", "GB"). - */ - fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) - - /** - * Sets [Builder.jurisdiction] to an arbitrary JSON value. - * - * You should usually call [Builder.jurisdiction] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun jurisdiction(jurisdiction: JsonField) = apply { - this.jurisdiction = jurisdiction - } - - /** Full name of the regulatory body. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** Registration or identification number with the regulator. */ - fun registrationNumber(registrationNumber: String) = - registrationNumber(JsonField.of(registrationNumber)) - - /** - * Sets [Builder.registrationNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.registrationNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun registrationNumber(registrationNumber: JsonField) = apply { - this.registrationNumber = registrationNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityRegulator]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityRegulator = - LegalEntityRegulator( - checkRequired("jurisdiction", jurisdiction), - checkRequired("name", name), - checkRequired("registrationNumber", registrationNumber), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalEntityRegulator = apply { - if (validated) { - return@apply - } - - jurisdiction() - name() - registrationNumber() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (jurisdiction.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (registrationNumber.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityRegulator && - jurisdiction == other.jurisdiction && - name == other.name && - registrationNumber == other.registrationNumber && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" - } - - /** The risk rating of the legal entity. One of low, medium, high. */ - class RiskRating @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val LOW = of("low") - - @JvmField val MEDIUM = of("medium") - - @JvmField val HIGH = of("high") - - @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) - } - - /** An enum containing [RiskRating]'s known values. */ - enum class Known { - LOW, - MEDIUM, - HIGH, - } - - /** - * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [RiskRating] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - LOW, - MEDIUM, - HIGH, - /** - * An enum member indicating that [RiskRating] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - LOW -> Value.LOW - MEDIUM -> Value.MEDIUM - HIGH -> Value.HIGH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - LOW -> Known.LOW - MEDIUM -> Known.MEDIUM - HIGH -> Known.HIGH - else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): RiskRating = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RiskRating && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") - @ExcludeMissing - object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = - employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = - sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("industry") - @ExcludeMissing - fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("live_mode") - @ExcludeMissing - fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = - annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = - annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** - * Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. - */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with - * `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = - incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = - incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = - occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = - occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException( - "Unknown EmploymentStatus: $value" - ) - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** A category given to the document, can be `null`. */ + class DocumentType + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -5981,58 +2972,54 @@ private constructor( companion object { - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + @JvmField val ARTICLES_OF_INCORPORATION = of("articles_of_incorporation") - @JvmField val INHERITANCE = of("inheritance") + @JvmField val CERTIFICATE_OF_GOOD_STANDING = of("certificate_of_good_standing") - @JvmField val INVESTMENTS = of("investments") + @JvmField val EIN_LETTER = of("ein_letter") - @JvmField val RENTAL_INCOME = of("rental_income") + @JvmField val GENERIC = of("generic") - @JvmField val RETIREMENT = of("retirement") + @JvmField val IDENTIFICATION_BACK = of("identification_back") - @JvmField val SALARY = of("salary") + @JvmField val IDENTIFICATION_FRONT = of("identification_front") - @JvmField val SELF_EMPLOYED = of("self_employed") + @JvmField val PROOF_OF_ADDRESS = of("proof_of_address") - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) + @JvmStatic fun of(value: String) = DocumentType(JsonField.of(value)) } - /** An enum containing [IncomeSource]'s known values. */ + /** An enum containing [DocumentType]'s known values. */ enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, + ARTICLES_OF_INCORPORATION, + CERTIFICATE_OF_GOOD_STANDING, + EIN_LETTER, + GENERIC, + IDENTIFICATION_BACK, + IDENTIFICATION_FRONT, + PROOF_OF_ADDRESS, } /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] + * An enum containing [DocumentType]'s known values, as well as an [_UNKNOWN] * member. * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: + * An instance of [DocumentType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, + ARTICLES_OF_INCORPORATION, + CERTIFICATE_OF_GOOD_STANDING, + EIN_LETTER, + GENERIC, + IDENTIFICATION_BACK, + IDENTIFICATION_FRONT, + PROOF_OF_ADDRESS, /** - * An enum member indicating that [IncomeSource] was instantiated with an + * An enum member indicating that [DocumentType] was instantiated with an * unknown value. */ _UNKNOWN, @@ -6047,14 +3034,13 @@ private constructor( */ fun value(): Value = when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED + ARTICLES_OF_INCORPORATION -> Value.ARTICLES_OF_INCORPORATION + CERTIFICATE_OF_GOOD_STANDING -> Value.CERTIFICATE_OF_GOOD_STANDING + EIN_LETTER -> Value.EIN_LETTER + GENERIC -> Value.GENERIC + IDENTIFICATION_BACK -> Value.IDENTIFICATION_BACK + IDENTIFICATION_FRONT -> Value.IDENTIFICATION_FRONT + PROOF_OF_ADDRESS -> Value.PROOF_OF_ADDRESS else -> Value._UNKNOWN } @@ -6069,16 +3055,15 @@ private constructor( */ fun known(): Known = when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED + ARTICLES_OF_INCORPORATION -> Known.ARTICLES_OF_INCORPORATION + CERTIFICATE_OF_GOOD_STANDING -> Known.CERTIFICATE_OF_GOOD_STANDING + EIN_LETTER -> Known.EIN_LETTER + GENERIC -> Known.GENERIC + IDENTIFICATION_BACK -> Known.IDENTIFICATION_BACK + IDENTIFICATION_FRONT -> Known.IDENTIFICATION_FRONT + PROOF_OF_ADDRESS -> Known.PROOF_OF_ADDRESS else -> - throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") + throw ModernTreasuryInvalidDataException("Unknown DocumentType: $value") } /** @@ -6107,7 +3092,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object * doesn't match its expected type. */ - fun validate(): IncomeSource = apply { + fun validate(): DocumentType = apply { if (validated) { return@apply } @@ -6137,7 +3122,7 @@ private constructor( return true } - return other is IncomeSource && value == other.value + return other is DocumentType && value == other.value } override fun hashCode() = value.hashCode() @@ -6145,1065 +3130,1034 @@ private constructor( override fun toString() = value.toString() } - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Document && + documentType == other.documentType && + fileData == other.fileData && + filename == other.filename && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(documentType, fileData, filename, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Document{documentType=$documentType, fileData=$fileData, filename=$filename, additionalProperties=$additionalProperties}" + } + + /** The type of legal entity. */ + class LegalEntityType + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val BUSINESS = of("business") + + @JvmField val INDIVIDUAL = of("individual") + + @JvmStatic fun of(value: String) = LegalEntityType(JsonField.of(value)) + } + + /** An enum containing [LegalEntityType]'s known values. */ + enum class Known { + BUSINESS, + INDIVIDUAL, + } + /** + * An enum containing [LegalEntityType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [LegalEntityType] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + BUSINESS, + INDIVIDUAL, /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * An enum member indicating that [LegalEntityType] was instantiated with an unknown + * value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + _UNKNOWN, + } - companion object { + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + BUSINESS -> Value.BUSINESS + INDIVIDUAL -> Value.INDIVIDUAL + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + BUSINESS -> Known.BUSINESS + INDIVIDUAL -> Known.INDIVIDUAL + else -> + throw ModernTreasuryInvalidDataException("Unknown LegalEntityType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LegalEntityType = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LegalEntityType && value == other.value + } - @JvmField val ACCOUNTING = of("accounting") + override fun hashCode() = value.hashCode() - @JvmField val AGRICULTURE = of("agriculture") + override fun toString() = value.toString() + } - @JvmField val AUTOMOTIVE = of("automotive") + /** The business's legal structure. */ + class LegalStructure + @JsonCreator + private constructor(private val value: JsonField) : Enum { - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmField val CONSTRUCTION = of("construction") + companion object { - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") + @JvmField val CORPORATION = of("corporation") - @JvmField val FOOD_SERVICE = of("food_service") + @JvmField val LLC = of("llc") - @JvmField val FINANCE = of("finance") + @JvmField val NON_PROFIT = of("non_profit") - @JvmField val GASOLINE = of("gasoline") + @JvmField val PARTNERSHIP = of("partnership") - @JvmField val HEALTH_STORES = of("health_stores") + @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - @JvmField val LAUNDRY = of("laundry") + @JvmField val TRUST = of("trust") - @JvmField val MAINTENANCE = of("maintenance") + @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) + } - @JvmField val MANUFACTURING = of("manufacturing") + /** An enum containing [LegalStructure]'s known values. */ + enum class Known { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, + } - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") + /** + * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [LegalStructure] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, + /** + * An enum member indicating that [LegalStructure] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - @JvmField val MINING = of("mining") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CORPORATION -> Value.CORPORATION + LLC -> Value.LLC + NON_PROFIT -> Value.NON_PROFIT + PARTNERSHIP -> Value.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP + TRUST -> Value.TRUST + else -> Value._UNKNOWN + } - @JvmField val PERFORMING_ARTS = of("performing_arts") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CORPORATION -> Known.CORPORATION + LLC -> Known.LLC + NON_PROFIT -> Known.NON_PROFIT + PARTNERSHIP -> Known.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP + TRUST -> Known.TRUST + else -> + throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") + } - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") + private var validated: Boolean = false - @JvmField val PUBLISHING = of("publishing") + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LegalStructure = apply { + if (validated) { + return@apply + } - @JvmField val REAL_ESTATE = of("real_estate") + known() + validated = true + } - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JvmField val RENTAL_SERVICES = of("rental_services") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val RETAIL_CLOTHING = of("retail_clothing") + return other is LegalStructure && value == other.value + } - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") + override fun hashCode() = value.hashCode() - @JvmField val RETAIL_FOOD = of("retail_food") + override fun toString() = value.toString() + } - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") + /** + * Additional data represented as key-value pairs. Both the key and value must be strings. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { - @JvmField val RETAIL_HOME = of("retail_home") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val RETAIL_NON_STORE = of("retail_non_store") + fun toBuilder() = Builder().from(this) - @JvmField val RETAIL_SPORTING = of("retail_sporting") + companion object { - @JvmField val TRANSPORTATION = of("transportation") + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } - @JvmField val TRAVEL = of("travel") + /** A builder for [Metadata]. */ + class Builder internal constructor() { - @JvmField val UTILITIES = of("utilities") + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown - * value. - */ - _UNKNOWN, + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } - private var validated: Boolean = false + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. + * Returns an immutable instance of [Metadata]. * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. + * Further updates to this [Builder] will not mutate the returned instance. */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - known() - validated = true + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Metadata = apply { + if (validated) { + return@apply } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + validated = true + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - return other is Industry && value == other.value + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + return other is Metadata && additionalProperties == other.additionalProperties } - /** The occupation of the individual. */ - class Occupation - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - companion object { + override fun hashCode(): Int = hashCode - @JvmField val CONSULTING = of("consulting") + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - @JvmField val EXECUTIVE = of("executive") + /** A list of phone numbers in E.164 format. */ + class PhoneNumber + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val phoneNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") + @JsonCreator + private constructor( + @JsonProperty("phone_number") + @ExcludeMissing + phoneNumber: JsonField = JsonMissing.of() + ) : this(phoneNumber, mutableMapOf()) - @JvmField val FOOD_SERVICES = of("food_services") + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - @JvmField val GOVERNMENT = of("government") + /** + * Returns the raw JSON value of [phoneNumber]. + * + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("phone_number") + @ExcludeMissing + fun _phoneNumber(): JsonField = phoneNumber - @JvmField val HEALTHCARE = of("healthcare") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmField val LEGAL_SERVICES = of("legal_services") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmField val MANUFACTURING = of("manufacturing") + fun toBuilder() = Builder().from(this) - @JvmField val OTHER = of("other") + companion object { - @JvmField val SALES = of("sales") + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ + @JvmStatic fun builder() = Builder() + } - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") + /** A builder for [PhoneNumber]. */ + class Builder internal constructor() { - @JvmField val TECHNOLOGY = of("technology") + private var phoneNumber: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.phoneNumber = phoneNumber.phoneNumber + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } + fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. + * Sets [Builder.phoneNumber] to an arbitrary JSON value. * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * You should usually call [Builder.phoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> - throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - private var validated: Boolean = false + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - known() - validated = true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [PhoneNumber]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): PhoneNumber = + PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Occupation && value == other.value + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + phoneNumber() + validated = true } - /** The source of the individual's funds. */ - class SourceOfFunds - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val INVESTMENT = of("investment") + return other is PhoneNumber && + phoneNumber == other.phoneNumber && + additionalProperties == other.additionalProperties + } - @JvmField val INVESTOR_FUNDING = of("investor_funding") + private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") + override fun hashCode(): Int = hashCode - @JvmField val LOTTERY = of("lottery") + override fun toString() = + "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" + } - @JvmField val REAL_ESTATE = of("real_estate") + class LegalEntityRegulator + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val jurisdiction: JsonField, + private val name: JsonField, + private val registrationNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") + @JsonCreator + private constructor( + @JsonProperty("jurisdiction") + @ExcludeMissing + jurisdiction: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("registration_number") + @ExcludeMissing + registrationNumber: JsonField = JsonMissing.of(), + ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) - @JvmField val RETIRED = of("retired") + /** + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., + * "US", "CA", "GB"). + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - @JvmField val RETIREMENT = of("retirement") + /** + * Full name of the regulatory body. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") - @JvmField val SALARY = of("salary") + /** + * Registration or identification number with the regulator. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") + /** + * Returns the raw JSON value of [jurisdiction]. + * + * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("jurisdiction") + @ExcludeMissing + fun _jurisdiction(): JsonField = jurisdiction - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JvmField val SELF_EMPLOYED = of("self_employed") + /** + * Returns the raw JSON value of [registrationNumber]. + * + * Unlike [registrationNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("registration_number") + @ExcludeMissing + fun _registrationNumber(): JsonField = registrationNumber - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmField val TRUST_INCOME = of("trust_income") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } + fun toBuilder() = Builder().from(this) - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } + companion object { /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] - * member. + * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an - * unknown value. - */ - _UNKNOWN, + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LegalEntityRegulator]. */ + class Builder internal constructor() { + + private var jurisdiction: JsonField? = null + private var name: JsonField? = null + private var registrationNumber: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { + jurisdiction = legalEntityRegulator.jurisdiction + name = legalEntityRegulator.name + registrationNumber = legalEntityRegulator.registrationNumber + additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() } /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format + * (e.g., "US", "CA", "GB"). */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } + fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. + * Sets [Builder.jurisdiction] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. + * You should usually call [Builder.jurisdiction] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException( - "Unknown SourceOfFunds: $value" - ) - } + fun jurisdiction(jurisdiction: JsonField) = apply { + this.jurisdiction = jurisdiction + } + + /** Full name of the regulatory body. */ + fun name(name: String) = name(JsonField.of(name)) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.name] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + fun name(name: JsonField) = apply { this.name = name } - private var validated: Boolean = false + /** Registration or identification number with the regulator. */ + fun registrationNumber(registrationNumber: String) = + registrationNumber(JsonField.of(registrationNumber)) /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. + * Sets [Builder.registrationNumber] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. + * You should usually call [Builder.registrationNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true + fun registrationNumber(registrationNumber: JsonField) = apply { + this.registrationNumber = registrationNumber } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - return other is SourceOfFunds && value == other.value + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns this class instance's raw value. + * Returns an immutable instance of [LegalEntityRegulator]. * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun build(): LegalEntityRegulator = + LegalEntityRegulator( + checkRequired("jurisdiction", jurisdiction), + checkRequired("name", name), + checkRequired("registrationNumber", registrationNumber), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LegalEntityRegulator = apply { + if (validated) { + return@apply + } - companion object { + jurisdiction() + name() + registrationNumber() + validated = true + } - @JvmField val BUSINESS_SALE = of("business_sale") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - @JvmField val FAMILY_SUPPORT = of("family_support") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (jurisdiction.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (registrationNumber.asKnown().isPresent) 1 else 0) - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val INHERITANCE = of("inheritance") + return other is LegalEntityRegulator && + jurisdiction == other.jurisdiction && + name == other.name && + registrationNumber == other.registrationNumber && + additionalProperties == other.additionalProperties + } - @JvmField val INVESTMENTS = of("investments") + private val hashCode: Int by lazy { + Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) + } - @JvmField val OTHER = of("other") + override fun hashCode(): Int = hashCode - @JvmField val RENTAL_INCOME = of("rental_income") + override fun toString() = + "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" + } - @JvmField val RETIREMENT = of("retirement") + /** The risk rating of the legal entity. One of low, medium, high. */ + class RiskRating @JsonCreator private constructor(private val value: JsonField) : + Enum { - @JvmField val SALARY = of("salary") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmField val SELF_EMPLOYED = of("self_employed") + companion object { - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } + @JvmField val LOW = of("low") - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } + @JvmField val MEDIUM = of("medium") - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + @JvmField val HIGH = of("high") - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } + @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) + } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } + /** An enum containing [RiskRating]'s known values. */ + enum class Known { + LOW, + MEDIUM, + HIGH, + } + /** + * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RiskRating] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + LOW, + MEDIUM, + HIGH, /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. + * An enum member indicating that [RiskRating] was instantiated with an unknown + * value. */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + _UNKNOWN, + } - private var validated: Boolean = false + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + LOW -> Value.LOW + MEDIUM -> Value.MEDIUM + HIGH -> Value.HIGH + else -> Value._UNKNOWN + } - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + LOW -> Known.LOW + MEDIUM -> Known.MEDIUM + HIGH -> Known.HIGH + else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") + } - known() - validated = true + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + private var validated: Boolean = false - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): RiskRating = apply { + if (validated) { + return@apply + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is WealthSource && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) + return other is RiskRating && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCollectAccountParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCollectAccountParams.kt index 1e6919fc..5012fe9d 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCollectAccountParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCollectAccountParams.kt @@ -797,12 +797,8 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hkInterbankClearingCode") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("huInterbankClearingCode") - @JvmField val DK_INTERBANK_CLEARING_CODE = of("dkInterbankClearingCode") - @JvmField val ID_SKNBI_CODE = of("idSknbiCode") - @JvmField val ZA_NATIONAL_CLEARING_CODE = of("zaNationalClearingCode") @JvmStatic fun of(value: String) = Field(JsonField.of(value)) @@ -835,9 +831,7 @@ private constructor( SE_BANKGIRO_CLEARING_CODE, NZ_NATIONAL_CLEARING_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, DK_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, ZA_NATIONAL_CLEARING_CODE, } @@ -876,9 +870,7 @@ private constructor( SE_BANKGIRO_CLEARING_CODE, NZ_NATIONAL_CLEARING_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, DK_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, ZA_NATIONAL_CLEARING_CODE, /** An enum member indicating that [Field] was instantiated with an unknown value. */ _UNKNOWN, @@ -918,9 +910,7 @@ private constructor( SE_BANKGIRO_CLEARING_CODE -> Value.SE_BANKGIRO_CLEARING_CODE NZ_NATIONAL_CLEARING_CODE -> Value.NZ_NATIONAL_CLEARING_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE ZA_NATIONAL_CLEARING_CODE -> Value.ZA_NATIONAL_CLEARING_CODE else -> Value._UNKNOWN } @@ -961,9 +951,7 @@ private constructor( SE_BANKGIRO_CLEARING_CODE -> Known.SE_BANKGIRO_CLEARING_CODE NZ_NATIONAL_CLEARING_CODE -> Known.NZ_NATIONAL_CLEARING_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE ZA_NATIONAL_CLEARING_CODE -> Known.ZA_NATIONAL_CLEARING_CODE else -> throw ModernTreasuryInvalidDataException("Unknown Field: $value") } diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCreateParams.kt index 9b4bcb90..b1e05851 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/CounterpartyCreateParams.kt @@ -19,7 +19,6 @@ import com.moderntreasury.api.core.http.QueryParams import com.moderntreasury.api.core.toImmutable import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException import java.time.LocalDate -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -3268,10 +3267,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -3308,8 +3303,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -3344,8 +3337,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -3382,8 +3373,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -3418,8 +3407,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -3539,10 +3526,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -3555,26 +3538,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -3597,24 +3570,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -3641,24 +3607,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -3689,24 +3648,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -3735,24 +3687,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -4040,7 +3985,7 @@ private constructor( private constructor( private val legalEntityType: JsonField, private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -4077,7 +4022,7 @@ private constructor( private val thirdPartyVerification: JsonField, private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -4092,7 +4037,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -4199,8 +4144,7 @@ private constructor( tickerSymbol: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = - JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( legalEntityType, @@ -4268,8 +4212,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun bankSettings(): Optional = - bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -4584,7 +4527,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -4622,7 +4565,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -4960,7 +4903,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -5000,7 +4943,7 @@ private constructor( private var legalEntityType: JsonField? = null private var addresses: JsonField>? = null - private var bankSettings: JsonField = JsonMissing.of() + private var bankSettings: JsonField = JsonMissing.of() private var businessDescription: JsonField = JsonMissing.of() private var businessName: JsonField = JsonMissing.of() private var citizenshipCountry: JsonField = JsonMissing.of() @@ -5042,7 +4985,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField = JsonMissing.of() - private var wealthAndEmploymentDetails: JsonField = + private var wealthAndEmploymentDetails: JsonField = JsonMissing.of() private var website: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -5142,21 +5085,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed - * [LegalEntityBankSetting] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -5950,7 +5893,7 @@ private constructor( } fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? + wealthAndEmploymentDetails: WealthAndEmploymentDetails? ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** @@ -5958,18 +5901,18 @@ private constructor( * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -6328,241 +6271,79 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityBankSetting + class Document @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val id: JsonField, - private val backupWithholdingPercentage: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, - private val updatedAt: JsonField, + private val documentType: JsonField, + private val fileData: JsonField, + private val filename: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") - @ExcludeMissing - object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") + documentType: JsonField = JsonMissing.of(), + @JsonProperty("file_data") @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") + fileData: JsonField = JsonMissing.of(), + @JsonProperty("filename") @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") + filename: JsonField = JsonMissing.of(), + ) : this(documentType, fileData, filename, mutableMapOf()) /** - * The percentage of backup withholding to apply to the legal entity. + * A category given to the document, can be `null`. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun documentType(): DocumentType = documentType.getRequired("document_type") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * Base64-encoded file content for the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * or is unexpectedly missing or null (e.g. if the server responded with an unexpected * value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * Cross River Bank specific setting to opt out of privacy policy. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun fileData(): String = fileData.getRequired("file_data") /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. + * The original filename of the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type * (e.g. if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has - * an unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [enableBackupWithholding]. - * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("live_mode") - @ExcludeMissing - fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + fun filename(): Optional = filename.getOptional("filename") /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [documentType]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _documentType(): JsonField = documentType /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [fileData]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected + * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("regulation_o") - @ExcludeMissing - fun _regulationO(): JsonField = regulationO + @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData /** - * Returns the raw JSON value of [updatedAt]. + * Returns the raw JSON value of [filename]. * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected + * Unlike [filename], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -6579,258 +6360,71 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Document]. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Document]. */ class Builder internal constructor() { - private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null - private var updatedAt: JsonField? = null + private var documentType: JsonField? = null + private var fileData: JsonField? = null + private var filename: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = - legalEntityBankSetting.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = - apply { - this.backupWithholdingPercentage = backupWithholdingPercentage - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + internal fun from(document: Document) = apply { + documentType = document.documentType + fileData = document.fileData + filename = document.filename + additionalProperties = document.additionalProperties.toMutableMap() } - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) + /** A category given to the document, can be `null`. */ + fun documentType(documentType: DocumentType) = + documentType(JsonField.of(documentType)) /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. + * Sets [Builder.documentType] to an arbitrary JSON value. * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] + * You should usually call [Builder.documentType] with a well-typed [DocumentType] * value instead. This method is primarily for setting the field to an undocumented * or not yet supported value. */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) - - /** - * Alias for [Builder.enableBackupWithholding]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. - */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) - - /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. - * - * You should usually call [Builder.enableBackupWithholding] with a well-typed - * [Boolean] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun documentType(documentType: JsonField) = apply { + this.documentType = documentType } - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) - - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) - - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) + /** Base64-encoded file content for the document. */ + fun fileData(fileData: String) = fileData(JsonField.of(fileData)) /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. + * Sets [Builder.fileData] to an arbitrary JSON value. * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value + * You should usually call [Builder.fileData] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut - } - - /** - * It covers, among other types of insider loans, extensions of credit by a member - * bank to an executive officer, director, or principal shareholder of the member - * bank; a bank holding company of which the member bank is a subsidiary; and any - * other subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = - regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = - regulationO(regulationO.getOrNull()) + /** The original filename of the document. */ + fun filename(filename: String) = filename(JsonField.of(filename)) /** - * Sets [Builder.regulationO] to an arbitrary JSON value. + * Sets [Builder.filename] to an arbitrary JSON value. * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value + * You should usually call [Builder.filename] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } + fun filename(filename: JsonField) = apply { this.filename = filename } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -6855,38 +6449,23 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Document]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( - checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), - checkRequired("updatedAt", updatedAt), + fun build(): Document = + Document( + checkRequired("documentType", documentType), + checkRequired("fileData", fileData), + filename, additionalProperties.toMutableMap(), ) } @@ -6903,21 +6482,14 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't * match its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Document = apply { if (validated) { return@apply } - id() - backupWithholdingPercentage() - createdAt() - discardedAt() - enableBackupWithholding() - liveMode() - object_() - privacyOptOut() - regulationO() - updatedAt() + documentType().validate() + fileData() + filename() validated = true } @@ -6937,2337 +6509,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + (documentType.asKnown().getOrNull()?.validity() ?: 0) + + (if (fileData.asKnown().isPresent) 1 else 0) + + (if (filename.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } - - class Document - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val documentType: JsonField, - private val fileData: JsonField, - private val filename: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("document_type") - @ExcludeMissing - documentType: JsonField = JsonMissing.of(), - @JsonProperty("file_data") - @ExcludeMissing - fileData: JsonField = JsonMissing.of(), - @JsonProperty("filename") - @ExcludeMissing - filename: JsonField = JsonMissing.of(), - ) : this(documentType, fileData, filename, mutableMapOf()) - - /** - * A category given to the document, can be `null`. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun documentType(): DocumentType = documentType.getRequired("document_type") - - /** - * Base64-encoded file content for the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun fileData(): String = fileData.getRequired("file_data") - - /** - * The original filename of the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun filename(): Optional = filename.getOptional("filename") - - /** - * Returns the raw JSON value of [documentType]. - * - * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("document_type") - @ExcludeMissing - fun _documentType(): JsonField = documentType - - /** - * Returns the raw JSON value of [fileData]. - * - * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData - - /** - * Returns the raw JSON value of [filename]. - * - * Unlike [filename], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Document]. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Document]. */ - class Builder internal constructor() { - - private var documentType: JsonField? = null - private var fileData: JsonField? = null - private var filename: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(document: Document) = apply { - documentType = document.documentType - fileData = document.fileData - filename = document.filename - additionalProperties = document.additionalProperties.toMutableMap() - } - - /** A category given to the document, can be `null`. */ - fun documentType(documentType: DocumentType) = - documentType(JsonField.of(documentType)) - - /** - * Sets [Builder.documentType] to an arbitrary JSON value. - * - * You should usually call [Builder.documentType] with a well-typed [DocumentType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun documentType(documentType: JsonField) = apply { - this.documentType = documentType - } - - /** Base64-encoded file content for the document. */ - fun fileData(fileData: String) = fileData(JsonField.of(fileData)) - - /** - * Sets [Builder.fileData] to an arbitrary JSON value. - * - * You should usually call [Builder.fileData] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - - /** The original filename of the document. */ - fun filename(filename: String) = filename(JsonField.of(filename)) - - /** - * Sets [Builder.filename] to an arbitrary JSON value. - * - * You should usually call [Builder.filename] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun filename(filename: JsonField) = apply { this.filename = filename } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Document]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Document = - Document( - checkRequired("documentType", documentType), - checkRequired("fileData", fileData), - filename, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Document = apply { - if (validated) { - return@apply - } - - documentType().validate() - fileData() - filename() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (documentType.asKnown().getOrNull()?.validity() ?: 0) + - (if (fileData.asKnown().isPresent) 1 else 0) + - (if (filename.asKnown().isPresent) 1 else 0) - - /** A category given to the document, can be `null`. */ - class DocumentType - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ARTICLES_OF_INCORPORATION = of("articles_of_incorporation") - - @JvmField val CERTIFICATE_OF_GOOD_STANDING = of("certificate_of_good_standing") - - @JvmField val EIN_LETTER = of("ein_letter") - - @JvmField val GENERIC = of("generic") - - @JvmField val IDENTIFICATION_BACK = of("identification_back") - - @JvmField val IDENTIFICATION_FRONT = of("identification_front") - - @JvmField val PROOF_OF_ADDRESS = of("proof_of_address") - - @JvmStatic fun of(value: String) = DocumentType(JsonField.of(value)) - } - - /** An enum containing [DocumentType]'s known values. */ - enum class Known { - ARTICLES_OF_INCORPORATION, - CERTIFICATE_OF_GOOD_STANDING, - EIN_LETTER, - GENERIC, - IDENTIFICATION_BACK, - IDENTIFICATION_FRONT, - PROOF_OF_ADDRESS, - } - - /** - * An enum containing [DocumentType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [DocumentType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ARTICLES_OF_INCORPORATION, - CERTIFICATE_OF_GOOD_STANDING, - EIN_LETTER, - GENERIC, - IDENTIFICATION_BACK, - IDENTIFICATION_FRONT, - PROOF_OF_ADDRESS, - /** - * An enum member indicating that [DocumentType] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ARTICLES_OF_INCORPORATION -> Value.ARTICLES_OF_INCORPORATION - CERTIFICATE_OF_GOOD_STANDING -> Value.CERTIFICATE_OF_GOOD_STANDING - EIN_LETTER -> Value.EIN_LETTER - GENERIC -> Value.GENERIC - IDENTIFICATION_BACK -> Value.IDENTIFICATION_BACK - IDENTIFICATION_FRONT -> Value.IDENTIFICATION_FRONT - PROOF_OF_ADDRESS -> Value.PROOF_OF_ADDRESS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ARTICLES_OF_INCORPORATION -> Known.ARTICLES_OF_INCORPORATION - CERTIFICATE_OF_GOOD_STANDING -> Known.CERTIFICATE_OF_GOOD_STANDING - EIN_LETTER -> Known.EIN_LETTER - GENERIC -> Known.GENERIC - IDENTIFICATION_BACK -> Known.IDENTIFICATION_BACK - IDENTIFICATION_FRONT -> Known.IDENTIFICATION_FRONT - PROOF_OF_ADDRESS -> Known.PROOF_OF_ADDRESS - else -> - throw ModernTreasuryInvalidDataException("Unknown DocumentType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): DocumentType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DocumentType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Document && - documentType == other.documentType && - fileData == other.fileData && - filename == other.filename && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(documentType, fileData, filename, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Document{documentType=$documentType, fileData=$fileData, filename=$filename, additionalProperties=$additionalProperties}" - } - - /** The business's legal structure. */ - class LegalStructure - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CORPORATION = of("corporation") - - @JvmField val LLC = of("llc") - - @JvmField val NON_PROFIT = of("non_profit") - - @JvmField val PARTNERSHIP = of("partnership") - - @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - - @JvmField val TRUST = of("trust") - - @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) - } - - /** An enum containing [LegalStructure]'s known values. */ - enum class Known { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - } - - /** - * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [LegalStructure] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - /** - * An enum member indicating that [LegalStructure] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CORPORATION -> Value.CORPORATION - LLC -> Value.LLC - NON_PROFIT -> Value.NON_PROFIT - PARTNERSHIP -> Value.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP - TRUST -> Value.TRUST - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CORPORATION -> Known.CORPORATION - LLC -> Known.LLC - NON_PROFIT -> Known.NON_PROFIT - PARTNERSHIP -> Known.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP - TRUST -> Known.TRUST - else -> - throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalStructure = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalStructure && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Additional data represented as key-value pairs. Both the key and value must be strings. - */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Metadata]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Metadata]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Metadata]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Metadata = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Metadata && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" - } - - /** A list of phone numbers in E.164 format. */ - class PhoneNumber - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val phoneNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("phone_number") - @ExcludeMissing - phoneNumber: JsonField = JsonMissing.of() - ) : this(phoneNumber, mutableMapOf()) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - - /** - * Returns the raw JSON value of [phoneNumber]. - * - * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("phone_number") - @ExcludeMissing - fun _phoneNumber(): JsonField = phoneNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [PhoneNumber]. */ - class Builder internal constructor() { - - private var phoneNumber: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(phoneNumber: PhoneNumber) = apply { - this.phoneNumber = phoneNumber.phoneNumber - additionalProperties = phoneNumber.additionalProperties.toMutableMap() - } - - fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) - - /** - * Sets [Builder.phoneNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.phoneNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun phoneNumber(phoneNumber: JsonField) = apply { - this.phoneNumber = phoneNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [PhoneNumber]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): PhoneNumber = - PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): PhoneNumber = apply { - if (validated) { - return@apply - } - - phoneNumber() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is PhoneNumber && - phoneNumber == other.phoneNumber && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" - } - - class LegalEntityRegulator - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val jurisdiction: JsonField, - private val name: JsonField, - private val registrationNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("jurisdiction") - @ExcludeMissing - jurisdiction: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("registration_number") - @ExcludeMissing - registrationNumber: JsonField = JsonMissing.of(), - ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., - * "US", "CA", "GB"). - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - - /** - * Full name of the regulatory body. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun name(): String = name.getRequired("name") - - /** - * Registration or identification number with the regulator. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - - /** - * Returns the raw JSON value of [jurisdiction]. - * - * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("jurisdiction") - @ExcludeMissing - fun _jurisdiction(): JsonField = jurisdiction - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - - /** - * Returns the raw JSON value of [registrationNumber]. - * - * Unlike [registrationNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("registration_number") - @ExcludeMissing - fun _registrationNumber(): JsonField = registrationNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityRegulator]. */ - class Builder internal constructor() { - - private var jurisdiction: JsonField? = null - private var name: JsonField? = null - private var registrationNumber: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { - jurisdiction = legalEntityRegulator.jurisdiction - name = legalEntityRegulator.name - registrationNumber = legalEntityRegulator.registrationNumber - additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() - } - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format - * (e.g., "US", "CA", "GB"). - */ - fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) - - /** - * Sets [Builder.jurisdiction] to an arbitrary JSON value. - * - * You should usually call [Builder.jurisdiction] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun jurisdiction(jurisdiction: JsonField) = apply { - this.jurisdiction = jurisdiction - } - - /** Full name of the regulatory body. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** Registration or identification number with the regulator. */ - fun registrationNumber(registrationNumber: String) = - registrationNumber(JsonField.of(registrationNumber)) - - /** - * Sets [Builder.registrationNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.registrationNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun registrationNumber(registrationNumber: JsonField) = apply { - this.registrationNumber = registrationNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityRegulator]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityRegulator = - LegalEntityRegulator( - checkRequired("jurisdiction", jurisdiction), - checkRequired("name", name), - checkRequired("registrationNumber", registrationNumber), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalEntityRegulator = apply { - if (validated) { - return@apply - } - - jurisdiction() - name() - registrationNumber() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (jurisdiction.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (registrationNumber.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityRegulator && - jurisdiction == other.jurisdiction && - name == other.name && - registrationNumber == other.registrationNumber && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" - } - - /** The risk rating of the legal entity. One of low, medium, high. */ - class RiskRating @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val LOW = of("low") - - @JvmField val MEDIUM = of("medium") - - @JvmField val HIGH = of("high") - - @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) - } - - /** An enum containing [RiskRating]'s known values. */ - enum class Known { - LOW, - MEDIUM, - HIGH, - } - - /** - * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [RiskRating] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - LOW, - MEDIUM, - HIGH, - /** - * An enum member indicating that [RiskRating] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - LOW -> Value.LOW - MEDIUM -> Value.MEDIUM - HIGH -> Value.HIGH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - LOW -> Known.LOW - MEDIUM -> Known.MEDIUM - HIGH -> Known.HIGH - else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): RiskRating = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RiskRating && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") - @ExcludeMissing - object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = - employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = - sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * or is unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("industry") - @ExcludeMissing - fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("live_mode") - @ExcludeMissing - fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = - annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = - annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** - * Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. - */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with - * `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = - incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = - incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = - occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = - occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus + /** A category given to the document, can be `null`. */ + class DocumentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -9283,47 +6530,54 @@ private constructor( companion object { - @JvmField val EMPLOYED = of("employed") + @JvmField val ARTICLES_OF_INCORPORATION = of("articles_of_incorporation") + + @JvmField val CERTIFICATE_OF_GOOD_STANDING = of("certificate_of_good_standing") + + @JvmField val EIN_LETTER = of("ein_letter") - @JvmField val RETIRED = of("retired") + @JvmField val GENERIC = of("generic") - @JvmField val SELF_EMPLOYED = of("self_employed") + @JvmField val IDENTIFICATION_BACK = of("identification_back") - @JvmField val STUDENT = of("student") + @JvmField val IDENTIFICATION_FRONT = of("identification_front") - @JvmField val UNEMPLOYED = of("unemployed") + @JvmField val PROOF_OF_ADDRESS = of("proof_of_address") - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) + @JvmStatic fun of(value: String) = DocumentType(JsonField.of(value)) } - /** An enum containing [EmploymentStatus]'s known values. */ + /** An enum containing [DocumentType]'s known values. */ enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, + ARTICLES_OF_INCORPORATION, + CERTIFICATE_OF_GOOD_STANDING, + EIN_LETTER, + GENERIC, + IDENTIFICATION_BACK, + IDENTIFICATION_FRONT, + PROOF_OF_ADDRESS, } /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] + * An enum containing [DocumentType]'s known values, as well as an [_UNKNOWN] * member. * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of - * cases: + * An instance of [DocumentType] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, + ARTICLES_OF_INCORPORATION, + CERTIFICATE_OF_GOOD_STANDING, + EIN_LETTER, + GENERIC, + IDENTIFICATION_BACK, + IDENTIFICATION_FRONT, + PROOF_OF_ADDRESS, /** - * An enum member indicating that [EmploymentStatus] was instantiated with an + * An enum member indicating that [DocumentType] was instantiated with an * unknown value. */ _UNKNOWN, @@ -9338,11 +6592,13 @@ private constructor( */ fun value(): Value = when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED + ARTICLES_OF_INCORPORATION -> Value.ARTICLES_OF_INCORPORATION + CERTIFICATE_OF_GOOD_STANDING -> Value.CERTIFICATE_OF_GOOD_STANDING + EIN_LETTER -> Value.EIN_LETTER + GENERIC -> Value.GENERIC + IDENTIFICATION_BACK -> Value.IDENTIFICATION_BACK + IDENTIFICATION_FRONT -> Value.IDENTIFICATION_FRONT + PROOF_OF_ADDRESS -> Value.PROOF_OF_ADDRESS else -> Value._UNKNOWN } @@ -9357,15 +6613,15 @@ private constructor( */ fun known(): Known = when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED + ARTICLES_OF_INCORPORATION -> Known.ARTICLES_OF_INCORPORATION + CERTIFICATE_OF_GOOD_STANDING -> Known.CERTIFICATE_OF_GOOD_STANDING + EIN_LETTER -> Known.EIN_LETTER + GENERIC -> Known.GENERIC + IDENTIFICATION_BACK -> Known.IDENTIFICATION_BACK + IDENTIFICATION_FRONT -> Known.IDENTIFICATION_FRONT + PROOF_OF_ADDRESS -> Known.PROOF_OF_ADDRESS else -> - throw ModernTreasuryInvalidDataException( - "Unknown EmploymentStatus: $value" - ) + throw ModernTreasuryInvalidDataException("Unknown DocumentType: $value") } /** @@ -9394,7 +6650,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object * doesn't match its expected type. */ - fun validate(): EmploymentStatus = apply { + fun validate(): DocumentType = apply { if (validated) { return@apply } @@ -9424,7 +6680,7 @@ private constructor( return true } - return other is EmploymentStatus && value == other.value + return other is DocumentType && value == other.value } override fun hashCode() = value.hashCode() @@ -9432,1246 +6688,890 @@ private constructor( override fun toString() = value.toString() } - /** The source of the individual's income. */ - class IncomeSource - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } + return other is Document && + documentType == other.documentType && + fileData == other.fileData && + filename == other.filename && + additionalProperties == other.additionalProperties + } - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + private val hashCode: Int by lazy { + Objects.hash(documentType, fileData, filename, additionalProperties) + } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } + override fun hashCode(): Int = hashCode - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } + override fun toString() = + "Document{documentType=$documentType, fileData=$fileData, filename=$filename, additionalProperties=$additionalProperties}" + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + /** The business's legal structure. */ + class LegalStructure + @JsonCreator + private constructor(private val value: JsonField) : Enum { - private var validated: Boolean = false + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } + companion object { - known() - validated = true - } + @JvmField val CORPORATION = of("corporation") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + @JvmField val LLC = of("llc") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmField val NON_PROFIT = of("non_profit") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JvmField val PARTNERSHIP = of("partnership") - return other is IncomeSource && value == other.value - } + @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - override fun hashCode() = value.hashCode() + @JvmField val TRUST = of("trust") - override fun toString() = value.toString() + @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) } - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** An enum containing [LegalStructure]'s known values. */ + enum class Known { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, + } + /** + * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [LegalStructure] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. + * An enum member indicating that [LegalStructure] was instantiated with an unknown + * value. */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") + _UNKNOWN, + } - @JvmField val MINING = of("mining") + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CORPORATION -> Value.CORPORATION + LLC -> Value.LLC + NON_PROFIT -> Value.NON_PROFIT + PARTNERSHIP -> Value.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP + TRUST -> Value.TRUST + else -> Value._UNKNOWN + } - @JvmField val PERFORMING_ARTS = of("performing_arts") + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CORPORATION -> Known.CORPORATION + LLC -> Known.LLC + NON_PROFIT -> Known.NON_PROFIT + PARTNERSHIP -> Known.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP + TRUST -> Known.TRUST + else -> + throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") + } - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") + private var validated: Boolean = false - @JvmField val PUBLISHING = of("publishing") + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LegalStructure = apply { + if (validated) { + return@apply + } - @JvmField val REAL_ESTATE = of("real_estate") + known() + validated = true + } - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JvmField val RENTAL_SERVICES = of("rental_services") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val RETAIL_CLOTHING = of("retail_clothing") + return other is LegalStructure && value == other.value + } - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") + override fun hashCode() = value.hashCode() - @JvmField val RETAIL_FOOD = of("retail_food") + override fun toString() = value.toString() + } - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") + /** + * Additional data represented as key-value pairs. Both the key and value must be strings. + */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { - @JvmField val RETAIL_HOME = of("retail_home") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties - @JvmField val RETAIL_NON_STORE = of("retail_non_store") + fun toBuilder() = Builder().from(this) - @JvmField val RETAIL_SPORTING = of("retail_sporting") + companion object { - @JvmField val TRANSPORTATION = of("transportation") + /** Returns a mutable builder for constructing an instance of [Metadata]. */ + @JvmStatic fun builder() = Builder() + } - @JvmField val TRAVEL = of("travel") + /** A builder for [Metadata]. */ + class Builder internal constructor() { - @JvmField val UTILITIES = of("utilities") + private var additionalProperties: MutableMap = mutableMapOf() - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) + @JvmSynthetic + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown - * value. - */ - _UNKNOWN, + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - known() - validated = true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [Metadata]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Industry && value == other.value + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): Metadata = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + validated = true } - /** The occupation of the individual. */ - class Occupation - @JsonCreator - private constructor(private val value: JsonField) : Enum { + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - companion object { + return other is Metadata && additionalProperties == other.additionalProperties + } - @JvmField val CONSULTING = of("consulting") + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - @JvmField val EXECUTIVE = of("executive") + override fun hashCode(): Int = hashCode - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - @JvmField val FOOD_SERVICES = of("food_services") + /** A list of phone numbers in E.164 format. */ + class PhoneNumber + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val phoneNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - @JvmField val GOVERNMENT = of("government") + @JsonCreator + private constructor( + @JsonProperty("phone_number") + @ExcludeMissing + phoneNumber: JsonField = JsonMissing.of() + ) : this(phoneNumber, mutableMapOf()) - @JvmField val HEALTHCARE = of("healthcare") + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - @JvmField val LEGAL_SERVICES = of("legal_services") + /** + * Returns the raw JSON value of [phoneNumber]. + * + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("phone_number") + @ExcludeMissing + fun _phoneNumber(): JsonField = phoneNumber - @JvmField val MANUFACTURING = of("manufacturing") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmField val OTHER = of("other") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmField val SALES = of("sales") + fun toBuilder() = Builder().from(this) - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") + companion object { - @JvmField val TECHNOLOGY = of("technology") + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ + @JvmStatic fun builder() = Builder() + } - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } + /** A builder for [PhoneNumber]. */ + class Builder internal constructor() { - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } + private var phoneNumber: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.phoneNumber = phoneNumber.phoneNumber + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } + fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. + * Sets [Builder.phoneNumber] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. + * You should usually call [Builder.phoneNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> - throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber + } - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - private var validated: Boolean = false + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - known() - validated = true + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [PhoneNumber]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun build(): PhoneNumber = + PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is Occupation && value == other.value + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): PhoneNumber = apply { + if (validated) { + return@apply } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + phoneNumber() + validated = true } - /** The source of the individual's funds. */ - class SourceOfFunds - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - @JvmField val DEBT_FINANCING = of("debt_financing") + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) - @JvmField val GENERAL_EMPLOYEE = of("general_employee") + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + return other is PhoneNumber && + phoneNumber == other.phoneNumber && + additionalProperties == other.additionalProperties + } - @JvmField val HOMEMAKER = of("homemaker") + private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") + override fun hashCode(): Int = hashCode - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") + override fun toString() = + "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" + } - @JvmField val INVESTMENT = of("investment") + class LegalEntityRegulator + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val jurisdiction: JsonField, + private val name: JsonField, + private val registrationNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - @JvmField val INVESTOR_FUNDING = of("investor_funding") + @JsonCreator + private constructor( + @JsonProperty("jurisdiction") + @ExcludeMissing + jurisdiction: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("registration_number") + @ExcludeMissing + registrationNumber: JsonField = JsonMissing.of(), + ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") + /** + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., + * "US", "CA", "GB"). + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - @JvmField val LOTTERY = of("lottery") + /** + * Full name of the regulatory body. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun name(): String = name.getRequired("name") - @JvmField val REAL_ESTATE = of("real_estate") + /** + * Registration or identification number with the regulator. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") + /** + * Returns the raw JSON value of [jurisdiction]. + * + * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("jurisdiction") + @ExcludeMissing + fun _jurisdiction(): JsonField = jurisdiction - @JvmField val RETIRED = of("retired") + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name - @JvmField val RETIREMENT = of("retirement") + /** + * Returns the raw JSON value of [registrationNumber]. + * + * Unlike [registrationNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("registration_number") + @ExcludeMissing + fun _registrationNumber(): JsonField = registrationNumber - @JvmField val SALARY = of("salary") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") + fun toBuilder() = Builder().from(this) - @JvmField val SELF_EMPLOYED = of("self_employed") + companion object { - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") + /** + * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. + * + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` + */ + @JvmStatic fun builder() = Builder() + } - @JvmField val TRUST_INCOME = of("trust_income") + /** A builder for [LegalEntityRegulator]. */ + class Builder internal constructor() { - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } + private var jurisdiction: JsonField? = null + private var name: JsonField? = null + private var registrationNumber: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, + @JvmSynthetic + internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { + jurisdiction = legalEntityRegulator.jurisdiction + name = legalEntityRegulator.name + registrationNumber = legalEntityRegulator.registrationNumber + additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() } /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format + * (e.g., "US", "CA", "GB"). */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } + fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * Sets [Builder.jurisdiction] to an arbitrary JSON value. * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. + * You should usually call [Builder.jurisdiction] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } + fun jurisdiction(jurisdiction: JsonField) = apply { + this.jurisdiction = jurisdiction + } + + /** Full name of the regulatory body. */ + fun name(name: String) = name(JsonField.of(name)) /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. + * Sets [Builder.name] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. + * You should usually call [Builder.name] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException( - "Unknown SourceOfFunds: $value" - ) - } + fun name(name: JsonField) = apply { this.name = name } + + /** Registration or identification number with the regulator. */ + fun registrationNumber(registrationNumber: String) = + registrationNumber(JsonField.of(registrationNumber)) /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. + * Sets [Builder.registrationNumber] to an arbitrary JSON value. * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. + * You should usually call [Builder.registrationNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") + fun registrationNumber(registrationNumber: JsonField) = apply { + this.registrationNumber = registrationNumber + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) } - private var validated: Boolean = false + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Validates that the types of all values in this object match their expected types - * recursively. + * Returns an immutable instance of [LegalEntityRegulator]. * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. + * Further updates to this [Builder] will not mutate the returned instance. * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } + fun build(): LegalEntityRegulator = + LegalEntityRegulator( + checkRequired("jurisdiction", jurisdiction), + checkRequired("name", name), + checkRequired("registrationNumber", registrationNumber), + additionalProperties.toMutableMap(), + ) + } - known() - validated = true + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): LegalEntityRegulator = apply { + if (validated) { + return@apply } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + jurisdiction() + name() + registrationNumber() + validated = true + } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (jurisdiction.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (registrationNumber.asKnown().isPresent) 1 else 0) - return other is SourceOfFunds && value == other.value + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() + return other is LegalEntityRegulator && + jurisdiction == other.jurisdiction && + name == other.name && + registrationNumber == other.registrationNumber && + additionalProperties == other.additionalProperties } - /** The source of the individual's wealth. */ - class WealthSource - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + private val hashCode: Int by lazy { + Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) + } - companion object { + override fun hashCode(): Int = hashCode - @JvmField val BUSINESS_SALE = of("business_sale") + override fun toString() = + "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" + } - @JvmField val FAMILY_SUPPORT = of("family_support") + /** The risk rating of the legal entity. One of low, medium, high. */ + class RiskRating @JsonCreator private constructor(private val value: JsonField) : + Enum { - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - @JvmField val INHERITANCE = of("inheritance") + companion object { - @JvmField val INVESTMENTS = of("investments") + @JvmField val LOW = of("low") - @JvmField val OTHER = of("other") + @JvmField val MEDIUM = of("medium") - @JvmField val RENTAL_INCOME = of("rental_income") + @JvmField val HIGH = of("high") - @JvmField val RETIREMENT = of("retirement") + @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) + } - @JvmField val SALARY = of("salary") + /** An enum containing [RiskRating]'s known values. */ + enum class Known { + LOW, + MEDIUM, + HIGH, + } - @JvmField val SELF_EMPLOYED = of("self_employed") + /** + * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RiskRating] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + LOW, + MEDIUM, + HIGH, + /** + * An enum member indicating that [RiskRating] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + LOW -> Value.LOW + MEDIUM -> Value.MEDIUM + HIGH -> Value.HIGH + else -> Value._UNKNOWN } - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + LOW -> Known.LOW + MEDIUM -> Known.MEDIUM + HIGH -> Known.HIGH + else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") } - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an - * unknown value. - */ - _UNKNOWN, + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") } - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object - * doesn't match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } + private var validated: Boolean = false - known() - validated = true + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): RiskRating = apply { + if (validated) { + return@apply } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + known() + validated = true + } - return other is WealthSource && value == other.value + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) + return other is RiskRating && value == other.value } - override fun hashCode(): Int = hashCode + override fun hashCode() = value.hashCode() - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPayment.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPayment.kt index 114ac14b..12a35ae0 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPayment.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPayment.kt @@ -431,8 +431,7 @@ private constructor( transactionLineItemId.getOptional("transaction_line_item_id") /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, - * wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1397,10 +1396,7 @@ private constructor( this.transactionLineItemId = transactionLineItemId } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentCreateParams.kt index 07095f19..29867d99 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentCreateParams.kt @@ -235,8 +235,7 @@ private constructor( fun statementDescriptor(): Optional = body.statementDescriptor() /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, - * wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -952,10 +951,7 @@ private constructor( body.statementDescriptor(statementDescriptor) } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = apply { body.type(type) } /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -1452,8 +1448,7 @@ private constructor( statementDescriptor.getOptional("statement_descriptor") /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2267,10 +2262,7 @@ private constructor( this.statementDescriptor = statementDescriptor } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentListParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentListParams.kt index a3339130..6df530d9 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentListParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentListParams.kt @@ -65,10 +65,7 @@ private constructor( /** One of unreconciled, reconciled, or archived. */ fun status(): Optional = Optional.ofNullable(status) - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp,sen, sepa, signet, - * wire - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire */ fun type(): Optional = Optional.ofNullable(type) /** Used to return expected payments updated after some datetime */ @@ -214,10 +211,7 @@ private constructor( /** Alias for calling [Builder.status] with `status.orElse(null)`. */ fun status(status: Optional) = status(status.getOrNull()) - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp,sen, sepa, - * signet, wire - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire */ fun type(type: Type?) = apply { this.type = type } /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -652,10 +646,7 @@ private constructor( override fun toString() = value.toString() } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp,sen, sepa, signet, - * wire - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -692,10 +683,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -708,26 +695,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -750,24 +727,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -794,24 +764,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -839,24 +802,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -885,24 +841,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentType.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentType.kt index d5075cb7..a1c90f4e 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentType.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentType.kt @@ -7,9 +7,7 @@ import com.moderntreasury.api.core.Enum import com.moderntreasury.api.core.JsonField import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException -/** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, wire. - */ +/** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ class ExpectedPaymentType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -46,10 +44,6 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -62,26 +56,16 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -104,24 +88,17 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -148,24 +125,17 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -196,24 +166,17 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -242,24 +205,17 @@ class ExpectedPaymentType @JsonCreator private constructor(private val value: Js DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentUpdateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentUpdateParams.kt index e0297b04..5c63b78a 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentUpdateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExpectedPaymentUpdateParams.kt @@ -219,8 +219,7 @@ private constructor( fun status(): Optional = body.status() /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, - * wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -880,10 +879,7 @@ private constructor( */ fun status(status: JsonField) = apply { body.status(status) } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = apply { body.type(type) } /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -1355,8 +1351,7 @@ private constructor( fun status(): Optional = status.getOptional("status") /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. + * One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2094,10 +2089,7 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** - * One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, - * signet, wire. - */ + /** One of: ach, au_becs, bacs, book, check, eft, rtp, sepa, wire. */ fun type(type: ExpectedPaymentType?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountCreateParams.kt index 322a6195..34d1e7dc 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountCreateParams.kt @@ -2444,10 +2444,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -2484,8 +2480,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2519,8 +2513,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2557,8 +2549,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -2593,8 +2583,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -2713,10 +2701,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -2729,26 +2713,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -2771,24 +2745,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2815,24 +2782,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2863,24 +2823,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -2909,24 +2862,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyParams.kt index 93365f74..0d7d9286 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyParams.kt @@ -809,10 +809,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -825,26 +821,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -867,24 +853,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -911,24 +890,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -958,24 +930,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1004,24 +969,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyResponse.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyResponse.kt index 23258b06..b93910f3 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyResponse.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ExternalAccountVerifyResponse.kt @@ -830,10 +830,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -846,26 +842,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -888,24 +874,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -932,24 +911,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -980,24 +952,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1026,24 +991,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IdentificationCreateRequest.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IdentificationCreateRequest.kt index 90c60286..bd7c1e7f 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IdentificationCreateRequest.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IdentificationCreateRequest.kt @@ -421,12 +421,30 @@ private constructor( @JvmField val AR_CUIT = of("ar_cuit") + @JvmField val AT_ATIN = of("at_atin") + + @JvmField val AT_VAT = of("at_vat") + + @JvmField val AU_ABN = of("au_abn") + + @JvmField val AU_TFN = of("au_tfn") + + @JvmField val BE_ENT = of("be_ent") + + @JvmField val BE_NRN = of("be_nrn") + @JvmField val BR_CNPJ = of("br_cnpj") @JvmField val BR_CPF = of("br_cpf") + @JvmField val CA_BN = of("ca_bn") + @JvmField val CA_SIN = of("ca_sin") + @JvmField val CH_AHV = of("ch_ahv") + + @JvmField val CH_UID = of("ch_uid") + @JvmField val CL_RUN = of("cl_run") @JvmField val CL_RUT = of("cl_rut") @@ -435,34 +453,154 @@ private constructor( @JvmField val CO_NIT = of("co_nit") + @JvmField val CY_TIN = of("cy_tin") + + @JvmField val CZ_ICO = of("cz_ico") + + @JvmField val CZ_RC = of("cz_rc") + + @JvmField val DE_STID = of("de_stid") + + @JvmField val DE_STNR = of("de_stnr") + + @JvmField val DE_VAT = of("de_vat") + + @JvmField val DK_CPR = of("dk_cpr") + + @JvmField val DK_CVR = of("dk_cvr") + @JvmField val DRIVERS_LICENSE = of("drivers_license") + @JvmField val EE_IK = of("ee_ik") + + @JvmField val EE_RK = of("ee_rk") + + @JvmField val ES_NIE = of("es_nie") + + @JvmField val ES_NIF = of("es_nif") + + @JvmField val FI_HETU = of("fi_hetu") + + @JvmField val FI_YTJ = of("fi_ytj") + + @JvmField val FR_NIF = of("fr_nif") + + @JvmField val FR_SIREN = of("fr_siren") + + @JvmField val FR_VAT = of("fr_vat") + + @JvmField val GB_NINO = of("gb_nino") + + @JvmField val GB_UTR = of("gb_utr") + + @JvmField val GB_VAT = of("gb_vat") + + @JvmField val GR_VAT = of("gr_vat") + @JvmField val HN_ID = of("hn_id") @JvmField val HN_RTN = of("hn_rtn") + @JvmField val HR_OIB = of("hr_oib") + + @JvmField val HU_ADJ = of("hu_adj") + + @JvmField val HU_ANUM = of("hu_anum") + @JvmField val IE_PPS = of("ie_pps") + @JvmField val IE_TRN = of("ie_trn") + @JvmField val IN_LEI = of("in_lei") + @JvmField val IS_KNT = of("is_knt") + + @JvmField val IT_CF = of("it_cf") + + @JvmField val IT_PIVA = of("it_piva") + + @JvmField val JP_HB = of("jp_hb") + + @JvmField val JP_MN = of("jp_mn") + @JvmField val KR_BRN = of("kr_brn") @JvmField val KR_CRN = of("kr_crn") @JvmField val KR_RRN = of("kr_rrn") + @JvmField val LI_PEID = of("li_peid") + + @JvmField val LT_AK = of("lt_ak") + + @JvmField val LT_JAK = of("lt_jak") + + @JvmField val LU_MTC = of("lu_mtc") + + @JvmField val LU_VAT = of("lu_vat") + + @JvmField val LV_PK = of("lv_pk") + + @JvmField val LV_RN = of("lv_rn") + + @JvmField val MT_TIN = of("mt_tin") + + @JvmField val MT_VAT = of("mt_vat") + @JvmField val MX_CURP = of("mx_curp") @JvmField val MX_INE = of("mx_ine") @JvmField val MX_RFC = of("mx_rfc") + @JvmField val NL_BSN = of("nl_bsn") + + @JvmField val NL_BTW = of("nl_btw") + + @JvmField val NL_RSIN = of("nl_rsin") + + @JvmField val NO_FDN = of("no_fdn") + + @JvmField val NO_MVA = of("no_mva") + + @JvmField val NO_ORGNR = of("no_orgnr") + + @JvmField val NZ_IRD = of("nz_ird") + @JvmField val PASSPORT = of("passport") + @JvmField val PL_NIP = of("pl_nip") + + @JvmField val PL_PESEL = of("pl_pesel") + + @JvmField val PT_NIF = of("pt_nif") + + @JvmField val RO_CNP = of("ro_cnp") + + @JvmField val RO_CUI = of("ro_cui") + @JvmField val SA_TIN = of("sa_tin") @JvmField val SA_VAT = of("sa_vat") + @JvmField val SE_ORGNR = of("se_orgnr") + + @JvmField val SE_PNMR = of("se_pnmr") + + @JvmField val SG_FIN = of("sg_fin") + + @JvmField val SG_NRIC = of("sg_nric") + + @JvmField val SG_UEN = of("sg_uen") + + @JvmField val SI_DAV = of("si_dav") + + @JvmField val SI_TIN = of("si_tin") + + @JvmField val SK_ICO = of("sk_ico") + + @JvmField val SK_RC = of("sk_rc") + @JvmField val US_EIN = of("us_ein") @JvmField val US_ITIN = of("us_itin") @@ -480,27 +618,96 @@ private constructor( enum class Known { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -520,27 +727,96 @@ private constructor( enum class Value { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -561,27 +837,96 @@ private constructor( when (this) { AR_CUIL -> Value.AR_CUIL AR_CUIT -> Value.AR_CUIT + AT_ATIN -> Value.AT_ATIN + AT_VAT -> Value.AT_VAT + AU_ABN -> Value.AU_ABN + AU_TFN -> Value.AU_TFN + BE_ENT -> Value.BE_ENT + BE_NRN -> Value.BE_NRN BR_CNPJ -> Value.BR_CNPJ BR_CPF -> Value.BR_CPF + CA_BN -> Value.CA_BN CA_SIN -> Value.CA_SIN + CH_AHV -> Value.CH_AHV + CH_UID -> Value.CH_UID CL_RUN -> Value.CL_RUN CL_RUT -> Value.CL_RUT CO_CEDULAS -> Value.CO_CEDULAS CO_NIT -> Value.CO_NIT + CY_TIN -> Value.CY_TIN + CZ_ICO -> Value.CZ_ICO + CZ_RC -> Value.CZ_RC + DE_STID -> Value.DE_STID + DE_STNR -> Value.DE_STNR + DE_VAT -> Value.DE_VAT + DK_CPR -> Value.DK_CPR + DK_CVR -> Value.DK_CVR DRIVERS_LICENSE -> Value.DRIVERS_LICENSE + EE_IK -> Value.EE_IK + EE_RK -> Value.EE_RK + ES_NIE -> Value.ES_NIE + ES_NIF -> Value.ES_NIF + FI_HETU -> Value.FI_HETU + FI_YTJ -> Value.FI_YTJ + FR_NIF -> Value.FR_NIF + FR_SIREN -> Value.FR_SIREN + FR_VAT -> Value.FR_VAT + GB_NINO -> Value.GB_NINO + GB_UTR -> Value.GB_UTR + GB_VAT -> Value.GB_VAT + GR_VAT -> Value.GR_VAT HN_ID -> Value.HN_ID HN_RTN -> Value.HN_RTN + HR_OIB -> Value.HR_OIB + HU_ADJ -> Value.HU_ADJ + HU_ANUM -> Value.HU_ANUM IE_PPS -> Value.IE_PPS + IE_TRN -> Value.IE_TRN IN_LEI -> Value.IN_LEI + IS_KNT -> Value.IS_KNT + IT_CF -> Value.IT_CF + IT_PIVA -> Value.IT_PIVA + JP_HB -> Value.JP_HB + JP_MN -> Value.JP_MN KR_BRN -> Value.KR_BRN KR_CRN -> Value.KR_CRN KR_RRN -> Value.KR_RRN + LI_PEID -> Value.LI_PEID + LT_AK -> Value.LT_AK + LT_JAK -> Value.LT_JAK + LU_MTC -> Value.LU_MTC + LU_VAT -> Value.LU_VAT + LV_PK -> Value.LV_PK + LV_RN -> Value.LV_RN + MT_TIN -> Value.MT_TIN + MT_VAT -> Value.MT_VAT MX_CURP -> Value.MX_CURP MX_INE -> Value.MX_INE MX_RFC -> Value.MX_RFC + NL_BSN -> Value.NL_BSN + NL_BTW -> Value.NL_BTW + NL_RSIN -> Value.NL_RSIN + NO_FDN -> Value.NO_FDN + NO_MVA -> Value.NO_MVA + NO_ORGNR -> Value.NO_ORGNR + NZ_IRD -> Value.NZ_IRD PASSPORT -> Value.PASSPORT + PL_NIP -> Value.PL_NIP + PL_PESEL -> Value.PL_PESEL + PT_NIF -> Value.PT_NIF + RO_CNP -> Value.RO_CNP + RO_CUI -> Value.RO_CUI SA_TIN -> Value.SA_TIN SA_VAT -> Value.SA_VAT + SE_ORGNR -> Value.SE_ORGNR + SE_PNMR -> Value.SE_PNMR + SG_FIN -> Value.SG_FIN + SG_NRIC -> Value.SG_NRIC + SG_UEN -> Value.SG_UEN + SI_DAV -> Value.SI_DAV + SI_TIN -> Value.SI_TIN + SK_ICO -> Value.SK_ICO + SK_RC -> Value.SK_RC US_EIN -> Value.US_EIN US_ITIN -> Value.US_ITIN US_SSN -> Value.US_SSN @@ -603,27 +948,96 @@ private constructor( when (this) { AR_CUIL -> Known.AR_CUIL AR_CUIT -> Known.AR_CUIT + AT_ATIN -> Known.AT_ATIN + AT_VAT -> Known.AT_VAT + AU_ABN -> Known.AU_ABN + AU_TFN -> Known.AU_TFN + BE_ENT -> Known.BE_ENT + BE_NRN -> Known.BE_NRN BR_CNPJ -> Known.BR_CNPJ BR_CPF -> Known.BR_CPF + CA_BN -> Known.CA_BN CA_SIN -> Known.CA_SIN + CH_AHV -> Known.CH_AHV + CH_UID -> Known.CH_UID CL_RUN -> Known.CL_RUN CL_RUT -> Known.CL_RUT CO_CEDULAS -> Known.CO_CEDULAS CO_NIT -> Known.CO_NIT + CY_TIN -> Known.CY_TIN + CZ_ICO -> Known.CZ_ICO + CZ_RC -> Known.CZ_RC + DE_STID -> Known.DE_STID + DE_STNR -> Known.DE_STNR + DE_VAT -> Known.DE_VAT + DK_CPR -> Known.DK_CPR + DK_CVR -> Known.DK_CVR DRIVERS_LICENSE -> Known.DRIVERS_LICENSE + EE_IK -> Known.EE_IK + EE_RK -> Known.EE_RK + ES_NIE -> Known.ES_NIE + ES_NIF -> Known.ES_NIF + FI_HETU -> Known.FI_HETU + FI_YTJ -> Known.FI_YTJ + FR_NIF -> Known.FR_NIF + FR_SIREN -> Known.FR_SIREN + FR_VAT -> Known.FR_VAT + GB_NINO -> Known.GB_NINO + GB_UTR -> Known.GB_UTR + GB_VAT -> Known.GB_VAT + GR_VAT -> Known.GR_VAT HN_ID -> Known.HN_ID HN_RTN -> Known.HN_RTN + HR_OIB -> Known.HR_OIB + HU_ADJ -> Known.HU_ADJ + HU_ANUM -> Known.HU_ANUM IE_PPS -> Known.IE_PPS + IE_TRN -> Known.IE_TRN IN_LEI -> Known.IN_LEI + IS_KNT -> Known.IS_KNT + IT_CF -> Known.IT_CF + IT_PIVA -> Known.IT_PIVA + JP_HB -> Known.JP_HB + JP_MN -> Known.JP_MN KR_BRN -> Known.KR_BRN KR_CRN -> Known.KR_CRN KR_RRN -> Known.KR_RRN + LI_PEID -> Known.LI_PEID + LT_AK -> Known.LT_AK + LT_JAK -> Known.LT_JAK + LU_MTC -> Known.LU_MTC + LU_VAT -> Known.LU_VAT + LV_PK -> Known.LV_PK + LV_RN -> Known.LV_RN + MT_TIN -> Known.MT_TIN + MT_VAT -> Known.MT_VAT MX_CURP -> Known.MX_CURP MX_INE -> Known.MX_INE MX_RFC -> Known.MX_RFC + NL_BSN -> Known.NL_BSN + NL_BTW -> Known.NL_BTW + NL_RSIN -> Known.NL_RSIN + NO_FDN -> Known.NO_FDN + NO_MVA -> Known.NO_MVA + NO_ORGNR -> Known.NO_ORGNR + NZ_IRD -> Known.NZ_IRD PASSPORT -> Known.PASSPORT + PL_NIP -> Known.PL_NIP + PL_PESEL -> Known.PL_PESEL + PT_NIF -> Known.PT_NIF + RO_CNP -> Known.RO_CNP + RO_CUI -> Known.RO_CUI SA_TIN -> Known.SA_TIN SA_VAT -> Known.SA_VAT + SE_ORGNR -> Known.SE_ORGNR + SE_PNMR -> Known.SE_PNMR + SG_FIN -> Known.SG_FIN + SG_NRIC -> Known.SG_NRIC + SG_UEN -> Known.SG_UEN + SI_DAV -> Known.SI_DAV + SI_TIN -> Known.SI_TIN + SK_ICO -> Known.SK_ICO + SK_RC -> Known.SK_RC US_EIN -> Known.US_EIN US_ITIN -> Known.US_ITIN US_SSN -> Known.US_SSN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetail.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetail.kt index 8c52650c..dadf509d 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetail.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetail.kt @@ -344,7 +344,7 @@ private constructor( transactionLineItemId.getOptional("transaction_line_item_id") /** - * One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. + * One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1180,7 +1180,7 @@ private constructor( this.transactionLineItemId = transactionLineItemId } - /** One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. */ + /** One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. */ fun type(type: Type) = type(JsonField.of(type)) /** @@ -2070,10 +2070,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -2110,8 +2106,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2146,8 +2140,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2184,8 +2176,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -2220,8 +2210,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -2598,7 +2586,7 @@ private constructor( override fun toString() = value.toString() } - /** One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. */ + /** One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -2625,8 +2613,6 @@ private constructor( @JvmField val EFT = of("eft") - @JvmField val INTERAC = of("interac") - @JvmField val NEFT = of("neft") @JvmField val NZ_BECS = of("nz_becs") @@ -2635,8 +2621,6 @@ private constructor( @JvmField val SEPA = of("sepa") - @JvmField val SIGNET = of("signet") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -2654,12 +2638,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -2681,12 +2663,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -2709,12 +2689,10 @@ private constructor( BOOK -> Value.BOOK CHECK -> Value.CHECK EFT -> Value.EFT - INTERAC -> Value.INTERAC NEFT -> Value.NEFT NZ_BECS -> Value.NZ_BECS RTP -> Value.RTP SEPA -> Value.SEPA - SIGNET -> Value.SIGNET STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -2738,12 +2716,10 @@ private constructor( BOOK -> Known.BOOK CHECK -> Known.CHECK EFT -> Known.EFT - INTERAC -> Known.INTERAC NEFT -> Known.NEFT NZ_BECS -> Known.NZ_BECS RTP -> Known.RTP SEPA -> Known.SEPA - SIGNET -> Known.SIGNET STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailCreateAsyncParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailCreateAsyncParams.kt index 71c37eed..b30fa71c 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailCreateAsyncParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailCreateAsyncParams.kt @@ -1219,8 +1219,6 @@ private constructor( @JvmField val EFT = of("eft") - @JvmField val INTERAC = of("interac") - @JvmField val NEFT = of("neft") @JvmField val NZ_BECS = of("nz_becs") @@ -1229,8 +1227,6 @@ private constructor( @JvmField val SEPA = of("sepa") - @JvmField val SIGNET = of("signet") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -1248,12 +1244,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -1275,12 +1269,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -1303,12 +1295,10 @@ private constructor( BOOK -> Value.BOOK CHECK -> Value.CHECK EFT -> Value.EFT - INTERAC -> Value.INTERAC NEFT -> Value.NEFT NZ_BECS -> Value.NZ_BECS RTP -> Value.RTP SEPA -> Value.SEPA - SIGNET -> Value.SIGNET STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1332,12 +1322,10 @@ private constructor( BOOK -> Known.BOOK CHECK -> Known.CHECK EFT -> Known.EFT - INTERAC -> Known.INTERAC NEFT -> Known.NEFT NZ_BECS -> Known.NZ_BECS RTP -> Known.RTP SEPA -> Known.SEPA - SIGNET -> Known.SIGNET STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailListParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailListParams.kt index 39e7fd11..d077bd8f 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailListParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/IncomingPaymentDetailListParams.kt @@ -68,7 +68,7 @@ private constructor( */ fun subtype(): Optional = Optional.ofNullable(subtype) - /** One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. */ + /** One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. */ fun type(): Optional = Optional.ofNullable(type) /** If the incoming payment detail is in a virtual account, the ID of the Virtual Account. */ @@ -196,7 +196,7 @@ private constructor( /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) - /** One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. */ + /** One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. */ fun type(type: Type?) = apply { this.type = type } /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -603,7 +603,7 @@ private constructor( override fun toString() = value.toString() } - /** One of: `ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`. */ + /** One of: `ach`, `book`, `check`, `eft`, `rtp`, `sepa`, or `wire`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -630,8 +630,6 @@ private constructor( @JvmField val EFT = of("eft") - @JvmField val INTERAC = of("interac") - @JvmField val NEFT = of("neft") @JvmField val NZ_BECS = of("nz_becs") @@ -640,8 +638,6 @@ private constructor( @JvmField val SEPA = of("sepa") - @JvmField val SIGNET = of("signet") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -659,12 +655,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -686,12 +680,10 @@ private constructor( BOOK, CHECK, EFT, - INTERAC, NEFT, NZ_BECS, RTP, SEPA, - SIGNET, STABLECOIN, WIRE, ZENGIN, @@ -714,12 +706,10 @@ private constructor( BOOK -> Value.BOOK CHECK -> Value.CHECK EFT -> Value.EFT - INTERAC -> Value.INTERAC NEFT -> Value.NEFT NZ_BECS -> Value.NZ_BECS RTP -> Value.RTP SEPA -> Value.SEPA - SIGNET -> Value.SIGNET STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -743,12 +733,10 @@ private constructor( BOOK -> Known.BOOK CHECK -> Known.CHECK EFT -> Known.EFT - INTERAC -> Known.INTERAC NEFT -> Known.NEFT NZ_BECS -> Known.NZ_BECS RTP -> Known.RTP SEPA -> Known.SEPA - SIGNET -> Known.SIGNET STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccount.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccount.kt index cb256a9c..ab50b969 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccount.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccount.kt @@ -33,6 +33,7 @@ private constructor( private val counterpartyId: JsonField, private val createdAt: JsonField, private val currency: JsonField, + private val debitable: JsonField, private val externalId: JsonField, private val ledgerAccountId: JsonField, private val legalEntityId: JsonField, @@ -76,6 +77,7 @@ private constructor( @ExcludeMissing createdAt: JsonField = JsonMissing.of(), @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + @JsonProperty("debitable") @ExcludeMissing debitable: JsonField = JsonMissing.of(), @JsonProperty("external_id") @ExcludeMissing externalId: JsonField = JsonMissing.of(), @@ -117,6 +119,7 @@ private constructor( counterpartyId, createdAt, currency, + debitable, externalId, ledgerAccountId, legalEntityId, @@ -207,6 +210,17 @@ private constructor( */ fun currency(): Currency = currency.getRequired("currency") + /** + * Whether this account can receive ACH debits. Only applicable to accounts created under a + * Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. Defaults to + * `false`. Configurable only on creation. Please reach out to your customer success manager to + * enable this capability for your connection. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun debitable(): Optional = debitable.getOptional("debitable") + /** * An optional user-defined 180 character unique identifier. * @@ -404,6 +418,13 @@ private constructor( */ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + /** + * Returns the raw JSON value of [debitable]. + * + * Unlike [debitable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("debitable") @ExcludeMissing fun _debitable(): JsonField = debitable + /** * Returns the raw JSON value of [externalId]. * @@ -549,6 +570,7 @@ private constructor( * .counterpartyId() * .createdAt() * .currency() + * .debitable() * .externalId() * .ledgerAccountId() * .legalEntityId() @@ -581,6 +603,7 @@ private constructor( private var counterpartyId: JsonField? = null private var createdAt: JsonField? = null private var currency: JsonField? = null + private var debitable: JsonField? = null private var externalId: JsonField? = null private var ledgerAccountId: JsonField? = null private var legalEntityId: JsonField? = null @@ -609,6 +632,7 @@ private constructor( counterpartyId = internalAccount.counterpartyId createdAt = internalAccount.createdAt currency = internalAccount.currency + debitable = internalAccount.debitable externalId = internalAccount.externalId ledgerAccountId = internalAccount.ledgerAccountId legalEntityId = internalAccount.legalEntityId @@ -790,6 +814,33 @@ private constructor( */ fun currency(currency: JsonField) = apply { this.currency = currency } + /** + * Whether this account can receive ACH debits. Only applicable to accounts created under a + * Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. Defaults to + * `false`. Configurable only on creation. Please reach out to your customer success manager + * to enable this capability for your connection. + */ + fun debitable(debitable: Boolean?) = debitable(JsonField.ofNullable(debitable)) + + /** + * Alias for [Builder.debitable]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun debitable(debitable: Boolean) = debitable(debitable as Boolean?) + + /** Alias for calling [Builder.debitable] with `debitable.orElse(null)`. */ + fun debitable(debitable: Optional) = debitable(debitable.getOrNull()) + + /** + * Sets [Builder.debitable] to an arbitrary JSON value. + * + * You should usually call [Builder.debitable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun debitable(debitable: JsonField) = apply { this.debitable = debitable } + /** An optional user-defined 180 character unique identifier. */ fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) @@ -1063,6 +1114,7 @@ private constructor( * .counterpartyId() * .createdAt() * .currency() + * .debitable() * .externalId() * .ledgerAccountId() * .legalEntityId() @@ -1093,6 +1145,7 @@ private constructor( checkRequired("counterpartyId", counterpartyId), checkRequired("createdAt", createdAt), checkRequired("currency", currency), + checkRequired("debitable", debitable), checkRequired("externalId", externalId), checkRequired("ledgerAccountId", ledgerAccountId), checkRequired("legalEntityId", legalEntityId), @@ -1136,6 +1189,7 @@ private constructor( counterpartyId() createdAt() currency().validate() + debitable() externalId() ledgerAccountId() legalEntityId() @@ -1178,6 +1232,7 @@ private constructor( (if (counterpartyId.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (currency.asKnown().getOrNull()?.validity() ?: 0) + + (if (debitable.asKnown().isPresent) 1 else 0) + (if (externalId.asKnown().isPresent) 1 else 0) + (if (ledgerAccountId.asKnown().isPresent) 1 else 0) + (if (legalEntityId.asKnown().isPresent) 1 else 0) + @@ -1724,10 +1779,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -1740,26 +1791,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -1782,24 +1823,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1826,24 +1860,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1874,24 +1901,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1920,24 +1940,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -2671,6 +2684,7 @@ private constructor( counterpartyId == other.counterpartyId && createdAt == other.createdAt && currency == other.currency && + debitable == other.debitable && externalId == other.externalId && ledgerAccountId == other.ledgerAccountId && legalEntityId == other.legalEntityId && @@ -2700,6 +2714,7 @@ private constructor( counterpartyId, createdAt, currency, + debitable, externalId, ledgerAccountId, legalEntityId, @@ -2722,5 +2737,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InternalAccount{id=$id, accountCapabilities=$accountCapabilities, accountDetails=$accountDetails, accountType=$accountType, connection=$connection, contraLedgerAccountId=$contraLedgerAccountId, counterpartyId=$counterpartyId, createdAt=$createdAt, currency=$currency, externalId=$externalId, ledgerAccountId=$ledgerAccountId, legalEntityId=$legalEntityId, liveMode=$liveMode, metadata=$metadata, name=$name, object_=$object_, parentAccountId=$parentAccountId, partyAddress=$partyAddress, partyName=$partyName, partyType=$partyType, routingDetails=$routingDetails, status=$status, updatedAt=$updatedAt, vendorId=$vendorId, additionalProperties=$additionalProperties}" + "InternalAccount{id=$id, accountCapabilities=$accountCapabilities, accountDetails=$accountDetails, accountType=$accountType, connection=$connection, contraLedgerAccountId=$contraLedgerAccountId, counterpartyId=$counterpartyId, createdAt=$createdAt, currency=$currency, debitable=$debitable, externalId=$externalId, ledgerAccountId=$ledgerAccountId, legalEntityId=$legalEntityId, liveMode=$liveMode, metadata=$metadata, name=$name, object_=$object_, parentAccountId=$parentAccountId, partyAddress=$partyAddress, partyName=$partyName, partyType=$partyType, routingDetails=$routingDetails, status=$status, updatedAt=$updatedAt, vendorId=$vendorId, additionalProperties=$additionalProperties}" } diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountCreateParams.kt index dede1f6e..f010be07 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountCreateParams.kt @@ -41,8 +41,7 @@ private constructor( fun connectionId(): String = body.connectionId() /** - * The currency of the internal account. Supports "USD" and "CAD" for fiat, and "USDC", "USDG", - * and "PYUSD" for stablecoin accounts. + * The currency of the internal account. Supports fiat and stablecoin currencies. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -90,6 +89,17 @@ private constructor( */ fun counterpartyId(): Optional = body.counterpartyId() + /** + * Whether this account can receive ACH debits. Only applicable to accounts created under a + * Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. Defaults to + * `false`. Configurable only on creation. Please reach out to your customer success manager to + * enable this capability for your connection. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun debitable(): Optional = body.debitable() + /** * An optional user-defined 180 character unique identifier. * @@ -189,6 +199,13 @@ private constructor( */ fun _counterpartyId(): JsonField = body._counterpartyId() + /** + * Returns the raw JSON value of [debitable]. + * + * Unlike [debitable], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _debitable(): JsonField = body._debitable() + /** * Returns the raw JSON value of [externalId]. * @@ -301,10 +318,7 @@ private constructor( body.connectionId(connectionId) } - /** - * The currency of the internal account. Supports "USD" and "CAD" for fiat, and "USDC", - * "USDG", and "PYUSD" for stablecoin accounts. - */ + /** The currency of the internal account. Supports fiat and stablecoin currencies. */ fun currency(currency: Currency) = apply { body.currency(currency) } /** @@ -397,6 +411,33 @@ private constructor( body.counterpartyId(counterpartyId) } + /** + * Whether this account can receive ACH debits. Only applicable to accounts created under a + * Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. Defaults to + * `false`. Configurable only on creation. Please reach out to your customer success manager + * to enable this capability for your connection. + */ + fun debitable(debitable: Boolean?) = apply { body.debitable(debitable) } + + /** + * Alias for [Builder.debitable]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun debitable(debitable: Boolean) = debitable(debitable as Boolean?) + + /** Alias for calling [Builder.debitable] with `debitable.orElse(null)`. */ + fun debitable(debitable: Optional) = debitable(debitable.getOrNull()) + + /** + * Sets [Builder.debitable] to an arbitrary JSON value. + * + * You should usually call [Builder.debitable] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun debitable(debitable: JsonField) = apply { body.debitable(debitable) } + /** An optional user-defined 180 character unique identifier. */ fun externalId(externalId: String?) = apply { body.externalId(externalId) } @@ -645,6 +686,7 @@ private constructor( private val accountCapabilities: JsonField>, private val accountType: JsonField, private val counterpartyId: JsonField, + private val debitable: JsonField, private val externalId: JsonField, private val legalEntityId: JsonField, private val metadata: JsonField, @@ -675,6 +717,9 @@ private constructor( @JsonProperty("counterparty_id") @ExcludeMissing counterpartyId: JsonField = JsonMissing.of(), + @JsonProperty("debitable") + @ExcludeMissing + debitable: JsonField = JsonMissing.of(), @JsonProperty("external_id") @ExcludeMissing externalId: JsonField = JsonMissing.of(), @@ -701,6 +746,7 @@ private constructor( accountCapabilities, accountType, counterpartyId, + debitable, externalId, legalEntityId, metadata, @@ -719,8 +765,7 @@ private constructor( fun connectionId(): String = connectionId.getRequired("connection_id") /** - * The currency of the internal account. Supports "USD" and "CAD" for fiat, and "USDC", - * "USDG", and "PYUSD" for stablecoin accounts. + * The currency of the internal account. Supports fiat and stablecoin currencies. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -769,6 +814,17 @@ private constructor( */ fun counterpartyId(): Optional = counterpartyId.getOptional("counterparty_id") + /** + * Whether this account can receive ACH debits. Only applicable to accounts created under a + * Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. Defaults to + * `false`. Configurable only on creation. Please reach out to your customer success manager + * to enable this capability for your connection. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun debitable(): Optional = debitable.getOptional("debitable") + /** * An optional user-defined 180 character unique identifier. * @@ -879,6 +935,13 @@ private constructor( @ExcludeMissing fun _counterpartyId(): JsonField = counterpartyId + /** + * Returns the raw JSON value of [debitable]. + * + * Unlike [debitable], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("debitable") @ExcludeMissing fun _debitable(): JsonField = debitable + /** * Returns the raw JSON value of [externalId]. * @@ -974,6 +1037,7 @@ private constructor( private var accountCapabilities: JsonField>? = null private var accountType: JsonField = JsonMissing.of() private var counterpartyId: JsonField = JsonMissing.of() + private var debitable: JsonField = JsonMissing.of() private var externalId: JsonField = JsonMissing.of() private var legalEntityId: JsonField = JsonMissing.of() private var metadata: JsonField = JsonMissing.of() @@ -992,6 +1056,7 @@ private constructor( internalAccountCreateRequest.accountCapabilities.map { it.toMutableList() } accountType = internalAccountCreateRequest.accountType counterpartyId = internalAccountCreateRequest.counterpartyId + debitable = internalAccountCreateRequest.debitable externalId = internalAccountCreateRequest.externalId legalEntityId = internalAccountCreateRequest.legalEntityId metadata = internalAccountCreateRequest.metadata @@ -1016,10 +1081,7 @@ private constructor( this.connectionId = connectionId } - /** - * The currency of the internal account. Supports "USD" and "CAD" for fiat, and "USDC", - * "USDG", and "PYUSD" for stablecoin accounts. - */ + /** The currency of the internal account. Supports fiat and stablecoin currencies. */ fun currency(currency: Currency) = currency(JsonField.of(currency)) /** @@ -1118,6 +1180,33 @@ private constructor( this.counterpartyId = counterpartyId } + /** + * Whether this account can receive ACH debits. Only applicable to accounts created + * under a Modern Treasury PSP connection, or `null` for Bring Your Own Bank accounts. + * Defaults to `false`. Configurable only on creation. Please reach out to your customer + * success manager to enable this capability for your connection. + */ + fun debitable(debitable: Boolean?) = debitable(JsonField.ofNullable(debitable)) + + /** + * Alias for [Builder.debitable]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun debitable(debitable: Boolean) = debitable(debitable as Boolean?) + + /** Alias for calling [Builder.debitable] with `debitable.orElse(null)`. */ + fun debitable(debitable: Optional) = debitable(debitable.getOrNull()) + + /** + * Sets [Builder.debitable] to an arbitrary JSON value. + * + * You should usually call [Builder.debitable] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun debitable(debitable: JsonField) = apply { this.debitable = debitable } + /** An optional user-defined 180 character unique identifier. */ fun externalId(externalId: String?) = externalId(JsonField.ofNullable(externalId)) @@ -1252,6 +1341,7 @@ private constructor( (accountCapabilities ?: JsonMissing.of()).map { it.toImmutable() }, accountType, counterpartyId, + debitable, externalId, legalEntityId, metadata, @@ -1285,6 +1375,7 @@ private constructor( accountCapabilities().ifPresent { it.forEach { it.validate() } } accountType().ifPresent { it.validate() } counterpartyId() + debitable() externalId() legalEntityId() metadata().ifPresent { it.validate() } @@ -1317,6 +1408,7 @@ private constructor( (accountCapabilities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (accountType.asKnown().getOrNull()?.validity() ?: 0) + (if (counterpartyId.asKnown().isPresent) 1 else 0) + + (if (debitable.asKnown().isPresent) 1 else 0) + (if (externalId.asKnown().isPresent) 1 else 0) + (if (legalEntityId.asKnown().isPresent) 1 else 0) + (metadata.asKnown().getOrNull()?.validity() ?: 0) + @@ -1337,6 +1429,7 @@ private constructor( accountCapabilities == other.accountCapabilities && accountType == other.accountType && counterpartyId == other.counterpartyId && + debitable == other.debitable && externalId == other.externalId && legalEntityId == other.legalEntityId && metadata == other.metadata && @@ -1355,6 +1448,7 @@ private constructor( accountCapabilities, accountType, counterpartyId, + debitable, externalId, legalEntityId, metadata, @@ -1368,13 +1462,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "InternalAccountCreateRequest{connectionId=$connectionId, currency=$currency, name=$name, partyName=$partyName, accountCapabilities=$accountCapabilities, accountType=$accountType, counterpartyId=$counterpartyId, externalId=$externalId, legalEntityId=$legalEntityId, metadata=$metadata, parentAccountId=$parentAccountId, partyAddress=$partyAddress, vendorAttributes=$vendorAttributes, additionalProperties=$additionalProperties}" + "InternalAccountCreateRequest{connectionId=$connectionId, currency=$currency, name=$name, partyName=$partyName, accountCapabilities=$accountCapabilities, accountType=$accountType, counterpartyId=$counterpartyId, debitable=$debitable, externalId=$externalId, legalEntityId=$legalEntityId, metadata=$metadata, parentAccountId=$parentAccountId, partyAddress=$partyAddress, vendorAttributes=$vendorAttributes, additionalProperties=$additionalProperties}" } - /** - * The currency of the internal account. Supports "USD" and "CAD" for fiat, and "USDC", "USDG", - * and "PYUSD" for stablecoin accounts. - */ + /** The currency of the internal account. Supports fiat and stablecoin currencies. */ class Currency @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1397,6 +1488,8 @@ private constructor( @JvmField val USDG = of("USDG") + @JvmField val USDT = of("USDT") + @JvmField val PYUSD = of("PYUSD") @JvmStatic fun of(value: String) = Currency(JsonField.of(value)) @@ -1408,6 +1501,7 @@ private constructor( CAD, USDC, USDG, + USDT, PYUSD, } @@ -1425,6 +1519,7 @@ private constructor( CAD, USDC, USDG, + USDT, PYUSD, /** An enum member indicating that [Currency] was instantiated with an unknown value. */ _UNKNOWN, @@ -1443,6 +1538,7 @@ private constructor( CAD -> Value.CAD USDC -> Value.USDC USDG -> Value.USDG + USDT -> Value.USDT PYUSD -> Value.PYUSD else -> Value._UNKNOWN } @@ -1462,6 +1558,7 @@ private constructor( CAD -> Known.CAD USDC -> Known.USDC USDG -> Known.USDG + USDT -> Known.USDT PYUSD -> Known.PYUSD else -> throw ModernTreasuryInvalidDataException("Unknown Currency: $value") } @@ -2059,10 +2156,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -2075,26 +2168,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -2117,24 +2200,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2161,24 +2237,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2209,24 +2278,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -2255,24 +2317,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountListParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountListParams.kt index d96b55b4..d6c449a7 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountListParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountListParams.kt @@ -466,10 +466,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -482,26 +478,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -524,24 +510,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -568,24 +547,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -615,24 +587,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -661,24 +626,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountUpdateAccountCapabilityResponse.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountUpdateAccountCapabilityResponse.kt index 2c556388..b2ccc8d1 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountUpdateAccountCapabilityResponse.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InternalAccountUpdateAccountCapabilityResponse.kt @@ -542,10 +542,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -558,26 +554,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -600,24 +586,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -644,24 +623,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -691,24 +663,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -737,24 +702,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceCreateParams.kt index e3e3f0b4..714c171d 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceCreateParams.kt @@ -193,9 +193,8 @@ private constructor( fun paymentMethod(): Optional = body.paymentMethod() /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -860,9 +859,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun paymentType(paymentType: PaymentOrderType) = apply { body.paymentType(paymentType) } @@ -1436,9 +1434,8 @@ private constructor( fun paymentMethod(): Optional = paymentMethod.getOptional("payment_method") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2203,9 +2200,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun paymentType(paymentType: PaymentOrderType) = paymentType(JsonField.of(paymentType)) diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceUpdateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceUpdateParams.kt index d8ac5c65..61be9ea8 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceUpdateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/InvoiceUpdateParams.kt @@ -186,9 +186,8 @@ private constructor( fun paymentMethod(): Optional = body.paymentMethod() /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -837,9 +836,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun paymentType(paymentType: PaymentOrderType) = apply { body.paymentType(paymentType) } @@ -1414,9 +1412,8 @@ private constructor( fun paymentMethod(): Optional = paymentMethod.getOptional("payment_method") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -2152,9 +2149,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun paymentType(paymentType: PaymentOrderType) = paymentType(JsonField.of(paymentType)) diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntity.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntity.kt index 5b67370a..7cbe00ee 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntity.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntity.kt @@ -27,7 +27,7 @@ class LegalEntity private constructor( private val id: JsonField, private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -69,7 +69,7 @@ private constructor( private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, private val updatedAt: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val legalEntityAssociations: JsonField>, private val additionalProperties: MutableMap, @@ -83,7 +83,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -192,7 +192,7 @@ private constructor( updatedAt: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), @JsonProperty("legal_entity_associations") @ExcludeMissing @@ -266,7 +266,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -604,7 +604,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -647,7 +647,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -1010,7 +1010,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -1106,7 +1106,7 @@ private constructor( private var id: JsonField? = null private var addresses: JsonField>? = null - private var bankSettings: JsonField? = null + private var bankSettings: JsonField? = null private var businessDescription: JsonField? = null private var businessName: JsonField? = null private var citizenshipCountry: JsonField? = null @@ -1150,7 +1150,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField? = null private var updatedAt: JsonField? = null - private var wealthAndEmploymentDetails: JsonField? = null + private var wealthAndEmploymentDetails: JsonField? = null private var website: JsonField? = null private var legalEntityAssociations: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1243,21 +1243,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed [LegalEntityBankSetting] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -2055,27 +2055,26 @@ private constructor( */ fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } - fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? - ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) + fun wealthAndEmploymentDetails(wealthAndEmploymentDetails: WealthAndEmploymentDetails?) = + wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** * Alias for calling [Builder.wealthAndEmploymentDetails] with * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -2408,6 +2407,7 @@ private constructor( private val locality: JsonField, private val object_: JsonField, private val postalCode: JsonField, + private val primary: JsonField, private val region: JsonField, private val updatedAt: JsonField, private val additionalProperties: MutableMap, @@ -2438,6 +2438,7 @@ private constructor( @JsonProperty("postal_code") @ExcludeMissing postalCode: JsonField = JsonMissing.of(), + @JsonProperty("primary") @ExcludeMissing primary: JsonField = JsonMissing.of(), @JsonProperty("region") @ExcludeMissing region: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing @@ -2454,6 +2455,7 @@ private constructor( locality, object_, postalCode, + primary, region, updatedAt, mutableMapOf(), @@ -2536,6 +2538,14 @@ private constructor( */ fun postalCode(): Optional = postalCode.getOptional("postal_code") + /** + * Whether this address is the primary address for the legal entity. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun primary(): Optional = primary.getOptional("primary") + /** * Region or State. * @@ -2636,6 +2646,13 @@ private constructor( @ExcludeMissing fun _postalCode(): JsonField = postalCode + /** + * Returns the raw JSON value of [primary]. + * + * Unlike [primary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("primary") @ExcludeMissing fun _primary(): JsonField = primary + /** * Returns the raw JSON value of [region]. * @@ -2682,6 +2699,7 @@ private constructor( * .locality() * .object_() * .postalCode() + * .primary() * .region() * .updatedAt() * ``` @@ -2703,6 +2721,7 @@ private constructor( private var locality: JsonField? = null private var object_: JsonField? = null private var postalCode: JsonField? = null + private var primary: JsonField? = null private var region: JsonField? = null private var updatedAt: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -2720,6 +2739,7 @@ private constructor( locality = legalEntityAddress.locality object_ = legalEntityAddress.object_ postalCode = legalEntityAddress.postalCode + primary = legalEntityAddress.primary region = legalEntityAddress.region updatedAt = legalEntityAddress.updatedAt additionalProperties = legalEntityAddress.additionalProperties.toMutableMap() @@ -2893,6 +2913,28 @@ private constructor( */ fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } + /** Whether this address is the primary address for the legal entity. */ + fun primary(primary: Boolean?) = primary(JsonField.ofNullable(primary)) + + /** + * Alias for [Builder.primary]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun primary(primary: Boolean) = primary(primary as Boolean?) + + /** Alias for calling [Builder.primary] with `primary.orElse(null)`. */ + fun primary(primary: Optional) = primary(primary.getOrNull()) + + /** + * Sets [Builder.primary] to an arbitrary JSON value. + * + * You should usually call [Builder.primary] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun primary(primary: JsonField) = apply { this.primary = primary } + /** Region or State. */ fun region(region: String?) = region(JsonField.ofNullable(region)) @@ -2958,6 +3000,7 @@ private constructor( * .locality() * .object_() * .postalCode() + * .primary() * .region() * .updatedAt() * ``` @@ -2977,6 +3020,7 @@ private constructor( checkRequired("locality", locality), checkRequired("object_", object_), checkRequired("postalCode", postalCode), + checkRequired("primary", primary), checkRequired("region", region), checkRequired("updatedAt", updatedAt), additionalProperties.toMutableMap(), @@ -3010,6 +3054,7 @@ private constructor( locality() object_() postalCode() + primary() region() updatedAt() validated = true @@ -3042,6 +3087,7 @@ private constructor( (if (locality.asKnown().isPresent) 1 else 0) + (if (object_.asKnown().isPresent) 1 else 0) + (if (postalCode.asKnown().isPresent) 1 else 0) + + (if (primary.asKnown().isPresent) 1 else 0) + (if (region.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) @@ -3227,6 +3273,7 @@ private constructor( locality == other.locality && object_ == other.object_ && postalCode == other.postalCode && + primary == other.primary && region == other.region && updatedAt == other.updatedAt && additionalProperties == other.additionalProperties @@ -3245,6 +3292,7 @@ private constructor( locality, object_, postalCode, + primary, region, updatedAt, additionalProperties, @@ -3254,21 +3302,22 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "LegalEntityAddress{id=$id, addressTypes=$addressTypes, country=$country, createdAt=$createdAt, discardedAt=$discardedAt, line1=$line1, line2=$line2, liveMode=$liveMode, locality=$locality, object_=$object_, postalCode=$postalCode, region=$region, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "LegalEntityAddress{id=$id, addressTypes=$addressTypes, country=$country, createdAt=$createdAt, discardedAt=$discardedAt, line1=$line1, line2=$line2, liveMode=$liveMode, locality=$locality, object_=$object_, postalCode=$postalCode, primary=$primary, region=$region, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" } - class LegalEntityBankSetting + class Identification @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val id: JsonField, - private val backupWithholdingPercentage: JsonField, private val createdAt: JsonField, private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, + private val documents: JsonField>, + private val expirationDate: JsonField, + private val idType: JsonField, + private val issuingCountry: JsonField, + private val issuingRegion: JsonField, private val liveMode: JsonField, private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, private val updatedAt: JsonField, private val additionalProperties: MutableMap, ) { @@ -3276,41 +3325,43 @@ private constructor( @JsonCreator private constructor( @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), @JsonProperty("discarded_at") @ExcludeMissing discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") + @JsonProperty("documents") + @ExcludeMissing + documents: JsonField> = JsonMissing.of(), + @JsonProperty("expiration_date") @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), + expirationDate: JsonField = JsonMissing.of(), + @JsonProperty("id_type") @ExcludeMissing idType: JsonField = JsonMissing.of(), + @JsonProperty("issuing_country") + @ExcludeMissing + issuingCountry: JsonField = JsonMissing.of(), + @JsonProperty("issuing_region") + @ExcludeMissing + issuingRegion: JsonField = JsonMissing.of(), @JsonProperty("live_mode") @ExcludeMissing liveMode: JsonField = JsonMissing.of(), @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") - @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") - @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), ) : this( id, - backupWithholdingPercentage, createdAt, discardedAt, - enableBackupWithholding, + documents, + expirationDate, + idType, + issuingCountry, + issuingRegion, liveMode, object_, - privacyOptOut, - regulationO, updatedAt, mutableMapOf(), ) @@ -3321,15 +3372,6 @@ private constructor( */ fun id(): String = id.getRequired("id") - /** - * The percentage of backup withholding to apply to the legal entity. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -3343,48 +3385,57 @@ private constructor( fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun documents(): List = documents.getRequired("documents") + + /** + * The date when the Identification is no longer considered valid by the issuing authority. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun expirationDate(): Optional = expirationDate.getOptional("expiration_date") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * The type of ID number. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") + fun idType(): IdType = idType.getRequired("id_type") /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * The ISO 3166-1 alpha-2 country code of the country that issued the identification + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun object_(): String = object_.getRequired("object") + fun issuingCountry(): Optional = issuingCountry.getOptional("issuing_country") /** - * Cross River Bank specific setting to opt out of privacy policy. + * The region in which the identifcation was issued. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun issuingRegion(): Optional = issuingRegion.getOptional("issuing_region") /** - * It covers, among other types of insider loans, extensions of credit by a member bank to - * an executive officer, director, or principal shareholder of the member bank; a bank - * holding company of which the member bank is a subsidiary; and any other subsidiary of - * that bank holding company. + * This field will be true if this object exists in the live environment or false if it + * exists in the test environment. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun liveMode(): Boolean = liveMode.getRequired("live_mode") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") + fun object_(): String = object_.getRequired("object") /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is @@ -3399,16 +3450,6 @@ private constructor( */ @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - /** * Returns the raw JSON value of [createdAt]. * @@ -3428,47 +3469,64 @@ private constructor( fun _discardedAt(): JsonField = discardedAt /** - * Returns the raw JSON value of [enableBackupWithholding]. + * Returns the raw JSON value of [documents]. * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [documents], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("enable_backup_withholding") + @JsonProperty("documents") @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding + fun _documents(): JsonField> = documents /** - * Returns the raw JSON value of [liveMode]. + * Returns the raw JSON value of [expirationDate]. * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [expirationDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + @JsonProperty("expiration_date") + @ExcludeMissing + fun _expirationDate(): JsonField = expirationDate /** - * Returns the raw JSON value of [object_]. + * Returns the raw JSON value of [idType]. * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [idType], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + @JsonProperty("id_type") @ExcludeMissing fun _idType(): JsonField = idType /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [issuingCountry]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [issuingCountry], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("issuing_country") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _issuingCountry(): JsonField = issuingCountry /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [issuingRegion]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [issuingRegion], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("regulation_o") + @JsonProperty("issuing_region") @ExcludeMissing - fun _regulationO(): JsonField = regulationO + fun _issuingRegion(): JsonField = issuingRegion + + /** + * Returns the raw JSON value of [liveMode]. + * + * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + + /** + * Returns the raw JSON value of [object_]. + * + * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ /** * Returns the raw JSON value of [updatedAt]. @@ -3494,53 +3552,56 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Identification]. * * The following fields are required: * ```java * .id() - * .backupWithholdingPercentage() * .createdAt() * .discardedAt() - * .enableBackupWithholding() + * .documents() + * .expirationDate() + * .idType() + * .issuingCountry() + * .issuingRegion() * .liveMode() * .object_() - * .privacyOptOut() - * .regulationO() * .updatedAt() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Identification]. */ class Builder internal constructor() { private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null private var createdAt: JsonField? = null private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null + private var documents: JsonField>? = null + private var expirationDate: JsonField? = null + private var idType: JsonField? = null + private var issuingCountry: JsonField? = null + private var issuingRegion: JsonField? = null private var liveMode: JsonField? = null private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null private var updatedAt: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = legalEntityBankSetting.additionalProperties.toMutableMap() + internal fun from(identification: Identification) = apply { + id = identification.id + createdAt = identification.createdAt + discardedAt = identification.discardedAt + documents = identification.documents.map { it.toMutableList() } + expirationDate = identification.expirationDate + idType = identification.idType + issuingCountry = identification.issuingCountry + issuingRegion = identification.issuingRegion + liveMode = identification.liveMode + object_ = identification.object_ + updatedAt = identification.updatedAt + additionalProperties = identification.additionalProperties.toMutableMap() } fun id(id: String) = id(JsonField.of(id)) @@ -3554,36 +3615,6 @@ private constructor( */ fun id(id: JsonField) = apply { this.id = id } - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { - this.backupWithholdingPercentage = backupWithholdingPercentage - } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** @@ -3615,119 +3646,128 @@ private constructor( this.discardedAt = discardedAt } - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) + fun documents(documents: List) = documents(JsonField.of(documents)) /** - * Alias for [Builder.enableBackupWithholding]. + * Sets [Builder.documents] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. + * You should usually call [Builder.documents] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) + fun documents(documents: JsonField>) = apply { + this.documents = documents.map { it.toMutableList() } + } /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. + * Adds a single [Document] to [documents]. * - * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun addDocument(document: Document) = apply { + documents = + (documents ?: JsonField.of(mutableListOf())).also { + checkKnown("documents", it).add(document) + } } /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * The date when the Identification is no longer considered valid by the issuing + * authority. */ - fun liveMode(liveMode: Boolean) = liveMode(JsonField.of(liveMode)) + fun expirationDate(expirationDate: LocalDate?) = + expirationDate(JsonField.ofNullable(expirationDate)) + + /** Alias for calling [Builder.expirationDate] with `expirationDate.orElse(null)`. */ + fun expirationDate(expirationDate: Optional) = + expirationDate(expirationDate.getOrNull()) /** - * Sets [Builder.liveMode] to an arbitrary JSON value. + * Sets [Builder.expirationDate] to an arbitrary JSON value. * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.expirationDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + fun expirationDate(expirationDate: JsonField) = apply { + this.expirationDate = expirationDate + } - fun object_(object_: String) = object_(JsonField.of(object_)) + /** The type of ID number. */ + fun idType(idType: IdType) = idType(JsonField.of(idType)) /** - * Sets [Builder.object_] to an arbitrary JSON value. + * Sets [Builder.idType] to an arbitrary JSON value. * - * You should usually call [Builder.object_] with a well-typed [String] value instead. + * You should usually call [Builder.idType] with a well-typed [IdType] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) + fun idType(idType: JsonField) = apply { this.idType = idType } - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) + /** The ISO 3166-1 alpha-2 country code of the country that issued the identification */ + fun issuingCountry(issuingCountry: String?) = + issuingCountry(JsonField.ofNullable(issuingCountry)) - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) + /** Alias for calling [Builder.issuingCountry] with `issuingCountry.orElse(null)`. */ + fun issuingCountry(issuingCountry: Optional) = + issuingCountry(issuingCountry.getOrNull()) /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. + * Sets [Builder.issuingCountry] to an arbitrary JSON value. * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value + * You should usually call [Builder.issuingCountry] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut + fun issuingCountry(issuingCountry: JsonField) = apply { + this.issuingCountry = issuingCountry } + /** The region in which the identifcation was issued. */ + fun issuingRegion(issuingRegion: String?) = + issuingRegion(JsonField.ofNullable(issuingRegion)) + + /** Alias for calling [Builder.issuingRegion] with `issuingRegion.orElse(null)`. */ + fun issuingRegion(issuingRegion: Optional) = + issuingRegion(issuingRegion.getOrNull()) + /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. + * Sets [Builder.issuingRegion] to an arbitrary JSON value. * - * This unboxed primitive overload exists for backwards compatibility. + * You should usually call [Builder.issuingRegion] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + fun issuingRegion(issuingRegion: JsonField) = apply { + this.issuingRegion = issuingRegion + } - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) + /** + * 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)) /** - * Sets [Builder.regulationO] to an arbitrary JSON value. + * Sets [Builder.liveMode] to an arbitrary JSON value. * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } + fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + + fun object_(object_: String) = object_(JsonField.of(object_)) + + /** + * Sets [Builder.object_] to an arbitrary JSON value. + * + * You should usually call [Builder.object_] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun object_(object_: JsonField) = apply { this.object_ = object_ } fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) @@ -3762,37 +3802,39 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Identification]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .id() - * .backupWithholdingPercentage() * .createdAt() * .discardedAt() - * .enableBackupWithholding() + * .documents() + * .expirationDate() + * .idType() + * .issuingCountry() + * .issuingRegion() * .liveMode() * .object_() - * .privacyOptOut() - * .regulationO() * .updatedAt() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( + fun build(): Identification = + Identification( checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), checkRequired("createdAt", createdAt), checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), + checkRequired("documents", documents).map { it.toImmutable() }, + checkRequired("expirationDate", expirationDate), + checkRequired("idType", idType), + checkRequired("issuingCountry", issuingCountry), + checkRequired("issuingRegion", issuingRegion), checkRequired("liveMode", liveMode), checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), checkRequired("updatedAt", updatedAt), additionalProperties.toMutableMap(), ) @@ -3809,20 +3851,21 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Identification = apply { if (validated) { return@apply } id() - backupWithholdingPercentage() createdAt() discardedAt() - enableBackupWithholding() + documents().forEach { it.validate() } + expirationDate() + idType().validate() + issuingCountry() + issuingRegion() liveMode() object_() - privacyOptOut() - regulationO() updatedAt() validated = true } @@ -3844,710 +3887,215 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + + (documents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (expirationDate.asKnown().isPresent) 1 else 0) + + (idType.asKnown().getOrNull()?.validity() ?: 0) + + (if (issuingCountry.asKnown().isPresent) 1 else 0) + + (if (issuingRegion.asKnown().isPresent) 1 else 0) + (if (liveMode.asKnown().isPresent) 1 else 0) + (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + /** The type of ID number. */ + class IdType @JsonCreator private constructor(private val value: JsonField) : Enum { - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } + companion object { - override fun hashCode(): Int = hashCode + @JvmField val AR_CUIL = of("ar_cuil") - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } + @JvmField val AR_CUIT = of("ar_cuit") - class Identification - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val documents: JsonField>, - private val expirationDate: JsonField, - private val idType: JsonField, - private val issuingCountry: JsonField, - private val issuingRegion: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val updatedAt: JsonField, - private val additionalProperties: MutableMap, - ) { + @JvmField val AT_ATIN = of("at_atin") - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("documents") - @ExcludeMissing - documents: JsonField> = JsonMissing.of(), - @JsonProperty("expiration_date") - @ExcludeMissing - expirationDate: JsonField = JsonMissing.of(), - @JsonProperty("id_type") @ExcludeMissing idType: JsonField = JsonMissing.of(), - @JsonProperty("issuing_country") - @ExcludeMissing - issuingCountry: JsonField = JsonMissing.of(), - @JsonProperty("issuing_region") - @ExcludeMissing - issuingRegion: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - createdAt, - discardedAt, - documents, - expirationDate, - idType, - issuingCountry, - issuingRegion, - liveMode, - object_, - updatedAt, - mutableMapOf(), - ) + @JvmField val AT_VAT = of("at_vat") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") + @JvmField val AU_ABN = of("au_abn") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + @JvmField val AU_TFN = of("au_tfn") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") + @JvmField val BE_ENT = of("be_ent") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun documents(): List = documents.getRequired("documents") + @JvmField val BE_NRN = of("be_nrn") - /** - * The date when the Identification is no longer considered valid by the issuing authority. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun expirationDate(): Optional = expirationDate.getOptional("expiration_date") + @JvmField val BR_CNPJ = of("br_cnpj") - /** - * The type of ID number. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun idType(): IdType = idType.getRequired("id_type") + @JvmField val BR_CPF = of("br_cpf") - /** - * The ISO 3166-1 alpha-2 country code of the country that issued the identification - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun issuingCountry(): Optional = issuingCountry.getOptional("issuing_country") + @JvmField val CA_BN = of("ca_bn") - /** - * The region in which the identifcation was issued. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun issuingRegion(): Optional = issuingRegion.getOptional("issuing_region") + @JvmField val CA_SIN = of("ca_sin") - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") + @JvmField val CH_AHV = of("ch_ahv") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") + @JvmField val CH_UID = of("ch_uid") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") + @JvmField val CL_RUN = of("cl_run") - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + @JvmField val CL_RUT = of("cl_rut") - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt + @JvmField val CO_CEDULAS = of("co_cedulas") - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt + @JvmField val CO_NIT = of("co_nit") - /** - * Returns the raw JSON value of [documents]. - * - * Unlike [documents], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("documents") - @ExcludeMissing - fun _documents(): JsonField> = documents + @JvmField val CY_TIN = of("cy_tin") - /** - * Returns the raw JSON value of [expirationDate]. - * - * Unlike [expirationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("expiration_date") - @ExcludeMissing - fun _expirationDate(): JsonField = expirationDate + @JvmField val CZ_ICO = of("cz_ico") - /** - * Returns the raw JSON value of [idType]. - * - * Unlike [idType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id_type") @ExcludeMissing fun _idType(): JsonField = idType + @JvmField val CZ_RC = of("cz_rc") - /** - * Returns the raw JSON value of [issuingCountry]. - * - * Unlike [issuingCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("issuing_country") - @ExcludeMissing - fun _issuingCountry(): JsonField = issuingCountry + @JvmField val DE_STID = of("de_stid") - /** - * Returns the raw JSON value of [issuingRegion]. - * - * Unlike [issuingRegion], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("issuing_region") - @ExcludeMissing - fun _issuingRegion(): JsonField = issuingRegion + @JvmField val DE_STNR = of("de_stnr") - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + @JvmField val DE_VAT = of("de_vat") - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + @JvmField val DK_CPR = of("dk_cpr") - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JvmField val DK_CVR = of("dk_cvr") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + @JvmField val DRIVERS_LICENSE = of("drivers_license") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + @JvmField val EE_IK = of("ee_ik") - fun toBuilder() = Builder().from(this) + @JvmField val EE_RK = of("ee_rk") - companion object { + @JvmField val ES_NIE = of("es_nie") - /** - * Returns a mutable builder for constructing an instance of [Identification]. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .discardedAt() - * .documents() - * .expirationDate() - * .idType() - * .issuingCountry() - * .issuingRegion() - * .liveMode() - * .object_() - * .updatedAt() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + @JvmField val ES_NIF = of("es_nif") - /** A builder for [Identification]. */ - class Builder internal constructor() { + @JvmField val FI_HETU = of("fi_hetu") - private var id: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var documents: JsonField>? = null - private var expirationDate: JsonField? = null - private var idType: JsonField? = null - private var issuingCountry: JsonField? = null - private var issuingRegion: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var updatedAt: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() + @JvmField val FI_YTJ = of("fi_ytj") - @JvmSynthetic - internal fun from(identification: Identification) = apply { - id = identification.id - createdAt = identification.createdAt - discardedAt = identification.discardedAt - documents = identification.documents.map { it.toMutableList() } - expirationDate = identification.expirationDate - idType = identification.idType - issuingCountry = identification.issuingCountry - issuingRegion = identification.issuingRegion - liveMode = identification.liveMode - object_ = identification.object_ - updatedAt = identification.updatedAt - additionalProperties = identification.additionalProperties.toMutableMap() - } + @JvmField val FR_NIF = of("fr_nif") - fun id(id: String) = id(JsonField.of(id)) + @JvmField val FR_SIREN = of("fr_siren") - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } + @JvmField val FR_VAT = of("fr_vat") - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + @JvmField val GB_NINO = of("gb_nino") - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } + @JvmField val GB_UTR = of("gb_utr") - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) + @JvmField val GB_VAT = of("gb_vat") - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) + @JvmField val GR_VAT = of("gr_vat") - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } + @JvmField val HN_ID = of("hn_id") - fun documents(documents: List) = documents(JsonField.of(documents)) + @JvmField val HN_RTN = of("hn_rtn") - /** - * Sets [Builder.documents] to an arbitrary JSON value. - * - * You should usually call [Builder.documents] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun documents(documents: JsonField>) = apply { - this.documents = documents.map { it.toMutableList() } - } + @JvmField val HR_OIB = of("hr_oib") - /** - * Adds a single [Document] to [documents]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addDocument(document: Document) = apply { - documents = - (documents ?: JsonField.of(mutableListOf())).also { - checkKnown("documents", it).add(document) - } - } + @JvmField val HU_ADJ = of("hu_adj") - /** - * The date when the Identification is no longer considered valid by the issuing - * authority. - */ - fun expirationDate(expirationDate: LocalDate?) = - expirationDate(JsonField.ofNullable(expirationDate)) + @JvmField val HU_ANUM = of("hu_anum") - /** Alias for calling [Builder.expirationDate] with `expirationDate.orElse(null)`. */ - fun expirationDate(expirationDate: Optional) = - expirationDate(expirationDate.getOrNull()) + @JvmField val IE_PPS = of("ie_pps") - /** - * Sets [Builder.expirationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.expirationDate] with a well-typed [LocalDate] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun expirationDate(expirationDate: JsonField) = apply { - this.expirationDate = expirationDate - } + @JvmField val IE_TRN = of("ie_trn") - /** The type of ID number. */ - fun idType(idType: IdType) = idType(JsonField.of(idType)) + @JvmField val IN_LEI = of("in_lei") - /** - * Sets [Builder.idType] to an arbitrary JSON value. - * - * You should usually call [Builder.idType] with a well-typed [IdType] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun idType(idType: JsonField) = apply { this.idType = idType } + @JvmField val IS_KNT = of("is_knt") - /** The ISO 3166-1 alpha-2 country code of the country that issued the identification */ - fun issuingCountry(issuingCountry: String?) = - issuingCountry(JsonField.ofNullable(issuingCountry)) + @JvmField val IT_CF = of("it_cf") - /** Alias for calling [Builder.issuingCountry] with `issuingCountry.orElse(null)`. */ - fun issuingCountry(issuingCountry: Optional) = - issuingCountry(issuingCountry.getOrNull()) + @JvmField val IT_PIVA = of("it_piva") - /** - * Sets [Builder.issuingCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.issuingCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun issuingCountry(issuingCountry: JsonField) = apply { - this.issuingCountry = issuingCountry - } + @JvmField val JP_HB = of("jp_hb") - /** The region in which the identifcation was issued. */ - fun issuingRegion(issuingRegion: String?) = - issuingRegion(JsonField.ofNullable(issuingRegion)) + @JvmField val JP_MN = of("jp_mn") - /** Alias for calling [Builder.issuingRegion] with `issuingRegion.orElse(null)`. */ - fun issuingRegion(issuingRegion: Optional) = - issuingRegion(issuingRegion.getOrNull()) + @JvmField val KR_BRN = of("kr_brn") - /** - * Sets [Builder.issuingRegion] to an arbitrary JSON value. - * - * You should usually call [Builder.issuingRegion] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun issuingRegion(issuingRegion: JsonField) = apply { - this.issuingRegion = issuingRegion - } + @JvmField val KR_CRN = of("kr_crn") - /** - * 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)) + @JvmField val KR_RRN = of("kr_rrn") - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + @JvmField val LI_PEID = of("li_peid") - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } + @JvmField val LT_AK = of("lt_ak") - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + @JvmField val LT_JAK = of("lt_jak") - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } + @JvmField val LU_MTC = of("lu_mtc") - /** - * Returns an immutable instance of [Identification]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .createdAt() - * .discardedAt() - * .documents() - * .expirationDate() - * .idType() - * .issuingCountry() - * .issuingRegion() - * .liveMode() - * .object_() - * .updatedAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Identification = - Identification( - checkRequired("id", id), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("documents", documents).map { it.toImmutable() }, - checkRequired("expirationDate", expirationDate), - checkRequired("idType", idType), - checkRequired("issuingCountry", issuingCountry), - checkRequired("issuingRegion", issuingRegion), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("updatedAt", updatedAt), - additionalProperties.toMutableMap(), - ) - } + @JvmField val LU_VAT = of("lu_vat") - private var validated: Boolean = false + @JvmField val LV_PK = of("lv_pk") - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): Identification = apply { - if (validated) { - return@apply - } + @JvmField val LV_RN = of("lv_rn") - id() - createdAt() - discardedAt() - documents().forEach { it.validate() } - expirationDate() - idType().validate() - issuingCountry() - issuingRegion() - liveMode() - object_() - updatedAt() - validated = true - } + @JvmField val MT_TIN = of("mt_tin") - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + @JvmField val MT_VAT = of("mt_vat") - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (documents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (expirationDate.asKnown().isPresent) 1 else 0) + - (idType.asKnown().getOrNull()?.validity() ?: 0) + - (if (issuingCountry.asKnown().isPresent) 1 else 0) + - (if (issuingRegion.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + @JvmField val MX_CURP = of("mx_curp") - /** The type of ID number. */ - class IdType @JsonCreator private constructor(private val value: JsonField) : Enum { + @JvmField val MX_INE = of("mx_ine") - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + @JvmField val MX_RFC = of("mx_rfc") - companion object { + @JvmField val NL_BSN = of("nl_bsn") - @JvmField val AR_CUIL = of("ar_cuil") + @JvmField val NL_BTW = of("nl_btw") - @JvmField val AR_CUIT = of("ar_cuit") + @JvmField val NL_RSIN = of("nl_rsin") - @JvmField val BR_CNPJ = of("br_cnpj") + @JvmField val NO_FDN = of("no_fdn") - @JvmField val BR_CPF = of("br_cpf") + @JvmField val NO_MVA = of("no_mva") - @JvmField val CA_SIN = of("ca_sin") + @JvmField val NO_ORGNR = of("no_orgnr") - @JvmField val CL_RUN = of("cl_run") + @JvmField val NZ_IRD = of("nz_ird") - @JvmField val CL_RUT = of("cl_rut") + @JvmField val PASSPORT = of("passport") - @JvmField val CO_CEDULAS = of("co_cedulas") + @JvmField val PL_NIP = of("pl_nip") - @JvmField val CO_NIT = of("co_nit") + @JvmField val PL_PESEL = of("pl_pesel") - @JvmField val DRIVERS_LICENSE = of("drivers_license") + @JvmField val PT_NIF = of("pt_nif") - @JvmField val HN_ID = of("hn_id") + @JvmField val RO_CNP = of("ro_cnp") - @JvmField val HN_RTN = of("hn_rtn") + @JvmField val RO_CUI = of("ro_cui") - @JvmField val IE_PPS = of("ie_pps") + @JvmField val SA_TIN = of("sa_tin") - @JvmField val IN_LEI = of("in_lei") + @JvmField val SA_VAT = of("sa_vat") - @JvmField val KR_BRN = of("kr_brn") + @JvmField val SE_ORGNR = of("se_orgnr") - @JvmField val KR_CRN = of("kr_crn") + @JvmField val SE_PNMR = of("se_pnmr") - @JvmField val KR_RRN = of("kr_rrn") + @JvmField val SG_FIN = of("sg_fin") - @JvmField val MX_CURP = of("mx_curp") + @JvmField val SG_NRIC = of("sg_nric") - @JvmField val MX_INE = of("mx_ine") + @JvmField val SG_UEN = of("sg_uen") - @JvmField val MX_RFC = of("mx_rfc") + @JvmField val SI_DAV = of("si_dav") - @JvmField val PASSPORT = of("passport") + @JvmField val SI_TIN = of("si_tin") - @JvmField val SA_TIN = of("sa_tin") + @JvmField val SK_ICO = of("sk_ico") - @JvmField val SA_VAT = of("sa_vat") + @JvmField val SK_RC = of("sk_rc") @JvmField val US_EIN = of("us_ein") @@ -4566,27 +4114,96 @@ private constructor( enum class Known { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -4606,27 +4223,96 @@ private constructor( enum class Value { AR_CUIL, AR_CUIT, + AT_ATIN, + AT_VAT, + AU_ABN, + AU_TFN, + BE_ENT, + BE_NRN, BR_CNPJ, BR_CPF, + CA_BN, CA_SIN, + CH_AHV, + CH_UID, CL_RUN, CL_RUT, CO_CEDULAS, CO_NIT, + CY_TIN, + CZ_ICO, + CZ_RC, + DE_STID, + DE_STNR, + DE_VAT, + DK_CPR, + DK_CVR, DRIVERS_LICENSE, + EE_IK, + EE_RK, + ES_NIE, + ES_NIF, + FI_HETU, + FI_YTJ, + FR_NIF, + FR_SIREN, + FR_VAT, + GB_NINO, + GB_UTR, + GB_VAT, + GR_VAT, HN_ID, HN_RTN, + HR_OIB, + HU_ADJ, + HU_ANUM, IE_PPS, + IE_TRN, IN_LEI, + IS_KNT, + IT_CF, + IT_PIVA, + JP_HB, + JP_MN, KR_BRN, KR_CRN, KR_RRN, + LI_PEID, + LT_AK, + LT_JAK, + LU_MTC, + LU_VAT, + LV_PK, + LV_RN, + MT_TIN, + MT_VAT, MX_CURP, MX_INE, MX_RFC, + NL_BSN, + NL_BTW, + NL_RSIN, + NO_FDN, + NO_MVA, + NO_ORGNR, + NZ_IRD, PASSPORT, + PL_NIP, + PL_PESEL, + PT_NIF, + RO_CNP, + RO_CUI, SA_TIN, SA_VAT, + SE_ORGNR, + SE_PNMR, + SG_FIN, + SG_NRIC, + SG_UEN, + SI_DAV, + SI_TIN, + SK_ICO, + SK_RC, US_EIN, US_ITIN, US_SSN, @@ -4649,27 +4335,96 @@ private constructor( when (this) { AR_CUIL -> Value.AR_CUIL AR_CUIT -> Value.AR_CUIT + AT_ATIN -> Value.AT_ATIN + AT_VAT -> Value.AT_VAT + AU_ABN -> Value.AU_ABN + AU_TFN -> Value.AU_TFN + BE_ENT -> Value.BE_ENT + BE_NRN -> Value.BE_NRN BR_CNPJ -> Value.BR_CNPJ BR_CPF -> Value.BR_CPF + CA_BN -> Value.CA_BN CA_SIN -> Value.CA_SIN + CH_AHV -> Value.CH_AHV + CH_UID -> Value.CH_UID CL_RUN -> Value.CL_RUN CL_RUT -> Value.CL_RUT CO_CEDULAS -> Value.CO_CEDULAS CO_NIT -> Value.CO_NIT + CY_TIN -> Value.CY_TIN + CZ_ICO -> Value.CZ_ICO + CZ_RC -> Value.CZ_RC + DE_STID -> Value.DE_STID + DE_STNR -> Value.DE_STNR + DE_VAT -> Value.DE_VAT + DK_CPR -> Value.DK_CPR + DK_CVR -> Value.DK_CVR DRIVERS_LICENSE -> Value.DRIVERS_LICENSE + EE_IK -> Value.EE_IK + EE_RK -> Value.EE_RK + ES_NIE -> Value.ES_NIE + ES_NIF -> Value.ES_NIF + FI_HETU -> Value.FI_HETU + FI_YTJ -> Value.FI_YTJ + FR_NIF -> Value.FR_NIF + FR_SIREN -> Value.FR_SIREN + FR_VAT -> Value.FR_VAT + GB_NINO -> Value.GB_NINO + GB_UTR -> Value.GB_UTR + GB_VAT -> Value.GB_VAT + GR_VAT -> Value.GR_VAT HN_ID -> Value.HN_ID HN_RTN -> Value.HN_RTN + HR_OIB -> Value.HR_OIB + HU_ADJ -> Value.HU_ADJ + HU_ANUM -> Value.HU_ANUM IE_PPS -> Value.IE_PPS + IE_TRN -> Value.IE_TRN IN_LEI -> Value.IN_LEI + IS_KNT -> Value.IS_KNT + IT_CF -> Value.IT_CF + IT_PIVA -> Value.IT_PIVA + JP_HB -> Value.JP_HB + JP_MN -> Value.JP_MN KR_BRN -> Value.KR_BRN KR_CRN -> Value.KR_CRN KR_RRN -> Value.KR_RRN + LI_PEID -> Value.LI_PEID + LT_AK -> Value.LT_AK + LT_JAK -> Value.LT_JAK + LU_MTC -> Value.LU_MTC + LU_VAT -> Value.LU_VAT + LV_PK -> Value.LV_PK + LV_RN -> Value.LV_RN + MT_TIN -> Value.MT_TIN + MT_VAT -> Value.MT_VAT MX_CURP -> Value.MX_CURP MX_INE -> Value.MX_INE MX_RFC -> Value.MX_RFC + NL_BSN -> Value.NL_BSN + NL_BTW -> Value.NL_BTW + NL_RSIN -> Value.NL_RSIN + NO_FDN -> Value.NO_FDN + NO_MVA -> Value.NO_MVA + NO_ORGNR -> Value.NO_ORGNR + NZ_IRD -> Value.NZ_IRD PASSPORT -> Value.PASSPORT + PL_NIP -> Value.PL_NIP + PL_PESEL -> Value.PL_PESEL + PT_NIF -> Value.PT_NIF + RO_CNP -> Value.RO_CNP + RO_CUI -> Value.RO_CUI SA_TIN -> Value.SA_TIN SA_VAT -> Value.SA_VAT + SE_ORGNR -> Value.SE_ORGNR + SE_PNMR -> Value.SE_PNMR + SG_FIN -> Value.SG_FIN + SG_NRIC -> Value.SG_NRIC + SG_UEN -> Value.SG_UEN + SI_DAV -> Value.SI_DAV + SI_TIN -> Value.SI_TIN + SK_ICO -> Value.SK_ICO + SK_RC -> Value.SK_RC US_EIN -> Value.US_EIN US_ITIN -> Value.US_ITIN US_SSN -> Value.US_SSN @@ -4691,27 +4446,96 @@ private constructor( when (this) { AR_CUIL -> Known.AR_CUIL AR_CUIT -> Known.AR_CUIT + AT_ATIN -> Known.AT_ATIN + AT_VAT -> Known.AT_VAT + AU_ABN -> Known.AU_ABN + AU_TFN -> Known.AU_TFN + BE_ENT -> Known.BE_ENT + BE_NRN -> Known.BE_NRN BR_CNPJ -> Known.BR_CNPJ BR_CPF -> Known.BR_CPF + CA_BN -> Known.CA_BN CA_SIN -> Known.CA_SIN + CH_AHV -> Known.CH_AHV + CH_UID -> Known.CH_UID CL_RUN -> Known.CL_RUN CL_RUT -> Known.CL_RUT CO_CEDULAS -> Known.CO_CEDULAS CO_NIT -> Known.CO_NIT + CY_TIN -> Known.CY_TIN + CZ_ICO -> Known.CZ_ICO + CZ_RC -> Known.CZ_RC + DE_STID -> Known.DE_STID + DE_STNR -> Known.DE_STNR + DE_VAT -> Known.DE_VAT + DK_CPR -> Known.DK_CPR + DK_CVR -> Known.DK_CVR DRIVERS_LICENSE -> Known.DRIVERS_LICENSE + EE_IK -> Known.EE_IK + EE_RK -> Known.EE_RK + ES_NIE -> Known.ES_NIE + ES_NIF -> Known.ES_NIF + FI_HETU -> Known.FI_HETU + FI_YTJ -> Known.FI_YTJ + FR_NIF -> Known.FR_NIF + FR_SIREN -> Known.FR_SIREN + FR_VAT -> Known.FR_VAT + GB_NINO -> Known.GB_NINO + GB_UTR -> Known.GB_UTR + GB_VAT -> Known.GB_VAT + GR_VAT -> Known.GR_VAT HN_ID -> Known.HN_ID HN_RTN -> Known.HN_RTN + HR_OIB -> Known.HR_OIB + HU_ADJ -> Known.HU_ADJ + HU_ANUM -> Known.HU_ANUM IE_PPS -> Known.IE_PPS + IE_TRN -> Known.IE_TRN IN_LEI -> Known.IN_LEI + IS_KNT -> Known.IS_KNT + IT_CF -> Known.IT_CF + IT_PIVA -> Known.IT_PIVA + JP_HB -> Known.JP_HB + JP_MN -> Known.JP_MN KR_BRN -> Known.KR_BRN KR_CRN -> Known.KR_CRN KR_RRN -> Known.KR_RRN + LI_PEID -> Known.LI_PEID + LT_AK -> Known.LT_AK + LT_JAK -> Known.LT_JAK + LU_MTC -> Known.LU_MTC + LU_VAT -> Known.LU_VAT + LV_PK -> Known.LV_PK + LV_RN -> Known.LV_RN + MT_TIN -> Known.MT_TIN + MT_VAT -> Known.MT_VAT MX_CURP -> Known.MX_CURP MX_INE -> Known.MX_INE MX_RFC -> Known.MX_RFC + NL_BSN -> Known.NL_BSN + NL_BTW -> Known.NL_BTW + NL_RSIN -> Known.NL_RSIN + NO_FDN -> Known.NO_FDN + NO_MVA -> Known.NO_MVA + NO_ORGNR -> Known.NO_ORGNR + NZ_IRD -> Known.NZ_IRD PASSPORT -> Known.PASSPORT + PL_NIP -> Known.PL_NIP + PL_PESEL -> Known.PL_PESEL + PT_NIF -> Known.PT_NIF + RO_CNP -> Known.RO_CNP + RO_CUI -> Known.RO_CUI SA_TIN -> Known.SA_TIN SA_VAT -> Known.SA_VAT + SE_ORGNR -> Known.SE_ORGNR + SE_PNMR -> Known.SE_PNMR + SG_FIN -> Known.SG_FIN + SG_NRIC -> Known.SG_NRIC + SG_UEN -> Known.SG_UEN + SI_DAV -> Known.SI_DAV + SI_TIN -> Known.SI_TIN + SK_ICO -> Known.SK_ICO + SK_RC -> Known.SK_RC US_EIN -> Known.US_EIN US_ITIN -> Known.US_ITIN US_SSN -> Known.US_SSN @@ -5961,2339 +5785,6 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) - } - - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IncomeSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") - - @JvmField val MINING = of("mining") - - @JvmField val PERFORMING_ARTS = of("performing_arts") - - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") - - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") - - @JvmField val PUBLISHING = of("publishing") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") - - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") - - @JvmField val RENTAL_SERVICES = of("rental_services") - - @JvmField val RETAIL_CLOTHING = of("retail_clothing") - - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") - - @JvmField val RETAIL_FOOD = of("retail_food") - - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") - - @JvmField val RETAIL_HOME = of("retail_home") - - @JvmField val RETAIL_NON_STORE = of("retail_non_store") - - @JvmField val RETAIL_SPORTING = of("retail_sporting") - - @JvmField val TRANSPORTATION = of("transportation") - - @JvmField val TRAVEL = of("travel") - - @JvmField val UTILITIES = of("utilities") - - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) - } - - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - } - - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Industry && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The occupation of the individual. */ - class Occupation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONSULTING = of("consulting") - - @JvmField val EXECUTIVE = of("executive") - - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") - - @JvmField val FOOD_SERVICES = of("food_services") - - @JvmField val GOVERNMENT = of("government") - - @JvmField val HEALTHCARE = of("healthcare") - - @JvmField val LEGAL_SERVICES = of("legal_services") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val OTHER = of("other") - - @JvmField val SALES = of("sales") - - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") - - @JvmField val TECHNOLOGY = of("technology") - - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } - - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } - - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Occupation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's funds. */ - class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") - - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") - - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") - - @JvmField val INVESTMENT = of("investment") - - @JvmField val INVESTOR_FUNDING = of("investor_funding") - - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") - - @JvmField val LOTTERY = of("lottery") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") - - @JvmField val RETIRED = of("retired") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") - - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") - - @JvmField val TRUST_INCOME = of("trust_income") - - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } - - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } - - /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SourceOfFunds && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS_SALE = of("business_sale") - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val OTHER = of("other") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } - - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WealthSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequest.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequest.kt index 5bad2189..3674a834 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequest.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequest.kt @@ -30,6 +30,7 @@ private constructor( private val region: JsonField, private val addressTypes: JsonField>, private val line2: JsonField, + private val primary: JsonField, private val additionalProperties: MutableMap, ) { @@ -46,7 +47,18 @@ private constructor( @ExcludeMissing addressTypes: JsonField> = JsonMissing.of(), @JsonProperty("line2") @ExcludeMissing line2: JsonField = JsonMissing.of(), - ) : this(country, line1, locality, postalCode, region, addressTypes, line2, mutableMapOf()) + @JsonProperty("primary") @ExcludeMissing primary: JsonField = JsonMissing.of(), + ) : this( + country, + line1, + locality, + postalCode, + region, + addressTypes, + line2, + primary, + mutableMapOf(), + ) /** * Country code conforms to [ISO 3166-1 alpha-2] @@ -100,6 +112,14 @@ private constructor( */ fun line2(): Optional = line2.getOptional("line2") + /** + * Whether this address is the primary address for the legal entity. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun primary(): Optional = primary.getOptional("primary") + /** * Returns the raw JSON value of [country]. * @@ -151,6 +171,13 @@ private constructor( */ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2 + /** + * Returns the raw JSON value of [primary]. + * + * Unlike [primary], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("primary") @ExcludeMissing fun _primary(): JsonField = primary + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -191,6 +218,7 @@ private constructor( private var region: JsonField? = null private var addressTypes: JsonField>? = null private var line2: JsonField = JsonMissing.of() + private var primary: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -204,6 +232,7 @@ private constructor( addressTypes = legalEntityAddressCreateRequest.addressTypes.map { it.toMutableList() } line2 = legalEntityAddressCreateRequest.line2 + primary = legalEntityAddressCreateRequest.primary additionalProperties = legalEntityAddressCreateRequest.additionalProperties.toMutableMap() } @@ -317,6 +346,27 @@ private constructor( */ fun line2(line2: JsonField) = apply { this.line2 = line2 } + /** Whether this address is the primary address for the legal entity. */ + fun primary(primary: Boolean?) = primary(JsonField.ofNullable(primary)) + + /** + * Alias for [Builder.primary]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun primary(primary: Boolean) = primary(primary as Boolean?) + + /** Alias for calling [Builder.primary] with `primary.orElse(null)`. */ + fun primary(primary: Optional) = primary(primary.getOrNull()) + + /** + * Sets [Builder.primary] to an arbitrary JSON value. + * + * You should usually call [Builder.primary] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun primary(primary: JsonField) = apply { this.primary = primary } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -361,6 +411,7 @@ private constructor( checkRequired("region", region), (addressTypes ?: JsonMissing.of()).map { it.toImmutable() }, line2, + primary, additionalProperties.toMutableMap(), ) } @@ -387,6 +438,7 @@ private constructor( region() addressTypes().ifPresent { it.forEach { it.validate() } } line2() + primary() validated = true } @@ -411,7 +463,8 @@ private constructor( (if (postalCode.asKnown().isPresent) 1 else 0) + (if (region.asKnown().isPresent) 1 else 0) + (addressTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (line2.asKnown().isPresent) 1 else 0) + (if (line2.asKnown().isPresent) 1 else 0) + + (if (primary.asKnown().isPresent) 1 else 0) class AddressType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -589,6 +642,7 @@ private constructor( region == other.region && addressTypes == other.addressTypes && line2 == other.line2 && + primary == other.primary && additionalProperties == other.additionalProperties } @@ -601,6 +655,7 @@ private constructor( region, addressTypes, line2, + primary, additionalProperties, ) } @@ -608,5 +663,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "LegalEntityAddressCreateRequest{country=$country, line1=$line1, locality=$locality, postalCode=$postalCode, region=$region, addressTypes=$addressTypes, line2=$line2, additionalProperties=$additionalProperties}" + "LegalEntityAddressCreateRequest{country=$country, line1=$line1, locality=$locality, postalCode=$postalCode, region=$region, addressTypes=$addressTypes, line2=$line2, primary=$primary, additionalProperties=$additionalProperties}" } diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityCreateParams.kt index 8c382510..3e4e4d6a 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityCreateParams.kt @@ -19,7 +19,6 @@ import com.moderntreasury.api.core.http.QueryParams import com.moderntreasury.api.core.toImmutable import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException import java.time.LocalDate -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -53,7 +52,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun bankSettings(): Optional = body.bankSettings() + fun bankSettings(): Optional = body.bankSettings() /** * A description of the business. @@ -352,7 +351,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = body.wealthAndEmploymentDetails() /** @@ -382,7 +381,7 @@ private constructor( * * Unlike [bankSettings], this method doesn't throw if the JSON field has an unexpected type. */ - fun _bankSettings(): JsonField = body._bankSettings() + fun _bankSettings(): JsonField = body._bankSettings() /** * Returns the raw JSON value of [businessDescription]. @@ -653,7 +652,7 @@ private constructor( * Unlike [wealthAndEmploymentDetails], this method doesn't throw if the JSON field has an * unexpected type. */ - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = body._wealthAndEmploymentDetails() /** @@ -755,22 +754,20 @@ private constructor( body.addAddress(address) } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = apply { - body.bankSettings(bankSettings) - } + fun bankSettings(bankSettings: BankSettings?) = apply { body.bankSettings(bankSettings) } /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed [LegalEntityBankSetting] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { body.bankSettings(bankSettings) } @@ -1505,27 +1502,28 @@ private constructor( body.tickerSymbol(tickerSymbol) } - fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? - ) = apply { body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) } + fun wealthAndEmploymentDetails(wealthAndEmploymentDetails: WealthAndEmploymentDetails?) = + apply { + body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) + } /** * Alias for calling [Builder.wealthAndEmploymentDetails] with * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) } /** The entity's primary website URL. */ @@ -1690,7 +1688,7 @@ private constructor( private constructor( private val legalEntityType: JsonField, private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -1727,7 +1725,7 @@ private constructor( private val thirdPartyVerification: JsonField, private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -1742,7 +1740,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -1849,8 +1847,7 @@ private constructor( tickerSymbol: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = - JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( legalEntityType, @@ -1918,8 +1915,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun bankSettings(): Optional = - bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -2234,7 +2230,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -2272,7 +2268,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -2610,7 +2606,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -2650,7 +2646,7 @@ private constructor( private var legalEntityType: JsonField? = null private var addresses: JsonField>? = null - private var bankSettings: JsonField = JsonMissing.of() + private var bankSettings: JsonField = JsonMissing.of() private var businessDescription: JsonField = JsonMissing.of() private var businessName: JsonField = JsonMissing.of() private var citizenshipCountry: JsonField = JsonMissing.of() @@ -2692,7 +2688,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField = JsonMissing.of() - private var wealthAndEmploymentDetails: JsonField = + private var wealthAndEmploymentDetails: JsonField = JsonMissing.of() private var website: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2792,21 +2788,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed - * [LegalEntityBankSetting] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -3600,7 +3596,7 @@ private constructor( } fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? + wealthAndEmploymentDetails: WealthAndEmploymentDetails? ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** @@ -3608,18 +3604,18 @@ private constructor( * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -4078,227 +4074,73 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityBankSetting + class Document @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val id: JsonField, - private val backupWithholdingPercentage: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, - private val updatedAt: JsonField, + private val documentType: JsonField, + private val fileData: JsonField, + private val filename: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") - @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") + @JsonProperty("document_type") @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") + documentType: JsonField = JsonMissing.of(), + @JsonProperty("file_data") @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") + fileData: JsonField = JsonMissing.of(), + @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), + ) : this(documentType, fileData, filename, mutableMapOf()) /** - * The percentage of backup withholding to apply to the legal entity. + * A category given to the document, can be `null`. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") - - /** * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + fun documentType(): DocumentType = documentType.getRequired("document_type") /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. + * Base64-encoded file content for the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * Cross River Bank specific setting to opt out of privacy policy. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + fun fileData(): String = fileData.getRequired("file_data") /** - * It covers, among other types of insider loans, extensions of credit by a member bank to - * an executive officer, director, or principal shareholder of the member bank; a bank - * holding company of which the member bank is a subsidiary; and any other subsidiary of - * that bank holding company. + * The original filename of the document. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [backupWithholdingPercentage]. - * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [enableBackupWithholding]. - * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + fun filename(): Optional = filename.getOptional("filename") /** - * Returns the raw JSON value of [privacyOptOut]. + * Returns the raw JSON value of [documentType]. * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected + * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("privacy_opt_out") + @JsonProperty("document_type") @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + fun _documentType(): JsonField = documentType /** - * Returns the raw JSON value of [regulationO]. + * Returns the raw JSON value of [fileData]. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("regulation_o") - @ExcludeMissing - fun _regulationO(): JsonField = regulationO + @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData /** - * Returns the raw JSON value of [updatedAt]. + * Returns the raw JSON value of [filename]. * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [filename], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -4315,253 +4157,70 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [LegalEntityBankSetting]. + * Returns a mutable builder for constructing an instance of [Document]. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Document]. */ class Builder internal constructor() { - private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null - private var updatedAt: JsonField? = null + private var documentType: JsonField? = null + private var fileData: JsonField? = null + private var filename: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = legalEntityBankSetting.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) - - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) - - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) - - /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. - * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { - this.backupWithholdingPercentage = backupWithholdingPercentage + internal fun from(document: Document) = apply { + documentType = document.documentType + fileData = document.fileData + filename = document.filename + additionalProperties = document.additionalProperties.toMutableMap() } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + /** A category given to the document, can be `null`. */ + fun documentType(documentType: DocumentType) = documentType(JsonField.of(documentType)) /** - * Sets [Builder.createdAt] to an arbitrary JSON value. + * Sets [Builder.documentType] to an arbitrary JSON value. * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * You should usually call [Builder.documentType] with a well-typed [DocumentType] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) - - /** - * Alias for [Builder.enableBackupWithholding]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) - - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. - */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) - - /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. - * - * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding + fun documentType(documentType: JsonField) = apply { + this.documentType = documentType } - /** - * 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)) + /** Base64-encoded file content for the document. */ + fun fileData(fileData: String) = fileData(JsonField.of(fileData)) /** - * Sets [Builder.liveMode] to an arbitrary JSON value. + * Sets [Builder.fileData] to an arbitrary JSON value. * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * You should usually call [Builder.fileData] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - fun object_(object_: String) = object_(JsonField.of(object_)) + /** The original filename of the document. */ + fun filename(filename: String) = filename(JsonField.of(filename)) /** - * Sets [Builder.object_] to an arbitrary JSON value. + * Sets [Builder.filename] to an arbitrary JSON value. * - * You should usually call [Builder.object_] with a well-typed [String] value instead. + * You should usually call [Builder.filename] with a well-typed [String] value instead. * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) - - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) - - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) - - /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. - * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut - } - - /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) - - /** - * Alias for [Builder.regulationO]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) - - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) - - /** - * Sets [Builder.regulationO] to an arbitrary JSON value. - * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } + fun filename(filename: JsonField) = apply { this.filename = filename } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -4583,38 +4242,23 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [Document]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() + * .documentType() + * .fileData() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( - checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), - checkRequired("updatedAt", updatedAt), + fun build(): Document = + Document( + checkRequired("documentType", documentType), + checkRequired("fileData", fileData), + filename, additionalProperties.toMutableMap(), ) } @@ -4630,300 +4274,14 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): Document = apply { if (validated) { return@apply } - id() - backupWithholdingPercentage() - createdAt() - discardedAt() - enableBackupWithholding() - liveMode() - object_() - privacyOptOut() - regulationO() - updatedAt() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" - } - - class Document - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val documentType: JsonField, - private val fileData: JsonField, - private val filename: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("document_type") - @ExcludeMissing - documentType: JsonField = JsonMissing.of(), - @JsonProperty("file_data") - @ExcludeMissing - fileData: JsonField = JsonMissing.of(), - @JsonProperty("filename") @ExcludeMissing filename: JsonField = JsonMissing.of(), - ) : this(documentType, fileData, filename, mutableMapOf()) - - /** - * A category given to the document, can be `null`. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun documentType(): DocumentType = documentType.getRequired("document_type") - - /** - * Base64-encoded file content for the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileData(): String = fileData.getRequired("file_data") - - /** - * The original filename of the document. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun filename(): Optional = filename.getOptional("filename") - - /** - * Returns the raw JSON value of [documentType]. - * - * Unlike [documentType], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("document_type") - @ExcludeMissing - fun _documentType(): JsonField = documentType - - /** - * Returns the raw JSON value of [fileData]. - * - * Unlike [fileData], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_data") @ExcludeMissing fun _fileData(): JsonField = fileData - - /** - * Returns the raw JSON value of [filename]. - * - * Unlike [filename], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("filename") @ExcludeMissing fun _filename(): JsonField = filename - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Document]. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Document]. */ - class Builder internal constructor() { - - private var documentType: JsonField? = null - private var fileData: JsonField? = null - private var filename: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(document: Document) = apply { - documentType = document.documentType - fileData = document.fileData - filename = document.filename - additionalProperties = document.additionalProperties.toMutableMap() - } - - /** A category given to the document, can be `null`. */ - fun documentType(documentType: DocumentType) = documentType(JsonField.of(documentType)) - - /** - * Sets [Builder.documentType] to an arbitrary JSON value. - * - * You should usually call [Builder.documentType] with a well-typed [DocumentType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun documentType(documentType: JsonField) = apply { - this.documentType = documentType - } - - /** Base64-encoded file content for the document. */ - fun fileData(fileData: String) = fileData(JsonField.of(fileData)) - - /** - * Sets [Builder.fileData] to an arbitrary JSON value. - * - * You should usually call [Builder.fileData] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fileData(fileData: JsonField) = apply { this.fileData = fileData } - - /** The original filename of the document. */ - fun filename(filename: String) = filename(JsonField.of(filename)) - - /** - * Sets [Builder.filename] to an arbitrary JSON value. - * - * You should usually call [Builder.filename] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun filename(filename: JsonField) = apply { this.filename = filename } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Document]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .documentType() - * .fileData() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Document = - Document( - checkRequired("documentType", documentType), - checkRequired("fileData", fileData), - filename, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): Document = apply { - if (validated) { - return@apply - } - - documentType().validate() - fileData() - filename() + documentType().validate() + fileData() + filename() validated = true } @@ -5979,2339 +5337,6 @@ private constructor( override fun toString() = value.toString() } - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) - } - - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IncomeSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") - - @JvmField val MINING = of("mining") - - @JvmField val PERFORMING_ARTS = of("performing_arts") - - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") - - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") - - @JvmField val PUBLISHING = of("publishing") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") - - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") - - @JvmField val RENTAL_SERVICES = of("rental_services") - - @JvmField val RETAIL_CLOTHING = of("retail_clothing") - - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") - - @JvmField val RETAIL_FOOD = of("retail_food") - - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") - - @JvmField val RETAIL_HOME = of("retail_home") - - @JvmField val RETAIL_NON_STORE = of("retail_non_store") - - @JvmField val RETAIL_SPORTING = of("retail_sporting") - - @JvmField val TRANSPORTATION = of("transportation") - - @JvmField val TRAVEL = of("travel") - - @JvmField val UTILITIES = of("utilities") - - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) - } - - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - } - - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Industry && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The occupation of the individual. */ - class Occupation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONSULTING = of("consulting") - - @JvmField val EXECUTIVE = of("executive") - - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") - - @JvmField val FOOD_SERVICES = of("food_services") - - @JvmField val GOVERNMENT = of("government") - - @JvmField val HEALTHCARE = of("healthcare") - - @JvmField val LEGAL_SERVICES = of("legal_services") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val OTHER = of("other") - - @JvmField val SALES = of("sales") - - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") - - @JvmField val TECHNOLOGY = of("technology") - - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } - - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } - - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Occupation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's funds. */ - class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") - - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") - - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") - - @JvmField val INVESTMENT = of("investment") - - @JvmField val INVESTOR_FUNDING = of("investor_funding") - - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") - - @JvmField val LOTTERY = of("lottery") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") - - @JvmField val RETIRED = of("retired") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") - - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") - - @JvmField val TRUST_INCOME = of("trust_income") - - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } - - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } - - /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SourceOfFunds && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS_SALE = of("business_sale") - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val OTHER = of("other") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } - - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WealthSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParams.kt index 25244cb2..23aa0eb3 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParams.kt @@ -19,7 +19,6 @@ import com.moderntreasury.api.core.http.QueryParams import com.moderntreasury.api.core.toImmutable import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException import java.time.LocalDate -import java.time.OffsetDateTime import java.util.Collections import java.util.Objects import java.util.Optional @@ -48,7 +47,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun bankSettings(): Optional = body.bankSettings() + fun bankSettings(): Optional = body.bankSettings() /** * A description of the business. @@ -310,7 +309,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = body.wealthAndEmploymentDetails() /** @@ -333,7 +332,7 @@ private constructor( * * Unlike [bankSettings], this method doesn't throw if the JSON field has an unexpected type. */ - fun _bankSettings(): JsonField = body._bankSettings() + fun _bankSettings(): JsonField = body._bankSettings() /** * Returns the raw JSON value of [businessDescription]. @@ -581,7 +580,7 @@ private constructor( * Unlike [wealthAndEmploymentDetails], this method doesn't throw if the JSON field has an * unexpected type. */ - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = body._wealthAndEmploymentDetails() /** @@ -669,22 +668,20 @@ private constructor( body.addAddress(address) } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = apply { - body.bankSettings(bankSettings) - } + fun bankSettings(bankSettings: BankSettings?) = apply { body.bankSettings(bankSettings) } /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed [LegalEntityBankSetting] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { body.bankSettings(bankSettings) } @@ -1336,27 +1333,28 @@ private constructor( body.tickerSymbol(tickerSymbol) } - fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? - ) = apply { body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) } + fun wealthAndEmploymentDetails(wealthAndEmploymentDetails: WealthAndEmploymentDetails?) = + apply { + body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) + } /** * Alias for calling [Builder.wealthAndEmploymentDetails] with * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { body.wealthAndEmploymentDetails(wealthAndEmploymentDetails) } /** The entity's primary website URL. */ @@ -1520,7 +1518,7 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val addresses: JsonField>, - private val bankSettings: JsonField, + private val bankSettings: JsonField, private val businessDescription: JsonField, private val businessName: JsonField, private val citizenshipCountry: JsonField, @@ -1553,7 +1551,7 @@ private constructor( private val thirdPartyVerification: JsonField, private val thirdPartyVerifications: JsonField>, private val tickerSymbol: JsonField, - private val wealthAndEmploymentDetails: JsonField, + private val wealthAndEmploymentDetails: JsonField, private val website: JsonField, private val additionalProperties: MutableMap, ) { @@ -1565,7 +1563,7 @@ private constructor( addresses: JsonField> = JsonMissing.of(), @JsonProperty("bank_settings") @ExcludeMissing - bankSettings: JsonField = JsonMissing.of(), + bankSettings: JsonField = JsonMissing.of(), @JsonProperty("business_description") @ExcludeMissing businessDescription: JsonField = JsonMissing.of(), @@ -1659,8 +1657,7 @@ private constructor( tickerSymbol: JsonField = JsonMissing.of(), @JsonProperty("wealth_and_employment_details") @ExcludeMissing - wealthAndEmploymentDetails: JsonField = - JsonMissing.of(), + wealthAndEmploymentDetails: JsonField = JsonMissing.of(), @JsonProperty("website") @ExcludeMissing website: JsonField = JsonMissing.of(), ) : this( addresses, @@ -1715,8 +1712,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun bankSettings(): Optional = - bankSettings.getOptional("bank_settings") + fun bankSettings(): Optional = bankSettings.getOptional("bank_settings") /** * A description of the business. @@ -1991,7 +1987,7 @@ private constructor( * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun wealthAndEmploymentDetails(): Optional = + fun wealthAndEmploymentDetails(): Optional = wealthAndEmploymentDetails.getOptional("wealth_and_employment_details") /** @@ -2019,7 +2015,7 @@ private constructor( */ @JsonProperty("bank_settings") @ExcludeMissing - fun _bankSettings(): JsonField = bankSettings + fun _bankSettings(): JsonField = bankSettings /** * Returns the raw JSON value of [businessDescription]. @@ -2327,7 +2323,7 @@ private constructor( */ @JsonProperty("wealth_and_employment_details") @ExcludeMissing - fun _wealthAndEmploymentDetails(): JsonField = + fun _wealthAndEmploymentDetails(): JsonField = wealthAndEmploymentDetails /** @@ -2361,7 +2357,7 @@ private constructor( class Builder internal constructor() { private var addresses: JsonField>? = null - private var bankSettings: JsonField = JsonMissing.of() + private var bankSettings: JsonField = JsonMissing.of() private var businessDescription: JsonField = JsonMissing.of() private var businessName: JsonField = JsonMissing.of() private var citizenshipCountry: JsonField = JsonMissing.of() @@ -2397,7 +2393,7 @@ private constructor( private var thirdPartyVerifications: JsonField>? = null private var tickerSymbol: JsonField = JsonMissing.of() - private var wealthAndEmploymentDetails: JsonField = + private var wealthAndEmploymentDetails: JsonField = JsonMissing.of() private var website: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -2476,21 +2472,21 @@ private constructor( } } - fun bankSettings(bankSettings: LegalEntityBankSetting?) = + fun bankSettings(bankSettings: BankSettings?) = bankSettings(JsonField.ofNullable(bankSettings)) /** Alias for calling [Builder.bankSettings] with `bankSettings.orElse(null)`. */ - fun bankSettings(bankSettings: Optional) = + fun bankSettings(bankSettings: Optional) = bankSettings(bankSettings.getOrNull()) /** * Sets [Builder.bankSettings] to an arbitrary JSON value. * - * You should usually call [Builder.bankSettings] with a well-typed - * [LegalEntityBankSetting] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * You should usually call [Builder.bankSettings] with a well-typed [BankSettings] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun bankSettings(bankSettings: JsonField) = apply { + fun bankSettings(bankSettings: JsonField) = apply { this.bankSettings = bankSettings } @@ -3186,7 +3182,7 @@ private constructor( } fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: LegalEntityWealthEmploymentDetail? + wealthAndEmploymentDetails: WealthAndEmploymentDetails? ) = wealthAndEmploymentDetails(JsonField.ofNullable(wealthAndEmploymentDetails)) /** @@ -3194,18 +3190,18 @@ private constructor( * `wealthAndEmploymentDetails.orElse(null)`. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: Optional + wealthAndEmploymentDetails: Optional ) = wealthAndEmploymentDetails(wealthAndEmploymentDetails.getOrNull()) /** * Sets [Builder.wealthAndEmploymentDetails] to an arbitrary JSON value. * * You should usually call [Builder.wealthAndEmploymentDetails] with a well-typed - * [LegalEntityWealthEmploymentDetail] value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. + * [WealthAndEmploymentDetails] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ fun wealthAndEmploymentDetails( - wealthAndEmploymentDetails: JsonField + wealthAndEmploymentDetails: JsonField ) = apply { this.wealthAndEmploymentDetails = wealthAndEmploymentDetails } /** The entity's primary website URL. */ @@ -3492,489 +3488,351 @@ private constructor( "LegalEntityUpdateRequest{addresses=$addresses, bankSettings=$bankSettings, businessDescription=$businessDescription, businessName=$businessName, citizenshipCountry=$citizenshipCountry, countryOfIncorporation=$countryOfIncorporation, dateFormed=$dateFormed, dateOfBirth=$dateOfBirth, doingBusinessAsNames=$doingBusinessAsNames, email=$email, expectedActivityVolume=$expectedActivityVolume, externalId=$externalId, firstName=$firstName, identifications=$identifications, industryClassifications=$industryClassifications, intendedUse=$intendedUse, lastName=$lastName, legalStructure=$legalStructure, listedExchange=$listedExchange, metadata=$metadata, middleName=$middleName, operatingJurisdictions=$operatingJurisdictions, phoneNumbers=$phoneNumbers, politicallyExposedPerson=$politicallyExposedPerson, preferredName=$preferredName, prefix=$prefix, primarySocialMediaSites=$primarySocialMediaSites, regulators=$regulators, riskRating=$riskRating, serviceProviderLegalEntityId=$serviceProviderLegalEntityId, suffix=$suffix, thirdPartyVerification=$thirdPartyVerification, thirdPartyVerifications=$thirdPartyVerifications, tickerSymbol=$tickerSymbol, wealthAndEmploymentDetails=$wealthAndEmploymentDetails, website=$website, additionalProperties=$additionalProperties}" } - class LegalEntityBankSetting - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val backupWithholdingPercentage: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val enableBackupWithholding: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val privacyOptOut: JsonField, - private val regulationO: JsonField, - private val updatedAt: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - backupWithholdingPercentage: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - enableBackupWithholding: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("privacy_opt_out") - @ExcludeMissing - privacyOptOut: JsonField = JsonMissing.of(), - @JsonProperty("regulation_o") - @ExcludeMissing - regulationO: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - ) : this( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") + /** The business's legal structure. */ + class LegalStructure @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * The percentage of backup withholding to apply to the legal entity. + * Returns this class instance's raw value. * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. */ - fun backupWithholdingPercentage(): Optional = - backupWithholdingPercentage.getOptional("backup_withholding_percentage") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + companion object { - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") + @JvmField val CORPORATION = of("corporation") - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun enableBackupWithholding(): Optional = - enableBackupWithholding.getOptional("enable_backup_withholding") + @JvmField val LLC = of("llc") - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") + @JvmField val NON_PROFIT = of("non_profit") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") + @JvmField val PARTNERSHIP = of("partnership") - /** - * Cross River Bank specific setting to opt out of privacy policy. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun privacyOptOut(): Optional = privacyOptOut.getOptional("privacy_opt_out") + @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - /** - * It covers, among other types of insider loans, extensions of credit by a member bank to - * an executive officer, director, or principal shareholder of the member bank; a bank - * holding company of which the member bank is a subsidiary; and any other subsidiary of - * that bank holding company. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun regulationO(): Optional = regulationO.getOptional("regulation_o") + @JvmField val TRUST = of("trust") - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") + @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) + } - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + /** An enum containing [LegalStructure]'s known values. */ + enum class Known { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, + } /** - * Returns the raw JSON value of [backupWithholdingPercentage]. + * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. * - * Unlike [backupWithholdingPercentage], this method doesn't throw if the JSON field has an - * unexpected type. + * An instance of [LegalStructure] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. */ - @JsonProperty("backup_withholding_percentage") - @ExcludeMissing - fun _backupWithholdingPercentage(): JsonField = backupWithholdingPercentage + enum class Value { + CORPORATION, + LLC, + NON_PROFIT, + PARTNERSHIP, + SOLE_PROPRIETORSHIP, + TRUST, + /** + * An enum member indicating that [LegalStructure] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } /** - * Returns the raw JSON value of [createdAt]. + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt + fun value(): Value = + when (this) { + CORPORATION -> Value.CORPORATION + LLC -> Value.LLC + NON_PROFIT -> Value.NON_PROFIT + PARTNERSHIP -> Value.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP + TRUST -> Value.TRUST + else -> Value._UNKNOWN + } /** - * Returns the raw JSON value of [discardedAt]. + * Returns an enum member corresponding to this class instance's value. * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [enableBackupWithholding]. + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. * - * Unlike [enableBackupWithholding], this method doesn't throw if the JSON field has an - * unexpected type. + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. */ - @JsonProperty("enable_backup_withholding") - @ExcludeMissing - fun _enableBackupWithholding(): JsonField = enableBackupWithholding + fun known(): Known = + when (this) { + CORPORATION -> Known.CORPORATION + LLC -> Known.LLC + NON_PROFIT -> Known.NON_PROFIT + PARTNERSHIP -> Known.PARTNERSHIP + SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP + TRUST -> Known.TRUST + else -> throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") + } /** - * Returns the raw JSON value of [liveMode]. + * Returns this class instance's primitive wire representation. * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } - /** - * Returns the raw JSON value of [privacyOptOut]. - * - * Unlike [privacyOptOut], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("privacy_opt_out") - @ExcludeMissing - fun _privacyOptOut(): JsonField = privacyOptOut + private var validated: Boolean = false /** - * Returns the raw JSON value of [regulationO]. + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. * - * Unlike [regulationO], this method doesn't throw if the JSON field has an unexpected type. + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. */ - @JsonProperty("regulation_o") - @ExcludeMissing - fun _regulationO(): JsonField = regulationO + fun validate(): LegalStructure = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } /** - * Returns the raw JSON value of [updatedAt]. + * Returns a score indicating how many valid values are contained in this object + * recursively. * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + * Used for best match union deserialization. */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LegalStructure && value == other.value } + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Additional data represented as key-value pairs. Both the key and value must be strings. */ + class Metadata + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + fun _additionalProperties(): Map = additionalProperties fun toBuilder() = Builder().from(this) companion object { - /** - * Returns a mutable builder for constructing an instance of [LegalEntityBankSetting]. - * - * The following fields are required: - * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() - * ``` - */ + /** Returns a mutable builder for constructing an instance of [Metadata]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [LegalEntityBankSetting]. */ + /** A builder for [Metadata]. */ class Builder internal constructor() { - private var id: JsonField? = null - private var backupWithholdingPercentage: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var enableBackupWithholding: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var privacyOptOut: JsonField? = null - private var regulationO: JsonField? = null - private var updatedAt: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(legalEntityBankSetting: LegalEntityBankSetting) = apply { - id = legalEntityBankSetting.id - backupWithholdingPercentage = legalEntityBankSetting.backupWithholdingPercentage - createdAt = legalEntityBankSetting.createdAt - discardedAt = legalEntityBankSetting.discardedAt - enableBackupWithholding = legalEntityBankSetting.enableBackupWithholding - liveMode = legalEntityBankSetting.liveMode - object_ = legalEntityBankSetting.object_ - privacyOptOut = legalEntityBankSetting.privacyOptOut - regulationO = legalEntityBankSetting.regulationO - updatedAt = legalEntityBankSetting.updatedAt - additionalProperties = legalEntityBankSetting.additionalProperties.toMutableMap() + internal fun from(metadata: Metadata) = apply { + additionalProperties = metadata.additionalProperties.toMutableMap() } - fun id(id: String) = id(JsonField.of(id)) + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } - /** The percentage of backup withholding to apply to the legal entity. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long?) = - backupWithholdingPercentage(JsonField.ofNullable(backupWithholdingPercentage)) + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - /** - * Alias for [Builder.backupWithholdingPercentage]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Long) = - backupWithholdingPercentage(backupWithholdingPercentage as Long?) + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - /** - * Alias for calling [Builder.backupWithholdingPercentage] with - * `backupWithholdingPercentage.orElse(null)`. - */ - fun backupWithholdingPercentage(backupWithholdingPercentage: Optional) = - backupWithholdingPercentage(backupWithholdingPercentage.getOrNull()) + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } /** - * Sets [Builder.backupWithholdingPercentage] to an arbitrary JSON value. + * Returns an immutable instance of [Metadata]. * - * You should usually call [Builder.backupWithholdingPercentage] with a well-typed - * [Long] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * Further updates to this [Builder] will not mutate the returned instance. */ - fun backupWithholdingPercentage(backupWithholdingPercentage: JsonField) = apply { - this.backupWithholdingPercentage = backupWithholdingPercentage - } + fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + } - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + private var validated: Boolean = false - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Metadata = apply { + if (validated) { + return@apply } - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt + override fun equals(other: Any?): Boolean { + if (this === other) { + return true } - /** - * Whether backup withholding is enabled. See more here - - * https://www.irs.gov/businesses/small-businesses-self-employed/backup-withholding. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean?) = - enableBackupWithholding(JsonField.ofNullable(enableBackupWithholding)) + return other is Metadata && additionalProperties == other.additionalProperties + } - /** - * Alias for [Builder.enableBackupWithholding]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun enableBackupWithholding(enableBackupWithholding: Boolean) = - enableBackupWithholding(enableBackupWithholding as Boolean?) + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - /** - * Alias for calling [Builder.enableBackupWithholding] with - * `enableBackupWithholding.orElse(null)`. - */ - fun enableBackupWithholding(enableBackupWithholding: Optional) = - enableBackupWithholding(enableBackupWithholding.getOrNull()) + override fun hashCode(): Int = hashCode - /** - * Sets [Builder.enableBackupWithholding] to an arbitrary JSON value. - * - * You should usually call [Builder.enableBackupWithholding] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun enableBackupWithholding(enableBackupWithholding: JsonField) = apply { - this.enableBackupWithholding = enableBackupWithholding - } + override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + } - /** - * 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)) + /** A list of phone numbers in E.164 format. */ + class PhoneNumber + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val phoneNumber: JsonField, + private val additionalProperties: MutableMap, + ) { - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + @JsonCreator + private constructor( + @JsonProperty("phone_number") + @ExcludeMissing + phoneNumber: JsonField = JsonMissing.of() + ) : this(phoneNumber, mutableMapOf()) - fun object_(object_: String) = object_(JsonField.of(object_)) + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } + /** + * Returns the raw JSON value of [phoneNumber]. + * + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("phone_number") + @ExcludeMissing + fun _phoneNumber(): JsonField = phoneNumber - /** Cross River Bank specific setting to opt out of privacy policy. */ - fun privacyOptOut(privacyOptOut: Boolean?) = - privacyOptOut(JsonField.ofNullable(privacyOptOut)) + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - /** - * Alias for [Builder.privacyOptOut]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun privacyOptOut(privacyOptOut: Boolean) = privacyOptOut(privacyOptOut as Boolean?) + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - /** Alias for calling [Builder.privacyOptOut] with `privacyOptOut.orElse(null)`. */ - fun privacyOptOut(privacyOptOut: Optional) = - privacyOptOut(privacyOptOut.getOrNull()) + fun toBuilder() = Builder().from(this) - /** - * Sets [Builder.privacyOptOut] to an arbitrary JSON value. - * - * You should usually call [Builder.privacyOptOut] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun privacyOptOut(privacyOptOut: JsonField) = apply { - this.privacyOptOut = privacyOptOut - } + companion object { - /** - * It covers, among other types of insider loans, extensions of credit by a member bank - * to an executive officer, director, or principal shareholder of the member bank; a - * bank holding company of which the member bank is a subsidiary; and any other - * subsidiary of that bank holding company. - */ - fun regulationO(regulationO: Boolean?) = regulationO(JsonField.ofNullable(regulationO)) + /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ + @JvmStatic fun builder() = Builder() + } - /** - * Alias for [Builder.regulationO]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun regulationO(regulationO: Boolean) = regulationO(regulationO as Boolean?) + /** A builder for [PhoneNumber]. */ + class Builder internal constructor() { - /** Alias for calling [Builder.regulationO] with `regulationO.orElse(null)`. */ - fun regulationO(regulationO: Optional) = regulationO(regulationO.getOrNull()) + private var phoneNumber: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() - /** - * Sets [Builder.regulationO] to an arbitrary JSON value. - * - * You should usually call [Builder.regulationO] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun regulationO(regulationO: JsonField) = apply { - this.regulationO = regulationO + @JvmSynthetic + internal fun from(phoneNumber: PhoneNumber) = apply { + this.phoneNumber = phoneNumber.phoneNumber + additionalProperties = phoneNumber.additionalProperties.toMutableMap() } - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. + * Sets [Builder.phoneNumber] to an arbitrary JSON value. * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * You should usually call [Builder.phoneNumber] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber } fun additionalProperties(additionalProperties: Map) = apply { @@ -3997,40 +3855,11 @@ private constructor( } /** - * Returns an immutable instance of [LegalEntityBankSetting]. + * Returns an immutable instance of [PhoneNumber]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .backupWithholdingPercentage() - * .createdAt() - * .discardedAt() - * .enableBackupWithholding() - * .liveMode() - * .object_() - * .privacyOptOut() - * .regulationO() - * .updatedAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ - fun build(): LegalEntityBankSetting = - LegalEntityBankSetting( - checkRequired("id", id), - checkRequired("backupWithholdingPercentage", backupWithholdingPercentage), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("enableBackupWithholding", enableBackupWithholding), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("privacyOptOut", privacyOptOut), - checkRequired("regulationO", regulationO), - checkRequired("updatedAt", updatedAt), - additionalProperties.toMutableMap(), - ) + fun build(): PhoneNumber = PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -4044,21 +3873,12 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): LegalEntityBankSetting = apply { + fun validate(): PhoneNumber = apply { if (validated) { return@apply } - id() - backupWithholdingPercentage() - createdAt() - discardedAt() - enableBackupWithholding() - liveMode() - object_() - privacyOptOut() - regulationO() - updatedAt() + phoneNumber() validated = true } @@ -4076,253 +3896,183 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (backupWithholdingPercentage.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (enableBackupWithholding.asKnown().isPresent) 1 else 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (if (privacyOptOut.asKnown().isPresent) 1 else 0) + - (if (regulationO.asKnown().isPresent) 1 else 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + @JvmSynthetic internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is LegalEntityBankSetting && - id == other.id && - backupWithholdingPercentage == other.backupWithholdingPercentage && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - enableBackupWithholding == other.enableBackupWithholding && - liveMode == other.liveMode && - object_ == other.object_ && - privacyOptOut == other.privacyOptOut && - regulationO == other.regulationO && - updatedAt == other.updatedAt && + return other is PhoneNumber && + phoneNumber == other.phoneNumber && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash( - id, - backupWithholdingPercentage, - createdAt, - discardedAt, - enableBackupWithholding, - liveMode, - object_, - privacyOptOut, - regulationO, - updatedAt, - additionalProperties, - ) - } + private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "LegalEntityBankSetting{id=$id, backupWithholdingPercentage=$backupWithholdingPercentage, createdAt=$createdAt, discardedAt=$discardedAt, enableBackupWithholding=$enableBackupWithholding, liveMode=$liveMode, object_=$object_, privacyOptOut=$privacyOptOut, regulationO=$regulationO, updatedAt=$updatedAt, additionalProperties=$additionalProperties}" + "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" } - /** The business's legal structure. */ - class LegalStructure @JsonCreator private constructor(private val value: JsonField) : - Enum { + class LegalEntityRegulator + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val jurisdiction: JsonField, + private val name: JsonField, + private val registrationNumber: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("jurisdiction") + @ExcludeMissing + jurisdiction: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("registration_number") + @ExcludeMissing + registrationNumber: JsonField = JsonMissing.of(), + ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) /** - * Returns this class instance's raw value. + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., + * "US", "CA", "GB"). * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - companion object { + /** + * Full name of the regulatory body. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun name(): String = name.getRequired("name") - @JvmField val CORPORATION = of("corporation") + /** + * Registration or identification number with the regulator. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - @JvmField val LLC = of("llc") - - @JvmField val NON_PROFIT = of("non_profit") - - @JvmField val PARTNERSHIP = of("partnership") - - @JvmField val SOLE_PROPRIETORSHIP = of("sole_proprietorship") - - @JvmField val TRUST = of("trust") - - @JvmStatic fun of(value: String) = LegalStructure(JsonField.of(value)) - } - - /** An enum containing [LegalStructure]'s known values. */ - enum class Known { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - } - - /** - * An enum containing [LegalStructure]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [LegalStructure] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CORPORATION, - LLC, - NON_PROFIT, - PARTNERSHIP, - SOLE_PROPRIETORSHIP, - TRUST, - /** - * An enum member indicating that [LegalStructure] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CORPORATION -> Value.CORPORATION - LLC -> Value.LLC - NON_PROFIT -> Value.NON_PROFIT - PARTNERSHIP -> Value.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Value.SOLE_PROPRIETORSHIP - TRUST -> Value.TRUST - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CORPORATION -> Known.CORPORATION - LLC -> Known.LLC - NON_PROFIT -> Known.NON_PROFIT - PARTNERSHIP -> Known.PARTNERSHIP - SOLE_PROPRIETORSHIP -> Known.SOLE_PROPRIETORSHIP - TRUST -> Known.TRUST - else -> throw ModernTreasuryInvalidDataException("Unknown LegalStructure: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false + /** + * Returns the raw JSON value of [jurisdiction]. + * + * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("jurisdiction") + @ExcludeMissing + fun _jurisdiction(): JsonField = jurisdiction /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. + * Returns the raw JSON value of [name]. * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. */ - fun validate(): LegalStructure = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns the raw JSON value of [registrationNumber]. * - * Used for best match union deserialization. + * Unlike [registrationNumber], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + @JsonProperty("registration_number") + @ExcludeMissing + fun _registrationNumber(): JsonField = registrationNumber - return other is LegalStructure && value == other.value + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Additional data represented as key-value pairs. Both the key and value must be strings. */ - class Metadata - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - @JsonAnyGetter @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) fun toBuilder() = Builder().from(this) companion object { - /** Returns a mutable builder for constructing an instance of [Metadata]. */ + /** + * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. + * + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` + */ @JvmStatic fun builder() = Builder() } - /** A builder for [Metadata]. */ + /** A builder for [LegalEntityRegulator]. */ class Builder internal constructor() { + private var jurisdiction: JsonField? = null + private var name: JsonField? = null + private var registrationNumber: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(metadata: Metadata) = apply { - additionalProperties = metadata.additionalProperties.toMutableMap() + internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { + jurisdiction = legalEntityRegulator.jurisdiction + name = legalEntityRegulator.name + registrationNumber = legalEntityRegulator.registrationNumber + additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() + } + + /** + * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., + * "US", "CA", "GB"). + */ + fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) + + /** + * Sets [Builder.jurisdiction] to an arbitrary JSON value. + * + * You should usually call [Builder.jurisdiction] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun jurisdiction(jurisdiction: JsonField) = apply { + this.jurisdiction = jurisdiction + } + + /** Full name of the regulatory body. */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** Registration or identification number with the regulator. */ + fun registrationNumber(registrationNumber: String) = + registrationNumber(JsonField.of(registrationNumber)) + + /** + * Sets [Builder.registrationNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.registrationNumber] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun registrationNumber(registrationNumber: JsonField) = apply { + this.registrationNumber = registrationNumber } fun additionalProperties(additionalProperties: Map) = apply { @@ -4345,11 +4095,26 @@ private constructor( } /** - * Returns an immutable instance of [Metadata]. + * Returns an immutable instance of [LegalEntityRegulator]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .jurisdiction() + * .name() + * .registrationNumber() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - fun build(): Metadata = Metadata(additionalProperties.toImmutable()) + fun build(): LegalEntityRegulator = + LegalEntityRegulator( + checkRequired("jurisdiction", jurisdiction), + checkRequired("name", name), + checkRequired("registrationNumber", registrationNumber), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -4363,11 +4128,14 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): Metadata = apply { + fun validate(): LegalEntityRegulator = apply { if (validated) { return@apply } + jurisdiction() + name() + registrationNumber() validated = true } @@ -4387,123 +4155,128 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + (if (jurisdiction.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (registrationNumber.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is Metadata && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + return other is LegalEntityRegulator && + jurisdiction == other.jurisdiction && + name == other.name && + registrationNumber == other.registrationNumber && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) + } override fun hashCode(): Int = hashCode - override fun toString() = "Metadata{additionalProperties=$additionalProperties}" + override fun toString() = + "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" } - /** A list of phone numbers in E.164 format. */ - class PhoneNumber - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val phoneNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("phone_number") - @ExcludeMissing - phoneNumber: JsonField = JsonMissing.of() - ) : this(phoneNumber, mutableMapOf()) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") + /** The risk rating of the legal entity. One of low, medium, high. */ + class RiskRating @JsonCreator private constructor(private val value: JsonField) : Enum { /** - * Returns the raw JSON value of [phoneNumber]. + * Returns this class instance's raw value. * - * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. */ - @JsonProperty("phone_number") - @ExcludeMissing - fun _phoneNumber(): JsonField = phoneNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value companion object { - /** Returns a mutable builder for constructing an instance of [PhoneNumber]. */ - @JvmStatic fun builder() = Builder() - } + @JvmField val LOW = of("low") - /** A builder for [PhoneNumber]. */ - class Builder internal constructor() { + @JvmField val MEDIUM = of("medium") - private var phoneNumber: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() + @JvmField val HIGH = of("high") - @JvmSynthetic - internal fun from(phoneNumber: PhoneNumber) = apply { - this.phoneNumber = phoneNumber.phoneNumber - additionalProperties = phoneNumber.additionalProperties.toMutableMap() - } + @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) + } - fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) + /** An enum containing [RiskRating]'s known values. */ + enum class Known { + LOW, + MEDIUM, + HIGH, + } + /** + * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [RiskRating] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + LOW, + MEDIUM, + HIGH, /** - * Sets [Builder.phoneNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.phoneNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * An enum member indicating that [RiskRating] was instantiated with an unknown value. */ - fun phoneNumber(phoneNumber: JsonField) = apply { - this.phoneNumber = phoneNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + _UNKNOWN, + } - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + LOW -> Value.LOW + MEDIUM -> Value.MEDIUM + HIGH -> Value.HIGH + else -> Value._UNKNOWN } - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + LOW -> Known.LOW + MEDIUM -> Known.MEDIUM + HIGH -> Known.HIGH + else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") } - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") } - /** - * Returns an immutable instance of [PhoneNumber]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): PhoneNumber = PhoneNumber(phoneNumber, additionalProperties.toMutableMap()) - } - private var validated: Boolean = false /** @@ -4515,12 +4288,12 @@ private constructor( * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match * its expected type. */ - fun validate(): PhoneNumber = apply { + fun validate(): RiskRating = apply { if (validated) { return@apply } - phoneNumber() + known() validated = true } @@ -4538,2767 +4311,19 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = (if (phoneNumber.asKnown().isPresent) 1 else 0) + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is PhoneNumber && - phoneNumber == other.phoneNumber && - additionalProperties == other.additionalProperties + return other is RiskRating && value == other.value } - private val hashCode: Int by lazy { Objects.hash(phoneNumber, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "PhoneNumber{phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" - } - - class LegalEntityRegulator - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val jurisdiction: JsonField, - private val name: JsonField, - private val registrationNumber: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("jurisdiction") - @ExcludeMissing - jurisdiction: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("registration_number") - @ExcludeMissing - registrationNumber: JsonField = JsonMissing.of(), - ) : this(jurisdiction, name, registrationNumber, mutableMapOf()) - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., - * "US", "CA", "GB"). - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun jurisdiction(): String = jurisdiction.getRequired("jurisdiction") - - /** - * Full name of the regulatory body. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun name(): String = name.getRequired("name") - - /** - * Registration or identification number with the regulator. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun registrationNumber(): String = registrationNumber.getRequired("registration_number") - - /** - * Returns the raw JSON value of [jurisdiction]. - * - * Unlike [jurisdiction], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("jurisdiction") - @ExcludeMissing - fun _jurisdiction(): JsonField = jurisdiction - - /** - * Returns the raw JSON value of [name]. - * - * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + override fun hashCode() = value.hashCode() - /** - * Returns the raw JSON value of [registrationNumber]. - * - * Unlike [registrationNumber], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("registration_number") - @ExcludeMissing - fun _registrationNumber(): JsonField = registrationNumber - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [LegalEntityRegulator]. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityRegulator]. */ - class Builder internal constructor() { - - private var jurisdiction: JsonField? = null - private var name: JsonField? = null - private var registrationNumber: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(legalEntityRegulator: LegalEntityRegulator) = apply { - jurisdiction = legalEntityRegulator.jurisdiction - name = legalEntityRegulator.name - registrationNumber = legalEntityRegulator.registrationNumber - additionalProperties = legalEntityRegulator.additionalProperties.toMutableMap() - } - - /** - * The country code where the regulator operates in the ISO 3166-1 alpha-2 format (e.g., - * "US", "CA", "GB"). - */ - fun jurisdiction(jurisdiction: String) = jurisdiction(JsonField.of(jurisdiction)) - - /** - * Sets [Builder.jurisdiction] to an arbitrary JSON value. - * - * You should usually call [Builder.jurisdiction] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun jurisdiction(jurisdiction: JsonField) = apply { - this.jurisdiction = jurisdiction - } - - /** Full name of the regulatory body. */ - fun name(name: String) = name(JsonField.of(name)) - - /** - * Sets [Builder.name] to an arbitrary JSON value. - * - * You should usually call [Builder.name] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun name(name: JsonField) = apply { this.name = name } - - /** Registration or identification number with the regulator. */ - fun registrationNumber(registrationNumber: String) = - registrationNumber(JsonField.of(registrationNumber)) - - /** - * Sets [Builder.registrationNumber] to an arbitrary JSON value. - * - * You should usually call [Builder.registrationNumber] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun registrationNumber(registrationNumber: JsonField) = apply { - this.registrationNumber = registrationNumber - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityRegulator]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .jurisdiction() - * .name() - * .registrationNumber() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityRegulator = - LegalEntityRegulator( - checkRequired("jurisdiction", jurisdiction), - checkRequired("name", name), - checkRequired("registrationNumber", registrationNumber), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityRegulator = apply { - if (validated) { - return@apply - } - - jurisdiction() - name() - registrationNumber() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (jurisdiction.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (registrationNumber.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityRegulator && - jurisdiction == other.jurisdiction && - name == other.name && - registrationNumber == other.registrationNumber && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(jurisdiction, name, registrationNumber, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityRegulator{jurisdiction=$jurisdiction, name=$name, registrationNumber=$registrationNumber, additionalProperties=$additionalProperties}" - } - - /** The risk rating of the legal entity. One of low, medium, high. */ - class RiskRating @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val LOW = of("low") - - @JvmField val MEDIUM = of("medium") - - @JvmField val HIGH = of("high") - - @JvmStatic fun of(value: String) = RiskRating(JsonField.of(value)) - } - - /** An enum containing [RiskRating]'s known values. */ - enum class Known { - LOW, - MEDIUM, - HIGH, - } - - /** - * An enum containing [RiskRating]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [RiskRating] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - LOW, - MEDIUM, - HIGH, - /** - * An enum member indicating that [RiskRating] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - LOW -> Value.LOW - MEDIUM -> Value.MEDIUM - HIGH -> Value.HIGH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - LOW -> Known.LOW - MEDIUM -> Known.MEDIUM - HIGH -> Known.HIGH - else -> throw ModernTreasuryInvalidDataException("Unknown RiskRating: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): RiskRating = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RiskRating && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class LegalEntityWealthEmploymentDetail - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val id: JsonField, - private val annualIncome: JsonField, - private val createdAt: JsonField, - private val discardedAt: JsonField, - private val employerCountry: JsonField, - private val employerName: JsonField, - private val employerState: JsonField, - private val employmentStatus: JsonField, - private val incomeCountry: JsonField, - private val incomeSource: JsonField, - private val incomeState: JsonField, - private val industry: JsonField, - private val liveMode: JsonField, - private val object_: JsonField, - private val occupation: JsonField, - private val sourceOfFunds: JsonField, - private val updatedAt: JsonField, - private val wealthSource: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("annual_income") - @ExcludeMissing - annualIncome: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("discarded_at") - @ExcludeMissing - discardedAt: JsonField = JsonMissing.of(), - @JsonProperty("employer_country") - @ExcludeMissing - employerCountry: JsonField = JsonMissing.of(), - @JsonProperty("employer_name") - @ExcludeMissing - employerName: JsonField = JsonMissing.of(), - @JsonProperty("employer_state") - @ExcludeMissing - employerState: JsonField = JsonMissing.of(), - @JsonProperty("employment_status") - @ExcludeMissing - employmentStatus: JsonField = JsonMissing.of(), - @JsonProperty("income_country") - @ExcludeMissing - incomeCountry: JsonField = JsonMissing.of(), - @JsonProperty("income_source") - @ExcludeMissing - incomeSource: JsonField = JsonMissing.of(), - @JsonProperty("income_state") - @ExcludeMissing - incomeState: JsonField = JsonMissing.of(), - @JsonProperty("industry") - @ExcludeMissing - industry: JsonField = JsonMissing.of(), - @JsonProperty("live_mode") - @ExcludeMissing - liveMode: JsonField = JsonMissing.of(), - @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), - @JsonProperty("occupation") - @ExcludeMissing - occupation: JsonField = JsonMissing.of(), - @JsonProperty("source_of_funds") - @ExcludeMissing - sourceOfFunds: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") - @ExcludeMissing - updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("wealth_source") - @ExcludeMissing - wealthSource: JsonField = JsonMissing.of(), - ) : this( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - mutableMapOf(), - ) - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * The annual income of the individual in USD. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun annualIncome(): Optional = annualIncome.getOptional("annual_income") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") - - /** - * The country in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerCountry(): Optional = employerCountry.getOptional("employer_country") - - /** - * The name of the employer. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerName(): Optional = employerName.getOptional("employer_name") - - /** - * The state in which the employer is located. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employerState(): Optional = employerState.getOptional("employer_state") - - /** - * The employment status of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun employmentStatus(): Optional = - employmentStatus.getOptional("employment_status") - - /** - * The country in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") - - /** - * The source of the individual's income. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeSource(): Optional = incomeSource.getOptional("income_source") - - /** - * The state in which the individual's income is earned. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun incomeState(): Optional = incomeState.getOptional("income_state") - - /** - * The industry of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun industry(): Optional = industry.getOptional("industry") - - /** - * This field will be true if this object exists in the live environment or false if it - * exists in the test environment. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun liveMode(): Boolean = liveMode.getRequired("live_mode") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun object_(): String = object_.getRequired("object") - - /** - * The occupation of the individual. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun occupation(): Optional = occupation.getOptional("occupation") - - /** - * The source of the individual's funds. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") - - /** - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") - - /** - * The source of the individual's wealth. - * - * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [annualIncome]. - * - * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("annual_income") - @ExcludeMissing - fun _annualIncome(): JsonField = annualIncome - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [discardedAt]. - * - * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("discarded_at") - @ExcludeMissing - fun _discardedAt(): JsonField = discardedAt - - /** - * Returns the raw JSON value of [employerCountry]. - * - * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_country") - @ExcludeMissing - fun _employerCountry(): JsonField = employerCountry - - /** - * Returns the raw JSON value of [employerName]. - * - * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_name") - @ExcludeMissing - fun _employerName(): JsonField = employerName - - /** - * Returns the raw JSON value of [employerState]. - * - * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employer_state") - @ExcludeMissing - fun _employerState(): JsonField = employerState - - /** - * Returns the raw JSON value of [employmentStatus]. - * - * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("employment_status") - @ExcludeMissing - fun _employmentStatus(): JsonField = employmentStatus - - /** - * Returns the raw JSON value of [incomeCountry]. - * - * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_country") - @ExcludeMissing - fun _incomeCountry(): JsonField = incomeCountry - - /** - * Returns the raw JSON value of [incomeSource]. - * - * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("income_source") - @ExcludeMissing - fun _incomeSource(): JsonField = incomeSource - - /** - * Returns the raw JSON value of [incomeState]. - * - * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("income_state") - @ExcludeMissing - fun _incomeState(): JsonField = incomeState - - /** - * Returns the raw JSON value of [industry]. - * - * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry - - /** - * Returns the raw JSON value of [liveMode]. - * - * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode - - /** - * Returns the raw JSON value of [object_]. - * - * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ - - /** - * Returns the raw JSON value of [occupation]. - * - * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("occupation") - @ExcludeMissing - fun _occupation(): JsonField = occupation - - /** - * Returns the raw JSON value of [sourceOfFunds]. - * - * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("source_of_funds") - @ExcludeMissing - fun _sourceOfFunds(): JsonField = sourceOfFunds - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") - @ExcludeMissing - fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [wealthSource]. - * - * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("wealth_source") - @ExcludeMissing - fun _wealthSource(): JsonField = wealthSource - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [LegalEntityWealthEmploymentDetail]. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LegalEntityWealthEmploymentDetail]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var annualIncome: JsonField? = null - private var createdAt: JsonField? = null - private var discardedAt: JsonField? = null - private var employerCountry: JsonField? = null - private var employerName: JsonField? = null - private var employerState: JsonField? = null - private var employmentStatus: JsonField? = null - private var incomeCountry: JsonField? = null - private var incomeSource: JsonField? = null - private var incomeState: JsonField? = null - private var industry: JsonField? = null - private var liveMode: JsonField? = null - private var object_: JsonField? = null - private var occupation: JsonField? = null - private var sourceOfFunds: JsonField? = null - private var updatedAt: JsonField? = null - private var wealthSource: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - legalEntityWealthEmploymentDetail: LegalEntityWealthEmploymentDetail - ) = apply { - id = legalEntityWealthEmploymentDetail.id - annualIncome = legalEntityWealthEmploymentDetail.annualIncome - createdAt = legalEntityWealthEmploymentDetail.createdAt - discardedAt = legalEntityWealthEmploymentDetail.discardedAt - employerCountry = legalEntityWealthEmploymentDetail.employerCountry - employerName = legalEntityWealthEmploymentDetail.employerName - employerState = legalEntityWealthEmploymentDetail.employerState - employmentStatus = legalEntityWealthEmploymentDetail.employmentStatus - incomeCountry = legalEntityWealthEmploymentDetail.incomeCountry - incomeSource = legalEntityWealthEmploymentDetail.incomeSource - incomeState = legalEntityWealthEmploymentDetail.incomeState - industry = legalEntityWealthEmploymentDetail.industry - liveMode = legalEntityWealthEmploymentDetail.liveMode - object_ = legalEntityWealthEmploymentDetail.object_ - occupation = legalEntityWealthEmploymentDetail.occupation - sourceOfFunds = legalEntityWealthEmploymentDetail.sourceOfFunds - updatedAt = legalEntityWealthEmploymentDetail.updatedAt - wealthSource = legalEntityWealthEmploymentDetail.wealthSource - additionalProperties = - legalEntityWealthEmploymentDetail.additionalProperties.toMutableMap() - } - - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** The annual income of the individual in USD. */ - fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) - - /** - * Alias for [Builder.annualIncome]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) - - /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ - fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) - - /** - * Sets [Builder.annualIncome] to an arbitrary JSON value. - * - * You should usually call [Builder.annualIncome] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun annualIncome(annualIncome: JsonField) = apply { - this.annualIncome = annualIncome - } - - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { - this.createdAt = createdAt - } - - fun discardedAt(discardedAt: OffsetDateTime?) = - discardedAt(JsonField.ofNullable(discardedAt)) - - /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ - fun discardedAt(discardedAt: Optional) = - discardedAt(discardedAt.getOrNull()) - - /** - * Sets [Builder.discardedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun discardedAt(discardedAt: JsonField) = apply { - this.discardedAt = discardedAt - } - - /** The country in which the employer is located. */ - fun employerCountry(employerCountry: String?) = - employerCountry(JsonField.ofNullable(employerCountry)) - - /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ - fun employerCountry(employerCountry: Optional) = - employerCountry(employerCountry.getOrNull()) - - /** - * Sets [Builder.employerCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.employerCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerCountry(employerCountry: JsonField) = apply { - this.employerCountry = employerCountry - } - - /** The name of the employer. */ - fun employerName(employerName: String?) = - employerName(JsonField.ofNullable(employerName)) - - /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ - fun employerName(employerName: Optional) = - employerName(employerName.getOrNull()) - - /** - * Sets [Builder.employerName] to an arbitrary JSON value. - * - * You should usually call [Builder.employerName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerName(employerName: JsonField) = apply { - this.employerName = employerName - } - - /** The state in which the employer is located. */ - fun employerState(employerState: String?) = - employerState(JsonField.ofNullable(employerState)) - - /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ - fun employerState(employerState: Optional) = - employerState(employerState.getOrNull()) - - /** - * Sets [Builder.employerState] to an arbitrary JSON value. - * - * You should usually call [Builder.employerState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun employerState(employerState: JsonField) = apply { - this.employerState = employerState - } - - /** The employment status of the individual. */ - fun employmentStatus(employmentStatus: EmploymentStatus?) = - employmentStatus(JsonField.ofNullable(employmentStatus)) - - /** - * Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. - */ - fun employmentStatus(employmentStatus: Optional) = - employmentStatus(employmentStatus.getOrNull()) - - /** - * Sets [Builder.employmentStatus] to an arbitrary JSON value. - * - * You should usually call [Builder.employmentStatus] with a well-typed - * [EmploymentStatus] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun employmentStatus(employmentStatus: JsonField) = apply { - this.employmentStatus = employmentStatus - } - - /** The country in which the individual's income is earned. */ - fun incomeCountry(incomeCountry: String?) = - incomeCountry(JsonField.ofNullable(incomeCountry)) - - /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ - fun incomeCountry(incomeCountry: Optional) = - incomeCountry(incomeCountry.getOrNull()) - - /** - * Sets [Builder.incomeCountry] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeCountry] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeCountry(incomeCountry: JsonField) = apply { - this.incomeCountry = incomeCountry - } - - /** The source of the individual's income. */ - fun incomeSource(incomeSource: IncomeSource?) = - incomeSource(JsonField.ofNullable(incomeSource)) - - /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ - fun incomeSource(incomeSource: Optional) = - incomeSource(incomeSource.getOrNull()) - - /** - * Sets [Builder.incomeSource] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeSource(incomeSource: JsonField) = apply { - this.incomeSource = incomeSource - } - - /** The state in which the individual's income is earned. */ - fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) - - /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ - fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) - - /** - * Sets [Builder.incomeState] to an arbitrary JSON value. - * - * You should usually call [Builder.incomeState] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun incomeState(incomeState: JsonField) = apply { - this.incomeState = incomeState - } - - /** The industry of the individual. */ - fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) - - /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ - fun industry(industry: Optional) = industry(industry.getOrNull()) - - /** - * Sets [Builder.industry] to an arbitrary JSON value. - * - * You should usually call [Builder.industry] with a well-typed [Industry] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun industry(industry: JsonField) = apply { this.industry = industry } - - /** - * 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)) - - /** - * Sets [Builder.liveMode] to an arbitrary JSON value. - * - * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } - - fun object_(object_: String) = object_(JsonField.of(object_)) - - /** - * Sets [Builder.object_] to an arbitrary JSON value. - * - * You should usually call [Builder.object_] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun object_(object_: JsonField) = apply { this.object_ = object_ } - - /** The occupation of the individual. */ - fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) - - /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ - fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) - - /** - * Sets [Builder.occupation] to an arbitrary JSON value. - * - * You should usually call [Builder.occupation] with a well-typed [Occupation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun occupation(occupation: JsonField) = apply { - this.occupation = occupation - } - - /** The source of the individual's funds. */ - fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = - sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) - - /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ - fun sourceOfFunds(sourceOfFunds: Optional) = - sourceOfFunds(sourceOfFunds.getOrNull()) - - /** - * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. - * - * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun sourceOfFunds(sourceOfFunds: JsonField) = apply { - this.sourceOfFunds = sourceOfFunds - } - - fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun updatedAt(updatedAt: JsonField) = apply { - this.updatedAt = updatedAt - } - - /** The source of the individual's wealth. */ - fun wealthSource(wealthSource: WealthSource?) = - wealthSource(JsonField.ofNullable(wealthSource)) - - /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ - fun wealthSource(wealthSource: Optional) = - wealthSource(wealthSource.getOrNull()) - - /** - * Sets [Builder.wealthSource] to an arbitrary JSON value. - * - * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wealthSource(wealthSource: JsonField) = apply { - this.wealthSource = wealthSource - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [LegalEntityWealthEmploymentDetail]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .annualIncome() - * .createdAt() - * .discardedAt() - * .employerCountry() - * .employerName() - * .employerState() - * .employmentStatus() - * .incomeCountry() - * .incomeSource() - * .incomeState() - * .industry() - * .liveMode() - * .object_() - * .occupation() - * .sourceOfFunds() - * .updatedAt() - * .wealthSource() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LegalEntityWealthEmploymentDetail = - LegalEntityWealthEmploymentDetail( - checkRequired("id", id), - checkRequired("annualIncome", annualIncome), - checkRequired("createdAt", createdAt), - checkRequired("discardedAt", discardedAt), - checkRequired("employerCountry", employerCountry), - checkRequired("employerName", employerName), - checkRequired("employerState", employerState), - checkRequired("employmentStatus", employmentStatus), - checkRequired("incomeCountry", incomeCountry), - checkRequired("incomeSource", incomeSource), - checkRequired("incomeState", incomeState), - checkRequired("industry", industry), - checkRequired("liveMode", liveMode), - checkRequired("object_", object_), - checkRequired("occupation", occupation), - checkRequired("sourceOfFunds", sourceOfFunds), - checkRequired("updatedAt", updatedAt), - checkRequired("wealthSource", wealthSource), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): LegalEntityWealthEmploymentDetail = apply { - if (validated) { - return@apply - } - - id() - annualIncome() - createdAt() - discardedAt() - employerCountry() - employerName() - employerState() - employmentStatus().ifPresent { it.validate() } - incomeCountry() - incomeSource().ifPresent { it.validate() } - incomeState() - industry().ifPresent { it.validate() } - liveMode() - object_() - occupation().ifPresent { it.validate() } - sourceOfFunds().ifPresent { it.validate() } - updatedAt() - wealthSource().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (if (annualIncome.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (discardedAt.asKnown().isPresent) 1 else 0) + - (if (employerCountry.asKnown().isPresent) 1 else 0) + - (if (employerName.asKnown().isPresent) 1 else 0) + - (if (employerState.asKnown().isPresent) 1 else 0) + - (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeCountry.asKnown().isPresent) 1 else 0) + - (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + - (if (incomeState.asKnown().isPresent) 1 else 0) + - (industry.asKnown().getOrNull()?.validity() ?: 0) + - (if (liveMode.asKnown().isPresent) 1 else 0) + - (if (object_.asKnown().isPresent) 1 else 0) + - (occupation.asKnown().getOrNull()?.validity() ?: 0) + - (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (wealthSource.asKnown().getOrNull()?.validity() ?: 0) - - /** The employment status of the individual. */ - class EmploymentStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val EMPLOYED = of("employed") - - @JvmField val RETIRED = of("retired") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val STUDENT = of("student") - - @JvmField val UNEMPLOYED = of("unemployed") - - @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) - } - - /** An enum containing [EmploymentStatus]'s known values. */ - enum class Known { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - } - - /** - * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - EMPLOYED, - RETIRED, - SELF_EMPLOYED, - STUDENT, - UNEMPLOYED, - /** - * An enum member indicating that [EmploymentStatus] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - EMPLOYED -> Value.EMPLOYED - RETIRED -> Value.RETIRED - SELF_EMPLOYED -> Value.SELF_EMPLOYED - STUDENT -> Value.STUDENT - UNEMPLOYED -> Value.UNEMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - EMPLOYED -> Known.EMPLOYED - RETIRED -> Known.RETIRED - SELF_EMPLOYED -> Known.SELF_EMPLOYED - STUDENT -> Known.STUDENT - UNEMPLOYED -> Known.UNEMPLOYED - else -> - throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): EmploymentStatus = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EmploymentStatus && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's income. */ - class IncomeSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) - } - - /** An enum containing [IncomeSource]'s known values. */ - enum class Known { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [IncomeSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [IncomeSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): IncomeSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is IncomeSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The industry of the individual. */ - class Industry @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ACCOUNTING = of("accounting") - - @JvmField val AGRICULTURE = of("agriculture") - - @JvmField val AUTOMOTIVE = of("automotive") - - @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") - - @JvmField val CONSTRUCTION = of("construction") - - @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") - - @JvmField val FOOD_SERVICE = of("food_service") - - @JvmField val FINANCE = of("finance") - - @JvmField val GASOLINE = of("gasoline") - - @JvmField val HEALTH_STORES = of("health_stores") - - @JvmField val LAUNDRY = of("laundry") - - @JvmField val MAINTENANCE = of("maintenance") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") - - @JvmField val MINING = of("mining") - - @JvmField val PERFORMING_ARTS = of("performing_arts") - - @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") - - @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") - - @JvmField val PUBLISHING = of("publishing") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RECREATION_GAMBLING = of("recreation_gambling") - - @JvmField val RELIGIOUS_CHARITY = of("religious_charity") - - @JvmField val RENTAL_SERVICES = of("rental_services") - - @JvmField val RETAIL_CLOTHING = of("retail_clothing") - - @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") - - @JvmField val RETAIL_FOOD = of("retail_food") - - @JvmField val RETAIL_FURNISHING = of("retail_furnishing") - - @JvmField val RETAIL_HOME = of("retail_home") - - @JvmField val RETAIL_NON_STORE = of("retail_non_store") - - @JvmField val RETAIL_SPORTING = of("retail_sporting") - - @JvmField val TRANSPORTATION = of("transportation") - - @JvmField val TRAVEL = of("travel") - - @JvmField val UTILITIES = of("utilities") - - @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) - } - - /** An enum containing [Industry]'s known values. */ - enum class Known { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - } - - /** - * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Industry] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ACCOUNTING, - AGRICULTURE, - AUTOMOTIVE, - CHEMICAL_MANUFACTURING, - CONSTRUCTION, - EDUCATIONAL_MEDICAL, - FOOD_SERVICE, - FINANCE, - GASOLINE, - HEALTH_STORES, - LAUNDRY, - MAINTENANCE, - MANUFACTURING, - MERCHANT_WHOLESALE, - MINING, - PERFORMING_ARTS, - PROFESSIONAL_NON_LEGAL, - PUBLIC_ADMINISTRATION, - PUBLISHING, - REAL_ESTATE, - RECREATION_GAMBLING, - RELIGIOUS_CHARITY, - RENTAL_SERVICES, - RETAIL_CLOTHING, - RETAIL_ELECTRONICS, - RETAIL_FOOD, - RETAIL_FURNISHING, - RETAIL_HOME, - RETAIL_NON_STORE, - RETAIL_SPORTING, - TRANSPORTATION, - TRAVEL, - UTILITIES, - /** - * An enum member indicating that [Industry] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ACCOUNTING -> Value.ACCOUNTING - AGRICULTURE -> Value.AGRICULTURE - AUTOMOTIVE -> Value.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Value.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Value.FOOD_SERVICE - FINANCE -> Value.FINANCE - GASOLINE -> Value.GASOLINE - HEALTH_STORES -> Value.HEALTH_STORES - LAUNDRY -> Value.LAUNDRY - MAINTENANCE -> Value.MAINTENANCE - MANUFACTURING -> Value.MANUFACTURING - MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE - MINING -> Value.MINING - PERFORMING_ARTS -> Value.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION - PUBLISHING -> Value.PUBLISHING - REAL_ESTATE -> Value.REAL_ESTATE - RECREATION_GAMBLING -> Value.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Value.RENTAL_SERVICES - RETAIL_CLOTHING -> Value.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS - RETAIL_FOOD -> Value.RETAIL_FOOD - RETAIL_FURNISHING -> Value.RETAIL_FURNISHING - RETAIL_HOME -> Value.RETAIL_HOME - RETAIL_NON_STORE -> Value.RETAIL_NON_STORE - RETAIL_SPORTING -> Value.RETAIL_SPORTING - TRANSPORTATION -> Value.TRANSPORTATION - TRAVEL -> Value.TRAVEL - UTILITIES -> Value.UTILITIES - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ACCOUNTING -> Known.ACCOUNTING - AGRICULTURE -> Known.AGRICULTURE - AUTOMOTIVE -> Known.AUTOMOTIVE - CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING - CONSTRUCTION -> Known.CONSTRUCTION - EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL - FOOD_SERVICE -> Known.FOOD_SERVICE - FINANCE -> Known.FINANCE - GASOLINE -> Known.GASOLINE - HEALTH_STORES -> Known.HEALTH_STORES - LAUNDRY -> Known.LAUNDRY - MAINTENANCE -> Known.MAINTENANCE - MANUFACTURING -> Known.MANUFACTURING - MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE - MINING -> Known.MINING - PERFORMING_ARTS -> Known.PERFORMING_ARTS - PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL - PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION - PUBLISHING -> Known.PUBLISHING - REAL_ESTATE -> Known.REAL_ESTATE - RECREATION_GAMBLING -> Known.RECREATION_GAMBLING - RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY - RENTAL_SERVICES -> Known.RENTAL_SERVICES - RETAIL_CLOTHING -> Known.RETAIL_CLOTHING - RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS - RETAIL_FOOD -> Known.RETAIL_FOOD - RETAIL_FURNISHING -> Known.RETAIL_FURNISHING - RETAIL_HOME -> Known.RETAIL_HOME - RETAIL_NON_STORE -> Known.RETAIL_NON_STORE - RETAIL_SPORTING -> Known.RETAIL_SPORTING - TRANSPORTATION -> Known.TRANSPORTATION - TRAVEL -> Known.TRAVEL - UTILITIES -> Known.UTILITIES - else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Industry = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Industry && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The occupation of the individual. */ - class Occupation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONSULTING = of("consulting") - - @JvmField val EXECUTIVE = of("executive") - - @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") - - @JvmField val FOOD_SERVICES = of("food_services") - - @JvmField val GOVERNMENT = of("government") - - @JvmField val HEALTHCARE = of("healthcare") - - @JvmField val LEGAL_SERVICES = of("legal_services") - - @JvmField val MANUFACTURING = of("manufacturing") - - @JvmField val OTHER = of("other") - - @JvmField val SALES = of("sales") - - @JvmField val SCIENCE_ENGINEERING = of("science_engineering") - - @JvmField val TECHNOLOGY = of("technology") - - @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) - } - - /** An enum containing [Occupation]'s known values. */ - enum class Known { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - } - - /** - * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Occupation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONSULTING, - EXECUTIVE, - FINANCE_ACCOUNTING, - FOOD_SERVICES, - GOVERNMENT, - HEALTHCARE, - LEGAL_SERVICES, - MANUFACTURING, - OTHER, - SALES, - SCIENCE_ENGINEERING, - TECHNOLOGY, - /** - * An enum member indicating that [Occupation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CONSULTING -> Value.CONSULTING - EXECUTIVE -> Value.EXECUTIVE - FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING - FOOD_SERVICES -> Value.FOOD_SERVICES - GOVERNMENT -> Value.GOVERNMENT - HEALTHCARE -> Value.HEALTHCARE - LEGAL_SERVICES -> Value.LEGAL_SERVICES - MANUFACTURING -> Value.MANUFACTURING - OTHER -> Value.OTHER - SALES -> Value.SALES - SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING - TECHNOLOGY -> Value.TECHNOLOGY - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - CONSULTING -> Known.CONSULTING - EXECUTIVE -> Known.EXECUTIVE - FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING - FOOD_SERVICES -> Known.FOOD_SERVICES - GOVERNMENT -> Known.GOVERNMENT - HEALTHCARE -> Known.HEALTHCARE - LEGAL_SERVICES -> Known.LEGAL_SERVICES - MANUFACTURING -> Known.MANUFACTURING - OTHER -> Known.OTHER - SALES -> Known.SALES - SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING - TECHNOLOGY -> Known.TECHNOLOGY - else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): Occupation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Occupation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's funds. */ - class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val ALIMONY = of("alimony") - - @JvmField val ANNUITY = of("annuity") - - @JvmField val BUSINESS_OWNER = of("business_owner") - - @JvmField val BUSINESS_REVENUE = of("business_revenue") - - @JvmField val DEBT_FINANCING = of("debt_financing") - - @JvmField val GENERAL_EMPLOYEE = of("general_employee") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val HOMEMAKER = of("homemaker") - - @JvmField val INHERITANCE_GIFT = of("inheritance_gift") - - @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") - - @JvmField val INVESTMENT = of("investment") - - @JvmField val INVESTOR_FUNDING = of("investor_funding") - - @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") - - @JvmField val LOTTERY = of("lottery") - - @JvmField val REAL_ESTATE = of("real_estate") - - @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") - - @JvmField val RETIRED = of("retired") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") - - @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmField val SENIOR_EXECUTIVE = of("senior_executive") - - @JvmField val TRUST_INCOME = of("trust_income") - - @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) - } - - /** An enum containing [SourceOfFunds]'s known values. */ - enum class Known { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - } - - /** - * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - ALIMONY, - ANNUITY, - BUSINESS_OWNER, - BUSINESS_REVENUE, - DEBT_FINANCING, - GENERAL_EMPLOYEE, - GOVERNMENT_BENEFITS, - HOMEMAKER, - INHERITANCE_GIFT, - INTERCOMPANY_LOAN, - INVESTMENT, - INVESTOR_FUNDING, - LEGAL_SETTLEMENT, - LOTTERY, - REAL_ESTATE, - RETAINED_EARNINGS_OR_SAVINGS, - RETIRED, - RETIREMENT, - SALARY, - SALE_OF_BUSINESS_ASSETS, - SALE_OF_REAL_ESTATE, - SELF_EMPLOYED, - SENIOR_EXECUTIVE, - TRUST_INCOME, - /** - * An enum member indicating that [SourceOfFunds] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - ALIMONY -> Value.ALIMONY - ANNUITY -> Value.ANNUITY - BUSINESS_OWNER -> Value.BUSINESS_OWNER - BUSINESS_REVENUE -> Value.BUSINESS_REVENUE - DEBT_FINANCING -> Value.DEBT_FINANCING - GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - HOMEMAKER -> Value.HOMEMAKER - INHERITANCE_GIFT -> Value.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN - INVESTMENT -> Value.INVESTMENT - INVESTOR_FUNDING -> Value.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT - LOTTERY -> Value.LOTTERY - REAL_ESTATE -> Value.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Value.RETIRED - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Value.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE - TRUST_INCOME -> Value.TRUST_INCOME - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - ALIMONY -> Known.ALIMONY - ANNUITY -> Known.ANNUITY - BUSINESS_OWNER -> Known.BUSINESS_OWNER - BUSINESS_REVENUE -> Known.BUSINESS_REVENUE - DEBT_FINANCING -> Known.DEBT_FINANCING - GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - HOMEMAKER -> Known.HOMEMAKER - INHERITANCE_GIFT -> Known.INHERITANCE_GIFT - INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN - INVESTMENT -> Known.INVESTMENT - INVESTOR_FUNDING -> Known.INVESTOR_FUNDING - LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT - LOTTERY -> Known.LOTTERY - REAL_ESTATE -> Known.REAL_ESTATE - RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS - RETIRED -> Known.RETIRED - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS - SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE - SELF_EMPLOYED -> Known.SELF_EMPLOYED - SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE - TRUST_INCOME -> Known.TRUST_INCOME - else -> - throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): SourceOfFunds = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SourceOfFunds && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The source of the individual's wealth. */ - class WealthSource @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BUSINESS_SALE = of("business_sale") - - @JvmField val FAMILY_SUPPORT = of("family_support") - - @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") - - @JvmField val INHERITANCE = of("inheritance") - - @JvmField val INVESTMENTS = of("investments") - - @JvmField val OTHER = of("other") - - @JvmField val RENTAL_INCOME = of("rental_income") - - @JvmField val RETIREMENT = of("retirement") - - @JvmField val SALARY = of("salary") - - @JvmField val SELF_EMPLOYED = of("self_employed") - - @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) - } - - /** An enum containing [WealthSource]'s known values. */ - enum class Known { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - } - - /** - * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WealthSource] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BUSINESS_SALE, - FAMILY_SUPPORT, - GOVERNMENT_BENEFITS, - INHERITANCE, - INVESTMENTS, - OTHER, - RENTAL_INCOME, - RETIREMENT, - SALARY, - SELF_EMPLOYED, - /** - * An enum member indicating that [WealthSource] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BUSINESS_SALE -> Value.BUSINESS_SALE - FAMILY_SUPPORT -> Value.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS - INHERITANCE -> Value.INHERITANCE - INVESTMENTS -> Value.INVESTMENTS - OTHER -> Value.OTHER - RENTAL_INCOME -> Value.RENTAL_INCOME - RETIREMENT -> Value.RETIREMENT - SALARY -> Value.SALARY - SELF_EMPLOYED -> Value.SELF_EMPLOYED - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BUSINESS_SALE -> Known.BUSINESS_SALE - FAMILY_SUPPORT -> Known.FAMILY_SUPPORT - GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS - INHERITANCE -> Known.INHERITANCE - INVESTMENTS -> Known.INVESTMENTS - OTHER -> Known.OTHER - RENTAL_INCOME -> Known.RENTAL_INCOME - RETIREMENT -> Known.RETIREMENT - SALARY -> Known.SALARY - SELF_EMPLOYED -> Known.SELF_EMPLOYED - else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws ModernTreasuryInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - ModernTreasuryInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WealthSource = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: ModernTreasuryInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WealthSource && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LegalEntityWealthEmploymentDetail && - id == other.id && - annualIncome == other.annualIncome && - createdAt == other.createdAt && - discardedAt == other.discardedAt && - employerCountry == other.employerCountry && - employerName == other.employerName && - employerState == other.employerState && - employmentStatus == other.employmentStatus && - incomeCountry == other.incomeCountry && - incomeSource == other.incomeSource && - incomeState == other.incomeState && - industry == other.industry && - liveMode == other.liveMode && - object_ == other.object_ && - occupation == other.occupation && - sourceOfFunds == other.sourceOfFunds && - updatedAt == other.updatedAt && - wealthSource == other.wealthSource && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - annualIncome, - createdAt, - discardedAt, - employerCountry, - employerName, - employerState, - employmentStatus, - incomeCountry, - incomeSource, - incomeState, - industry, - liveMode, - object_, - occupation, - sourceOfFunds, - updatedAt, - wealthSource, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LegalEntityWealthEmploymentDetail{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" + override fun toString() = value.toString() } override fun equals(other: Any?): Boolean { diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrder.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrder.kt index 2922cb75..af644c92 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrder.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrder.kt @@ -640,9 +640,8 @@ private constructor( fun transactionIds(): List = transactionIds.getRequired("transaction_ids") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2134,9 +2133,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(JsonField.of(type)) diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateAsyncParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateAsyncParams.kt index 956f82de..1349782d 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateAsyncParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateAsyncParams.kt @@ -61,9 +61,8 @@ private constructor( fun originatingAccountId(): String = body.originatingAccountId() /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -807,9 +806,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = apply { body.type(type) } @@ -1953,9 +1951,8 @@ private constructor( originatingAccountId.getRequired("originating_account_id") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2870,9 +2867,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(JsonField.of(type)) @@ -7099,10 +7095,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -7139,8 +7131,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7175,8 +7165,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7213,8 +7201,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -7249,8 +7235,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -7370,10 +7354,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -7386,26 +7366,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -7428,24 +7398,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7472,24 +7435,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7520,24 +7476,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -7566,24 +7515,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateParams.kt index 7c8cd9e8..6684d58f 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderCreateParams.kt @@ -65,9 +65,8 @@ private constructor( fun originatingAccountId(): String = body.originatingAccountId() /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -835,9 +834,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = apply { body.type(type) } @@ -1896,9 +1894,8 @@ private constructor( originatingAccountId.value.getRequired("originating_account_id") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -2861,9 +2858,8 @@ private constructor( } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(MultipartField.of(type)) @@ -7383,10 +7379,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -7423,8 +7415,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7459,8 +7449,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -7497,8 +7485,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -7533,8 +7519,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -7654,10 +7638,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -7670,26 +7650,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -7712,24 +7682,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7756,24 +7719,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7804,24 +7760,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -7850,24 +7799,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderListParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderListParams.kt index f211f3cf..80e68277 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderListParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderListParams.kt @@ -943,10 +943,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -959,26 +955,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -1001,24 +987,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1045,24 +1024,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1090,24 +1062,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1136,24 +1101,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderSubtype.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderSubtype.kt index ce0397bc..266a1113 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderSubtype.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderSubtype.kt @@ -60,8 +60,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js @JvmField val ETHEREUM = of("ethereum") - @JvmField val HU_ICS = of("hu_ics") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -76,8 +74,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js @JvmField val POLYGON = of("polygon") - @JvmField val RO_SENT = of("ro_sent") - @JvmField val SE_BANKGIROT = of("se_bankgirot") @JvmField val SEPA = of("sepa") @@ -86,8 +82,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js @JvmField val SIC = of("sic") - @JvmField val SKNBI = of("sknbi") - @JvmField val SOLANA = of("solana") @JvmField val ZENGIN = of("zengin") @@ -114,7 +108,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js DK_NETS, EFT, ETHEREUM, - HU_ICS, MASAV, MX_CCEN, NEFT, @@ -122,12 +115,10 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js NZ_BECS, PL_ELIXIR, POLYGON, - RO_SENT, SE_BANKGIROT, SEPA, SG_GIRO, SIC, - SKNBI, SOLANA, ZENGIN, } @@ -159,7 +150,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js DK_NETS, EFT, ETHEREUM, - HU_ICS, MASAV, MX_CCEN, NEFT, @@ -167,12 +157,10 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js NZ_BECS, PL_ELIXIR, POLYGON, - RO_SENT, SE_BANKGIROT, SEPA, SG_GIRO, SIC, - SKNBI, SOLANA, ZENGIN, /** @@ -208,7 +196,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js DK_NETS -> Value.DK_NETS EFT -> Value.EFT ETHEREUM -> Value.ETHEREUM - HU_ICS -> Value.HU_ICS MASAV -> Value.MASAV MX_CCEN -> Value.MX_CCEN NEFT -> Value.NEFT @@ -216,12 +203,10 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js NZ_BECS -> Value.NZ_BECS PL_ELIXIR -> Value.PL_ELIXIR POLYGON -> Value.POLYGON - RO_SENT -> Value.RO_SENT SE_BANKGIROT -> Value.SE_BANKGIROT SEPA -> Value.SEPA SG_GIRO -> Value.SG_GIRO SIC -> Value.SIC - SKNBI -> Value.SKNBI SOLANA -> Value.SOLANA ZENGIN -> Value.ZENGIN else -> Value._UNKNOWN @@ -255,7 +240,6 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js DK_NETS -> Known.DK_NETS EFT -> Known.EFT ETHEREUM -> Known.ETHEREUM - HU_ICS -> Known.HU_ICS MASAV -> Known.MASAV MX_CCEN -> Known.MX_CCEN NEFT -> Known.NEFT @@ -263,12 +247,10 @@ class PaymentOrderSubtype @JsonCreator private constructor(private val value: Js NZ_BECS -> Known.NZ_BECS PL_ELIXIR -> Known.PL_ELIXIR POLYGON -> Known.POLYGON - RO_SENT -> Known.RO_SENT SE_BANKGIROT -> Known.SE_BANKGIROT SEPA -> Known.SEPA SG_GIRO -> Known.SG_GIRO SIC -> Known.SIC - SKNBI -> Known.SKNBI SOLANA -> Known.SOLANA ZENGIN -> Known.ZENGIN else -> throw ModernTreasuryInvalidDataException("Unknown PaymentOrderSubtype: $value") diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderType.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderType.kt index 33fcf9b7..40d097a3 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderType.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderType.kt @@ -8,9 +8,8 @@ import com.moderntreasury.api.core.JsonField import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, + * `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ class PaymentOrderType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -48,10 +47,6 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -64,26 +59,16 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -106,24 +91,17 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -150,24 +128,17 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -197,24 +168,17 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -243,24 +207,17 @@ class PaymentOrderType @JsonCreator private constructor(private val value: JsonF DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderUpdateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderUpdateParams.kt index 4a567d83..62a7852a 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderUpdateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/PaymentOrderUpdateParams.kt @@ -322,9 +322,8 @@ private constructor( fun subtype(): Optional = body.subtype() /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, - * `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `signet`, - * `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -1319,9 +1318,8 @@ private constructor( fun subtype(subtype: JsonField) = apply { body.subtype(subtype) } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = apply { body.type(type) } @@ -2076,9 +2074,8 @@ private constructor( fun subtype(): Optional = subtype.getOptional("subtype") /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -3204,9 +3201,8 @@ private constructor( fun subtype(subtype: JsonField) = apply { this.subtype = subtype } /** - * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, - * `bacs`, `au_becs`, `interac`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, - * `signet`, `provexchange`, `zengin`. + * One of `ach`, `se_bankgirot`, `eft`, `wire`, `check`, `book`, `rtp`, `sepa`, `bacs`, + * `au_becs`, `neft`, `nics`, `nz_national_clearing_code`, `sic`, `zengin`. */ fun type(type: PaymentOrderType) = type(JsonField.of(type)) @@ -6759,10 +6755,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -6799,8 +6791,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -6835,8 +6825,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -6873,8 +6861,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -6909,8 +6895,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -7030,10 +7014,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -7046,26 +7026,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -7088,24 +7058,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7132,24 +7095,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -7180,24 +7136,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -7226,24 +7175,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReconciliationRule.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReconciliationRule.kt index 23944ec9..277debee 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReconciliationRule.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReconciliationRule.kt @@ -155,8 +155,7 @@ private constructor( fun dateUpperBound(): Optional = dateUpperBound.getOptional("date_upper_bound") /** - * One of ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet - * wire + * One of ach, au_becs, bacs, book, check, eft, rtp, sepa, wire * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -463,10 +462,7 @@ private constructor( this.dateUpperBound = dateUpperBound } - /** - * One of ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet - * wire - */ + /** One of ach, au_becs, bacs, book, check, eft, rtp, sepa, wire */ fun type(type: Type?) = type(JsonField.ofNullable(type)) /** Alias for calling [Builder.type] with `type.orElse(null)`. */ @@ -835,10 +831,7 @@ private constructor( override fun toString() = "CustomIdentifiers{additionalProperties=$additionalProperties}" } - /** - * One of ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet - * wire - */ + /** One of ach, au_becs, bacs, book, check, eft, rtp, sepa, wire */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -875,10 +868,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -891,26 +880,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -933,24 +912,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -977,24 +949,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1022,24 +987,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1068,24 +1026,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReturnObject.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReturnObject.kt index 62264e59..fbadfc96 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReturnObject.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ReturnObject.kt @@ -334,8 +334,8 @@ private constructor( transactionLineItemId.getOptional("transaction_line_item_id") /** - * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `interac`, - * `manual`, `paper_item`, `wire`. + * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `manual`, + * `paper_item`, `wire`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1086,8 +1086,8 @@ private constructor( } /** - * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `interac`, - * `manual`, `paper_item`, `wire`. + * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `manual`, + * `paper_item`, `wire`. */ fun type(type: Type) = type(JsonField.of(type)) @@ -4192,8 +4192,8 @@ private constructor( } /** - * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `interac`, - * `manual`, `paper_item`, `wire`. + * The type of return. Can be one of: `ach`, `ach_noc`, `au_becs`, `bacs`, `eft`, `manual`, + * `paper_item`, `wire`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -4227,12 +4227,18 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val INTERAC = of("interac") - @JvmField val MANUAL = of("manual") + @JvmField val NEFT = of("neft") + + @JvmField val NZ_BECS = of("nz_becs") + + @JvmField val RTP = of("rtp") + @JvmField val SEPA = of("sepa") + @JvmField val STABLECOIN = of("stablecoin") + @JvmField val WIRE = of("wire") @JvmField val ZENGIN = of("zengin") @@ -4251,9 +4257,12 @@ private constructor( CROSS_BORDER, EFT, GB_FPS, - INTERAC, MANUAL, + NEFT, + NZ_BECS, + RTP, SEPA, + STABLECOIN, WIRE, ZENGIN, } @@ -4277,9 +4286,12 @@ private constructor( CROSS_BORDER, EFT, GB_FPS, - INTERAC, MANUAL, + NEFT, + NZ_BECS, + RTP, SEPA, + STABLECOIN, WIRE, ZENGIN, /** An enum member indicating that [Type] was instantiated with an unknown value. */ @@ -4304,9 +4316,12 @@ private constructor( CROSS_BORDER -> Value.CROSS_BORDER EFT -> Value.EFT GB_FPS -> Value.GB_FPS - INTERAC -> Value.INTERAC MANUAL -> Value.MANUAL + NEFT -> Value.NEFT + NZ_BECS -> Value.NZ_BECS + RTP -> Value.RTP SEPA -> Value.SEPA + STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN else -> Value._UNKNOWN @@ -4332,9 +4347,12 @@ private constructor( CROSS_BORDER -> Known.CROSS_BORDER EFT -> Known.EFT GB_FPS -> Known.GB_FPS - INTERAC -> Known.INTERAC MANUAL -> Known.MANUAL + NEFT -> Known.NEFT + NZ_BECS -> Known.NZ_BECS + RTP -> Known.RTP SEPA -> Known.SEPA + STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN else -> throw ModernTreasuryInvalidDataException("Unknown Type: $value") diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetail.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetail.kt index 2f15a07d..5d9f1da9 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetail.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetail.kt @@ -625,10 +625,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -641,26 +637,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -683,24 +669,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -727,24 +706,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -774,24 +746,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -820,24 +785,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -944,10 +902,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -984,8 +938,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -1018,8 +970,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -1056,8 +1006,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -1092,8 +1040,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetailCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetailCreateParams.kt index f01e2263..adf83213 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetailCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingDetailCreateParams.kt @@ -672,10 +672,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -712,8 +708,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -746,8 +740,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -784,8 +776,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -820,8 +810,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -941,10 +929,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -957,26 +941,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -999,24 +973,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1043,24 +1010,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1090,24 +1050,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1136,24 +1089,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequest.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequest.kt index b0c7c9f5..93283ce9 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequest.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequest.kt @@ -738,10 +738,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -754,26 +750,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -796,24 +782,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -841,24 +820,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -889,24 +861,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -935,24 +900,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/Transaction.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/Transaction.kt index 53a1ff9f..686cbbdf 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/Transaction.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/Transaction.kt @@ -269,8 +269,8 @@ private constructor( fun reconciled(): Boolean = reconciled.getRequired("reconciled") /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, - * or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -295,7 +295,7 @@ private constructor( /** * 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. + * `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -893,8 +893,8 @@ private constructor( fun reconciled(reconciled: JsonField) = apply { this.reconciled = reconciled } /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. */ fun type(type: Type) = type(JsonField.of(type)) @@ -938,8 +938,7 @@ private constructor( /** * 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. + * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. */ fun vendorCodeType(vendorCodeType: VendorCodeType?) = vendorCodeType(JsonField.ofNullable(vendorCodeType)) @@ -1422,8 +1421,8 @@ private constructor( } /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, - * or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1461,10 +1460,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -1477,26 +1472,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -1521,24 +1506,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1566,24 +1544,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1612,24 +1583,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1659,24 +1623,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN @@ -1750,7 +1707,7 @@ private constructor( /** * 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. + * `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. */ class VendorCodeType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1809,8 +1766,6 @@ private constructor( @JvmField val PNC = of("pnc") - @JvmField val SIGNET = of("signet") - @JvmField val SILVERGATE = of("silvergate") @JvmField val SWIFT = of("swift") @@ -1847,7 +1802,6 @@ private constructor( PAXOS, PAYPAL, PNC, - SIGNET, SILVERGATE, SWIFT, US_BANK, @@ -1886,7 +1840,6 @@ private constructor( PAXOS, PAYPAL, PNC, - SIGNET, SILVERGATE, SWIFT, US_BANK, @@ -1929,7 +1882,6 @@ private constructor( PAXOS -> Value.PAXOS PAYPAL -> Value.PAYPAL PNC -> Value.PNC - SIGNET -> Value.SIGNET SILVERGATE -> Value.SILVERGATE SWIFT -> Value.SWIFT US_BANK -> Value.US_BANK @@ -1970,7 +1922,6 @@ private constructor( PAXOS -> Known.PAXOS PAYPAL -> Known.PAYPAL PNC -> Known.PNC - SIGNET -> Known.SIGNET SILVERGATE -> Known.SILVERGATE SWIFT -> Known.SWIFT US_BANK -> Known.US_BANK diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/TransactionCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/TransactionCreateParams.kt index cc609203..c6fa3e43 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/TransactionCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/TransactionCreateParams.kt @@ -75,7 +75,7 @@ private constructor( /** * 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. + * `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -99,8 +99,8 @@ private constructor( fun posted(): Optional = body.posted() /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, - * or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). @@ -335,8 +335,7 @@ private constructor( /** * 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. + * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. */ fun vendorCodeType(vendorCodeType: String?) = apply { body.vendorCodeType(vendorCodeType) } @@ -381,8 +380,8 @@ private constructor( fun posted(posted: JsonField) = apply { body.posted(posted) } /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. */ fun type(type: Type?) = apply { body.type(type) } @@ -693,8 +692,7 @@ private constructor( /** * 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. + * `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, `us_bank`, or others. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -718,8 +716,8 @@ private constructor( fun posted(): Optional = posted.getOptional("posted") /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. * * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -975,7 +973,7 @@ private constructor( /** * 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`, + * `evolve`, `goldman_sachs`, `iso20022`, `jpmc`, `mx`, `silvergate`, `swift`, * `us_bank`, or others. */ fun vendorCodeType(vendorCodeType: String?) = @@ -1025,7 +1023,7 @@ private constructor( /** * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, - * `book`, or `sen`. + * or `book`. */ fun type(type: Type?) = type(JsonField.ofNullable(type)) @@ -1350,8 +1348,8 @@ private constructor( } /** - * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, `book`, - * or `sen`. + * The type of the transaction. Examples could be `card, `ach`, `wire`, `check`, `rtp`, or + * `book`. */ class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1389,10 +1387,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -1405,26 +1399,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -1449,24 +1433,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1494,24 +1471,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -1540,24 +1510,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -1587,24 +1550,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ValidationValidateRoutingNumberParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ValidationValidateRoutingNumberParams.kt index df7ed65c..cb9e764a 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ValidationValidateRoutingNumberParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/ValidationValidateRoutingNumberParams.kt @@ -257,10 +257,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -297,8 +293,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -331,8 +325,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -369,8 +361,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -405,8 +395,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/VirtualAccountCreateParams.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/VirtualAccountCreateParams.kt index e7be514b..744877b7 100644 --- a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/VirtualAccountCreateParams.kt +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/VirtualAccountCreateParams.kt @@ -2057,10 +2057,6 @@ private constructor( @JvmField val HK_INTERBANK_CLEARING_CODE = of("hk_interbank_clearing_code") - @JvmField val HU_INTERBANK_CLEARING_CODE = of("hu_interbank_clearing_code") - - @JvmField val ID_SKNBI_CODE = of("id_sknbi_code") - @JvmField val IL_BANK_CODE = of("il_bank_code") @JvmField val IN_IFSC = of("in_ifsc") @@ -2097,8 +2093,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2132,8 +2126,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE, GB_SORT_CODE, HK_INTERBANK_CLEARING_CODE, - HU_INTERBANK_CLEARING_CODE, - ID_SKNBI_CODE, IL_BANK_CODE, IN_IFSC, JP_ZENGIN_CODE, @@ -2170,8 +2162,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Value.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Value.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Value.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Value.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Value.ID_SKNBI_CODE IL_BANK_CODE -> Value.IL_BANK_CODE IN_IFSC -> Value.IN_IFSC JP_ZENGIN_CODE -> Value.JP_ZENGIN_CODE @@ -2206,8 +2196,6 @@ private constructor( DK_INTERBANK_CLEARING_CODE -> Known.DK_INTERBANK_CLEARING_CODE GB_SORT_CODE -> Known.GB_SORT_CODE HK_INTERBANK_CLEARING_CODE -> Known.HK_INTERBANK_CLEARING_CODE - HU_INTERBANK_CLEARING_CODE -> Known.HU_INTERBANK_CLEARING_CODE - ID_SKNBI_CODE -> Known.ID_SKNBI_CODE IL_BANK_CODE -> Known.IL_BANK_CODE IN_IFSC -> Known.IN_IFSC JP_ZENGIN_CODE -> Known.JP_ZENGIN_CODE @@ -2330,10 +2318,6 @@ private constructor( @JvmField val GB_FPS = of("gb_fps") - @JvmField val HU_ICS = of("hu_ics") - - @JvmField val INTERAC = of("interac") - @JvmField val MASAV = of("masav") @JvmField val MX_CCEN = of("mx_ccen") @@ -2346,26 +2330,16 @@ private constructor( @JvmField val PL_ELIXIR = of("pl_elixir") - @JvmField val PROVXCHANGE = of("provxchange") - - @JvmField val RO_SENT = of("ro_sent") - @JvmField val RTP = of("rtp") @JvmField val SE_BANKGIROT = of("se_bankgirot") - @JvmField val SEN = of("sen") - @JvmField val SEPA = of("sepa") @JvmField val SG_GIRO = of("sg_giro") @JvmField val SIC = of("sic") - @JvmField val SIGNET = of("signet") - - @JvmField val SKNBI = of("sknbi") - @JvmField val STABLECOIN = of("stablecoin") @JvmField val WIRE = of("wire") @@ -2388,24 +2362,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2432,24 +2399,17 @@ private constructor( DK_NETS, EFT, GB_FPS, - 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, STABLECOIN, WIRE, ZENGIN, @@ -2480,24 +2440,17 @@ private constructor( DK_NETS -> Value.DK_NETS EFT -> Value.EFT GB_FPS -> Value.GB_FPS - 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 STABLECOIN -> Value.STABLECOIN WIRE -> Value.WIRE ZENGIN -> Value.ZENGIN @@ -2526,24 +2479,17 @@ private constructor( DK_NETS -> Known.DK_NETS EFT -> Known.EFT GB_FPS -> Known.GB_FPS - 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 STABLECOIN -> Known.STABLECOIN WIRE -> Known.WIRE ZENGIN -> Known.ZENGIN diff --git a/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetails.kt b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetails.kt new file mode 100644 index 00000000..ea592110 --- /dev/null +++ b/modern-treasury-java-core/src/main/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetails.kt @@ -0,0 +1,2302 @@ +// 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.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.checkRequired +import com.moderntreasury.api.errors.ModernTreasuryInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class WealthAndEmploymentDetails +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val id: JsonField, + private val annualIncome: JsonField, + private val createdAt: JsonField, + private val discardedAt: JsonField, + private val employerCountry: JsonField, + private val employerName: JsonField, + private val employerState: JsonField, + private val employmentStatus: JsonField, + private val incomeCountry: JsonField, + private val incomeSource: JsonField, + private val incomeState: JsonField, + private val industry: JsonField, + private val liveMode: JsonField, + private val object_: JsonField, + private val occupation: JsonField, + private val sourceOfFunds: JsonField, + private val updatedAt: JsonField, + private val wealthSource: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), + @JsonProperty("annual_income") + @ExcludeMissing + annualIncome: JsonField = JsonMissing.of(), + @JsonProperty("created_at") + @ExcludeMissing + createdAt: JsonField = JsonMissing.of(), + @JsonProperty("discarded_at") + @ExcludeMissing + discardedAt: JsonField = JsonMissing.of(), + @JsonProperty("employer_country") + @ExcludeMissing + employerCountry: JsonField = JsonMissing.of(), + @JsonProperty("employer_name") + @ExcludeMissing + employerName: JsonField = JsonMissing.of(), + @JsonProperty("employer_state") + @ExcludeMissing + employerState: JsonField = JsonMissing.of(), + @JsonProperty("employment_status") + @ExcludeMissing + employmentStatus: JsonField = JsonMissing.of(), + @JsonProperty("income_country") + @ExcludeMissing + incomeCountry: JsonField = JsonMissing.of(), + @JsonProperty("income_source") + @ExcludeMissing + incomeSource: JsonField = JsonMissing.of(), + @JsonProperty("income_state") + @ExcludeMissing + incomeState: JsonField = JsonMissing.of(), + @JsonProperty("industry") @ExcludeMissing industry: JsonField = JsonMissing.of(), + @JsonProperty("live_mode") @ExcludeMissing liveMode: JsonField = JsonMissing.of(), + @JsonProperty("object") @ExcludeMissing object_: JsonField = JsonMissing.of(), + @JsonProperty("occupation") + @ExcludeMissing + occupation: JsonField = JsonMissing.of(), + @JsonProperty("source_of_funds") + @ExcludeMissing + sourceOfFunds: JsonField = JsonMissing.of(), + @JsonProperty("updated_at") + @ExcludeMissing + updatedAt: JsonField = JsonMissing.of(), + @JsonProperty("wealth_source") + @ExcludeMissing + wealthSource: JsonField = JsonMissing.of(), + ) : this( + id, + annualIncome, + createdAt, + discardedAt, + employerCountry, + employerName, + employerState, + employmentStatus, + incomeCountry, + incomeSource, + incomeState, + industry, + liveMode, + object_, + occupation, + sourceOfFunds, + updatedAt, + wealthSource, + mutableMapOf(), + ) + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun id(): String = id.getRequired("id") + + /** + * The annual income of the individual in USD. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun annualIncome(): Optional = annualIncome.getOptional("annual_income") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun discardedAt(): Optional = discardedAt.getOptional("discarded_at") + + /** + * The country in which the employer is located. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun employerCountry(): Optional = employerCountry.getOptional("employer_country") + + /** + * The name of the employer. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun employerName(): Optional = employerName.getOptional("employer_name") + + /** + * The state in which the employer is located. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun employerState(): Optional = employerState.getOptional("employer_state") + + /** + * The employment status of the individual. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun employmentStatus(): Optional = + employmentStatus.getOptional("employment_status") + + /** + * The country in which the individual's income is earned. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun incomeCountry(): Optional = incomeCountry.getOptional("income_country") + + /** + * The source of the individual's income. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun incomeSource(): Optional = incomeSource.getOptional("income_source") + + /** + * The state in which the individual's income is earned. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun incomeState(): Optional = incomeState.getOptional("income_state") + + /** + * The industry of the individual. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun industry(): Optional = industry.getOptional("industry") + + /** + * This field will be true if this object exists in the live environment or false if it exists + * in the test environment. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun liveMode(): Boolean = liveMode.getRequired("live_mode") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun object_(): String = object_.getRequired("object") + + /** + * The occupation of the individual. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun occupation(): Optional = occupation.getOptional("occupation") + + /** + * The source of the individual's funds. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun sourceOfFunds(): Optional = sourceOfFunds.getOptional("source_of_funds") + + /** + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") + + /** + * The source of the individual's wealth. + * + * @throws ModernTreasuryInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun wealthSource(): Optional = wealthSource.getOptional("wealth_source") + + /** + * Returns the raw JSON value of [id]. + * + * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id + + /** + * Returns the raw JSON value of [annualIncome]. + * + * Unlike [annualIncome], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("annual_income") + @ExcludeMissing + fun _annualIncome(): JsonField = annualIncome + + /** + * Returns the raw JSON value of [createdAt]. + * + * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created_at") + @ExcludeMissing + fun _createdAt(): JsonField = createdAt + + /** + * Returns the raw JSON value of [discardedAt]. + * + * Unlike [discardedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("discarded_at") + @ExcludeMissing + fun _discardedAt(): JsonField = discardedAt + + /** + * Returns the raw JSON value of [employerCountry]. + * + * Unlike [employerCountry], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("employer_country") + @ExcludeMissing + fun _employerCountry(): JsonField = employerCountry + + /** + * Returns the raw JSON value of [employerName]. + * + * Unlike [employerName], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("employer_name") + @ExcludeMissing + fun _employerName(): JsonField = employerName + + /** + * Returns the raw JSON value of [employerState]. + * + * Unlike [employerState], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("employer_state") + @ExcludeMissing + fun _employerState(): JsonField = employerState + + /** + * Returns the raw JSON value of [employmentStatus]. + * + * Unlike [employmentStatus], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("employment_status") + @ExcludeMissing + fun _employmentStatus(): JsonField = employmentStatus + + /** + * Returns the raw JSON value of [incomeCountry]. + * + * Unlike [incomeCountry], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("income_country") + @ExcludeMissing + fun _incomeCountry(): JsonField = incomeCountry + + /** + * Returns the raw JSON value of [incomeSource]. + * + * Unlike [incomeSource], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("income_source") + @ExcludeMissing + fun _incomeSource(): JsonField = incomeSource + + /** + * Returns the raw JSON value of [incomeState]. + * + * Unlike [incomeState], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("income_state") + @ExcludeMissing + fun _incomeState(): JsonField = incomeState + + /** + * Returns the raw JSON value of [industry]. + * + * Unlike [industry], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("industry") @ExcludeMissing fun _industry(): JsonField = industry + + /** + * Returns the raw JSON value of [liveMode]. + * + * Unlike [liveMode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("live_mode") @ExcludeMissing fun _liveMode(): JsonField = liveMode + + /** + * Returns the raw JSON value of [object_]. + * + * Unlike [object_], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("object") @ExcludeMissing fun _object_(): JsonField = object_ + + /** + * Returns the raw JSON value of [occupation]. + * + * Unlike [occupation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("occupation") + @ExcludeMissing + fun _occupation(): JsonField = occupation + + /** + * Returns the raw JSON value of [sourceOfFunds]. + * + * Unlike [sourceOfFunds], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("source_of_funds") + @ExcludeMissing + fun _sourceOfFunds(): JsonField = sourceOfFunds + + /** + * Returns the raw JSON value of [updatedAt]. + * + * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated_at") + @ExcludeMissing + fun _updatedAt(): JsonField = updatedAt + + /** + * Returns the raw JSON value of [wealthSource]. + * + * Unlike [wealthSource], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("wealth_source") + @ExcludeMissing + fun _wealthSource(): JsonField = wealthSource + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [WealthAndEmploymentDetails]. + * + * The following fields are required: + * ```java + * .id() + * .annualIncome() + * .createdAt() + * .discardedAt() + * .employerCountry() + * .employerName() + * .employerState() + * .employmentStatus() + * .incomeCountry() + * .incomeSource() + * .incomeState() + * .industry() + * .liveMode() + * .object_() + * .occupation() + * .sourceOfFunds() + * .updatedAt() + * .wealthSource() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [WealthAndEmploymentDetails]. */ + class Builder internal constructor() { + + private var id: JsonField? = null + private var annualIncome: JsonField? = null + private var createdAt: JsonField? = null + private var discardedAt: JsonField? = null + private var employerCountry: JsonField? = null + private var employerName: JsonField? = null + private var employerState: JsonField? = null + private var employmentStatus: JsonField? = null + private var incomeCountry: JsonField? = null + private var incomeSource: JsonField? = null + private var incomeState: JsonField? = null + private var industry: JsonField? = null + private var liveMode: JsonField? = null + private var object_: JsonField? = null + private var occupation: JsonField? = null + private var sourceOfFunds: JsonField? = null + private var updatedAt: JsonField? = null + private var wealthSource: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(wealthAndEmploymentDetails: WealthAndEmploymentDetails) = apply { + id = wealthAndEmploymentDetails.id + annualIncome = wealthAndEmploymentDetails.annualIncome + createdAt = wealthAndEmploymentDetails.createdAt + discardedAt = wealthAndEmploymentDetails.discardedAt + employerCountry = wealthAndEmploymentDetails.employerCountry + employerName = wealthAndEmploymentDetails.employerName + employerState = wealthAndEmploymentDetails.employerState + employmentStatus = wealthAndEmploymentDetails.employmentStatus + incomeCountry = wealthAndEmploymentDetails.incomeCountry + incomeSource = wealthAndEmploymentDetails.incomeSource + incomeState = wealthAndEmploymentDetails.incomeState + industry = wealthAndEmploymentDetails.industry + liveMode = wealthAndEmploymentDetails.liveMode + object_ = wealthAndEmploymentDetails.object_ + occupation = wealthAndEmploymentDetails.occupation + sourceOfFunds = wealthAndEmploymentDetails.sourceOfFunds + updatedAt = wealthAndEmploymentDetails.updatedAt + wealthSource = wealthAndEmploymentDetails.wealthSource + additionalProperties = wealthAndEmploymentDetails.additionalProperties.toMutableMap() + } + + fun id(id: String) = id(JsonField.of(id)) + + /** + * Sets [Builder.id] to an arbitrary JSON value. + * + * You should usually call [Builder.id] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun id(id: JsonField) = apply { this.id = id } + + /** The annual income of the individual in USD. */ + fun annualIncome(annualIncome: Long?) = annualIncome(JsonField.ofNullable(annualIncome)) + + /** + * Alias for [Builder.annualIncome]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun annualIncome(annualIncome: Long) = annualIncome(annualIncome as Long?) + + /** Alias for calling [Builder.annualIncome] with `annualIncome.orElse(null)`. */ + fun annualIncome(annualIncome: Optional) = annualIncome(annualIncome.getOrNull()) + + /** + * Sets [Builder.annualIncome] to an arbitrary JSON value. + * + * You should usually call [Builder.annualIncome] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun annualIncome(annualIncome: JsonField) = apply { this.annualIncome = annualIncome } + + fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) + + /** + * Sets [Builder.createdAt] to an arbitrary JSON value. + * + * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + + fun discardedAt(discardedAt: OffsetDateTime?) = + discardedAt(JsonField.ofNullable(discardedAt)) + + /** Alias for calling [Builder.discardedAt] with `discardedAt.orElse(null)`. */ + fun discardedAt(discardedAt: Optional) = + discardedAt(discardedAt.getOrNull()) + + /** + * Sets [Builder.discardedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.discardedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun discardedAt(discardedAt: JsonField) = apply { + this.discardedAt = discardedAt + } + + /** The country in which the employer is located. */ + fun employerCountry(employerCountry: String?) = + employerCountry(JsonField.ofNullable(employerCountry)) + + /** Alias for calling [Builder.employerCountry] with `employerCountry.orElse(null)`. */ + fun employerCountry(employerCountry: Optional) = + employerCountry(employerCountry.getOrNull()) + + /** + * Sets [Builder.employerCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.employerCountry] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun employerCountry(employerCountry: JsonField) = apply { + this.employerCountry = employerCountry + } + + /** The name of the employer. */ + fun employerName(employerName: String?) = employerName(JsonField.ofNullable(employerName)) + + /** Alias for calling [Builder.employerName] with `employerName.orElse(null)`. */ + fun employerName(employerName: Optional) = employerName(employerName.getOrNull()) + + /** + * Sets [Builder.employerName] to an arbitrary JSON value. + * + * You should usually call [Builder.employerName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun employerName(employerName: JsonField) = apply { + this.employerName = employerName + } + + /** The state in which the employer is located. */ + fun employerState(employerState: String?) = + employerState(JsonField.ofNullable(employerState)) + + /** Alias for calling [Builder.employerState] with `employerState.orElse(null)`. */ + fun employerState(employerState: Optional) = + employerState(employerState.getOrNull()) + + /** + * Sets [Builder.employerState] to an arbitrary JSON value. + * + * You should usually call [Builder.employerState] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun employerState(employerState: JsonField) = apply { + this.employerState = employerState + } + + /** The employment status of the individual. */ + fun employmentStatus(employmentStatus: EmploymentStatus?) = + employmentStatus(JsonField.ofNullable(employmentStatus)) + + /** Alias for calling [Builder.employmentStatus] with `employmentStatus.orElse(null)`. */ + fun employmentStatus(employmentStatus: Optional) = + employmentStatus(employmentStatus.getOrNull()) + + /** + * Sets [Builder.employmentStatus] to an arbitrary JSON value. + * + * You should usually call [Builder.employmentStatus] with a well-typed [EmploymentStatus] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun employmentStatus(employmentStatus: JsonField) = apply { + this.employmentStatus = employmentStatus + } + + /** The country in which the individual's income is earned. */ + fun incomeCountry(incomeCountry: String?) = + incomeCountry(JsonField.ofNullable(incomeCountry)) + + /** Alias for calling [Builder.incomeCountry] with `incomeCountry.orElse(null)`. */ + fun incomeCountry(incomeCountry: Optional) = + incomeCountry(incomeCountry.getOrNull()) + + /** + * Sets [Builder.incomeCountry] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeCountry] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun incomeCountry(incomeCountry: JsonField) = apply { + this.incomeCountry = incomeCountry + } + + /** The source of the individual's income. */ + fun incomeSource(incomeSource: IncomeSource?) = + incomeSource(JsonField.ofNullable(incomeSource)) + + /** Alias for calling [Builder.incomeSource] with `incomeSource.orElse(null)`. */ + fun incomeSource(incomeSource: Optional) = + incomeSource(incomeSource.getOrNull()) + + /** + * Sets [Builder.incomeSource] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeSource] with a well-typed [IncomeSource] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun incomeSource(incomeSource: JsonField) = apply { + this.incomeSource = incomeSource + } + + /** The state in which the individual's income is earned. */ + fun incomeState(incomeState: String?) = incomeState(JsonField.ofNullable(incomeState)) + + /** Alias for calling [Builder.incomeState] with `incomeState.orElse(null)`. */ + fun incomeState(incomeState: Optional) = incomeState(incomeState.getOrNull()) + + /** + * Sets [Builder.incomeState] to an arbitrary JSON value. + * + * You should usually call [Builder.incomeState] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun incomeState(incomeState: JsonField) = apply { this.incomeState = incomeState } + + /** The industry of the individual. */ + fun industry(industry: Industry?) = industry(JsonField.ofNullable(industry)) + + /** Alias for calling [Builder.industry] with `industry.orElse(null)`. */ + fun industry(industry: Optional) = industry(industry.getOrNull()) + + /** + * Sets [Builder.industry] to an arbitrary JSON value. + * + * You should usually call [Builder.industry] with a well-typed [Industry] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun industry(industry: JsonField) = apply { this.industry = industry } + + /** + * 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)) + + /** + * Sets [Builder.liveMode] to an arbitrary JSON value. + * + * You should usually call [Builder.liveMode] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun liveMode(liveMode: JsonField) = apply { this.liveMode = liveMode } + + fun object_(object_: String) = object_(JsonField.of(object_)) + + /** + * Sets [Builder.object_] to an arbitrary JSON value. + * + * You should usually call [Builder.object_] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun object_(object_: JsonField) = apply { this.object_ = object_ } + + /** The occupation of the individual. */ + fun occupation(occupation: Occupation?) = occupation(JsonField.ofNullable(occupation)) + + /** Alias for calling [Builder.occupation] with `occupation.orElse(null)`. */ + fun occupation(occupation: Optional) = occupation(occupation.getOrNull()) + + /** + * Sets [Builder.occupation] to an arbitrary JSON value. + * + * You should usually call [Builder.occupation] with a well-typed [Occupation] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun occupation(occupation: JsonField) = apply { this.occupation = occupation } + + /** The source of the individual's funds. */ + fun sourceOfFunds(sourceOfFunds: SourceOfFunds?) = + sourceOfFunds(JsonField.ofNullable(sourceOfFunds)) + + /** Alias for calling [Builder.sourceOfFunds] with `sourceOfFunds.orElse(null)`. */ + fun sourceOfFunds(sourceOfFunds: Optional) = + sourceOfFunds(sourceOfFunds.getOrNull()) + + /** + * Sets [Builder.sourceOfFunds] to an arbitrary JSON value. + * + * You should usually call [Builder.sourceOfFunds] with a well-typed [SourceOfFunds] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun sourceOfFunds(sourceOfFunds: JsonField) = apply { + this.sourceOfFunds = sourceOfFunds + } + + fun updatedAt(updatedAt: OffsetDateTime) = updatedAt(JsonField.of(updatedAt)) + + /** + * Sets [Builder.updatedAt] to an arbitrary JSON value. + * + * You should usually call [Builder.updatedAt] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + + /** The source of the individual's wealth. */ + fun wealthSource(wealthSource: WealthSource?) = + wealthSource(JsonField.ofNullable(wealthSource)) + + /** Alias for calling [Builder.wealthSource] with `wealthSource.orElse(null)`. */ + fun wealthSource(wealthSource: Optional) = + wealthSource(wealthSource.getOrNull()) + + /** + * Sets [Builder.wealthSource] to an arbitrary JSON value. + * + * You should usually call [Builder.wealthSource] with a well-typed [WealthSource] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun wealthSource(wealthSource: JsonField) = apply { + this.wealthSource = wealthSource + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [WealthAndEmploymentDetails]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .id() + * .annualIncome() + * .createdAt() + * .discardedAt() + * .employerCountry() + * .employerName() + * .employerState() + * .employmentStatus() + * .incomeCountry() + * .incomeSource() + * .incomeState() + * .industry() + * .liveMode() + * .object_() + * .occupation() + * .sourceOfFunds() + * .updatedAt() + * .wealthSource() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): WealthAndEmploymentDetails = + WealthAndEmploymentDetails( + checkRequired("id", id), + checkRequired("annualIncome", annualIncome), + checkRequired("createdAt", createdAt), + checkRequired("discardedAt", discardedAt), + checkRequired("employerCountry", employerCountry), + checkRequired("employerName", employerName), + checkRequired("employerState", employerState), + checkRequired("employmentStatus", employmentStatus), + checkRequired("incomeCountry", incomeCountry), + checkRequired("incomeSource", incomeSource), + checkRequired("incomeState", incomeState), + checkRequired("industry", industry), + checkRequired("liveMode", liveMode), + checkRequired("object_", object_), + checkRequired("occupation", occupation), + checkRequired("sourceOfFunds", sourceOfFunds), + checkRequired("updatedAt", updatedAt), + checkRequired("wealthSource", wealthSource), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): WealthAndEmploymentDetails = apply { + if (validated) { + return@apply + } + + id() + annualIncome() + createdAt() + discardedAt() + employerCountry() + employerName() + employerState() + employmentStatus().ifPresent { it.validate() } + incomeCountry() + incomeSource().ifPresent { it.validate() } + incomeState() + industry().ifPresent { it.validate() } + liveMode() + object_() + occupation().ifPresent { it.validate() } + sourceOfFunds().ifPresent { it.validate() } + updatedAt() + wealthSource().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (id.asKnown().isPresent) 1 else 0) + + (if (annualIncome.asKnown().isPresent) 1 else 0) + + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (discardedAt.asKnown().isPresent) 1 else 0) + + (if (employerCountry.asKnown().isPresent) 1 else 0) + + (if (employerName.asKnown().isPresent) 1 else 0) + + (if (employerState.asKnown().isPresent) 1 else 0) + + (employmentStatus.asKnown().getOrNull()?.validity() ?: 0) + + (if (incomeCountry.asKnown().isPresent) 1 else 0) + + (incomeSource.asKnown().getOrNull()?.validity() ?: 0) + + (if (incomeState.asKnown().isPresent) 1 else 0) + + (industry.asKnown().getOrNull()?.validity() ?: 0) + + (if (liveMode.asKnown().isPresent) 1 else 0) + + (if (object_.asKnown().isPresent) 1 else 0) + + (occupation.asKnown().getOrNull()?.validity() ?: 0) + + (sourceOfFunds.asKnown().getOrNull()?.validity() ?: 0) + + (if (updatedAt.asKnown().isPresent) 1 else 0) + + (wealthSource.asKnown().getOrNull()?.validity() ?: 0) + + /** The employment status of the individual. */ + class EmploymentStatus @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val EMPLOYED = of("employed") + + @JvmField val RETIRED = of("retired") + + @JvmField val SELF_EMPLOYED = of("self_employed") + + @JvmField val STUDENT = of("student") + + @JvmField val UNEMPLOYED = of("unemployed") + + @JvmStatic fun of(value: String) = EmploymentStatus(JsonField.of(value)) + } + + /** An enum containing [EmploymentStatus]'s known values. */ + enum class Known { + EMPLOYED, + RETIRED, + SELF_EMPLOYED, + STUDENT, + UNEMPLOYED, + } + + /** + * An enum containing [EmploymentStatus]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EmploymentStatus] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + EMPLOYED, + RETIRED, + SELF_EMPLOYED, + STUDENT, + UNEMPLOYED, + /** + * An enum member indicating that [EmploymentStatus] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EMPLOYED -> Value.EMPLOYED + RETIRED -> Value.RETIRED + SELF_EMPLOYED -> Value.SELF_EMPLOYED + STUDENT -> Value.STUDENT + UNEMPLOYED -> Value.UNEMPLOYED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + EMPLOYED -> Known.EMPLOYED + RETIRED -> Known.RETIRED + SELF_EMPLOYED -> Known.SELF_EMPLOYED + STUDENT -> Known.STUDENT + UNEMPLOYED -> Known.UNEMPLOYED + else -> throw ModernTreasuryInvalidDataException("Unknown EmploymentStatus: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): EmploymentStatus = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is EmploymentStatus && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The source of the individual's income. */ + class IncomeSource @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val FAMILY_SUPPORT = of("family_support") + + @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + + @JvmField val INHERITANCE = of("inheritance") + + @JvmField val INVESTMENTS = of("investments") + + @JvmField val RENTAL_INCOME = of("rental_income") + + @JvmField val RETIREMENT = of("retirement") + + @JvmField val SALARY = of("salary") + + @JvmField val SELF_EMPLOYED = of("self_employed") + + @JvmStatic fun of(value: String) = IncomeSource(JsonField.of(value)) + } + + /** An enum containing [IncomeSource]'s known values. */ + enum class Known { + FAMILY_SUPPORT, + GOVERNMENT_BENEFITS, + INHERITANCE, + INVESTMENTS, + RENTAL_INCOME, + RETIREMENT, + SALARY, + SELF_EMPLOYED, + } + + /** + * An enum containing [IncomeSource]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [IncomeSource] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + FAMILY_SUPPORT, + GOVERNMENT_BENEFITS, + INHERITANCE, + INVESTMENTS, + RENTAL_INCOME, + RETIREMENT, + SALARY, + SELF_EMPLOYED, + /** + * An enum member indicating that [IncomeSource] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + FAMILY_SUPPORT -> Value.FAMILY_SUPPORT + GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS + INHERITANCE -> Value.INHERITANCE + INVESTMENTS -> Value.INVESTMENTS + RENTAL_INCOME -> Value.RENTAL_INCOME + RETIREMENT -> Value.RETIREMENT + SALARY -> Value.SALARY + SELF_EMPLOYED -> Value.SELF_EMPLOYED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + FAMILY_SUPPORT -> Known.FAMILY_SUPPORT + GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS + INHERITANCE -> Known.INHERITANCE + INVESTMENTS -> Known.INVESTMENTS + RENTAL_INCOME -> Known.RENTAL_INCOME + RETIREMENT -> Known.RETIREMENT + SALARY -> Known.SALARY + SELF_EMPLOYED -> Known.SELF_EMPLOYED + else -> throw ModernTreasuryInvalidDataException("Unknown IncomeSource: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): IncomeSource = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IncomeSource && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The industry of the individual. */ + class Industry @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ACCOUNTING = of("accounting") + + @JvmField val AGRICULTURE = of("agriculture") + + @JvmField val AUTOMOTIVE = of("automotive") + + @JvmField val CHEMICAL_MANUFACTURING = of("chemical_manufacturing") + + @JvmField val CONSTRUCTION = of("construction") + + @JvmField val EDUCATIONAL_MEDICAL = of("educational_medical") + + @JvmField val FOOD_SERVICE = of("food_service") + + @JvmField val FINANCE = of("finance") + + @JvmField val GASOLINE = of("gasoline") + + @JvmField val HEALTH_STORES = of("health_stores") + + @JvmField val LAUNDRY = of("laundry") + + @JvmField val MAINTENANCE = of("maintenance") + + @JvmField val MANUFACTURING = of("manufacturing") + + @JvmField val MERCHANT_WHOLESALE = of("merchant_wholesale") + + @JvmField val MINING = of("mining") + + @JvmField val PERFORMING_ARTS = of("performing_arts") + + @JvmField val PROFESSIONAL_NON_LEGAL = of("professional_non_legal") + + @JvmField val PUBLIC_ADMINISTRATION = of("public_administration") + + @JvmField val PUBLISHING = of("publishing") + + @JvmField val REAL_ESTATE = of("real_estate") + + @JvmField val RECREATION_GAMBLING = of("recreation_gambling") + + @JvmField val RELIGIOUS_CHARITY = of("religious_charity") + + @JvmField val RENTAL_SERVICES = of("rental_services") + + @JvmField val RETAIL_CLOTHING = of("retail_clothing") + + @JvmField val RETAIL_ELECTRONICS = of("retail_electronics") + + @JvmField val RETAIL_FOOD = of("retail_food") + + @JvmField val RETAIL_FURNISHING = of("retail_furnishing") + + @JvmField val RETAIL_HOME = of("retail_home") + + @JvmField val RETAIL_NON_STORE = of("retail_non_store") + + @JvmField val RETAIL_SPORTING = of("retail_sporting") + + @JvmField val TRANSPORTATION = of("transportation") + + @JvmField val TRAVEL = of("travel") + + @JvmField val UTILITIES = of("utilities") + + @JvmStatic fun of(value: String) = Industry(JsonField.of(value)) + } + + /** An enum containing [Industry]'s known values. */ + enum class Known { + ACCOUNTING, + AGRICULTURE, + AUTOMOTIVE, + CHEMICAL_MANUFACTURING, + CONSTRUCTION, + EDUCATIONAL_MEDICAL, + FOOD_SERVICE, + FINANCE, + GASOLINE, + HEALTH_STORES, + LAUNDRY, + MAINTENANCE, + MANUFACTURING, + MERCHANT_WHOLESALE, + MINING, + PERFORMING_ARTS, + PROFESSIONAL_NON_LEGAL, + PUBLIC_ADMINISTRATION, + PUBLISHING, + REAL_ESTATE, + RECREATION_GAMBLING, + RELIGIOUS_CHARITY, + RENTAL_SERVICES, + RETAIL_CLOTHING, + RETAIL_ELECTRONICS, + RETAIL_FOOD, + RETAIL_FURNISHING, + RETAIL_HOME, + RETAIL_NON_STORE, + RETAIL_SPORTING, + TRANSPORTATION, + TRAVEL, + UTILITIES, + } + + /** + * An enum containing [Industry]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Industry] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACCOUNTING, + AGRICULTURE, + AUTOMOTIVE, + CHEMICAL_MANUFACTURING, + CONSTRUCTION, + EDUCATIONAL_MEDICAL, + FOOD_SERVICE, + FINANCE, + GASOLINE, + HEALTH_STORES, + LAUNDRY, + MAINTENANCE, + MANUFACTURING, + MERCHANT_WHOLESALE, + MINING, + PERFORMING_ARTS, + PROFESSIONAL_NON_LEGAL, + PUBLIC_ADMINISTRATION, + PUBLISHING, + REAL_ESTATE, + RECREATION_GAMBLING, + RELIGIOUS_CHARITY, + RENTAL_SERVICES, + RETAIL_CLOTHING, + RETAIL_ELECTRONICS, + RETAIL_FOOD, + RETAIL_FURNISHING, + RETAIL_HOME, + RETAIL_NON_STORE, + RETAIL_SPORTING, + TRANSPORTATION, + TRAVEL, + UTILITIES, + /** An enum member indicating that [Industry] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNTING -> Value.ACCOUNTING + AGRICULTURE -> Value.AGRICULTURE + AUTOMOTIVE -> Value.AUTOMOTIVE + CHEMICAL_MANUFACTURING -> Value.CHEMICAL_MANUFACTURING + CONSTRUCTION -> Value.CONSTRUCTION + EDUCATIONAL_MEDICAL -> Value.EDUCATIONAL_MEDICAL + FOOD_SERVICE -> Value.FOOD_SERVICE + FINANCE -> Value.FINANCE + GASOLINE -> Value.GASOLINE + HEALTH_STORES -> Value.HEALTH_STORES + LAUNDRY -> Value.LAUNDRY + MAINTENANCE -> Value.MAINTENANCE + MANUFACTURING -> Value.MANUFACTURING + MERCHANT_WHOLESALE -> Value.MERCHANT_WHOLESALE + MINING -> Value.MINING + PERFORMING_ARTS -> Value.PERFORMING_ARTS + PROFESSIONAL_NON_LEGAL -> Value.PROFESSIONAL_NON_LEGAL + PUBLIC_ADMINISTRATION -> Value.PUBLIC_ADMINISTRATION + PUBLISHING -> Value.PUBLISHING + REAL_ESTATE -> Value.REAL_ESTATE + RECREATION_GAMBLING -> Value.RECREATION_GAMBLING + RELIGIOUS_CHARITY -> Value.RELIGIOUS_CHARITY + RENTAL_SERVICES -> Value.RENTAL_SERVICES + RETAIL_CLOTHING -> Value.RETAIL_CLOTHING + RETAIL_ELECTRONICS -> Value.RETAIL_ELECTRONICS + RETAIL_FOOD -> Value.RETAIL_FOOD + RETAIL_FURNISHING -> Value.RETAIL_FURNISHING + RETAIL_HOME -> Value.RETAIL_HOME + RETAIL_NON_STORE -> Value.RETAIL_NON_STORE + RETAIL_SPORTING -> Value.RETAIL_SPORTING + TRANSPORTATION -> Value.TRANSPORTATION + TRAVEL -> Value.TRAVEL + UTILITIES -> Value.UTILITIES + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNTING -> Known.ACCOUNTING + AGRICULTURE -> Known.AGRICULTURE + AUTOMOTIVE -> Known.AUTOMOTIVE + CHEMICAL_MANUFACTURING -> Known.CHEMICAL_MANUFACTURING + CONSTRUCTION -> Known.CONSTRUCTION + EDUCATIONAL_MEDICAL -> Known.EDUCATIONAL_MEDICAL + FOOD_SERVICE -> Known.FOOD_SERVICE + FINANCE -> Known.FINANCE + GASOLINE -> Known.GASOLINE + HEALTH_STORES -> Known.HEALTH_STORES + LAUNDRY -> Known.LAUNDRY + MAINTENANCE -> Known.MAINTENANCE + MANUFACTURING -> Known.MANUFACTURING + MERCHANT_WHOLESALE -> Known.MERCHANT_WHOLESALE + MINING -> Known.MINING + PERFORMING_ARTS -> Known.PERFORMING_ARTS + PROFESSIONAL_NON_LEGAL -> Known.PROFESSIONAL_NON_LEGAL + PUBLIC_ADMINISTRATION -> Known.PUBLIC_ADMINISTRATION + PUBLISHING -> Known.PUBLISHING + REAL_ESTATE -> Known.REAL_ESTATE + RECREATION_GAMBLING -> Known.RECREATION_GAMBLING + RELIGIOUS_CHARITY -> Known.RELIGIOUS_CHARITY + RENTAL_SERVICES -> Known.RENTAL_SERVICES + RETAIL_CLOTHING -> Known.RETAIL_CLOTHING + RETAIL_ELECTRONICS -> Known.RETAIL_ELECTRONICS + RETAIL_FOOD -> Known.RETAIL_FOOD + RETAIL_FURNISHING -> Known.RETAIL_FURNISHING + RETAIL_HOME -> Known.RETAIL_HOME + RETAIL_NON_STORE -> Known.RETAIL_NON_STORE + RETAIL_SPORTING -> Known.RETAIL_SPORTING + TRANSPORTATION -> Known.TRANSPORTATION + TRAVEL -> Known.TRAVEL + UTILITIES -> Known.UTILITIES + else -> throw ModernTreasuryInvalidDataException("Unknown Industry: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Industry = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Industry && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The occupation of the individual. */ + class Occupation @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CONSULTING = of("consulting") + + @JvmField val EXECUTIVE = of("executive") + + @JvmField val FINANCE_ACCOUNTING = of("finance_accounting") + + @JvmField val FOOD_SERVICES = of("food_services") + + @JvmField val GOVERNMENT = of("government") + + @JvmField val HEALTHCARE = of("healthcare") + + @JvmField val LEGAL_SERVICES = of("legal_services") + + @JvmField val MANUFACTURING = of("manufacturing") + + @JvmField val OTHER = of("other") + + @JvmField val SALES = of("sales") + + @JvmField val SCIENCE_ENGINEERING = of("science_engineering") + + @JvmField val TECHNOLOGY = of("technology") + + @JvmStatic fun of(value: String) = Occupation(JsonField.of(value)) + } + + /** An enum containing [Occupation]'s known values. */ + enum class Known { + CONSULTING, + EXECUTIVE, + FINANCE_ACCOUNTING, + FOOD_SERVICES, + GOVERNMENT, + HEALTHCARE, + LEGAL_SERVICES, + MANUFACTURING, + OTHER, + SALES, + SCIENCE_ENGINEERING, + TECHNOLOGY, + } + + /** + * An enum containing [Occupation]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Occupation] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CONSULTING, + EXECUTIVE, + FINANCE_ACCOUNTING, + FOOD_SERVICES, + GOVERNMENT, + HEALTHCARE, + LEGAL_SERVICES, + MANUFACTURING, + OTHER, + SALES, + SCIENCE_ENGINEERING, + TECHNOLOGY, + /** + * An enum member indicating that [Occupation] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CONSULTING -> Value.CONSULTING + EXECUTIVE -> Value.EXECUTIVE + FINANCE_ACCOUNTING -> Value.FINANCE_ACCOUNTING + FOOD_SERVICES -> Value.FOOD_SERVICES + GOVERNMENT -> Value.GOVERNMENT + HEALTHCARE -> Value.HEALTHCARE + LEGAL_SERVICES -> Value.LEGAL_SERVICES + MANUFACTURING -> Value.MANUFACTURING + OTHER -> Value.OTHER + SALES -> Value.SALES + SCIENCE_ENGINEERING -> Value.SCIENCE_ENGINEERING + TECHNOLOGY -> Value.TECHNOLOGY + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CONSULTING -> Known.CONSULTING + EXECUTIVE -> Known.EXECUTIVE + FINANCE_ACCOUNTING -> Known.FINANCE_ACCOUNTING + FOOD_SERVICES -> Known.FOOD_SERVICES + GOVERNMENT -> Known.GOVERNMENT + HEALTHCARE -> Known.HEALTHCARE + LEGAL_SERVICES -> Known.LEGAL_SERVICES + MANUFACTURING -> Known.MANUFACTURING + OTHER -> Known.OTHER + SALES -> Known.SALES + SCIENCE_ENGINEERING -> Known.SCIENCE_ENGINEERING + TECHNOLOGY -> Known.TECHNOLOGY + else -> throw ModernTreasuryInvalidDataException("Unknown Occupation: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Occupation = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Occupation && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The source of the individual's funds. */ + class SourceOfFunds @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ALIMONY = of("alimony") + + @JvmField val ANNUITY = of("annuity") + + @JvmField val BUSINESS_OWNER = of("business_owner") + + @JvmField val BUSINESS_REVENUE = of("business_revenue") + + @JvmField val DEBT_FINANCING = of("debt_financing") + + @JvmField val GENERAL_EMPLOYEE = of("general_employee") + + @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + + @JvmField val HOMEMAKER = of("homemaker") + + @JvmField val INHERITANCE_GIFT = of("inheritance_gift") + + @JvmField val INTERCOMPANY_LOAN = of("intercompany_loan") + + @JvmField val INVESTMENT = of("investment") + + @JvmField val INVESTOR_FUNDING = of("investor_funding") + + @JvmField val LEGAL_SETTLEMENT = of("legal_settlement") + + @JvmField val LOTTERY = of("lottery") + + @JvmField val REAL_ESTATE = of("real_estate") + + @JvmField val RETAINED_EARNINGS_OR_SAVINGS = of("retained_earnings_or_savings") + + @JvmField val RETIRED = of("retired") + + @JvmField val RETIREMENT = of("retirement") + + @JvmField val SALARY = of("salary") + + @JvmField val SALE_OF_BUSINESS_ASSETS = of("sale_of_business_assets") + + @JvmField val SALE_OF_REAL_ESTATE = of("sale_of_real_estate") + + @JvmField val SELF_EMPLOYED = of("self_employed") + + @JvmField val SENIOR_EXECUTIVE = of("senior_executive") + + @JvmField val TRUST_INCOME = of("trust_income") + + @JvmStatic fun of(value: String) = SourceOfFunds(JsonField.of(value)) + } + + /** An enum containing [SourceOfFunds]'s known values. */ + enum class Known { + ALIMONY, + ANNUITY, + BUSINESS_OWNER, + BUSINESS_REVENUE, + DEBT_FINANCING, + GENERAL_EMPLOYEE, + GOVERNMENT_BENEFITS, + HOMEMAKER, + INHERITANCE_GIFT, + INTERCOMPANY_LOAN, + INVESTMENT, + INVESTOR_FUNDING, + LEGAL_SETTLEMENT, + LOTTERY, + REAL_ESTATE, + RETAINED_EARNINGS_OR_SAVINGS, + RETIRED, + RETIREMENT, + SALARY, + SALE_OF_BUSINESS_ASSETS, + SALE_OF_REAL_ESTATE, + SELF_EMPLOYED, + SENIOR_EXECUTIVE, + TRUST_INCOME, + } + + /** + * An enum containing [SourceOfFunds]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [SourceOfFunds] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ALIMONY, + ANNUITY, + BUSINESS_OWNER, + BUSINESS_REVENUE, + DEBT_FINANCING, + GENERAL_EMPLOYEE, + GOVERNMENT_BENEFITS, + HOMEMAKER, + INHERITANCE_GIFT, + INTERCOMPANY_LOAN, + INVESTMENT, + INVESTOR_FUNDING, + LEGAL_SETTLEMENT, + LOTTERY, + REAL_ESTATE, + RETAINED_EARNINGS_OR_SAVINGS, + RETIRED, + RETIREMENT, + SALARY, + SALE_OF_BUSINESS_ASSETS, + SALE_OF_REAL_ESTATE, + SELF_EMPLOYED, + SENIOR_EXECUTIVE, + TRUST_INCOME, + /** + * An enum member indicating that [SourceOfFunds] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ALIMONY -> Value.ALIMONY + ANNUITY -> Value.ANNUITY + BUSINESS_OWNER -> Value.BUSINESS_OWNER + BUSINESS_REVENUE -> Value.BUSINESS_REVENUE + DEBT_FINANCING -> Value.DEBT_FINANCING + GENERAL_EMPLOYEE -> Value.GENERAL_EMPLOYEE + GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS + HOMEMAKER -> Value.HOMEMAKER + INHERITANCE_GIFT -> Value.INHERITANCE_GIFT + INTERCOMPANY_LOAN -> Value.INTERCOMPANY_LOAN + INVESTMENT -> Value.INVESTMENT + INVESTOR_FUNDING -> Value.INVESTOR_FUNDING + LEGAL_SETTLEMENT -> Value.LEGAL_SETTLEMENT + LOTTERY -> Value.LOTTERY + REAL_ESTATE -> Value.REAL_ESTATE + RETAINED_EARNINGS_OR_SAVINGS -> Value.RETAINED_EARNINGS_OR_SAVINGS + RETIRED -> Value.RETIRED + RETIREMENT -> Value.RETIREMENT + SALARY -> Value.SALARY + SALE_OF_BUSINESS_ASSETS -> Value.SALE_OF_BUSINESS_ASSETS + SALE_OF_REAL_ESTATE -> Value.SALE_OF_REAL_ESTATE + SELF_EMPLOYED -> Value.SELF_EMPLOYED + SENIOR_EXECUTIVE -> Value.SENIOR_EXECUTIVE + TRUST_INCOME -> Value.TRUST_INCOME + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ALIMONY -> Known.ALIMONY + ANNUITY -> Known.ANNUITY + BUSINESS_OWNER -> Known.BUSINESS_OWNER + BUSINESS_REVENUE -> Known.BUSINESS_REVENUE + DEBT_FINANCING -> Known.DEBT_FINANCING + GENERAL_EMPLOYEE -> Known.GENERAL_EMPLOYEE + GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS + HOMEMAKER -> Known.HOMEMAKER + INHERITANCE_GIFT -> Known.INHERITANCE_GIFT + INTERCOMPANY_LOAN -> Known.INTERCOMPANY_LOAN + INVESTMENT -> Known.INVESTMENT + INVESTOR_FUNDING -> Known.INVESTOR_FUNDING + LEGAL_SETTLEMENT -> Known.LEGAL_SETTLEMENT + LOTTERY -> Known.LOTTERY + REAL_ESTATE -> Known.REAL_ESTATE + RETAINED_EARNINGS_OR_SAVINGS -> Known.RETAINED_EARNINGS_OR_SAVINGS + RETIRED -> Known.RETIRED + RETIREMENT -> Known.RETIREMENT + SALARY -> Known.SALARY + SALE_OF_BUSINESS_ASSETS -> Known.SALE_OF_BUSINESS_ASSETS + SALE_OF_REAL_ESTATE -> Known.SALE_OF_REAL_ESTATE + SELF_EMPLOYED -> Known.SELF_EMPLOYED + SENIOR_EXECUTIVE -> Known.SENIOR_EXECUTIVE + TRUST_INCOME -> Known.TRUST_INCOME + else -> throw ModernTreasuryInvalidDataException("Unknown SourceOfFunds: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): SourceOfFunds = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SourceOfFunds && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** The source of the individual's wealth. */ + class WealthSource @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val BUSINESS_SALE = of("business_sale") + + @JvmField val FAMILY_SUPPORT = of("family_support") + + @JvmField val GOVERNMENT_BENEFITS = of("government_benefits") + + @JvmField val INHERITANCE = of("inheritance") + + @JvmField val INVESTMENTS = of("investments") + + @JvmField val OTHER = of("other") + + @JvmField val RENTAL_INCOME = of("rental_income") + + @JvmField val RETIREMENT = of("retirement") + + @JvmField val SALARY = of("salary") + + @JvmField val SELF_EMPLOYED = of("self_employed") + + @JvmStatic fun of(value: String) = WealthSource(JsonField.of(value)) + } + + /** An enum containing [WealthSource]'s known values. */ + enum class Known { + BUSINESS_SALE, + FAMILY_SUPPORT, + GOVERNMENT_BENEFITS, + INHERITANCE, + INVESTMENTS, + OTHER, + RENTAL_INCOME, + RETIREMENT, + SALARY, + SELF_EMPLOYED, + } + + /** + * An enum containing [WealthSource]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [WealthSource] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + BUSINESS_SALE, + FAMILY_SUPPORT, + GOVERNMENT_BENEFITS, + INHERITANCE, + INVESTMENTS, + OTHER, + RENTAL_INCOME, + RETIREMENT, + SALARY, + SELF_EMPLOYED, + /** + * An enum member indicating that [WealthSource] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + BUSINESS_SALE -> Value.BUSINESS_SALE + FAMILY_SUPPORT -> Value.FAMILY_SUPPORT + GOVERNMENT_BENEFITS -> Value.GOVERNMENT_BENEFITS + INHERITANCE -> Value.INHERITANCE + INVESTMENTS -> Value.INVESTMENTS + OTHER -> Value.OTHER + RENTAL_INCOME -> Value.RENTAL_INCOME + RETIREMENT -> Value.RETIREMENT + SALARY -> Value.SALARY + SELF_EMPLOYED -> Value.SELF_EMPLOYED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + BUSINESS_SALE -> Known.BUSINESS_SALE + FAMILY_SUPPORT -> Known.FAMILY_SUPPORT + GOVERNMENT_BENEFITS -> Known.GOVERNMENT_BENEFITS + INHERITANCE -> Known.INHERITANCE + INVESTMENTS -> Known.INVESTMENTS + OTHER -> Known.OTHER + RENTAL_INCOME -> Known.RENTAL_INCOME + RETIREMENT -> Known.RETIREMENT + SALARY -> Known.SALARY + SELF_EMPLOYED -> Known.SELF_EMPLOYED + else -> throw ModernTreasuryInvalidDataException("Unknown WealthSource: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws ModernTreasuryInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + ModernTreasuryInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws ModernTreasuryInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): WealthSource = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: ModernTreasuryInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WealthSource && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WealthAndEmploymentDetails && + id == other.id && + annualIncome == other.annualIncome && + createdAt == other.createdAt && + discardedAt == other.discardedAt && + employerCountry == other.employerCountry && + employerName == other.employerName && + employerState == other.employerState && + employmentStatus == other.employmentStatus && + incomeCountry == other.incomeCountry && + incomeSource == other.incomeSource && + incomeState == other.incomeState && + industry == other.industry && + liveMode == other.liveMode && + object_ == other.object_ && + occupation == other.occupation && + sourceOfFunds == other.sourceOfFunds && + updatedAt == other.updatedAt && + wealthSource == other.wealthSource && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + id, + annualIncome, + createdAt, + discardedAt, + employerCountry, + employerName, + employerState, + employmentStatus, + incomeCountry, + incomeSource, + incomeState, + industry, + liveMode, + object_, + occupation, + sourceOfFunds, + updatedAt, + wealthSource, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "WealthAndEmploymentDetails{id=$id, annualIncome=$annualIncome, createdAt=$createdAt, discardedAt=$discardedAt, employerCountry=$employerCountry, employerName=$employerName, employerState=$employerState, employmentStatus=$employmentStatus, incomeCountry=$incomeCountry, incomeSource=$incomeSource, incomeState=$incomeState, industry=$industry, liveMode=$liveMode, object_=$object_, occupation=$occupation, sourceOfFunds=$sourceOfFunds, updatedAt=$updatedAt, wealthSource=$wealthSource, additionalProperties=$additionalProperties}" +} diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/BankSettingsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/BankSettingsTest.kt new file mode 100644 index 00000000..af1f0778 --- /dev/null +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/BankSettingsTest.kt @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.moderntreasury.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.moderntreasury.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BankSettingsTest { + + @Test + fun create() { + val bankSettings = + BankSettings.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .backupWithholdingPercentage(0L) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .discardedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .enableBackupWithholding(true) + .liveMode(true) + .object_("object") + .privacyOptOut(true) + .regulationO(true) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(bankSettings.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(bankSettings.backupWithholdingPercentage()).contains(0L) + assertThat(bankSettings.createdAt()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(bankSettings.discardedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(bankSettings.enableBackupWithholding()).contains(true) + assertThat(bankSettings.liveMode()).isEqualTo(true) + assertThat(bankSettings.object_()).isEqualTo("object") + assertThat(bankSettings.privacyOptOut()).contains(true) + assertThat(bankSettings.regulationO()).contains(true) + assertThat(bankSettings.updatedAt()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val bankSettings = + BankSettings.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .backupWithholdingPercentage(0L) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .discardedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .enableBackupWithholding(true) + .liveMode(true) + .object_("object") + .privacyOptOut(true) + .regulationO(true) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedBankSettings = + jsonMapper.readValue( + jsonMapper.writeValueAsString(bankSettings), + jacksonTypeRef(), + ) + + assertThat(roundtrippedBankSettings).isEqualTo(bankSettings) + } +} diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreateTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreateTest.kt index e569c085..f5c1eda1 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreateTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityCreateTest.kt @@ -26,10 +26,11 @@ internal class ChildLegalEntityCreateTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -166,7 +167,7 @@ internal class ChildLegalEntityCreateTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -174,36 +175,17 @@ internal class ChildLegalEntityCreateTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -219,11 +201,12 @@ internal class ChildLegalEntityCreateTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) assertThat(childLegalEntityCreate.bankSettings()) .contains( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -373,7 +356,7 @@ internal class ChildLegalEntityCreateTest { assertThat(childLegalEntityCreate.tickerSymbol()).contains("ticker_symbol") assertThat(childLegalEntityCreate.wealthAndEmploymentDetails()) .contains( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -381,34 +364,17 @@ internal class ChildLegalEntityCreateTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) assertThat(childLegalEntityCreate.website()).contains("website") @@ -428,10 +394,11 @@ internal class ChildLegalEntityCreateTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -568,7 +535,7 @@ internal class ChildLegalEntityCreateTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -576,36 +543,17 @@ internal class ChildLegalEntityCreateTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityTest.kt index 21d00635..f7c207e5 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ChildLegalEntityTest.kt @@ -31,12 +31,13 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -184,12 +185,13 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -421,7 +423,7 @@ internal class ChildLegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -432,39 +434,25 @@ internal class ChildLegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -545,7 +533,7 @@ internal class ChildLegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -553,32 +541,17 @@ internal class ChildLegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -599,13 +572,14 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) assertThat(childLegalEntity.bankSettings()) .contains( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -754,12 +728,13 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -976,7 +951,7 @@ internal class ChildLegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -985,38 +960,21 @@ internal class ChildLegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -1101,7 +1059,7 @@ internal class ChildLegalEntityTest { .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(childLegalEntity.wealthAndEmploymentDetails()) .contains( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1109,31 +1067,17 @@ internal class ChildLegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus.EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) assertThat(childLegalEntity.website()).contains("website") @@ -1158,12 +1102,13 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1311,12 +1256,13 @@ internal class ChildLegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1548,7 +1494,7 @@ internal class ChildLegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1559,39 +1505,25 @@ internal class ChildLegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -1672,7 +1604,7 @@ internal class ChildLegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1680,32 +1612,17 @@ internal class ChildLegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParamsTest.kt index 9bba184e..5b00fc24 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/ConnectionLegalEntityCreateParamsTest.kt @@ -25,11 +25,11 @@ internal class ConnectionLegalEntityCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - ConnectionLegalEntityCreateParams.LegalEntity.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -119,10 +119,11 @@ internal class ConnectionLegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -282,8 +283,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -296,46 +296,30 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -411,9 +395,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -421,47 +403,17 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -489,11 +441,11 @@ internal class ConnectionLegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ConnectionLegalEntityCreateParams.LegalEntity.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -585,10 +537,11 @@ internal class ConnectionLegalEntityCreateParamsTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -752,8 +705,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -766,46 +718,31 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -882,9 +819,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -893,46 +828,20 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -956,11 +865,11 @@ internal class ConnectionLegalEntityCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - ConnectionLegalEntityCreateParams.LegalEntity.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1050,10 +959,11 @@ internal class ConnectionLegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -1213,8 +1123,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -1227,46 +1136,30 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -1342,9 +1235,7 @@ internal class ConnectionLegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1352,47 +1243,17 @@ internal class ConnectionLegalEntityCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/CounterpartyCreateParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/CounterpartyCreateParamsTest.kt index d8c244e5..7a649d2e 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/CounterpartyCreateParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/CounterpartyCreateParamsTest.kt @@ -114,11 +114,11 @@ internal class CounterpartyCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -209,10 +209,11 @@ internal class CounterpartyCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -372,8 +373,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -386,46 +386,30 @@ internal class CounterpartyCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -499,9 +483,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -509,47 +491,17 @@ internal class CounterpartyCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -679,11 +631,11 @@ internal class CounterpartyCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -775,10 +727,11 @@ internal class CounterpartyCreateParamsTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -942,8 +895,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -956,46 +908,31 @@ internal class CounterpartyCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -1072,9 +1009,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1083,46 +1018,20 @@ internal class CounterpartyCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -1246,11 +1155,11 @@ internal class CounterpartyCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1341,10 +1250,11 @@ internal class CounterpartyCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -1504,8 +1414,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -1518,46 +1427,30 @@ internal class CounterpartyCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -1631,9 +1524,7 @@ internal class CounterpartyCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1641,47 +1532,17 @@ internal class CounterpartyCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountCreateParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountCreateParamsTest.kt index fbf4ef80..145de93b 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountCreateParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountCreateParamsTest.kt @@ -32,6 +32,7 @@ internal class InternalAccountCreateParamsTest { ) .accountType(InternalAccountCreateParams.AccountType.CHECKING) .counterpartyId("counterparty_id") + .debitable(true) .externalId("external_id") .legalEntityId("legal_entity_id") .metadata( @@ -83,6 +84,7 @@ internal class InternalAccountCreateParamsTest { ) .accountType(InternalAccountCreateParams.AccountType.CHECKING) .counterpartyId("counterparty_id") + .debitable(true) .externalId("external_id") .legalEntityId("legal_entity_id") .metadata( @@ -132,6 +134,7 @@ internal class InternalAccountCreateParamsTest { ) assertThat(body.accountType()).contains(InternalAccountCreateParams.AccountType.CHECKING) assertThat(body.counterpartyId()).contains("counterparty_id") + assertThat(body.debitable()).contains(true) assertThat(body.externalId()).contains("external_id") assertThat(body.legalEntityId()).contains("legal_entity_id") assertThat(body.metadata()) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountTest.kt index 881f650c..9790077d 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/InternalAccountTest.kt @@ -60,6 +60,7 @@ internal class InternalAccountTest { .counterpartyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency(Currency.AED) + .debitable(true) .externalId("external_id") .ledgerAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .legalEntityId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -176,6 +177,7 @@ internal class InternalAccountTest { assertThat(internalAccount.createdAt()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(internalAccount.currency()).isEqualTo(Currency.AED) + assertThat(internalAccount.debitable()).contains(true) assertThat(internalAccount.externalId()).contains("external_id") assertThat(internalAccount.ledgerAccountId()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -297,6 +299,7 @@ internal class InternalAccountTest { .counterpartyId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .currency(Currency.AED) + .debitable(true) .externalId("external_id") .ledgerAccountId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .legalEntityId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequestTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequestTest.kt index 7605893a..fcde708b 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequestTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAddressCreateRequestTest.kt @@ -21,6 +21,7 @@ internal class LegalEntityAddressCreateRequestTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() assertThat(legalEntityAddressCreateRequest.country()).contains("country") @@ -31,6 +32,7 @@ internal class LegalEntityAddressCreateRequestTest { assertThat(legalEntityAddressCreateRequest.addressTypes().getOrNull()) .containsExactly(LegalEntityAddressCreateRequest.AddressType.BUSINESS) assertThat(legalEntityAddressCreateRequest.line2()).contains("line2") + assertThat(legalEntityAddressCreateRequest.primary()).contains(true) } @Test @@ -45,6 +47,7 @@ internal class LegalEntityAddressCreateRequestTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() val roundtrippedLegalEntityAddressCreateRequest = diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationInlineCreateTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationInlineCreateTest.kt index 934e4a05..1660c0fd 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationInlineCreateTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationInlineCreateTest.kt @@ -32,10 +32,11 @@ internal class LegalEntityAssociationInlineCreateTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -166,7 +167,7 @@ internal class LegalEntityAssociationInlineCreateTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -175,40 +176,20 @@ internal class LegalEntityAssociationInlineCreateTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -233,10 +214,11 @@ internal class LegalEntityAssociationInlineCreateTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -367,7 +349,7 @@ internal class LegalEntityAssociationInlineCreateTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -375,39 +357,17 @@ internal class LegalEntityAssociationInlineCreateTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -440,10 +400,11 @@ internal class LegalEntityAssociationInlineCreateTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -574,7 +535,7 @@ internal class LegalEntityAssociationInlineCreateTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -583,40 +544,20 @@ internal class LegalEntityAssociationInlineCreateTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationTest.kt index b55620ac..19ca27e5 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityAssociationTest.kt @@ -35,12 +35,13 @@ internal class LegalEntityAssociationTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -237,7 +238,7 @@ internal class LegalEntityAssociationTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -246,35 +247,20 @@ internal class LegalEntityAssociationTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -311,12 +297,13 @@ internal class LegalEntityAssociationTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -507,7 +494,7 @@ internal class LegalEntityAssociationTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -515,35 +502,17 @@ internal class LegalEntityAssociationTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -588,12 +557,13 @@ internal class LegalEntityAssociationTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -790,7 +760,7 @@ internal class LegalEntityAssociationTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -799,35 +769,20 @@ internal class LegalEntityAssociationTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityCreateParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityCreateParamsTest.kt index 91ed2b08..b1b0f7d3 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityCreateParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityCreateParamsTest.kt @@ -24,10 +24,11 @@ internal class LegalEntityCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityCreateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -113,10 +114,11 @@ internal class LegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -251,7 +253,7 @@ internal class LegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -260,39 +262,21 @@ internal class LegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -356,7 +340,7 @@ internal class LegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -364,35 +348,17 @@ internal class LegalEntityCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -413,10 +379,11 @@ internal class LegalEntityCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityCreateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -504,10 +471,11 @@ internal class LegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -650,8 +618,7 @@ internal class LegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -662,39 +629,25 @@ internal class LegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -764,7 +717,7 @@ internal class LegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -772,36 +725,17 @@ internal class LegalEntityCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -821,11 +755,12 @@ internal class LegalEntityCreateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) assertThat(body.bankSettings()) .contains( - LegalEntityCreateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -915,10 +850,11 @@ internal class LegalEntityCreateParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1053,7 +989,7 @@ internal class LegalEntityCreateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1062,39 +998,21 @@ internal class LegalEntityCreateParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -1166,7 +1084,7 @@ internal class LegalEntityCreateParamsTest { assertThat(body.tickerSymbol()).contains("ticker_symbol") assertThat(body.wealthAndEmploymentDetails()) .contains( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1174,35 +1092,17 @@ internal class LegalEntityCreateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) assertThat(body.website()).contains("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityTest.kt index 5a8c882b..833b1f85 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityTest.kt @@ -31,12 +31,13 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - LegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -222,7 +223,7 @@ internal class LegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - LegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -230,28 +231,17 @@ internal class LegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus.EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry(LegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING - ) - .sourceOfFunds( - LegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntity.LegalEntityWealthEmploymentDetail.WealthSource.BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -278,12 +268,13 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -515,7 +506,7 @@ internal class LegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -526,39 +517,25 @@ internal class LegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -595,13 +572,14 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) assertThat(legalEntity.bankSettings()) .contains( - LegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -790,7 +768,7 @@ internal class LegalEntityTest { .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(legalEntity.wealthAndEmploymentDetails()) .contains( - LegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -798,25 +776,17 @@ internal class LegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus.EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource.FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry(LegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation(LegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING) - .sourceOfFunds( - LegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntity.LegalEntityWealthEmploymentDetail.WealthSource.BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) assertThat(legalEntity.website()).contains("website") @@ -842,12 +812,13 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1064,7 +1035,7 @@ internal class LegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1073,38 +1044,21 @@ internal class LegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) @@ -1143,12 +1097,13 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - LegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1334,7 +1289,7 @@ internal class LegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - LegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1342,28 +1297,17 @@ internal class LegalEntityTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntity.LegalEntityWealthEmploymentDetail.EmploymentStatus.EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntity.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry(LegalEntity.LegalEntityWealthEmploymentDetail.Industry.ACCOUNTING) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntity.LegalEntityWealthEmploymentDetail.Occupation.CONSULTING - ) - .sourceOfFunds( - LegalEntity.LegalEntityWealthEmploymentDetail.SourceOfFunds.ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntity.LegalEntityWealthEmploymentDetail.WealthSource.BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -1390,12 +1334,13 @@ internal class LegalEntityTest { .locality("locality") .object_("object") .postalCode("postal_code") + .primary(true) .region("region") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .bankSettings( - ChildLegalEntity.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1627,7 +1572,7 @@ internal class LegalEntityTest { .tickerSymbol("ticker_symbol") .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthAndEmploymentDetails( - ChildLegalEntity.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -1638,39 +1583,25 @@ internal class LegalEntityTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") .occupation( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ChildLegalEntity.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParamsTest.kt index 281aa8cd..ef218821 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/LegalEntityUpdateParamsTest.kt @@ -24,10 +24,11 @@ internal class LegalEntityUpdateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityUpdateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -136,7 +137,7 @@ internal class LegalEntityUpdateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -144,35 +145,17 @@ internal class LegalEntityUpdateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -202,10 +185,11 @@ internal class LegalEntityUpdateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityUpdateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -322,7 +306,7 @@ internal class LegalEntityUpdateParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -330,36 +314,17 @@ internal class LegalEntityUpdateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -377,11 +342,12 @@ internal class LegalEntityUpdateParamsTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) assertThat(body.bankSettings()) .contains( - LegalEntityUpdateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -500,7 +466,7 @@ internal class LegalEntityUpdateParamsTest { assertThat(body.tickerSymbol()).contains("ticker_symbol") assertThat(body.wealthAndEmploymentDetails()) .contains( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -508,35 +474,17 @@ internal class LegalEntityUpdateParamsTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) assertThat(body.website()).contains("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequestTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequestTest.kt index 9b06b9a9..04028ec6 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequestTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/RoutingNumberLookupRequestTest.kt @@ -46,24 +46,17 @@ internal class RoutingNumberLookupRequestTest { RoutingNumberLookupRequest.SupportedPaymentType.DK_NETS, RoutingNumberLookupRequest.SupportedPaymentType.EFT, RoutingNumberLookupRequest.SupportedPaymentType.GB_FPS, - RoutingNumberLookupRequest.SupportedPaymentType.HU_ICS, - RoutingNumberLookupRequest.SupportedPaymentType.INTERAC, RoutingNumberLookupRequest.SupportedPaymentType.MASAV, RoutingNumberLookupRequest.SupportedPaymentType.MX_CCEN, RoutingNumberLookupRequest.SupportedPaymentType.NEFT, RoutingNumberLookupRequest.SupportedPaymentType.NICS, RoutingNumberLookupRequest.SupportedPaymentType.NZ_BECS, RoutingNumberLookupRequest.SupportedPaymentType.PL_ELIXIR, - RoutingNumberLookupRequest.SupportedPaymentType.PROVXCHANGE, - RoutingNumberLookupRequest.SupportedPaymentType.RO_SENT, RoutingNumberLookupRequest.SupportedPaymentType.RTP, RoutingNumberLookupRequest.SupportedPaymentType.SE_BANKGIROT, - RoutingNumberLookupRequest.SupportedPaymentType.SEN, RoutingNumberLookupRequest.SupportedPaymentType.SEPA, RoutingNumberLookupRequest.SupportedPaymentType.SG_GIRO, RoutingNumberLookupRequest.SupportedPaymentType.SIC, - RoutingNumberLookupRequest.SupportedPaymentType.SIGNET, - RoutingNumberLookupRequest.SupportedPaymentType.SKNBI, RoutingNumberLookupRequest.SupportedPaymentType.STABLECOIN, RoutingNumberLookupRequest.SupportedPaymentType.WIRE, RoutingNumberLookupRequest.SupportedPaymentType.ZENGIN, @@ -105,24 +98,17 @@ internal class RoutingNumberLookupRequestTest { RoutingNumberLookupRequest.SupportedPaymentType.DK_NETS, RoutingNumberLookupRequest.SupportedPaymentType.EFT, RoutingNumberLookupRequest.SupportedPaymentType.GB_FPS, - RoutingNumberLookupRequest.SupportedPaymentType.HU_ICS, - RoutingNumberLookupRequest.SupportedPaymentType.INTERAC, RoutingNumberLookupRequest.SupportedPaymentType.MASAV, RoutingNumberLookupRequest.SupportedPaymentType.MX_CCEN, RoutingNumberLookupRequest.SupportedPaymentType.NEFT, RoutingNumberLookupRequest.SupportedPaymentType.NICS, RoutingNumberLookupRequest.SupportedPaymentType.NZ_BECS, RoutingNumberLookupRequest.SupportedPaymentType.PL_ELIXIR, - RoutingNumberLookupRequest.SupportedPaymentType.PROVXCHANGE, - RoutingNumberLookupRequest.SupportedPaymentType.RO_SENT, RoutingNumberLookupRequest.SupportedPaymentType.RTP, RoutingNumberLookupRequest.SupportedPaymentType.SE_BANKGIROT, - RoutingNumberLookupRequest.SupportedPaymentType.SEN, RoutingNumberLookupRequest.SupportedPaymentType.SEPA, RoutingNumberLookupRequest.SupportedPaymentType.SG_GIRO, RoutingNumberLookupRequest.SupportedPaymentType.SIC, - RoutingNumberLookupRequest.SupportedPaymentType.SIGNET, - RoutingNumberLookupRequest.SupportedPaymentType.SKNBI, RoutingNumberLookupRequest.SupportedPaymentType.STABLECOIN, RoutingNumberLookupRequest.SupportedPaymentType.WIRE, RoutingNumberLookupRequest.SupportedPaymentType.ZENGIN, @@ -165,24 +151,17 @@ internal class RoutingNumberLookupRequestTest { RoutingNumberLookupRequest.SupportedPaymentType.DK_NETS, RoutingNumberLookupRequest.SupportedPaymentType.EFT, RoutingNumberLookupRequest.SupportedPaymentType.GB_FPS, - RoutingNumberLookupRequest.SupportedPaymentType.HU_ICS, - RoutingNumberLookupRequest.SupportedPaymentType.INTERAC, RoutingNumberLookupRequest.SupportedPaymentType.MASAV, RoutingNumberLookupRequest.SupportedPaymentType.MX_CCEN, RoutingNumberLookupRequest.SupportedPaymentType.NEFT, RoutingNumberLookupRequest.SupportedPaymentType.NICS, RoutingNumberLookupRequest.SupportedPaymentType.NZ_BECS, RoutingNumberLookupRequest.SupportedPaymentType.PL_ELIXIR, - RoutingNumberLookupRequest.SupportedPaymentType.PROVXCHANGE, - RoutingNumberLookupRequest.SupportedPaymentType.RO_SENT, RoutingNumberLookupRequest.SupportedPaymentType.RTP, RoutingNumberLookupRequest.SupportedPaymentType.SE_BANKGIROT, - RoutingNumberLookupRequest.SupportedPaymentType.SEN, RoutingNumberLookupRequest.SupportedPaymentType.SEPA, RoutingNumberLookupRequest.SupportedPaymentType.SG_GIRO, RoutingNumberLookupRequest.SupportedPaymentType.SIC, - RoutingNumberLookupRequest.SupportedPaymentType.SIGNET, - RoutingNumberLookupRequest.SupportedPaymentType.SKNBI, RoutingNumberLookupRequest.SupportedPaymentType.STABLECOIN, RoutingNumberLookupRequest.SupportedPaymentType.WIRE, RoutingNumberLookupRequest.SupportedPaymentType.ZENGIN, diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetailsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetailsTest.kt new file mode 100644 index 00000000..c37031ea --- /dev/null +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/models/WealthAndEmploymentDetailsTest.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.moderntreasury.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.moderntreasury.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class WealthAndEmploymentDetailsTest { + + @Test + fun create() { + val wealthAndEmploymentDetails = + WealthAndEmploymentDetails.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .annualIncome(0L) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .discardedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .employerCountry("employer_country") + .employerName("employer_name") + .employerState("employer_state") + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) + .incomeCountry("income_country") + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) + .incomeState("income_state") + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) + .liveMode(true) + .object_("object") + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) + .build() + + assertThat(wealthAndEmploymentDetails.id()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(wealthAndEmploymentDetails.annualIncome()).contains(0L) + assertThat(wealthAndEmploymentDetails.createdAt()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(wealthAndEmploymentDetails.discardedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(wealthAndEmploymentDetails.employerCountry()).contains("employer_country") + assertThat(wealthAndEmploymentDetails.employerName()).contains("employer_name") + assertThat(wealthAndEmploymentDetails.employerState()).contains("employer_state") + assertThat(wealthAndEmploymentDetails.employmentStatus()) + .contains(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) + assertThat(wealthAndEmploymentDetails.incomeCountry()).contains("income_country") + assertThat(wealthAndEmploymentDetails.incomeSource()) + .contains(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) + assertThat(wealthAndEmploymentDetails.incomeState()).contains("income_state") + assertThat(wealthAndEmploymentDetails.industry()) + .contains(WealthAndEmploymentDetails.Industry.ACCOUNTING) + assertThat(wealthAndEmploymentDetails.liveMode()).isEqualTo(true) + assertThat(wealthAndEmploymentDetails.object_()).isEqualTo("object") + assertThat(wealthAndEmploymentDetails.occupation()) + .contains(WealthAndEmploymentDetails.Occupation.CONSULTING) + assertThat(wealthAndEmploymentDetails.sourceOfFunds()) + .contains(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) + assertThat(wealthAndEmploymentDetails.updatedAt()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(wealthAndEmploymentDetails.wealthSource()) + .contains(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val wealthAndEmploymentDetails = + WealthAndEmploymentDetails.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .annualIncome(0L) + .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .discardedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .employerCountry("employer_country") + .employerName("employer_name") + .employerState("employer_state") + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) + .incomeCountry("income_country") + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) + .incomeState("income_state") + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) + .liveMode(true) + .object_("object") + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) + .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) + .build() + + val roundtrippedWealthAndEmploymentDetails = + jsonMapper.readValue( + jsonMapper.writeValueAsString(wealthAndEmploymentDetails), + jacksonTypeRef(), + ) + + assertThat(roundtrippedWealthAndEmploymentDetails).isEqualTo(wealthAndEmploymentDetails) + } +} diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/ServiceParamsTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/ServiceParamsTest.kt index c5fa8439..ce8b918d 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/ServiceParamsTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/ServiceParamsTest.kt @@ -16,6 +16,7 @@ import com.moderntreasury.api.client.ModernTreasuryClient import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient import com.moderntreasury.api.core.JsonValue import com.moderntreasury.api.models.AddressRequest +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.ContactDetailCreateRequest import com.moderntreasury.api.models.CounterpartyCreateParams @@ -27,6 +28,7 @@ import com.moderntreasury.api.models.LegalEntityAssociationInlineCreate import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.ThirdPartyVerification import com.moderntreasury.api.models.TransactionDirection +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.BeforeEach @@ -162,11 +164,11 @@ internal class ServiceParamsTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -258,10 +260,11 @@ internal class ServiceParamsTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -425,8 +428,7 @@ internal class ServiceParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -439,46 +441,31 @@ internal class ServiceParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -555,9 +542,7 @@ internal class ServiceParamsTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -566,46 +551,20 @@ internal class ServiceParamsTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/ConnectionLegalEntityServiceAsyncTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/ConnectionLegalEntityServiceAsyncTest.kt index d6970798..205dc946 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/ConnectionLegalEntityServiceAsyncTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/ConnectionLegalEntityServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.moderntreasury.api.services.async import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync import com.moderntreasury.api.core.JsonValue +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.ConnectionLegalEntityCreateParams import com.moderntreasury.api.models.ConnectionLegalEntityUpdateParams @@ -13,6 +14,7 @@ import com.moderntreasury.api.models.LegalEntityAddressCreateRequest import com.moderntreasury.api.models.LegalEntityAssociationInlineCreate import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.ThirdPartyVerification +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -48,11 +50,11 @@ internal class ConnectionLegalEntityServiceAsyncTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ConnectionLegalEntityCreateParams.LegalEntity.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -144,11 +146,11 @@ internal class ConnectionLegalEntityServiceAsyncTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -335,9 +337,7 @@ internal class ConnectionLegalEntityServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -354,37 +354,27 @@ internal class ConnectionLegalEntityServiceAsyncTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry + WealthAndEmploymentDetails.Industry .ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation + WealthAndEmploymentDetails.Occupation .CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds + WealthAndEmploymentDetails.SourceOfFunds .ALIMONY ) .updatedAt( @@ -393,9 +383,7 @@ internal class ConnectionLegalEntityServiceAsyncTest { ) ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -480,9 +468,7 @@ internal class ConnectionLegalEntityServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -491,45 +477,21 @@ internal class ConnectionLegalEntityServiceAsyncTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/CounterpartyServiceAsyncTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/CounterpartyServiceAsyncTest.kt index b1449887..d3054f57 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/CounterpartyServiceAsyncTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/CounterpartyServiceAsyncTest.kt @@ -6,6 +6,7 @@ import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync import com.moderntreasury.api.core.JsonValue import com.moderntreasury.api.models.AddressRequest +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.ContactDetailCreateRequest import com.moderntreasury.api.models.CounterpartyCollectAccountParams @@ -19,6 +20,7 @@ import com.moderntreasury.api.models.LegalEntityAssociationInlineCreate import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.ThirdPartyVerification import com.moderntreasury.api.models.TransactionDirection +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -154,12 +156,11 @@ internal class CounterpartyServiceAsyncTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -251,11 +252,11 @@ internal class CounterpartyServiceAsyncTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -442,9 +443,7 @@ internal class CounterpartyServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -461,37 +460,27 @@ internal class CounterpartyServiceAsyncTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry + WealthAndEmploymentDetails.Industry .ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation + WealthAndEmploymentDetails.Occupation .CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds + WealthAndEmploymentDetails.SourceOfFunds .ALIMONY ) .updatedAt( @@ -500,9 +489,7 @@ internal class CounterpartyServiceAsyncTest { ) ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -585,9 +572,7 @@ internal class CounterpartyServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -596,45 +581,21 @@ internal class CounterpartyServiceAsyncTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/InternalAccountServiceAsyncTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/InternalAccountServiceAsyncTest.kt index aedaf2ab..4e1f78c9 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/InternalAccountServiceAsyncTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/InternalAccountServiceAsyncTest.kt @@ -50,6 +50,7 @@ internal class InternalAccountServiceAsyncTest { ) .accountType(InternalAccountCreateParams.AccountType.CHECKING) .counterpartyId("counterparty_id") + .debitable(true) .externalId("external_id") .legalEntityId("legal_entity_id") .metadata( diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/LegalEntityServiceAsyncTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/LegalEntityServiceAsyncTest.kt index a1168237..9e59c1c7 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/LegalEntityServiceAsyncTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/async/LegalEntityServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.moderntreasury.api.services.async import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClientAsync import com.moderntreasury.api.core.JsonValue +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.IdentificationCreateRequest import com.moderntreasury.api.models.LegalEntityAddressCreateRequest @@ -13,6 +14,7 @@ import com.moderntreasury.api.models.LegalEntityCreateParams import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.LegalEntityUpdateParams import com.moderntreasury.api.models.ThirdPartyVerification +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Disabled @@ -46,10 +48,11 @@ internal class LegalEntityServiceAsyncTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityCreateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -139,10 +142,11 @@ internal class LegalEntityServiceAsyncTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -302,8 +306,7 @@ internal class LegalEntityServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -316,46 +319,30 @@ internal class LegalEntityServiceAsyncTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -426,7 +413,7 @@ internal class LegalEntityServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -434,39 +421,17 @@ internal class LegalEntityServiceAsyncTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -516,10 +481,11 @@ internal class LegalEntityServiceAsyncTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityUpdateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -636,7 +602,7 @@ internal class LegalEntityServiceAsyncTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -644,39 +610,17 @@ internal class LegalEntityServiceAsyncTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/ConnectionLegalEntityServiceTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/ConnectionLegalEntityServiceTest.kt index bf8fdd7a..9ce43d61 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/ConnectionLegalEntityServiceTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/ConnectionLegalEntityServiceTest.kt @@ -5,6 +5,7 @@ package com.moderntreasury.api.services.blocking import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient import com.moderntreasury.api.core.JsonValue +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.ConnectionLegalEntityCreateParams import com.moderntreasury.api.models.ConnectionLegalEntityUpdateParams @@ -13,6 +14,7 @@ import com.moderntreasury.api.models.LegalEntityAddressCreateRequest import com.moderntreasury.api.models.LegalEntityAssociationInlineCreate import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.ThirdPartyVerification +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -48,11 +50,11 @@ internal class ConnectionLegalEntityServiceTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ConnectionLegalEntityCreateParams.LegalEntity.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -144,11 +146,11 @@ internal class ConnectionLegalEntityServiceTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -335,9 +337,7 @@ internal class ConnectionLegalEntityServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -354,37 +354,27 @@ internal class ConnectionLegalEntityServiceTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry + WealthAndEmploymentDetails.Industry .ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation + WealthAndEmploymentDetails.Occupation .CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds + WealthAndEmploymentDetails.SourceOfFunds .ALIMONY ) .updatedAt( @@ -393,9 +383,7 @@ internal class ConnectionLegalEntityServiceTest { ) ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -480,9 +468,7 @@ internal class ConnectionLegalEntityServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -491,45 +477,21 @@ internal class ConnectionLegalEntityServiceTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - ConnectionLegalEntityCreateParams.LegalEntity - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/CounterpartyServiceTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/CounterpartyServiceTest.kt index db350465..f8e69dc6 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/CounterpartyServiceTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/CounterpartyServiceTest.kt @@ -6,6 +6,7 @@ import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient import com.moderntreasury.api.core.JsonValue import com.moderntreasury.api.models.AddressRequest +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.ContactDetailCreateRequest import com.moderntreasury.api.models.CounterpartyCollectAccountParams @@ -19,6 +20,7 @@ import com.moderntreasury.api.models.LegalEntityAssociationInlineCreate import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.ThirdPartyVerification import com.moderntreasury.api.models.TransactionDirection +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Test @@ -154,12 +156,11 @@ internal class CounterpartyServiceTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -251,11 +252,11 @@ internal class CounterpartyServiceTest { .BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting - .builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -442,9 +443,7 @@ internal class CounterpartyServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -461,37 +460,27 @@ internal class CounterpartyServiceTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus + WealthAndEmploymentDetails.EmploymentStatus .EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry + WealthAndEmploymentDetails.Industry .ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation + WealthAndEmploymentDetails.Occupation .CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds + WealthAndEmploymentDetails.SourceOfFunds .ALIMONY ) .updatedAt( @@ -500,9 +489,7 @@ internal class CounterpartyServiceTest { ) ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -585,9 +572,7 @@ internal class CounterpartyServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -596,45 +581,21 @@ internal class CounterpartyServiceTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT + WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT ) .incomeState("income_state") - .industry( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING - ) - .sourceOfFunds( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .wealthSource( - CounterpartyCreateParams.LegalEntityCreateRequest - .LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE + WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE ) .build() ) diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/InternalAccountServiceTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/InternalAccountServiceTest.kt index 5dad99af..f43ecdc3 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/InternalAccountServiceTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/InternalAccountServiceTest.kt @@ -50,6 +50,7 @@ internal class InternalAccountServiceTest { ) .accountType(InternalAccountCreateParams.AccountType.CHECKING) .counterpartyId("counterparty_id") + .debitable(true) .externalId("external_id") .legalEntityId("legal_entity_id") .metadata( diff --git a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/LegalEntityServiceTest.kt b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/LegalEntityServiceTest.kt index 12df1cbe..20f0265d 100644 --- a/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/LegalEntityServiceTest.kt +++ b/modern-treasury-java-core/src/test/kotlin/com/moderntreasury/api/services/blocking/LegalEntityServiceTest.kt @@ -5,6 +5,7 @@ package com.moderntreasury.api.services.blocking import com.moderntreasury.api.TestServerExtension import com.moderntreasury.api.client.okhttp.ModernTreasuryOkHttpClient import com.moderntreasury.api.core.JsonValue +import com.moderntreasury.api.models.BankSettings import com.moderntreasury.api.models.ChildLegalEntityCreate import com.moderntreasury.api.models.IdentificationCreateRequest import com.moderntreasury.api.models.LegalEntityAddressCreateRequest @@ -13,6 +14,7 @@ import com.moderntreasury.api.models.LegalEntityCreateParams import com.moderntreasury.api.models.LegalEntityIndustryClassification import com.moderntreasury.api.models.LegalEntityUpdateParams import com.moderntreasury.api.models.ThirdPartyVerification +import com.moderntreasury.api.models.WealthAndEmploymentDetails import java.time.LocalDate import java.time.OffsetDateTime import org.junit.jupiter.api.Disabled @@ -46,10 +48,11 @@ internal class LegalEntityServiceTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityCreateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -139,10 +142,11 @@ internal class LegalEntityServiceTest { LegalEntityAddressCreateRequest.AddressType.BUSINESS ) .line2("line2") + .primary(true) .build() ) .bankSettings( - ChildLegalEntityCreate.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt( @@ -302,8 +306,7 @@ internal class LegalEntityServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - ChildLegalEntityCreate.LegalEntityWealthEmploymentDetail - .builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt( @@ -316,46 +319,30 @@ internal class LegalEntityServiceTest { .employerName("employer_name") .employerState("employer_state") .employmentStatus( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED + WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED ) .incomeCountry("income_country") .incomeSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .IncomeSource + WealthAndEmploymentDetails.IncomeSource .FAMILY_SUPPORT ) .incomeState("income_state") .industry( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Industry - .ACCOUNTING + WealthAndEmploymentDetails.Industry.ACCOUNTING ) .liveMode(true) .object_("object") .occupation( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .Occupation - .CONSULTING + WealthAndEmploymentDetails.Occupation.CONSULTING ) .sourceOfFunds( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY + WealthAndEmploymentDetails.SourceOfFunds.ALIMONY ) .updatedAt( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") ) .wealthSource( - ChildLegalEntityCreate - .LegalEntityWealthEmploymentDetail - .WealthSource + WealthAndEmploymentDetails.WealthSource .BUSINESS_SALE ) .build() @@ -426,7 +413,7 @@ internal class LegalEntityServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -434,39 +421,17 @@ internal class LegalEntityServiceTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityCreateParams.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website") @@ -514,10 +479,11 @@ internal class LegalEntityServiceTest { .region("region") .addAddressType(LegalEntityAddressCreateRequest.AddressType.BUSINESS) .line2("line2") + .primary(true) .build() ) .bankSettings( - LegalEntityUpdateParams.LegalEntityBankSetting.builder() + BankSettings.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .backupWithholdingPercentage(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -634,7 +600,7 @@ internal class LegalEntityServiceTest { ) .tickerSymbol("ticker_symbol") .wealthAndEmploymentDetails( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.builder() + WealthAndEmploymentDetails.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .annualIncome(0L) .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -642,39 +608,17 @@ internal class LegalEntityServiceTest { .employerCountry("employer_country") .employerName("employer_name") .employerState("employer_state") - .employmentStatus( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .EmploymentStatus - .EMPLOYED - ) + .employmentStatus(WealthAndEmploymentDetails.EmploymentStatus.EMPLOYED) .incomeCountry("income_country") - .incomeSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .IncomeSource - .FAMILY_SUPPORT - ) + .incomeSource(WealthAndEmploymentDetails.IncomeSource.FAMILY_SUPPORT) .incomeState("income_state") - .industry( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Industry - .ACCOUNTING - ) + .industry(WealthAndEmploymentDetails.Industry.ACCOUNTING) .liveMode(true) .object_("object") - .occupation( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail.Occupation - .CONSULTING - ) - .sourceOfFunds( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .SourceOfFunds - .ALIMONY - ) + .occupation(WealthAndEmploymentDetails.Occupation.CONSULTING) + .sourceOfFunds(WealthAndEmploymentDetails.SourceOfFunds.ALIMONY) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .wealthSource( - LegalEntityUpdateParams.LegalEntityWealthEmploymentDetail - .WealthSource - .BUSINESS_SALE - ) + .wealthSource(WealthAndEmploymentDetails.WealthSource.BUSINESS_SALE) .build() ) .website("website")