diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 62c7b030b..82f990268 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.470.0"
+ ".": "0.471.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 89d1fa6cf..8db47988d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 236
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-5c95dd79214af830e2e7fb34ab05f98bde9213311d5e2d59f9a816a8e0369b85.yml
-openapi_spec_hash: ec66c2961a8b90e06ea57f934d8d75db
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-6cc15216773be06ef5899a9f805480d69ba2e610a3746bb638c7773baa10c407.yml
+openapi_spec_hash: c24d9a85acb17d73e8d6434d7c907d40
config_hash: 25d7d7aa4882db6189b4b53e8e249e80
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 57ccd6e38..9d5a18fa9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.471.0 (2026-03-12)
+
+Full Changelog: [v0.470.0...v0.471.0](https://github.com/Increase/increase-java/compare/v0.470.0...v0.471.0)
+
+### Features
+
+* **api:** api update ([6df8195](https://github.com/Increase/increase-java/commit/6df8195707c2f445bb2590519c9a8cd61ca1b33e))
+
## 0.470.0 (2026-03-12)
Full Changelog: [v0.469.0...v0.470.0](https://github.com/Increase/increase-java/compare/v0.469.0...v0.470.0)
diff --git a/README.md b/README.md
index 00db06e8b..199276e45 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.470.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.470.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.471.0)
+[](https://javadoc.io/doc/com.increase.api/increase-java/0.471.0)
@@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe
-The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.470.0).
+The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.471.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle
```kotlin
-implementation("com.increase.api:increase-java:0.470.0")
+implementation("com.increase.api:increase-java:0.471.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.470.0")
com.increase.api
increase-java
- 0.470.0
+ 0.471.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index d3a71b9de..0ca550a5c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.470.0" // x-release-please-version
+ version = "0.471.0" // x-release-please-version
}
subprojects {
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/Entity.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/Entity.kt
index abd4f55cd..ede15978d 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/Entity.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/Entity.kt
@@ -15,7 +15,6 @@ import com.increase.api.core.checkKnown
import com.increase.api.core.checkRequired
import com.increase.api.core.toImmutable
import com.increase.api.errors.IncreaseInvalidDataException
-import com.increase.api.models.beneficialowners.EntityBeneficialOwner
import com.increase.api.models.supplementaldocuments.EntitySupplementalDocument
import java.time.LocalDate
import java.time.OffsetDateTime
@@ -955,7 +954,7 @@ private constructor(
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val address: JsonField
,
- private val beneficialOwners: JsonField>,
+ private val beneficialOwners: JsonField>,
private val email: JsonField,
private val incorporationState: JsonField,
private val industryCode: JsonField,
@@ -970,7 +969,7 @@ private constructor(
@JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(),
@JsonProperty("beneficial_owners")
@ExcludeMissing
- beneficialOwners: JsonField> = JsonMissing.of(),
+ beneficialOwners: JsonField> = JsonMissing.of(),
@JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(),
@JsonProperty("incorporation_state")
@ExcludeMissing
@@ -1009,7 +1008,7 @@ private constructor(
* @throws IncreaseInvalidDataException 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 beneficialOwners(): List =
+ fun beneficialOwners(): List =
beneficialOwners.getRequired("beneficial_owners")
/**
@@ -1078,7 +1077,7 @@ private constructor(
*/
@JsonProperty("beneficial_owners")
@ExcludeMissing
- fun _beneficialOwners(): JsonField> = beneficialOwners
+ fun _beneficialOwners(): JsonField> = beneficialOwners
/**
* Returns the raw JSON value of [email].
@@ -1167,7 +1166,7 @@ private constructor(
class Builder internal constructor() {
private var address: JsonField? = null
- private var beneficialOwners: JsonField>? = null
+ private var beneficialOwners: JsonField>? = null
private var email: JsonField? = null
private var incorporationState: JsonField? = null
private var industryCode: JsonField? = null
@@ -1205,26 +1204,26 @@ private constructor(
* The identifying details of anyone controlling or owning 25% or more of the
* corporation.
*/
- fun beneficialOwners(beneficialOwners: List) =
+ fun beneficialOwners(beneficialOwners: List) =
beneficialOwners(JsonField.of(beneficialOwners))
/**
* Sets [Builder.beneficialOwners] to an arbitrary JSON value.
*
* You should usually call [Builder.beneficialOwners] with a well-typed
- * `List` value instead. This method is primarily for setting the
- * field to an undocumented or not yet supported value.
+ * `List` value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
*/
- fun beneficialOwners(beneficialOwners: JsonField>) = apply {
+ fun beneficialOwners(beneficialOwners: JsonField>) = apply {
this.beneficialOwners = beneficialOwners.map { it.toMutableList() }
}
/**
- * Adds a single [EntityBeneficialOwner] to [beneficialOwners].
+ * Adds a single [BeneficialOwner] to [beneficialOwners].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
- fun addBeneficialOwner(beneficialOwner: EntityBeneficialOwner) = apply {
+ fun addBeneficialOwner(beneficialOwner: BeneficialOwner) = apply {
beneficialOwners =
(beneficialOwners ?: JsonField.of(mutableListOf())).also {
checkKnown("beneficialOwners", it).add(beneficialOwner)
@@ -1760,6 +1759,1554 @@ private constructor(
"Address{city=$city, line1=$line1, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}"
}
+ class BeneficialOwner
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val id: JsonField,
+ private val companyTitle: JsonField,
+ private val individual: JsonField,
+ private val prongs: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
+ @JsonProperty("company_title")
+ @ExcludeMissing
+ companyTitle: JsonField = JsonMissing.of(),
+ @JsonProperty("individual")
+ @ExcludeMissing
+ individual: JsonField = JsonMissing.of(),
+ @JsonProperty("prongs")
+ @ExcludeMissing
+ prongs: JsonField> = JsonMissing.of(),
+ ) : this(id, companyTitle, individual, prongs, mutableMapOf())
+
+ /**
+ * The identifier of this beneficial owner.
+ *
+ * @throws IncreaseInvalidDataException 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")
+
+ /**
+ * This person's role or title within the entity.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun companyTitle(): Optional = companyTitle.getOptional("company_title")
+
+ /**
+ * Personal details for the beneficial owner.
+ *
+ * @throws IncreaseInvalidDataException 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 individual(): Individual = individual.getRequired("individual")
+
+ /**
+ * Why this person is considered a beneficial owner of the entity.
+ *
+ * @throws IncreaseInvalidDataException 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 prongs(): List = prongs.getRequired("prongs")
+
+ /**
+ * 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 [companyTitle].
+ *
+ * Unlike [companyTitle], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("company_title")
+ @ExcludeMissing
+ fun _companyTitle(): JsonField = companyTitle
+
+ /**
+ * Returns the raw JSON value of [individual].
+ *
+ * Unlike [individual], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("individual")
+ @ExcludeMissing
+ fun _individual(): JsonField = individual
+
+ /**
+ * Returns the raw JSON value of [prongs].
+ *
+ * Unlike [prongs], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("prongs") @ExcludeMissing fun _prongs(): JsonField> = prongs
+
+ @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 [BeneficialOwner].
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .companyTitle()
+ * .individual()
+ * .prongs()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [BeneficialOwner]. */
+ class Builder internal constructor() {
+
+ private var id: JsonField? = null
+ private var companyTitle: JsonField? = null
+ private var individual: JsonField? = null
+ private var prongs: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(beneficialOwner: BeneficialOwner) = apply {
+ id = beneficialOwner.id
+ companyTitle = beneficialOwner.companyTitle
+ individual = beneficialOwner.individual
+ prongs = beneficialOwner.prongs.map { it.toMutableList() }
+ additionalProperties = beneficialOwner.additionalProperties.toMutableMap()
+ }
+
+ /** The identifier of this beneficial owner. */
+ 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 }
+
+ /** This person's role or title within the entity. */
+ fun companyTitle(companyTitle: String?) =
+ companyTitle(JsonField.ofNullable(companyTitle))
+
+ /** Alias for calling [Builder.companyTitle] with `companyTitle.orElse(null)`. */
+ fun companyTitle(companyTitle: Optional) =
+ companyTitle(companyTitle.getOrNull())
+
+ /**
+ * Sets [Builder.companyTitle] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.companyTitle] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun companyTitle(companyTitle: JsonField) = apply {
+ this.companyTitle = companyTitle
+ }
+
+ /** Personal details for the beneficial owner. */
+ fun individual(individual: Individual) = individual(JsonField.of(individual))
+
+ /**
+ * Sets [Builder.individual] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.individual] with a well-typed [Individual] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun individual(individual: JsonField) = apply {
+ this.individual = individual
+ }
+
+ /** Why this person is considered a beneficial owner of the entity. */
+ fun prongs(prongs: List) = prongs(JsonField.of(prongs))
+
+ /**
+ * Sets [Builder.prongs] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.prongs] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun prongs(prongs: JsonField>) = apply {
+ this.prongs = prongs.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Prong] to [prongs].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addProng(prong: Prong) = apply {
+ prongs =
+ (prongs ?: JsonField.of(mutableListOf())).also {
+ checkKnown("prongs", it).add(prong)
+ }
+ }
+
+ 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 [BeneficialOwner].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .id()
+ * .companyTitle()
+ * .individual()
+ * .prongs()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): BeneficialOwner =
+ BeneficialOwner(
+ checkRequired("id", id),
+ checkRequired("companyTitle", companyTitle),
+ checkRequired("individual", individual),
+ checkRequired("prongs", prongs).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): BeneficialOwner = apply {
+ if (validated) {
+ return@apply
+ }
+
+ id()
+ companyTitle()
+ individual().validate()
+ prongs().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 (companyTitle.asKnown().isPresent) 1 else 0) +
+ (individual.asKnown().getOrNull()?.validity() ?: 0) +
+ (prongs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /** Personal details for the beneficial owner. */
+ class Individual
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val address: JsonField,
+ private val dateOfBirth: JsonField,
+ private val identification: JsonField,
+ private val name: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("address")
+ @ExcludeMissing
+ address: JsonField = JsonMissing.of(),
+ @JsonProperty("date_of_birth")
+ @ExcludeMissing
+ dateOfBirth: JsonField = JsonMissing.of(),
+ @JsonProperty("identification")
+ @ExcludeMissing
+ identification: JsonField = JsonMissing.of(),
+ @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
+ ) : this(address, dateOfBirth, identification, name, mutableMapOf())
+
+ /**
+ * The person's address.
+ *
+ * @throws IncreaseInvalidDataException 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 address(): Address = address.getRequired("address")
+
+ /**
+ * The person's date of birth in YYYY-MM-DD format.
+ *
+ * @throws IncreaseInvalidDataException 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 dateOfBirth(): LocalDate = dateOfBirth.getRequired("date_of_birth")
+
+ /**
+ * A means of verifying the person's identity.
+ *
+ * @throws IncreaseInvalidDataException 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 identification(): Identification = identification.getRequired("identification")
+
+ /**
+ * The person's legal name.
+ *
+ * @throws IncreaseInvalidDataException 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")
+
+ /**
+ * Returns the raw JSON value of [address].
+ *
+ * Unlike [address], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("address")
+ @ExcludeMissing
+ fun _address(): JsonField = address
+
+ /**
+ * Returns the raw JSON value of [dateOfBirth].
+ *
+ * Unlike [dateOfBirth], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("date_of_birth")
+ @ExcludeMissing
+ fun _dateOfBirth(): JsonField = dateOfBirth
+
+ /**
+ * Returns the raw JSON value of [identification].
+ *
+ * Unlike [identification], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("identification")
+ @ExcludeMissing
+ fun _identification(): JsonField = identification
+
+ /**
+ * 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 [Individual].
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dateOfBirth()
+ * .identification()
+ * .name()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Individual]. */
+ class Builder internal constructor() {
+
+ private var address: JsonField? = null
+ private var dateOfBirth: JsonField? = null
+ private var identification: JsonField? = null
+ private var name: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(individual: Individual) = apply {
+ address = individual.address
+ dateOfBirth = individual.dateOfBirth
+ identification = individual.identification
+ name = individual.name
+ additionalProperties = individual.additionalProperties.toMutableMap()
+ }
+
+ /** The person's address. */
+ fun address(address: Address) = address(JsonField.of(address))
+
+ /**
+ * Sets [Builder.address] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.address] with a well-typed [Address] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun address(address: JsonField) = apply { this.address = address }
+
+ /** The person's date of birth in YYYY-MM-DD format. */
+ fun dateOfBirth(dateOfBirth: LocalDate) = dateOfBirth(JsonField.of(dateOfBirth))
+
+ /**
+ * Sets [Builder.dateOfBirth] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.dateOfBirth] with a well-typed [LocalDate]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun dateOfBirth(dateOfBirth: JsonField) = apply {
+ this.dateOfBirth = dateOfBirth
+ }
+
+ /** A means of verifying the person's identity. */
+ fun identification(identification: Identification) =
+ identification(JsonField.of(identification))
+
+ /**
+ * Sets [Builder.identification] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.identification] with a well-typed
+ * [Identification] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun identification(identification: JsonField) = apply {
+ this.identification = identification
+ }
+
+ /** The person's legal name. */
+ 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 [Individual].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .dateOfBirth()
+ * .identification()
+ * .name()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Individual =
+ Individual(
+ checkRequired("address", address),
+ checkRequired("dateOfBirth", dateOfBirth),
+ checkRequired("identification", identification),
+ checkRequired("name", name),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Individual = apply {
+ if (validated) {
+ return@apply
+ }
+
+ address().validate()
+ dateOfBirth()
+ identification().validate()
+ name()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 =
+ (address.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (dateOfBirth.asKnown().isPresent) 1 else 0) +
+ (identification.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (name.asKnown().isPresent) 1 else 0)
+
+ /** The person's address. */
+ class Address
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val city: JsonField,
+ private val country: JsonField,
+ private val line1: JsonField,
+ private val line2: JsonField,
+ private val state: JsonField,
+ private val zip: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("city")
+ @ExcludeMissing
+ city: JsonField = JsonMissing.of(),
+ @JsonProperty("country")
+ @ExcludeMissing
+ country: JsonField = JsonMissing.of(),
+ @JsonProperty("line1")
+ @ExcludeMissing
+ line1: JsonField = JsonMissing.of(),
+ @JsonProperty("line2")
+ @ExcludeMissing
+ line2: JsonField = JsonMissing.of(),
+ @JsonProperty("state")
+ @ExcludeMissing
+ state: JsonField = JsonMissing.of(),
+ @JsonProperty("zip")
+ @ExcludeMissing
+ zip: JsonField = JsonMissing.of(),
+ ) : this(city, country, line1, line2, state, zip, mutableMapOf())
+
+ /**
+ * The city, district, town, or village of the address.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun city(): Optional = city.getOptional("city")
+
+ /**
+ * The two-letter ISO 3166-1 alpha-2 code for the country of the address.
+ *
+ * @throws IncreaseInvalidDataException 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 country(): String = country.getRequired("country")
+
+ /**
+ * The first line of the address.
+ *
+ * @throws IncreaseInvalidDataException 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 line1(): String = line1.getRequired("line1")
+
+ /**
+ * The second line of the address.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun line2(): Optional = line2.getOptional("line2")
+
+ /**
+ * The two-letter United States Postal Service (USPS) abbreviation for the US
+ * state, province, or region of the address.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun state(): Optional = state.getOptional("state")
+
+ /**
+ * The ZIP or postal code of the address.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun zip(): Optional = zip.getOptional("zip")
+
+ /**
+ * Returns the raw JSON value of [city].
+ *
+ * Unlike [city], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("country")
+ @ExcludeMissing
+ fun _country(): JsonField = country
+
+ /**
+ * Returns the raw JSON value of [line1].
+ *
+ * Unlike [line1], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("line1") @ExcludeMissing fun _line1(): JsonField = line1
+
+ /**
+ * Returns the raw JSON value of [line2].
+ *
+ * Unlike [line2], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("line2") @ExcludeMissing fun _line2(): JsonField = line2
+
+ /**
+ * Returns the raw JSON value of [state].
+ *
+ * Unlike [state], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state
+
+ /**
+ * Returns the raw JSON value of [zip].
+ *
+ * Unlike [zip], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("zip") @ExcludeMissing fun _zip(): JsonField = zip
+
+ @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 [Address].
+ *
+ * The following fields are required:
+ * ```java
+ * .city()
+ * .country()
+ * .line1()
+ * .line2()
+ * .state()
+ * .zip()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Address]. */
+ class Builder internal constructor() {
+
+ private var city: JsonField? = null
+ private var country: JsonField? = null
+ private var line1: JsonField? = null
+ private var line2: JsonField? = null
+ private var state: JsonField? = null
+ private var zip: JsonField? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(address: Address) = apply {
+ city = address.city
+ country = address.country
+ line1 = address.line1
+ line2 = address.line2
+ state = address.state
+ zip = address.zip
+ additionalProperties = address.additionalProperties.toMutableMap()
+ }
+
+ /** The city, district, town, or village of the address. */
+ fun city(city: String?) = city(JsonField.ofNullable(city))
+
+ /** Alias for calling [Builder.city] with `city.orElse(null)`. */
+ fun city(city: Optional) = city(city.getOrNull())
+
+ /**
+ * Sets [Builder.city] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.city] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun city(city: JsonField) = apply { this.city = city }
+
+ /**
+ * The two-letter ISO 3166-1 alpha-2 code for the country of the address.
+ */
+ fun country(country: String) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ /** The first line of the address. */
+ fun line1(line1: String) = line1(JsonField.of(line1))
+
+ /**
+ * Sets [Builder.line1] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.line1] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun line1(line1: JsonField) = apply { this.line1 = line1 }
+
+ /** The second line of the address. */
+ fun line2(line2: String?) = line2(JsonField.ofNullable(line2))
+
+ /** Alias for calling [Builder.line2] with `line2.orElse(null)`. */
+ fun line2(line2: Optional) = line2(line2.getOrNull())
+
+ /**
+ * Sets [Builder.line2] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.line2] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun line2(line2: JsonField) = apply { this.line2 = line2 }
+
+ /**
+ * The two-letter United States Postal Service (USPS) abbreviation for the
+ * US state, province, or region of the address.
+ */
+ fun state(state: String?) = state(JsonField.ofNullable(state))
+
+ /** Alias for calling [Builder.state] with `state.orElse(null)`. */
+ fun state(state: Optional) = state(state.getOrNull())
+
+ /**
+ * Sets [Builder.state] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.state] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun state(state: JsonField) = apply { this.state = state }
+
+ /** The ZIP or postal code of the address. */
+ fun zip(zip: String?) = zip(JsonField.ofNullable(zip))
+
+ /** Alias for calling [Builder.zip] with `zip.orElse(null)`. */
+ fun zip(zip: Optional) = zip(zip.getOrNull())
+
+ /**
+ * Sets [Builder.zip] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.zip] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun zip(zip: JsonField) = apply { this.zip = zip }
+
+ 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 [Address].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .city()
+ * .country()
+ * .line1()
+ * .line2()
+ * .state()
+ * .zip()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Address =
+ Address(
+ checkRequired("city", city),
+ checkRequired("country", country),
+ checkRequired("line1", line1),
+ checkRequired("line2", line2),
+ checkRequired("state", state),
+ checkRequired("zip", zip),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Address = apply {
+ if (validated) {
+ return@apply
+ }
+
+ city()
+ country()
+ line1()
+ line2()
+ state()
+ zip()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 (city.asKnown().isPresent) 1 else 0) +
+ (if (country.asKnown().isPresent) 1 else 0) +
+ (if (line1.asKnown().isPresent) 1 else 0) +
+ (if (line2.asKnown().isPresent) 1 else 0) +
+ (if (state.asKnown().isPresent) 1 else 0) +
+ (if (zip.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Address &&
+ city == other.city &&
+ country == other.country &&
+ line1 == other.line1 &&
+ line2 == other.line2 &&
+ state == other.state &&
+ zip == other.zip &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(city, country, line1, line2, state, zip, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Address{city=$city, country=$country, line1=$line1, line2=$line2, state=$state, zip=$zip, additionalProperties=$additionalProperties}"
+ }
+
+ /** A means of verifying the person's identity. */
+ class Identification
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val method: JsonField,
+ private val numberLast4: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("method")
+ @ExcludeMissing
+ method: JsonField = JsonMissing.of(),
+ @JsonProperty("number_last4")
+ @ExcludeMissing
+ numberLast4: JsonField = JsonMissing.of(),
+ ) : this(method, numberLast4, mutableMapOf())
+
+ /**
+ * A method that can be used to verify the individual's identity.
+ *
+ * @throws IncreaseInvalidDataException 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 method(): Method = method.getRequired("method")
+
+ /**
+ * The last 4 digits of the identification number that can be used to verify the
+ * individual's identity.
+ *
+ * @throws IncreaseInvalidDataException 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 numberLast4(): String = numberLast4.getRequired("number_last4")
+
+ /**
+ * Returns the raw JSON value of [method].
+ *
+ * Unlike [method], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("method")
+ @ExcludeMissing
+ fun _method(): JsonField = method
+
+ /**
+ * Returns the raw JSON value of [numberLast4].
+ *
+ * Unlike [numberLast4], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("number_last4")
+ @ExcludeMissing
+ fun _numberLast4(): JsonField = numberLast4
+
+ @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
+ * [Identification].
+ *
+ * The following fields are required:
+ * ```java
+ * .method()
+ * .numberLast4()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Identification]. */
+ class Builder internal constructor() {
+
+ private var method: JsonField? = null
+ private var numberLast4: JsonField? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(identification: Identification) = apply {
+ method = identification.method
+ numberLast4 = identification.numberLast4
+ additionalProperties =
+ identification.additionalProperties.toMutableMap()
+ }
+
+ /** A method that can be used to verify the individual's identity. */
+ fun method(method: Method) = method(JsonField.of(method))
+
+ /**
+ * Sets [Builder.method] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.method] with a well-typed [Method] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun method(method: JsonField) = apply { this.method = method }
+
+ /**
+ * The last 4 digits of the identification number that can be used to verify
+ * the individual's identity.
+ */
+ fun numberLast4(numberLast4: String) =
+ numberLast4(JsonField.of(numberLast4))
+
+ /**
+ * Sets [Builder.numberLast4] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.numberLast4] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun numberLast4(numberLast4: JsonField) = apply {
+ this.numberLast4 = numberLast4
+ }
+
+ 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 [Identification].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .method()
+ * .numberLast4()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Identification =
+ Identification(
+ checkRequired("method", method),
+ checkRequired("numberLast4", numberLast4),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Identification = apply {
+ if (validated) {
+ return@apply
+ }
+
+ method().validate()
+ numberLast4()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 =
+ (method.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (numberLast4.asKnown().isPresent) 1 else 0)
+
+ /** A method that can be used to verify the individual's identity. */
+ class Method
+ @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 {
+
+ /** A social security number. */
+ @JvmField val SOCIAL_SECURITY_NUMBER = of("social_security_number")
+
+ /** An individual taxpayer identification number (ITIN). */
+ @JvmField
+ val INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER =
+ of("individual_taxpayer_identification_number")
+
+ /** A passport number. */
+ @JvmField val PASSPORT = of("passport")
+
+ /** A driver's license number. */
+ @JvmField val DRIVERS_LICENSE = of("drivers_license")
+
+ /** Another identifying document. */
+ @JvmField val OTHER = of("other")
+
+ @JvmStatic fun of(value: String) = Method(JsonField.of(value))
+ }
+
+ /** An enum containing [Method]'s known values. */
+ enum class Known {
+ /** A social security number. */
+ SOCIAL_SECURITY_NUMBER,
+ /** An individual taxpayer identification number (ITIN). */
+ INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER,
+ /** A passport number. */
+ PASSPORT,
+ /** A driver's license number. */
+ DRIVERS_LICENSE,
+ /** Another identifying document. */
+ OTHER,
+ }
+
+ /**
+ * An enum containing [Method]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [Method] 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 {
+ /** A social security number. */
+ SOCIAL_SECURITY_NUMBER,
+ /** An individual taxpayer identification number (ITIN). */
+ INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER,
+ /** A passport number. */
+ PASSPORT,
+ /** A driver's license number. */
+ DRIVERS_LICENSE,
+ /** Another identifying document. */
+ OTHER,
+ /**
+ * An enum member indicating that [Method] 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) {
+ SOCIAL_SECURITY_NUMBER -> Value.SOCIAL_SECURITY_NUMBER
+ INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER ->
+ Value.INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER
+ PASSPORT -> Value.PASSPORT
+ DRIVERS_LICENSE -> Value.DRIVERS_LICENSE
+ OTHER -> Value.OTHER
+ 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 IncreaseInvalidDataException if this class instance's value is a
+ * not a known member.
+ */
+ fun known(): Known =
+ when (this) {
+ SOCIAL_SECURITY_NUMBER -> Known.SOCIAL_SECURITY_NUMBER
+ INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER ->
+ Known.INDIVIDUAL_TAXPAYER_IDENTIFICATION_NUMBER
+ PASSPORT -> Known.PASSPORT
+ DRIVERS_LICENSE -> Known.DRIVERS_LICENSE
+ OTHER -> Known.OTHER
+ else -> throw IncreaseInvalidDataException("Unknown Method: $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 IncreaseInvalidDataException if this class instance's value does
+ * not have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Method = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 Method && 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 Identification &&
+ method == other.method &&
+ numberLast4 == other.numberLast4 &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(method, numberLast4, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Identification{method=$method, numberLast4=$numberLast4, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Individual &&
+ address == other.address &&
+ dateOfBirth == other.dateOfBirth &&
+ identification == other.identification &&
+ name == other.name &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(address, dateOfBirth, identification, name, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Individual{address=$address, dateOfBirth=$dateOfBirth, identification=$identification, name=$name, additionalProperties=$additionalProperties}"
+ }
+
+ class Prong @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 {
+
+ /** A person with 25% or greater direct or indirect ownership of the entity. */
+ @JvmField val OWNERSHIP = of("ownership")
+
+ /** A person who manages, directs, or has significant control of the entity. */
+ @JvmField val CONTROL = of("control")
+
+ @JvmStatic fun of(value: String) = Prong(JsonField.of(value))
+ }
+
+ /** An enum containing [Prong]'s known values. */
+ enum class Known {
+ /** A person with 25% or greater direct or indirect ownership of the entity. */
+ OWNERSHIP,
+ /** A person who manages, directs, or has significant control of the entity. */
+ CONTROL,
+ }
+
+ /**
+ * An enum containing [Prong]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Prong] 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 {
+ /** A person with 25% or greater direct or indirect ownership of the entity. */
+ OWNERSHIP,
+ /** A person who manages, directs, or has significant control of the entity. */
+ CONTROL,
+ /**
+ * An enum member indicating that [Prong] 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) {
+ OWNERSHIP -> Value.OWNERSHIP
+ CONTROL -> Value.CONTROL
+ 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 IncreaseInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ OWNERSHIP -> Known.OWNERSHIP
+ CONTROL -> Known.CONTROL
+ else -> throw IncreaseInvalidDataException("Unknown Prong: $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 IncreaseInvalidDataException if this class instance's value does not have
+ * the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ IncreaseInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Prong = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 Prong && 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 BeneficialOwner &&
+ id == other.id &&
+ companyTitle == other.companyTitle &&
+ individual == other.individual &&
+ prongs == other.prongs &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(id, companyTitle, individual, prongs, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "BeneficialOwner{id=$id, companyTitle=$companyTitle, individual=$individual, prongs=$prongs, additionalProperties=$additionalProperties}"
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityListPageResponseTest.kt
index 401fa8cad..2e12db2c0 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityListPageResponseTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityListPageResponseTest.kt
@@ -4,7 +4,6 @@ package com.increase.api.models.entities
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.increase.api.core.jsonMapper
-import com.increase.api.models.beneficialowners.EntityBeneficialOwner
import com.increase.api.models.supplementaldocuments.EntitySupplementalDocument
import java.time.LocalDate
import java.time.OffsetDateTime
@@ -32,17 +31,16 @@ internal class EntityListPageResponseTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id(
"entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7"
)
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address
+ Entity.Corporation.BeneficialOwner.Individual
+ .Address
.builder()
.city("New York")
.country("US")
@@ -54,10 +52,12 @@ internal class EntityListPageResponseTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.builder()
.method(
- EntityBeneficialOwner.Individual
+ Entity.Corporation.BeneficialOwner
+ .Individual
.Identification
.Method
.SOCIAL_SECURITY_NUMBER
@@ -68,9 +68,10 @@ internal class EntityListPageResponseTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(
+ Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP
+ )
.build()
)
.email(null)
@@ -288,17 +289,17 @@ internal class EntityListPageResponseTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id(
"entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7"
)
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address.builder()
+ Entity.Corporation.BeneficialOwner.Individual
+ .Address
+ .builder()
.city("New York")
.country("US")
.line1("33 Liberty Street")
@@ -309,10 +310,12 @@ internal class EntityListPageResponseTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.builder()
.method(
- EntityBeneficialOwner.Individual
+ Entity.Corporation.BeneficialOwner
+ .Individual
.Identification
.Method
.SOCIAL_SECURITY_NUMBER
@@ -323,9 +326,8 @@ internal class EntityListPageResponseTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP)
.build()
)
.email(null)
@@ -546,17 +548,16 @@ internal class EntityListPageResponseTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id(
"entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7"
)
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address
+ Entity.Corporation.BeneficialOwner.Individual
+ .Address
.builder()
.city("New York")
.country("US")
@@ -568,10 +569,12 @@ internal class EntityListPageResponseTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.builder()
.method(
- EntityBeneficialOwner.Individual
+ Entity.Corporation.BeneficialOwner
+ .Individual
.Identification
.Method
.SOCIAL_SECURITY_NUMBER
@@ -582,9 +585,10 @@ internal class EntityListPageResponseTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(
+ Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP
+ )
.build()
)
.email(null)
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityTest.kt
index 48a74f822..3d81c0678 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityTest.kt
@@ -4,7 +4,6 @@ package com.increase.api.models.entities
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.increase.api.core.jsonMapper
-import com.increase.api.models.beneficialowners.EntityBeneficialOwner
import com.increase.api.models.supplementaldocuments.EntitySupplementalDocument
import java.time.LocalDate
import java.time.OffsetDateTime
@@ -30,15 +29,14 @@ internal class EntityTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7")
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address.builder()
+ Entity.Corporation.BeneficialOwner.Individual.Address
+ .builder()
.city("New York")
.country("US")
.line1("33 Liberty Street")
@@ -49,10 +47,12 @@ internal class EntityTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.builder()
.method(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.Method
.SOCIAL_SECURITY_NUMBER
)
@@ -62,9 +62,8 @@ internal class EntityTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP)
.build()
)
.email(null)
@@ -274,15 +273,14 @@ internal class EntityTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7")
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address.builder()
+ Entity.Corporation.BeneficialOwner.Individual.Address
+ .builder()
.city("New York")
.country("US")
.line1("33 Liberty Street")
@@ -293,9 +291,11 @@ internal class EntityTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification.builder()
+ Entity.Corporation.BeneficialOwner.Individual.Identification
+ .builder()
.method(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.Method
.SOCIAL_SECURITY_NUMBER
)
@@ -305,9 +305,8 @@ internal class EntityTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP)
.build()
)
.email(null)
@@ -528,15 +527,14 @@ internal class EntityTest {
.build()
)
.addBeneficialOwner(
- EntityBeneficialOwner.builder()
+ Entity.Corporation.BeneficialOwner.builder()
.id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7")
.companyTitle("CEO")
- .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z"))
- .idempotencyKey(null)
.individual(
- EntityBeneficialOwner.Individual.builder()
+ Entity.Corporation.BeneficialOwner.Individual.builder()
.address(
- EntityBeneficialOwner.Individual.Address.builder()
+ Entity.Corporation.BeneficialOwner.Individual.Address
+ .builder()
.city("New York")
.country("US")
.line1("33 Liberty Street")
@@ -547,10 +545,12 @@ internal class EntityTest {
)
.dateOfBirth(LocalDate.parse("1970-01-31"))
.identification(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.builder()
.method(
- EntityBeneficialOwner.Individual.Identification
+ Entity.Corporation.BeneficialOwner.Individual
+ .Identification
.Method
.SOCIAL_SECURITY_NUMBER
)
@@ -560,9 +560,8 @@ internal class EntityTest {
.name("Ian Crease")
.build()
)
- .addProng(EntityBeneficialOwner.Prong.CONTROL)
- .addProng(EntityBeneficialOwner.Prong.OWNERSHIP)
- .type(EntityBeneficialOwner.Type.ENTITY_BENEFICIAL_OWNER)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.CONTROL)
+ .addProng(Entity.Corporation.BeneficialOwner.Prong.OWNERSHIP)
.build()
)
.email(null)