From 7470b8e77eb0ff806b41158136ec6b2346270330 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:19:27 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 8 +- .../BeneficialOwnerCreateParams.kt | 2960 +++++++++++++++++ .../beneficialowners/EntityBeneficialOwner.kt | 69 +- .../async/BeneficialOwnerServiceAsync.kt | 26 + .../async/BeneficialOwnerServiceAsyncImpl.kt | 39 + .../blocking/BeneficialOwnerService.kt | 26 + .../blocking/BeneficialOwnerServiceImpl.kt | 36 + .../BeneficialOwnerCreateParamsTest.kt | 255 ++ .../BeneficialOwnerListPageResponseTest.kt | 3 + .../EntityBeneficialOwnerTest.kt | 3 + .../entities/EntityListPageResponseTest.kt | 3 + .../api/models/entities/EntityTest.kt | 3 + .../async/BeneficialOwnerServiceAsyncTest.kt | 78 + .../blocking/BeneficialOwnerServiceTest.kt | 77 + 14 files changed, 3579 insertions(+), 7 deletions(-) create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParams.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParamsTest.kt diff --git a/.stats.yml b/.stats.yml index c29f1d485..3528901cc 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-4d9e8a8a1909ef7c96fe28293ab07720938ce09be84687c57e3cf95890a78205.yml -openapi_spec_hash: 4b3867a81a8429bf6ab119f910e72865 -config_hash: e73b1147c039cb3d6a2c56ae5926bca8 +configured_endpoints: 237 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-2c11248a841117464c3d87ee8069761f8fdf1a235557bbc885bcfa13de4107c4.yml +openapi_spec_hash: 6bcd6b02eaff96080fc9f57fd5942502 +config_hash: 81fdd83e44056d1f623e280bc106245d diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParams.kt new file mode 100644 index 000000000..3067c6fc2 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParams.kt @@ -0,0 +1,2960 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.beneficialowners + +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.increase.api.core.Enum +import com.increase.api.core.ExcludeMissing +import com.increase.api.core.JsonField +import com.increase.api.core.JsonMissing +import com.increase.api.core.JsonValue +import com.increase.api.core.Params +import com.increase.api.core.checkKnown +import com.increase.api.core.checkRequired +import com.increase.api.core.http.Headers +import com.increase.api.core.http.QueryParams +import com.increase.api.core.toImmutable +import com.increase.api.errors.IncreaseInvalidDataException +import java.time.LocalDate +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Create a beneficial owner */ +class BeneficialOwnerCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * The identifier of the Entity to associate with the new 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 entityId(): String = body.entityId() + + /** + * 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 = body.individual() + + /** + * Why this person is considered a beneficial owner of the entity. At least one option is + * required, if a person is both a control person and owner, submit an array containing both. + * + * @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 = body.prongs() + + /** + * 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 = body.companyTitle() + + /** + * Returns the raw JSON value of [entityId]. + * + * Unlike [entityId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _entityId(): JsonField = body._entityId() + + /** + * Returns the raw JSON value of [individual]. + * + * Unlike [individual], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _individual(): JsonField = body._individual() + + /** + * Returns the raw JSON value of [prongs]. + * + * Unlike [prongs], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _prongs(): JsonField> = body._prongs() + + /** + * Returns the raw JSON value of [companyTitle]. + * + * Unlike [companyTitle], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _companyTitle(): JsonField = body._companyTitle() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [BeneficialOwnerCreateParams]. + * + * The following fields are required: + * ```java + * .entityId() + * .individual() + * .prongs() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [BeneficialOwnerCreateParams]. */ + class Builder internal constructor() { + + private var body: Body.Builder = Body.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(beneficialOwnerCreateParams: BeneficialOwnerCreateParams) = apply { + body = beneficialOwnerCreateParams.body.toBuilder() + additionalHeaders = beneficialOwnerCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = beneficialOwnerCreateParams.additionalQueryParams.toBuilder() + } + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [entityId] + * - [individual] + * - [prongs] + * - [companyTitle] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The identifier of the Entity to associate with the new Beneficial Owner. */ + fun entityId(entityId: String) = apply { body.entityId(entityId) } + + /** + * Sets [Builder.entityId] to an arbitrary JSON value. + * + * You should usually call [Builder.entityId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun entityId(entityId: JsonField) = apply { body.entityId(entityId) } + + /** Personal details for the beneficial owner. */ + fun individual(individual: Individual) = apply { body.individual(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 { body.individual(individual) } + + /** + * Why this person is considered a beneficial owner of the entity. At least one option is + * required, if a person is both a control person and owner, submit an array containing + * both. + */ + fun prongs(prongs: List) = apply { body.prongs(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 { body.prongs(prongs) } + + /** + * Adds a single [Prong] to [prongs]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addProng(prong: Prong) = apply { body.addProng(prong) } + + /** This person's role or title within the entity. */ + fun companyTitle(companyTitle: String) = apply { body.companyTitle(companyTitle) } + + /** + * 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 { + body.companyTitle(companyTitle) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [BeneficialOwnerCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .entityId() + * .individual() + * .prongs() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): BeneficialOwnerCreateParams = + BeneficialOwnerCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val entityId: JsonField, + private val individual: JsonField, + private val prongs: JsonField>, + private val companyTitle: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("entity_id") + @ExcludeMissing + entityId: JsonField = JsonMissing.of(), + @JsonProperty("individual") + @ExcludeMissing + individual: JsonField = JsonMissing.of(), + @JsonProperty("prongs") + @ExcludeMissing + prongs: JsonField> = JsonMissing.of(), + @JsonProperty("company_title") + @ExcludeMissing + companyTitle: JsonField = JsonMissing.of(), + ) : this(entityId, individual, prongs, companyTitle, mutableMapOf()) + + /** + * The identifier of the Entity to associate with the new 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 entityId(): String = entityId.getRequired("entity_id") + + /** + * 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. At least one option is + * required, if a person is both a control person and owner, submit an array containing + * both. + * + * @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") + + /** + * 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") + + /** + * Returns the raw JSON value of [entityId]. + * + * Unlike [entityId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("entity_id") @ExcludeMissing fun _entityId(): JsonField = entityId + + /** + * 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 + + /** + * 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 + + @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 [Body]. + * + * The following fields are required: + * ```java + * .entityId() + * .individual() + * .prongs() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var entityId: JsonField? = null + private var individual: JsonField? = null + private var prongs: JsonField>? = null + private var companyTitle: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + entityId = body.entityId + individual = body.individual + prongs = body.prongs.map { it.toMutableList() } + companyTitle = body.companyTitle + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The identifier of the Entity to associate with the new Beneficial Owner. */ + fun entityId(entityId: String) = entityId(JsonField.of(entityId)) + + /** + * Sets [Builder.entityId] to an arbitrary JSON value. + * + * You should usually call [Builder.entityId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun entityId(entityId: JsonField) = apply { this.entityId = entityId } + + /** 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. At least one option + * is required, if a person is both a control person and owner, submit an array + * containing both. + */ + 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) + } + } + + /** This person's role or title within the entity. */ + fun companyTitle(companyTitle: String) = companyTitle(JsonField.of(companyTitle)) + + /** + * 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 + } + + 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 [Body]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .entityId() + * .individual() + * .prongs() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("entityId", entityId), + checkRequired("individual", individual), + checkRequired("prongs", prongs).map { it.toImmutable() }, + companyTitle, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + entityId() + individual().validate() + prongs().forEach { it.validate() } + companyTitle() + 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 (entityId.asKnown().isPresent) 1 else 0) + + (individual.asKnown().getOrNull()?.validity() ?: 0) + + (prongs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (companyTitle.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + entityId == other.entityId && + individual == other.individual && + prongs == other.prongs && + companyTitle == other.companyTitle && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(entityId, individual, prongs, companyTitle, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{entityId=$entityId, individual=$individual, prongs=$prongs, companyTitle=$companyTitle, additionalProperties=$additionalProperties}" + } + + /** 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 confirmedNoUsTaxId: 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(), + @JsonProperty("confirmed_no_us_tax_id") + @ExcludeMissing + confirmedNoUsTaxId: JsonField = JsonMissing.of(), + ) : this(address, dateOfBirth, identification, name, confirmedNoUsTaxId, mutableMapOf()) + + /** + * The individual's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + * + * @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") + + /** + * The identification method for an individual can only be a passport, driver's license, or + * other document if you've confirmed the individual does not have a US tax id (either a + * Social Security Number or Individual Taxpayer Identification Number). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun confirmedNoUsTaxId(): Optional = + confirmedNoUsTaxId.getOptional("confirmed_no_us_tax_id") + + /** + * 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 + + /** + * Returns the raw JSON value of [confirmedNoUsTaxId]. + * + * Unlike [confirmedNoUsTaxId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("confirmed_no_us_tax_id") + @ExcludeMissing + fun _confirmedNoUsTaxId(): JsonField = confirmedNoUsTaxId + + @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 confirmedNoUsTaxId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(individual: Individual) = apply { + address = individual.address + dateOfBirth = individual.dateOfBirth + identification = individual.identification + name = individual.name + confirmedNoUsTaxId = individual.confirmedNoUsTaxId + additionalProperties = individual.additionalProperties.toMutableMap() + } + + /** + * The individual's physical address. Mail receiving locations like PO Boxes and PMB's + * are disallowed. + */ + 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 } + + /** + * The identification method for an individual can only be a passport, driver's license, + * or other document if you've confirmed the individual does not have a US tax id + * (either a Social Security Number or Individual Taxpayer Identification Number). + */ + fun confirmedNoUsTaxId(confirmedNoUsTaxId: Boolean) = + confirmedNoUsTaxId(JsonField.of(confirmedNoUsTaxId)) + + /** + * Sets [Builder.confirmedNoUsTaxId] to an arbitrary JSON value. + * + * You should usually call [Builder.confirmedNoUsTaxId] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun confirmedNoUsTaxId(confirmedNoUsTaxId: JsonField) = apply { + this.confirmedNoUsTaxId = confirmedNoUsTaxId + } + + 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), + confirmedNoUsTaxId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Individual = apply { + if (validated) { + return@apply + } + + address().validate() + dateOfBirth() + identification().validate() + name() + confirmedNoUsTaxId() + 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) + + (if (confirmedNoUsTaxId.asKnown().isPresent) 1 else 0) + + /** + * The individual's physical address. Mail receiving locations like PO Boxes and PMB's are + * disallowed. + */ + 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 or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun city(): String = city.getRequired("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. This is usually the street number and street. + * + * @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. This might be the floor or room number. + * + * @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. Required in certain countries. + * + * @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. Required in certain countries. + * + * @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() + * ``` + */ + @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 = JsonMissing.of() + private var state: JsonField = JsonMissing.of() + private var zip: JsonField = JsonMissing.of() + 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.of(city)) + + /** + * 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. This is usually the street number and street. */ + 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. This might be the floor or room number. */ + fun line2(line2: String) = line2(JsonField.of(line2)) + + /** + * 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. Required in certain countries. + */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * 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. Required in certain countries. */ + fun zip(zip: String) = zip(JsonField.of(zip)) + + /** + * 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() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Address = + Address( + checkRequired("city", city), + checkRequired("country", country), + checkRequired("line1", line1), + line2, + state, + 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 number: JsonField, + private val driversLicense: JsonField, + private val other: JsonField, + private val passport: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("method") + @ExcludeMissing + method: JsonField = JsonMissing.of(), + @JsonProperty("number") + @ExcludeMissing + number: JsonField = JsonMissing.of(), + @JsonProperty("drivers_license") + @ExcludeMissing + driversLicense: JsonField = JsonMissing.of(), + @JsonProperty("other") @ExcludeMissing other: JsonField = JsonMissing.of(), + @JsonProperty("passport") + @ExcludeMissing + passport: JsonField = JsonMissing.of(), + ) : this(method, number, driversLicense, other, passport, 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") + + /** + * An identification number that can be used to verify the individual's identity, such + * as a social security number. + * + * @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 number(): String = number.getRequired("number") + + /** + * Information about the United States driver's license used for identification. + * Required if `method` is equal to `drivers_license`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun driversLicense(): Optional = + driversLicense.getOptional("drivers_license") + + /** + * Information about the identification document provided. Required if `method` is equal + * to `other`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun other(): Optional = other.getOptional("other") + + /** + * Information about the passport used for identification. Required if `method` is equal + * to `passport`. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun passport(): Optional = passport.getOptional("passport") + + /** + * 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 [number]. + * + * Unlike [number], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number + + /** + * Returns the raw JSON value of [driversLicense]. + * + * Unlike [driversLicense], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("drivers_license") + @ExcludeMissing + fun _driversLicense(): JsonField = driversLicense + + /** + * Returns the raw JSON value of [other]. + * + * Unlike [other], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("other") @ExcludeMissing fun _other(): JsonField = other + + /** + * Returns the raw JSON value of [passport]. + * + * Unlike [passport], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("passport") + @ExcludeMissing + fun _passport(): JsonField = passport + + @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() + * .number() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Identification]. */ + class Builder internal constructor() { + + private var method: JsonField? = null + private var number: JsonField? = null + private var driversLicense: JsonField = JsonMissing.of() + private var other: JsonField = JsonMissing.of() + private var passport: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(identification: Identification) = apply { + method = identification.method + number = identification.number + driversLicense = identification.driversLicense + other = identification.other + passport = identification.passport + 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 } + + /** + * An identification number that can be used to verify the individual's identity, + * such as a social security number. + */ + fun number(number: String) = number(JsonField.of(number)) + + /** + * Sets [Builder.number] to an arbitrary JSON value. + * + * You should usually call [Builder.number] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun number(number: JsonField) = apply { this.number = number } + + /** + * Information about the United States driver's license used for identification. + * Required if `method` is equal to `drivers_license`. + */ + fun driversLicense(driversLicense: DriversLicense) = + driversLicense(JsonField.of(driversLicense)) + + /** + * Sets [Builder.driversLicense] to an arbitrary JSON value. + * + * You should usually call [Builder.driversLicense] with a well-typed + * [DriversLicense] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun driversLicense(driversLicense: JsonField) = apply { + this.driversLicense = driversLicense + } + + /** + * Information about the identification document provided. Required if `method` is + * equal to `other`. + */ + fun other(other: Other) = other(JsonField.of(other)) + + /** + * Sets [Builder.other] to an arbitrary JSON value. + * + * You should usually call [Builder.other] with a well-typed [Other] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun other(other: JsonField) = apply { this.other = other } + + /** + * Information about the passport used for identification. Required if `method` is + * equal to `passport`. + */ + fun passport(passport: Passport) = passport(JsonField.of(passport)) + + /** + * Sets [Builder.passport] to an arbitrary JSON value. + * + * You should usually call [Builder.passport] with a well-typed [Passport] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun passport(passport: JsonField) = apply { this.passport = passport } + + 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() + * .number() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Identification = + Identification( + checkRequired("method", method), + checkRequired("number", number), + driversLicense, + other, + passport, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Identification = apply { + if (validated) { + return@apply + } + + method().validate() + number() + driversLicense().ifPresent { it.validate() } + other().ifPresent { it.validate() } + passport().ifPresent { 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 = + (method.asKnown().getOrNull()?.validity() ?: 0) + + (if (number.asKnown().isPresent) 1 else 0) + + (driversLicense.asKnown().getOrNull()?.validity() ?: 0) + + (other.asKnown().getOrNull()?.validity() ?: 0) + + (passport.asKnown().getOrNull()?.validity() ?: 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() + } + + /** + * Information about the United States driver's license used for identification. + * Required if `method` is equal to `drivers_license`. + */ + class DriversLicense + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val expirationDate: JsonField, + private val fileId: JsonField, + private val state: JsonField, + private val backFileId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("expiration_date") + @ExcludeMissing + expirationDate: JsonField = JsonMissing.of(), + @JsonProperty("file_id") + @ExcludeMissing + fileId: JsonField = JsonMissing.of(), + @JsonProperty("state") + @ExcludeMissing + state: JsonField = JsonMissing.of(), + @JsonProperty("back_file_id") + @ExcludeMissing + backFileId: JsonField = JsonMissing.of(), + ) : this(expirationDate, fileId, state, backFileId, mutableMapOf()) + + /** + * The driver's license's expiration date 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 expirationDate(): LocalDate = expirationDate.getRequired("expiration_date") + + /** + * The identifier of the File containing the front of the driver's license. + * + * @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 fileId(): String = fileId.getRequired("file_id") + + /** + * The state that issued the provided driver's license. + * + * @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 state(): String = state.getRequired("state") + + /** + * The identifier of the File containing the back of the driver's license. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun backFileId(): Optional = backFileId.getOptional("back_file_id") + + /** + * 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 + + /** + * Returns the raw JSON value of [fileId]. + * + * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId + + /** + * 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 [backFileId]. + * + * Unlike [backFileId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("back_file_id") + @ExcludeMissing + fun _backFileId(): JsonField = backFileId + + @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 [DriversLicense]. + * + * The following fields are required: + * ```java + * .expirationDate() + * .fileId() + * .state() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DriversLicense]. */ + class Builder internal constructor() { + + private var expirationDate: JsonField? = null + private var fileId: JsonField? = null + private var state: JsonField? = null + private var backFileId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(driversLicense: DriversLicense) = apply { + expirationDate = driversLicense.expirationDate + fileId = driversLicense.fileId + state = driversLicense.state + backFileId = driversLicense.backFileId + additionalProperties = driversLicense.additionalProperties.toMutableMap() + } + + /** The driver's license's expiration date in YYYY-MM-DD format. */ + fun expirationDate(expirationDate: LocalDate) = + expirationDate(JsonField.of(expirationDate)) + + /** + * 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 + } + + /** The identifier of the File containing the front of the driver's license. */ + fun fileId(fileId: String) = fileId(JsonField.of(fileId)) + + /** + * Sets [Builder.fileId] to an arbitrary JSON value. + * + * You should usually call [Builder.fileId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun fileId(fileId: JsonField) = apply { this.fileId = fileId } + + /** The state that issued the provided driver's license. */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * 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 identifier of the File containing the back of the driver's license. */ + fun backFileId(backFileId: String) = backFileId(JsonField.of(backFileId)) + + /** + * Sets [Builder.backFileId] to an arbitrary JSON value. + * + * You should usually call [Builder.backFileId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun backFileId(backFileId: JsonField) = apply { + this.backFileId = backFileId + } + + 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 [DriversLicense]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .expirationDate() + * .fileId() + * .state() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DriversLicense = + DriversLicense( + checkRequired("expirationDate", expirationDate), + checkRequired("fileId", fileId), + checkRequired("state", state), + backFileId, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DriversLicense = apply { + if (validated) { + return@apply + } + + expirationDate() + fileId() + state() + backFileId() + 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 (expirationDate.asKnown().isPresent) 1 else 0) + + (if (fileId.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + (if (backFileId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DriversLicense && + expirationDate == other.expirationDate && + fileId == other.fileId && + state == other.state && + backFileId == other.backFileId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(expirationDate, fileId, state, backFileId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DriversLicense{expirationDate=$expirationDate, fileId=$fileId, state=$state, backFileId=$backFileId, additionalProperties=$additionalProperties}" + } + + /** + * Information about the identification document provided. Required if `method` is equal + * to `other`. + */ + class Other + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val country: JsonField, + private val description: JsonField, + private val fileId: JsonField, + private val backFileId: JsonField, + private val expirationDate: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("description") + @ExcludeMissing + description: JsonField = JsonMissing.of(), + @JsonProperty("file_id") + @ExcludeMissing + fileId: JsonField = JsonMissing.of(), + @JsonProperty("back_file_id") + @ExcludeMissing + backFileId: JsonField = JsonMissing.of(), + @JsonProperty("expiration_date") + @ExcludeMissing + expirationDate: JsonField = JsonMissing.of(), + ) : this(country, description, fileId, backFileId, expirationDate, mutableMapOf()) + + /** + * The two-character ISO 3166-1 code representing the country that issued the + * document (e.g., `US`). + * + * @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") + + /** + * A description of the document submitted. + * + * @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 description(): String = description.getRequired("description") + + /** + * The identifier of the File containing the front of the document. + * + * @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 fileId(): String = fileId.getRequired("file_id") + + /** + * The identifier of the File containing the back of the document. Not every + * document has a reverse side. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun backFileId(): Optional = backFileId.getOptional("back_file_id") + + /** + * The document's expiration date in YYYY-MM-DD format. + * + * @throws IncreaseInvalidDataException 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") + + /** + * 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 [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 [fileId]. + * + * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId + + /** + * Returns the raw JSON value of [backFileId]. + * + * Unlike [backFileId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("back_file_id") + @ExcludeMissing + fun _backFileId(): JsonField = backFileId + + /** + * 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 + + @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 [Other]. + * + * The following fields are required: + * ```java + * .country() + * .description() + * .fileId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Other]. */ + class Builder internal constructor() { + + private var country: JsonField? = null + private var description: JsonField? = null + private var fileId: JsonField? = null + private var backFileId: JsonField = JsonMissing.of() + private var expirationDate: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(other: Other) = apply { + country = other.country + description = other.description + fileId = other.fileId + backFileId = other.backFileId + expirationDate = other.expirationDate + additionalProperties = other.additionalProperties.toMutableMap() + } + + /** + * The two-character ISO 3166-1 code representing the country that issued the + * document (e.g., `US`). + */ + 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 } + + /** A description of the document submitted. */ + fun description(description: String) = description(JsonField.of(description)) + + /** + * 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 + } + + /** The identifier of the File containing the front of the document. */ + fun fileId(fileId: String) = fileId(JsonField.of(fileId)) + + /** + * Sets [Builder.fileId] to an arbitrary JSON value. + * + * You should usually call [Builder.fileId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun fileId(fileId: JsonField) = apply { this.fileId = fileId } + + /** + * The identifier of the File containing the back of the document. Not every + * document has a reverse side. + */ + fun backFileId(backFileId: String) = backFileId(JsonField.of(backFileId)) + + /** + * Sets [Builder.backFileId] to an arbitrary JSON value. + * + * You should usually call [Builder.backFileId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun backFileId(backFileId: JsonField) = apply { + this.backFileId = backFileId + } + + /** The document's expiration date in YYYY-MM-DD format. */ + fun expirationDate(expirationDate: LocalDate) = + expirationDate(JsonField.of(expirationDate)) + + /** + * 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 + } + + 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 [Other]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .country() + * .description() + * .fileId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Other = + Other( + checkRequired("country", country), + checkRequired("description", description), + checkRequired("fileId", fileId), + backFileId, + expirationDate, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Other = apply { + if (validated) { + return@apply + } + + country() + description() + fileId() + backFileId() + expirationDate() + 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 (country.asKnown().isPresent) 1 else 0) + + (if (description.asKnown().isPresent) 1 else 0) + + (if (fileId.asKnown().isPresent) 1 else 0) + + (if (backFileId.asKnown().isPresent) 1 else 0) + + (if (expirationDate.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Other && + country == other.country && + description == other.description && + fileId == other.fileId && + backFileId == other.backFileId && + expirationDate == other.expirationDate && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + country, + description, + fileId, + backFileId, + expirationDate, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Other{country=$country, description=$description, fileId=$fileId, backFileId=$backFileId, expirationDate=$expirationDate, additionalProperties=$additionalProperties}" + } + + /** + * Information about the passport used for identification. Required if `method` is equal + * to `passport`. + */ + class Passport + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val country: JsonField, + private val expirationDate: JsonField, + private val fileId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("country") + @ExcludeMissing + country: JsonField = JsonMissing.of(), + @JsonProperty("expiration_date") + @ExcludeMissing + expirationDate: JsonField = JsonMissing.of(), + @JsonProperty("file_id") + @ExcludeMissing + fileId: JsonField = JsonMissing.of(), + ) : this(country, expirationDate, fileId, mutableMapOf()) + + /** + * The two-character ISO 3166-1 code representing the country that issued the + * document (e.g., `US`). + * + * @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 passport's expiration date 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 expirationDate(): LocalDate = expirationDate.getRequired("expiration_date") + + /** + * The identifier of the File containing the passport. + * + * @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 fileId(): String = fileId.getRequired("file_id") + + /** + * 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 [expirationDate]. + * + * Unlike [expirationDate], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("expiration_date") + @ExcludeMissing + fun _expirationDate(): JsonField = expirationDate + + /** + * Returns the raw JSON value of [fileId]. + * + * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId + + @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 [Passport]. + * + * The following fields are required: + * ```java + * .country() + * .expirationDate() + * .fileId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Passport]. */ + class Builder internal constructor() { + + private var country: JsonField? = null + private var expirationDate: JsonField? = null + private var fileId: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(passport: Passport) = apply { + country = passport.country + expirationDate = passport.expirationDate + fileId = passport.fileId + additionalProperties = passport.additionalProperties.toMutableMap() + } + + /** + * The two-character ISO 3166-1 code representing the country that issued the + * document (e.g., `US`). + */ + 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 passport's expiration date in YYYY-MM-DD format. */ + fun expirationDate(expirationDate: LocalDate) = + expirationDate(JsonField.of(expirationDate)) + + /** + * 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 + } + + /** The identifier of the File containing the passport. */ + fun fileId(fileId: String) = fileId(JsonField.of(fileId)) + + /** + * Sets [Builder.fileId] to an arbitrary JSON value. + * + * You should usually call [Builder.fileId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun fileId(fileId: JsonField) = apply { this.fileId = fileId } + + 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 [Passport]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .country() + * .expirationDate() + * .fileId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Passport = + Passport( + checkRequired("country", country), + checkRequired("expirationDate", expirationDate), + checkRequired("fileId", fileId), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Passport = apply { + if (validated) { + return@apply + } + + country() + expirationDate() + fileId() + 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 (country.asKnown().isPresent) 1 else 0) + + (if (expirationDate.asKnown().isPresent) 1 else 0) + + (if (fileId.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Passport && + country == other.country && + expirationDate == other.expirationDate && + fileId == other.fileId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(country, expirationDate, fileId, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Passport{country=$country, expirationDate=$expirationDate, fileId=$fileId, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Identification && + method == other.method && + number == other.number && + driversLicense == other.driversLicense && + this.other == other.other && + passport == other.passport && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(method, number, driversLicense, other, passport, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Identification{method=$method, number=$number, driversLicense=$driversLicense, other=$other, passport=$passport, 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 && + confirmedNoUsTaxId == other.confirmedNoUsTaxId && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + address, + dateOfBirth, + identification, + name, + confirmedNoUsTaxId, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Individual{address=$address, dateOfBirth=$dateOfBirth, identification=$identification, name=$name, confirmedNoUsTaxId=$confirmedNoUsTaxId, 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 BeneficialOwnerCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "BeneficialOwnerCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwner.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwner.kt index 6cac2f2e0..878927e0c 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwner.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwner.kt @@ -34,6 +34,7 @@ private constructor( private val id: JsonField, private val companyTitle: JsonField, private val createdAt: JsonField, + private val idempotencyKey: JsonField, private val individual: JsonField, private val prongs: JsonField>, private val type: JsonField, @@ -49,12 +50,15 @@ private constructor( @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("idempotency_key") + @ExcludeMissing + idempotencyKey: JsonField = JsonMissing.of(), @JsonProperty("individual") @ExcludeMissing individual: JsonField = JsonMissing.of(), @JsonProperty("prongs") @ExcludeMissing prongs: JsonField> = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(id, companyTitle, createdAt, individual, prongs, type, mutableMapOf()) + ) : this(id, companyTitle, createdAt, idempotencyKey, individual, prongs, type, mutableMapOf()) /** * The identifier of this beneficial owner. @@ -81,6 +85,16 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** + * The idempotency key you chose for this object. This value is unique across Increase and is + * used to ensure that a request is only processed once. Learn more about + * [idempotency](https://increase.com/documentation/idempotency-keys). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun idempotencyKey(): Optional = idempotencyKey.getOptional("idempotency_key") + /** * Personal details for the beneficial owner. * @@ -131,6 +145,15 @@ private constructor( @ExcludeMissing fun _createdAt(): JsonField = createdAt + /** + * Returns the raw JSON value of [idempotencyKey]. + * + * Unlike [idempotencyKey], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("idempotency_key") + @ExcludeMissing + fun _idempotencyKey(): JsonField = idempotencyKey + /** * Returns the raw JSON value of [individual]. * @@ -176,6 +199,7 @@ private constructor( * .id() * .companyTitle() * .createdAt() + * .idempotencyKey() * .individual() * .prongs() * .type() @@ -190,6 +214,7 @@ private constructor( private var id: JsonField? = null private var companyTitle: JsonField? = null private var createdAt: JsonField? = null + private var idempotencyKey: JsonField? = null private var individual: JsonField? = null private var prongs: JsonField>? = null private var type: JsonField? = null @@ -200,6 +225,7 @@ private constructor( id = entityBeneficialOwner.id companyTitle = entityBeneficialOwner.companyTitle createdAt = entityBeneficialOwner.createdAt + idempotencyKey = entityBeneficialOwner.idempotencyKey individual = entityBeneficialOwner.individual prongs = entityBeneficialOwner.prongs.map { it.toMutableList() } type = entityBeneficialOwner.type @@ -249,6 +275,29 @@ private constructor( */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } + /** + * The idempotency key you chose for this object. This value is unique across Increase and + * is used to ensure that a request is only processed once. Learn more about + * [idempotency](https://increase.com/documentation/idempotency-keys). + */ + fun idempotencyKey(idempotencyKey: String?) = + idempotencyKey(JsonField.ofNullable(idempotencyKey)) + + /** Alias for calling [Builder.idempotencyKey] with `idempotencyKey.orElse(null)`. */ + fun idempotencyKey(idempotencyKey: Optional) = + idempotencyKey(idempotencyKey.getOrNull()) + + /** + * Sets [Builder.idempotencyKey] to an arbitrary JSON value. + * + * You should usually call [Builder.idempotencyKey] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun idempotencyKey(idempotencyKey: JsonField) = apply { + this.idempotencyKey = idempotencyKey + } + /** Personal details for the beneficial owner. */ fun individual(individual: Individual) = individual(JsonField.of(individual)) @@ -330,6 +379,7 @@ private constructor( * .id() * .companyTitle() * .createdAt() + * .idempotencyKey() * .individual() * .prongs() * .type() @@ -342,6 +392,7 @@ private constructor( checkRequired("id", id), checkRequired("companyTitle", companyTitle), checkRequired("createdAt", createdAt), + checkRequired("idempotencyKey", idempotencyKey), checkRequired("individual", individual), checkRequired("prongs", prongs).map { it.toImmutable() }, checkRequired("type", type), @@ -359,6 +410,7 @@ private constructor( id() companyTitle() createdAt() + idempotencyKey() individual().validate() prongs().forEach { it.validate() } type().validate() @@ -383,6 +435,7 @@ private constructor( (if (id.asKnown().isPresent) 1 else 0) + (if (companyTitle.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (idempotencyKey.asKnown().isPresent) 1 else 0) + (individual.asKnown().getOrNull()?.validity() ?: 0) + (prongs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) @@ -1703,6 +1756,7 @@ private constructor( id == other.id && companyTitle == other.companyTitle && createdAt == other.createdAt && + idempotencyKey == other.idempotencyKey && individual == other.individual && prongs == other.prongs && type == other.type && @@ -1710,11 +1764,20 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(id, companyTitle, createdAt, individual, prongs, type, additionalProperties) + Objects.hash( + id, + companyTitle, + createdAt, + idempotencyKey, + individual, + prongs, + type, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "EntityBeneficialOwner{id=$id, companyTitle=$companyTitle, createdAt=$createdAt, individual=$individual, prongs=$prongs, type=$type, additionalProperties=$additionalProperties}" + "EntityBeneficialOwner{id=$id, companyTitle=$companyTitle, createdAt=$createdAt, idempotencyKey=$idempotencyKey, individual=$individual, prongs=$prongs, type=$type, additionalProperties=$additionalProperties}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsync.kt index e7b5cfada..9dca27b28 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsync.kt @@ -6,6 +6,7 @@ import com.increase.api.core.ClientOptions import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor import com.increase.api.models.beneficialowners.BeneficialOwnerArchiveParams +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListPageAsync import com.increase.api.models.beneficialowners.BeneficialOwnerListParams import com.increase.api.models.beneficialowners.BeneficialOwnerRetrieveParams @@ -28,6 +29,16 @@ interface BeneficialOwnerServiceAsync { */ fun withOptions(modifier: Consumer): BeneficialOwnerServiceAsync + /** Create a beneficial owner */ + fun create(params: BeneficialOwnerCreateParams): CompletableFuture = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** Retrieve a Beneficial Owner */ fun retrieve(entityBeneficialOwnerId: String): CompletableFuture = retrieve(entityBeneficialOwnerId, BeneficialOwnerRetrieveParams.none()) @@ -170,6 +181,21 @@ interface BeneficialOwnerServiceAsync { modifier: Consumer ): BeneficialOwnerServiceAsync.WithRawResponse + /** + * Returns a raw HTTP response for `post /entity_beneficial_owners`, but is otherwise the + * same as [BeneficialOwnerServiceAsync.create]. + */ + fun create( + params: BeneficialOwnerCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + /** * Returns a raw HTTP response for `get * /entity_beneficial_owners/{entity_beneficial_owner_id}`, but is otherwise the same as diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncImpl.kt index bb1e342ed..40c2b5db5 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncImpl.kt @@ -17,6 +17,7 @@ import com.increase.api.core.http.json import com.increase.api.core.http.parseable import com.increase.api.core.prepareAsync import com.increase.api.models.beneficialowners.BeneficialOwnerArchiveParams +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListPageAsync import com.increase.api.models.beneficialowners.BeneficialOwnerListPageResponse import com.increase.api.models.beneficialowners.BeneficialOwnerListParams @@ -41,6 +42,13 @@ internal constructor(private val clientOptions: ClientOptions) : BeneficialOwner ): BeneficialOwnerServiceAsync = BeneficialOwnerServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /entity_beneficial_owners + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + override fun retrieve( params: BeneficialOwnerRetrieveParams, requestOptions: RequestOptions, @@ -82,6 +90,37 @@ internal constructor(private val clientOptions: ClientOptions) : BeneficialOwner clientOptions.toBuilder().apply(modifier::accept).build() ) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("entity_beneficial_owners") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerService.kt index 409cec3dc..0cd956883 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerService.kt @@ -7,6 +7,7 @@ import com.increase.api.core.ClientOptions import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor import com.increase.api.models.beneficialowners.BeneficialOwnerArchiveParams +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListPage import com.increase.api.models.beneficialowners.BeneficialOwnerListParams import com.increase.api.models.beneficialowners.BeneficialOwnerRetrieveParams @@ -28,6 +29,16 @@ interface BeneficialOwnerService { */ fun withOptions(modifier: Consumer): BeneficialOwnerService + /** Create a beneficial owner */ + fun create(params: BeneficialOwnerCreateParams): EntityBeneficialOwner = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): EntityBeneficialOwner + /** Retrieve a Beneficial Owner */ fun retrieve(entityBeneficialOwnerId: String): EntityBeneficialOwner = retrieve(entityBeneficialOwnerId, BeneficialOwnerRetrieveParams.none()) @@ -167,6 +178,21 @@ interface BeneficialOwnerService { modifier: Consumer ): BeneficialOwnerService.WithRawResponse + /** + * Returns a raw HTTP response for `post /entity_beneficial_owners`, but is otherwise the + * same as [BeneficialOwnerService.create]. + */ + @MustBeClosed + fun create(params: BeneficialOwnerCreateParams): HttpResponseFor = + create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + /** * Returns a raw HTTP response for `get * /entity_beneficial_owners/{entity_beneficial_owner_id}`, but is otherwise the same as diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceImpl.kt index 7935f88b6..39ae277ed 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceImpl.kt @@ -17,6 +17,7 @@ import com.increase.api.core.http.json import com.increase.api.core.http.parseable import com.increase.api.core.prepare import com.increase.api.models.beneficialowners.BeneficialOwnerArchiveParams +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListPage import com.increase.api.models.beneficialowners.BeneficialOwnerListPageResponse import com.increase.api.models.beneficialowners.BeneficialOwnerListParams @@ -38,6 +39,13 @@ class BeneficialOwnerServiceImpl internal constructor(private val clientOptions: override fun withOptions(modifier: Consumer): BeneficialOwnerService = BeneficialOwnerServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + override fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions, + ): EntityBeneficialOwner = + // post /entity_beneficial_owners + withRawResponse().create(params, requestOptions).parse() + override fun retrieve( params: BeneficialOwnerRetrieveParams, requestOptions: RequestOptions, @@ -79,6 +87,34 @@ class BeneficialOwnerServiceImpl internal constructor(private val clientOptions: clientOptions.toBuilder().apply(modifier::accept).build() ) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: BeneficialOwnerCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("entity_beneficial_owners") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { createHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParamsTest.kt new file mode 100644 index 000000000..718d341b9 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerCreateParamsTest.kt @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.beneficialowners + +import java.time.LocalDate +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class BeneficialOwnerCreateParamsTest { + + @Test + fun create() { + BeneficialOwnerCreateParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .individual( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .line2("x") + .state("NY") + .zip("10045") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .driversLicense( + BeneficialOwnerCreateParams.Individual.Identification.DriversLicense + .builder() + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .state("x") + .backFileId("back_file_id") + .build() + ) + .other( + BeneficialOwnerCreateParams.Individual.Identification.Other + .builder() + .country("x") + .description("x") + .fileId("file_id") + .backFileId("back_file_id") + .expirationDate(LocalDate.parse("2019-12-27")) + .build() + ) + .passport( + BeneficialOwnerCreateParams.Individual.Identification.Passport + .builder() + .country("x") + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .build() + ) + .build() + ) + .name("Ian Crease") + .confirmedNoUsTaxId(true) + .build() + ) + .addProng(BeneficialOwnerCreateParams.Prong.CONTROL) + .companyTitle("CEO") + .build() + } + + @Test + fun body() { + val params = + BeneficialOwnerCreateParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .individual( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .line2("x") + .state("NY") + .zip("10045") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .driversLicense( + BeneficialOwnerCreateParams.Individual.Identification + .DriversLicense + .builder() + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .state("x") + .backFileId("back_file_id") + .build() + ) + .other( + BeneficialOwnerCreateParams.Individual.Identification.Other + .builder() + .country("x") + .description("x") + .fileId("file_id") + .backFileId("back_file_id") + .expirationDate(LocalDate.parse("2019-12-27")) + .build() + ) + .passport( + BeneficialOwnerCreateParams.Individual.Identification.Passport + .builder() + .country("x") + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .build() + ) + .build() + ) + .name("Ian Crease") + .confirmedNoUsTaxId(true) + .build() + ) + .addProng(BeneficialOwnerCreateParams.Prong.CONTROL) + .companyTitle("CEO") + .build() + + val body = params._body() + + assertThat(body.entityId()).isEqualTo("entity_n8y8tnk2p9339ti393yi") + assertThat(body.individual()) + .isEqualTo( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .line2("x") + .state("NY") + .zip("10045") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .driversLicense( + BeneficialOwnerCreateParams.Individual.Identification.DriversLicense + .builder() + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .state("x") + .backFileId("back_file_id") + .build() + ) + .other( + BeneficialOwnerCreateParams.Individual.Identification.Other + .builder() + .country("x") + .description("x") + .fileId("file_id") + .backFileId("back_file_id") + .expirationDate(LocalDate.parse("2019-12-27")) + .build() + ) + .passport( + BeneficialOwnerCreateParams.Individual.Identification.Passport + .builder() + .country("x") + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .build() + ) + .build() + ) + .name("Ian Crease") + .confirmedNoUsTaxId(true) + .build() + ) + assertThat(body.prongs()).containsExactly(BeneficialOwnerCreateParams.Prong.CONTROL) + assertThat(body.companyTitle()).contains("CEO") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + BeneficialOwnerCreateParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .individual( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .build() + ) + .name("Ian Crease") + .build() + ) + .addProng(BeneficialOwnerCreateParams.Prong.CONTROL) + .build() + + val body = params._body() + + assertThat(body.entityId()).isEqualTo("entity_n8y8tnk2p9339ti393yi") + assertThat(body.individual()) + .isEqualTo( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .build() + ) + .name("Ian Crease") + .build() + ) + assertThat(body.prongs()).containsExactly(BeneficialOwnerCreateParams.Prong.CONTROL) + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerListPageResponseTest.kt index 24f2cd025..5818f524e 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/BeneficialOwnerListPageResponseTest.kt @@ -20,6 +20,7 @@ internal class BeneficialOwnerListPageResponseTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -59,6 +60,7 @@ internal class BeneficialOwnerListPageResponseTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -102,6 +104,7 @@ internal class BeneficialOwnerListPageResponseTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwnerTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwnerTest.kt index dcb272885..7e433c36a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwnerTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/beneficialowners/EntityBeneficialOwnerTest.kt @@ -18,6 +18,7 @@ internal class EntityBeneficialOwnerTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -53,6 +54,7 @@ internal class EntityBeneficialOwnerTest { assertThat(entityBeneficialOwner.companyTitle()).contains("CEO") assertThat(entityBeneficialOwner.createdAt()) .isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + assertThat(entityBeneficialOwner.idempotencyKey()).isEmpty assertThat(entityBeneficialOwner.individual()) .isEqualTo( EntityBeneficialOwner.Individual.builder() @@ -96,6 +98,7 @@ internal class EntityBeneficialOwnerTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( 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 73756fbc2..401fa8cad 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 @@ -38,6 +38,7 @@ internal class EntityListPageResponseTest { ) .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -293,6 +294,7 @@ internal class EntityListPageResponseTest { ) .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -550,6 +552,7 @@ internal class EntityListPageResponseTest { ) .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( 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 f95072624..48a74f822 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 @@ -34,6 +34,7 @@ internal class EntityTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -277,6 +278,7 @@ internal class EntityTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( @@ -530,6 +532,7 @@ internal class EntityTest { .id("entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7") .companyTitle("CEO") .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .idempotencyKey(null) .individual( EntityBeneficialOwner.Individual.builder() .address( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncTest.kt index a098b9ba5..109371802 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/BeneficialOwnerServiceAsyncTest.kt @@ -4,6 +4,7 @@ package com.increase.api.services.async import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListParams import com.increase.api.models.beneficialowners.BeneficialOwnerUpdateParams import java.time.LocalDate @@ -13,6 +14,83 @@ import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) internal class BeneficialOwnerServiceAsyncTest { + @Test + fun create() { + val client = + IncreaseOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val beneficialOwnerServiceAsync = client.beneficialOwners() + + val entityBeneficialOwnerFuture = + beneficialOwnerServiceAsync.create( + BeneficialOwnerCreateParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .individual( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .line2("x") + .state("NY") + .zip("10045") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .driversLicense( + BeneficialOwnerCreateParams.Individual.Identification + .DriversLicense + .builder() + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .state("x") + .backFileId("back_file_id") + .build() + ) + .other( + BeneficialOwnerCreateParams.Individual.Identification.Other + .builder() + .country("x") + .description("x") + .fileId("file_id") + .backFileId("back_file_id") + .expirationDate(LocalDate.parse("2019-12-27")) + .build() + ) + .passport( + BeneficialOwnerCreateParams.Individual.Identification + .Passport + .builder() + .country("x") + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .build() + ) + .build() + ) + .name("Ian Crease") + .confirmedNoUsTaxId(true) + .build() + ) + .addProng(BeneficialOwnerCreateParams.Prong.CONTROL) + .companyTitle("CEO") + .build() + ) + + val entityBeneficialOwner = entityBeneficialOwnerFuture.get() + entityBeneficialOwner.validate() + } + @Test fun retrieve() { val client = diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceTest.kt index 36de7ab86..77114e09a 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/BeneficialOwnerServiceTest.kt @@ -4,6 +4,7 @@ package com.increase.api.services.blocking import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClient +import com.increase.api.models.beneficialowners.BeneficialOwnerCreateParams import com.increase.api.models.beneficialowners.BeneficialOwnerListParams import com.increase.api.models.beneficialowners.BeneficialOwnerUpdateParams import java.time.LocalDate @@ -13,6 +14,82 @@ import org.junit.jupiter.api.extension.ExtendWith @ExtendWith(TestServerExtension::class) internal class BeneficialOwnerServiceTest { + @Test + fun create() { + val client = + IncreaseOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val beneficialOwnerService = client.beneficialOwners() + + val entityBeneficialOwner = + beneficialOwnerService.create( + BeneficialOwnerCreateParams.builder() + .entityId("entity_n8y8tnk2p9339ti393yi") + .individual( + BeneficialOwnerCreateParams.Individual.builder() + .address( + BeneficialOwnerCreateParams.Individual.Address.builder() + .city("New York") + .country("US") + .line1("33 Liberty Street") + .line2("x") + .state("NY") + .zip("10045") + .build() + ) + .dateOfBirth(LocalDate.parse("1970-01-31")) + .identification( + BeneficialOwnerCreateParams.Individual.Identification.builder() + .method( + BeneficialOwnerCreateParams.Individual.Identification.Method + .SOCIAL_SECURITY_NUMBER + ) + .number("078051120") + .driversLicense( + BeneficialOwnerCreateParams.Individual.Identification + .DriversLicense + .builder() + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .state("x") + .backFileId("back_file_id") + .build() + ) + .other( + BeneficialOwnerCreateParams.Individual.Identification.Other + .builder() + .country("x") + .description("x") + .fileId("file_id") + .backFileId("back_file_id") + .expirationDate(LocalDate.parse("2019-12-27")) + .build() + ) + .passport( + BeneficialOwnerCreateParams.Individual.Identification + .Passport + .builder() + .country("x") + .expirationDate(LocalDate.parse("2019-12-27")) + .fileId("file_id") + .build() + ) + .build() + ) + .name("Ian Crease") + .confirmedNoUsTaxId(true) + .build() + ) + .addProng(BeneficialOwnerCreateParams.Prong.CONTROL) + .companyTitle("CEO") + .build() + ) + + entityBeneficialOwner.validate() + } + @Test fun retrieve() { val client = From f40da246ad6e98f954edcab0931eace92ed4cd3f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:28:07 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 8 +- .../EntityCreateBeneficialOwnerParams.kt | 3098 ----------------- .../api/services/async/EntityServiceAsync.kt | 56 - .../services/async/EntityServiceAsyncImpl.kt | 42 - .../api/services/blocking/EntityService.kt | 54 - .../services/blocking/EntityServiceImpl.kt | 39 - .../EntityCreateBeneficialOwnerParamsTest.kt | 368 -- .../services/async/EntityServiceAsyncTest.kt | 99 - .../services/blocking/EntityServiceTest.kt | 98 - 9 files changed, 4 insertions(+), 3858 deletions(-) delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt diff --git a/.stats.yml b/.stats.yml index 3528901cc..89d1fa6cf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 237 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-2c11248a841117464c3d87ee8069761f8fdf1a235557bbc885bcfa13de4107c4.yml -openapi_spec_hash: 6bcd6b02eaff96080fc9f57fd5942502 -config_hash: 81fdd83e44056d1f623e280bc106245d +configured_endpoints: 236 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-5c95dd79214af830e2e7fb34ab05f98bde9213311d5e2d59f9a816a8e0369b85.yml +openapi_spec_hash: ec66c2961a8b90e06ea57f934d8d75db +config_hash: 25d7d7aa4882db6189b4b53e8e249e80 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt deleted file mode 100644 index 4e90fb7b0..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParams.kt +++ /dev/null @@ -1,3098 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.entities - -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.increase.api.core.Enum -import com.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.Params -import com.increase.api.core.checkKnown -import com.increase.api.core.checkRequired -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.core.toImmutable -import com.increase.api.errors.IncreaseInvalidDataException -import java.time.LocalDate -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Create a beneficial owner for a corporate Entity */ -class EntityCreateBeneficialOwnerParams -private constructor( - private val entityId: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Entity to associate with the new Beneficial Owner. */ - fun entityId(): Optional = Optional.ofNullable(entityId) - - /** - * The identifying details of anyone controlling or owning 25% or more of the corporation. - * - * @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 beneficialOwner(): BeneficialOwner = body.beneficialOwner() - - /** - * Returns the raw JSON value of [beneficialOwner]. - * - * Unlike [beneficialOwner], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _beneficialOwner(): JsonField = body._beneficialOwner() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [EntityCreateBeneficialOwnerParams]. - * - * The following fields are required: - * ```java - * .beneficialOwner() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [EntityCreateBeneficialOwnerParams]. */ - class Builder internal constructor() { - - private var entityId: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(entityCreateBeneficialOwnerParams: EntityCreateBeneficialOwnerParams) = - apply { - entityId = entityCreateBeneficialOwnerParams.entityId - body = entityCreateBeneficialOwnerParams.body.toBuilder() - additionalHeaders = entityCreateBeneficialOwnerParams.additionalHeaders.toBuilder() - additionalQueryParams = - entityCreateBeneficialOwnerParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Entity to associate with the new Beneficial Owner. */ - fun entityId(entityId: String?) = apply { this.entityId = entityId } - - /** Alias for calling [Builder.entityId] with `entityId.orElse(null)`. */ - fun entityId(entityId: Optional) = entityId(entityId.getOrNull()) - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [beneficialOwner] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** - * The identifying details of anyone controlling or owning 25% or more of the corporation. - */ - fun beneficialOwner(beneficialOwner: BeneficialOwner) = apply { - body.beneficialOwner(beneficialOwner) - } - - /** - * Sets [Builder.beneficialOwner] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwner] with a well-typed [BeneficialOwner] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun beneficialOwner(beneficialOwner: JsonField) = apply { - body.beneficialOwner(beneficialOwner) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [EntityCreateBeneficialOwnerParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .beneficialOwner() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): EntityCreateBeneficialOwnerParams = - EntityCreateBeneficialOwnerParams( - entityId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> entityId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val beneficialOwner: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("beneficial_owner") - @ExcludeMissing - beneficialOwner: JsonField = JsonMissing.of() - ) : this(beneficialOwner, mutableMapOf()) - - /** - * The identifying details of anyone controlling or owning 25% or more of the corporation. - * - * @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 beneficialOwner(): BeneficialOwner = beneficialOwner.getRequired("beneficial_owner") - - /** - * Returns the raw JSON value of [beneficialOwner]. - * - * Unlike [beneficialOwner], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("beneficial_owner") - @ExcludeMissing - fun _beneficialOwner(): JsonField = beneficialOwner - - @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 [Body]. - * - * The following fields are required: - * ```java - * .beneficialOwner() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var beneficialOwner: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - beneficialOwner = body.beneficialOwner - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** - * The identifying details of anyone controlling or owning 25% or more of the - * corporation. - */ - fun beneficialOwner(beneficialOwner: BeneficialOwner) = - beneficialOwner(JsonField.of(beneficialOwner)) - - /** - * Sets [Builder.beneficialOwner] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwner] with a well-typed [BeneficialOwner] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun beneficialOwner(beneficialOwner: JsonField) = apply { - this.beneficialOwner = beneficialOwner - } - - 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 [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .beneficialOwner() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("beneficialOwner", beneficialOwner), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - beneficialOwner().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 = (beneficialOwner.asKnown().getOrNull()?.validity() ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - beneficialOwner == other.beneficialOwner && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(beneficialOwner, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{beneficialOwner=$beneficialOwner, additionalProperties=$additionalProperties}" - } - - /** The identifying details of anyone controlling or owning 25% or more of the corporation. */ - class BeneficialOwner - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val individual: JsonField, - private val prongs: JsonField>, - private val companyTitle: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("individual") - @ExcludeMissing - individual: JsonField = JsonMissing.of(), - @JsonProperty("prongs") - @ExcludeMissing - prongs: JsonField> = JsonMissing.of(), - @JsonProperty("company_title") - @ExcludeMissing - companyTitle: JsonField = JsonMissing.of(), - ) : this(individual, prongs, companyTitle, mutableMapOf()) - - /** - * 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. At least one option is - * required, if a person is both a control person and owner, submit an array containing - * both. - * - * @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") - - /** - * 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") - - /** - * 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 - - /** - * 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 - - @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 - * .individual() - * .prongs() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [BeneficialOwner]. */ - class Builder internal constructor() { - - private var individual: JsonField? = null - private var prongs: JsonField>? = null - private var companyTitle: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(beneficialOwner: BeneficialOwner) = apply { - individual = beneficialOwner.individual - prongs = beneficialOwner.prongs.map { it.toMutableList() } - companyTitle = beneficialOwner.companyTitle - additionalProperties = beneficialOwner.additionalProperties.toMutableMap() - } - - /** 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. At least one option - * is required, if a person is both a control person and owner, submit an array - * containing both. - */ - 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) - } - } - - /** This person's role or title within the entity. */ - fun companyTitle(companyTitle: String) = companyTitle(JsonField.of(companyTitle)) - - /** - * 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 - } - - 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 - * .individual() - * .prongs() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): BeneficialOwner = - BeneficialOwner( - checkRequired("individual", individual), - checkRequired("prongs", prongs).map { it.toImmutable() }, - companyTitle, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): BeneficialOwner = apply { - if (validated) { - return@apply - } - - individual().validate() - prongs().forEach { it.validate() } - companyTitle() - 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 = - (individual.asKnown().getOrNull()?.validity() ?: 0) + - (prongs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (companyTitle.asKnown().isPresent) 1 else 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 confirmedNoUsTaxId: 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(), - @JsonProperty("confirmed_no_us_tax_id") - @ExcludeMissing - confirmedNoUsTaxId: JsonField = JsonMissing.of(), - ) : this(address, dateOfBirth, identification, name, confirmedNoUsTaxId, mutableMapOf()) - - /** - * The individual's physical address. Mail receiving locations like PO Boxes and PMB's - * are disallowed. - * - * @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") - - /** - * The identification method for an individual can only be a passport, driver's license, - * or other document if you've confirmed the individual does not have a US tax id - * (either a Social Security Number or Individual Taxpayer Identification Number). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun confirmedNoUsTaxId(): Optional = - confirmedNoUsTaxId.getOptional("confirmed_no_us_tax_id") - - /** - * 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 - - /** - * Returns the raw JSON value of [confirmedNoUsTaxId]. - * - * Unlike [confirmedNoUsTaxId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("confirmed_no_us_tax_id") - @ExcludeMissing - fun _confirmedNoUsTaxId(): JsonField = confirmedNoUsTaxId - - @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 confirmedNoUsTaxId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(individual: Individual) = apply { - address = individual.address - dateOfBirth = individual.dateOfBirth - identification = individual.identification - name = individual.name - confirmedNoUsTaxId = individual.confirmedNoUsTaxId - additionalProperties = individual.additionalProperties.toMutableMap() - } - - /** - * The individual's physical address. Mail receiving locations like PO Boxes and - * PMB's are disallowed. - */ - 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 } - - /** - * The identification method for an individual can only be a passport, driver's - * license, or other document if you've confirmed the individual does not have a US - * tax id (either a Social Security Number or Individual Taxpayer Identification - * Number). - */ - fun confirmedNoUsTaxId(confirmedNoUsTaxId: Boolean) = - confirmedNoUsTaxId(JsonField.of(confirmedNoUsTaxId)) - - /** - * Sets [Builder.confirmedNoUsTaxId] to an arbitrary JSON value. - * - * You should usually call [Builder.confirmedNoUsTaxId] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun confirmedNoUsTaxId(confirmedNoUsTaxId: JsonField) = apply { - this.confirmedNoUsTaxId = confirmedNoUsTaxId - } - - 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), - confirmedNoUsTaxId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Individual = apply { - if (validated) { - return@apply - } - - address().validate() - dateOfBirth() - identification().validate() - name() - confirmedNoUsTaxId() - 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) + - (if (confirmedNoUsTaxId.asKnown().isPresent) 1 else 0) - - /** - * The individual's physical address. Mail receiving locations like PO Boxes and PMB's - * are disallowed. - */ - 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 or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). - */ - fun city(): String = city.getRequired("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. This is usually the street number and street. - * - * @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. This might be the floor or room number. - * - * @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. Required in certain countries. - * - * @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. Required in certain countries. - * - * @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() - * ``` - */ - @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 = JsonMissing.of() - private var state: JsonField = JsonMissing.of() - private var zip: JsonField = JsonMissing.of() - 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.of(city)) - - /** - * 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. This is usually the street number and street. - */ - 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. This might be the floor or room number. */ - fun line2(line2: String) = line2(JsonField.of(line2)) - - /** - * 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. Required in certain countries. - */ - fun state(state: String) = state(JsonField.of(state)) - - /** - * 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. Required in certain countries. */ - fun zip(zip: String) = zip(JsonField.of(zip)) - - /** - * 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() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Address = - Address( - checkRequired("city", city), - checkRequired("country", country), - checkRequired("line1", line1), - line2, - state, - 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 number: JsonField, - private val driversLicense: JsonField, - private val other: JsonField, - private val passport: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("method") - @ExcludeMissing - method: JsonField = JsonMissing.of(), - @JsonProperty("number") - @ExcludeMissing - number: JsonField = JsonMissing.of(), - @JsonProperty("drivers_license") - @ExcludeMissing - driversLicense: JsonField = JsonMissing.of(), - @JsonProperty("other") - @ExcludeMissing - other: JsonField = JsonMissing.of(), - @JsonProperty("passport") - @ExcludeMissing - passport: JsonField = JsonMissing.of(), - ) : this(method, number, driversLicense, other, passport, 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") - - /** - * An identification number that can be used to verify the individual's identity, - * such as a social security number. - * - * @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 number(): String = number.getRequired("number") - - /** - * Information about the United States driver's license used for identification. - * Required if `method` is equal to `drivers_license`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun driversLicense(): Optional = - driversLicense.getOptional("drivers_license") - - /** - * Information about the identification document provided. Required if `method` is - * equal to `other`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun other(): Optional = other.getOptional("other") - - /** - * Information about the passport used for identification. Required if `method` is - * equal to `passport`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun passport(): Optional = passport.getOptional("passport") - - /** - * 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 [number]. - * - * Unlike [number], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("number") @ExcludeMissing fun _number(): JsonField = number - - /** - * Returns the raw JSON value of [driversLicense]. - * - * Unlike [driversLicense], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("drivers_license") - @ExcludeMissing - fun _driversLicense(): JsonField = driversLicense - - /** - * Returns the raw JSON value of [other]. - * - * Unlike [other], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("other") @ExcludeMissing fun _other(): JsonField = other - - /** - * Returns the raw JSON value of [passport]. - * - * Unlike [passport], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("passport") - @ExcludeMissing - fun _passport(): JsonField = passport - - @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() - * .number() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Identification]. */ - class Builder internal constructor() { - - private var method: JsonField? = null - private var number: JsonField? = null - private var driversLicense: JsonField = JsonMissing.of() - private var other: JsonField = JsonMissing.of() - private var passport: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(identification: Identification) = apply { - method = identification.method - number = identification.number - driversLicense = identification.driversLicense - other = identification.other - passport = identification.passport - 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 } - - /** - * An identification number that can be used to verify the individual's - * identity, such as a social security number. - */ - fun number(number: String) = number(JsonField.of(number)) - - /** - * Sets [Builder.number] to an arbitrary JSON value. - * - * You should usually call [Builder.number] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun number(number: JsonField) = apply { this.number = number } - - /** - * Information about the United States driver's license used for identification. - * Required if `method` is equal to `drivers_license`. - */ - fun driversLicense(driversLicense: DriversLicense) = - driversLicense(JsonField.of(driversLicense)) - - /** - * Sets [Builder.driversLicense] to an arbitrary JSON value. - * - * You should usually call [Builder.driversLicense] with a well-typed - * [DriversLicense] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun driversLicense(driversLicense: JsonField) = apply { - this.driversLicense = driversLicense - } - - /** - * Information about the identification document provided. Required if `method` - * is equal to `other`. - */ - fun other(other: Other) = other(JsonField.of(other)) - - /** - * Sets [Builder.other] to an arbitrary JSON value. - * - * You should usually call [Builder.other] with a well-typed [Other] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun other(other: JsonField) = apply { this.other = other } - - /** - * Information about the passport used for identification. Required if `method` - * is equal to `passport`. - */ - fun passport(passport: Passport) = passport(JsonField.of(passport)) - - /** - * Sets [Builder.passport] to an arbitrary JSON value. - * - * You should usually call [Builder.passport] with a well-typed [Passport] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun passport(passport: JsonField) = apply { this.passport = passport } - - 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() - * .number() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Identification = - Identification( - checkRequired("method", method), - checkRequired("number", number), - driversLicense, - other, - passport, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Identification = apply { - if (validated) { - return@apply - } - - method().validate() - number() - driversLicense().ifPresent { it.validate() } - other().ifPresent { it.validate() } - passport().ifPresent { 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 = - (method.asKnown().getOrNull()?.validity() ?: 0) + - (if (number.asKnown().isPresent) 1 else 0) + - (driversLicense.asKnown().getOrNull()?.validity() ?: 0) + - (other.asKnown().getOrNull()?.validity() ?: 0) + - (passport.asKnown().getOrNull()?.validity() ?: 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() - } - - /** - * Information about the United States driver's license used for identification. - * Required if `method` is equal to `drivers_license`. - */ - class DriversLicense - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val expirationDate: JsonField, - private val fileId: JsonField, - private val state: JsonField, - private val backFileId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("expiration_date") - @ExcludeMissing - expirationDate: JsonField = JsonMissing.of(), - @JsonProperty("file_id") - @ExcludeMissing - fileId: JsonField = JsonMissing.of(), - @JsonProperty("state") - @ExcludeMissing - state: JsonField = JsonMissing.of(), - @JsonProperty("back_file_id") - @ExcludeMissing - backFileId: JsonField = JsonMissing.of(), - ) : this(expirationDate, fileId, state, backFileId, mutableMapOf()) - - /** - * The driver's license's expiration date 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 expirationDate(): LocalDate = expirationDate.getRequired("expiration_date") - - /** - * The identifier of the File containing the front of the driver's license. - * - * @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 fileId(): String = fileId.getRequired("file_id") - - /** - * The state that issued the provided driver's license. - * - * @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 state(): String = state.getRequired("state") - - /** - * The identifier of the File containing the back of the driver's license. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun backFileId(): Optional = backFileId.getOptional("back_file_id") - - /** - * 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 - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("file_id") - @ExcludeMissing - fun _fileId(): JsonField = fileId - - /** - * 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 [backFileId]. - * - * Unlike [backFileId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("back_file_id") - @ExcludeMissing - fun _backFileId(): JsonField = backFileId - - @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 - * [DriversLicense]. - * - * The following fields are required: - * ```java - * .expirationDate() - * .fileId() - * .state() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DriversLicense]. */ - class Builder internal constructor() { - - private var expirationDate: JsonField? = null - private var fileId: JsonField? = null - private var state: JsonField? = null - private var backFileId: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(driversLicense: DriversLicense) = apply { - expirationDate = driversLicense.expirationDate - fileId = driversLicense.fileId - state = driversLicense.state - backFileId = driversLicense.backFileId - additionalProperties = - driversLicense.additionalProperties.toMutableMap() - } - - /** The driver's license's expiration date in YYYY-MM-DD format. */ - fun expirationDate(expirationDate: LocalDate) = - expirationDate(JsonField.of(expirationDate)) - - /** - * 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 - } - - /** - * The identifier of the File containing the front of the driver's license. - */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** The state that issued the provided driver's license. */ - fun state(state: String) = state(JsonField.of(state)) - - /** - * 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 identifier of the File containing the back of the driver's license. - */ - fun backFileId(backFileId: String) = backFileId(JsonField.of(backFileId)) - - /** - * Sets [Builder.backFileId] to an arbitrary JSON value. - * - * You should usually call [Builder.backFileId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backFileId(backFileId: JsonField) = apply { - this.backFileId = backFileId - } - - 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 [DriversLicense]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .expirationDate() - * .fileId() - * .state() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DriversLicense = - DriversLicense( - checkRequired("expirationDate", expirationDate), - checkRequired("fileId", fileId), - checkRequired("state", state), - backFileId, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DriversLicense = apply { - if (validated) { - return@apply - } - - expirationDate() - fileId() - state() - backFileId() - 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 (expirationDate.asKnown().isPresent) 1 else 0) + - (if (fileId.asKnown().isPresent) 1 else 0) + - (if (state.asKnown().isPresent) 1 else 0) + - (if (backFileId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DriversLicense && - expirationDate == other.expirationDate && - fileId == other.fileId && - state == other.state && - backFileId == other.backFileId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - expirationDate, - fileId, - state, - backFileId, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DriversLicense{expirationDate=$expirationDate, fileId=$fileId, state=$state, backFileId=$backFileId, additionalProperties=$additionalProperties}" - } - - /** - * Information about the identification document provided. Required if `method` is - * equal to `other`. - */ - class Other - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val country: JsonField, - private val description: JsonField, - private val fileId: JsonField, - private val backFileId: JsonField, - private val expirationDate: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("country") - @ExcludeMissing - country: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - description: JsonField = JsonMissing.of(), - @JsonProperty("file_id") - @ExcludeMissing - fileId: JsonField = JsonMissing.of(), - @JsonProperty("back_file_id") - @ExcludeMissing - backFileId: JsonField = JsonMissing.of(), - @JsonProperty("expiration_date") - @ExcludeMissing - expirationDate: JsonField = JsonMissing.of(), - ) : this( - country, - description, - fileId, - backFileId, - expirationDate, - mutableMapOf(), - ) - - /** - * The two-character ISO 3166-1 code representing the country that issued the - * document (e.g., `US`). - * - * @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") - - /** - * A description of the document submitted. - * - * @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 description(): String = description.getRequired("description") - - /** - * The identifier of the File containing the front of the document. - * - * @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 fileId(): String = fileId.getRequired("file_id") - - /** - * The identifier of the File containing the back of the document. Not every - * document has a reverse side. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun backFileId(): Optional = backFileId.getOptional("back_file_id") - - /** - * The document's expiration date in YYYY-MM-DD format. - * - * @throws IncreaseInvalidDataException 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") - - /** - * 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 [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 [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("file_id") - @ExcludeMissing - fun _fileId(): JsonField = fileId - - /** - * Returns the raw JSON value of [backFileId]. - * - * Unlike [backFileId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("back_file_id") - @ExcludeMissing - fun _backFileId(): JsonField = backFileId - - /** - * 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 - - @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 [Other]. - * - * The following fields are required: - * ```java - * .country() - * .description() - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Other]. */ - class Builder internal constructor() { - - private var country: JsonField? = null - private var description: JsonField? = null - private var fileId: JsonField? = null - private var backFileId: JsonField = JsonMissing.of() - private var expirationDate: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(other: Other) = apply { - country = other.country - description = other.description - fileId = other.fileId - backFileId = other.backFileId - expirationDate = other.expirationDate - additionalProperties = other.additionalProperties.toMutableMap() - } - - /** - * The two-character ISO 3166-1 code representing the country that issued - * the document (e.g., `US`). - */ - 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 } - - /** A description of the document submitted. */ - fun description(description: String) = - description(JsonField.of(description)) - - /** - * 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 - } - - /** The identifier of the File containing the front of the document. */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** - * The identifier of the File containing the back of the document. Not every - * document has a reverse side. - */ - fun backFileId(backFileId: String) = backFileId(JsonField.of(backFileId)) - - /** - * Sets [Builder.backFileId] to an arbitrary JSON value. - * - * You should usually call [Builder.backFileId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun backFileId(backFileId: JsonField) = apply { - this.backFileId = backFileId - } - - /** The document's expiration date in YYYY-MM-DD format. */ - fun expirationDate(expirationDate: LocalDate) = - expirationDate(JsonField.of(expirationDate)) - - /** - * 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 - } - - 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 [Other]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .country() - * .description() - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Other = - Other( - checkRequired("country", country), - checkRequired("description", description), - checkRequired("fileId", fileId), - backFileId, - expirationDate, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Other = apply { - if (validated) { - return@apply - } - - country() - description() - fileId() - backFileId() - expirationDate() - 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 (country.asKnown().isPresent) 1 else 0) + - (if (description.asKnown().isPresent) 1 else 0) + - (if (fileId.asKnown().isPresent) 1 else 0) + - (if (backFileId.asKnown().isPresent) 1 else 0) + - (if (expirationDate.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Other && - country == other.country && - description == other.description && - fileId == other.fileId && - backFileId == other.backFileId && - expirationDate == other.expirationDate && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - country, - description, - fileId, - backFileId, - expirationDate, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Other{country=$country, description=$description, fileId=$fileId, backFileId=$backFileId, expirationDate=$expirationDate, additionalProperties=$additionalProperties}" - } - - /** - * Information about the passport used for identification. Required if `method` is - * equal to `passport`. - */ - class Passport - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val country: JsonField, - private val expirationDate: JsonField, - private val fileId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("country") - @ExcludeMissing - country: JsonField = JsonMissing.of(), - @JsonProperty("expiration_date") - @ExcludeMissing - expirationDate: JsonField = JsonMissing.of(), - @JsonProperty("file_id") - @ExcludeMissing - fileId: JsonField = JsonMissing.of(), - ) : this(country, expirationDate, fileId, mutableMapOf()) - - /** - * The two-character ISO 3166-1 code representing the country that issued the - * document (e.g., `US`). - * - * @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 passport's expiration date 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 expirationDate(): LocalDate = expirationDate.getRequired("expiration_date") - - /** - * The identifier of the File containing the passport. - * - * @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 fileId(): String = fileId.getRequired("file_id") - - /** - * 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 [expirationDate]. - * - * Unlike [expirationDate], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("expiration_date") - @ExcludeMissing - fun _expirationDate(): JsonField = expirationDate - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("file_id") - @ExcludeMissing - fun _fileId(): JsonField = fileId - - @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 [Passport]. - * - * The following fields are required: - * ```java - * .country() - * .expirationDate() - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Passport]. */ - class Builder internal constructor() { - - private var country: JsonField? = null - private var expirationDate: JsonField? = null - private var fileId: JsonField? = null - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(passport: Passport) = apply { - country = passport.country - expirationDate = passport.expirationDate - fileId = passport.fileId - additionalProperties = passport.additionalProperties.toMutableMap() - } - - /** - * The two-character ISO 3166-1 code representing the country that issued - * the document (e.g., `US`). - */ - 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 passport's expiration date in YYYY-MM-DD format. */ - fun expirationDate(expirationDate: LocalDate) = - expirationDate(JsonField.of(expirationDate)) - - /** - * 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 - } - - /** The identifier of the File containing the passport. */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - 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 [Passport]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .country() - * .expirationDate() - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Passport = - Passport( - checkRequired("country", country), - checkRequired("expirationDate", expirationDate), - checkRequired("fileId", fileId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Passport = apply { - if (validated) { - return@apply - } - - country() - expirationDate() - fileId() - 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 (country.asKnown().isPresent) 1 else 0) + - (if (expirationDate.asKnown().isPresent) 1 else 0) + - (if (fileId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Passport && - country == other.country && - expirationDate == other.expirationDate && - fileId == other.fileId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(country, expirationDate, fileId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Passport{country=$country, expirationDate=$expirationDate, fileId=$fileId, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Identification && - method == other.method && - number == other.number && - driversLicense == other.driversLicense && - this.other == other.other && - passport == other.passport && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - method, - number, - driversLicense, - other, - passport, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Identification{method=$method, number=$number, driversLicense=$driversLicense, other=$other, passport=$passport, 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 && - confirmedNoUsTaxId == other.confirmedNoUsTaxId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - address, - dateOfBirth, - identification, - name, - confirmedNoUsTaxId, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Individual{address=$address, dateOfBirth=$dateOfBirth, identification=$identification, name=$name, confirmedNoUsTaxId=$confirmedNoUsTaxId, 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 && - individual == other.individual && - prongs == other.prongs && - companyTitle == other.companyTitle && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(individual, prongs, companyTitle, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "BeneficialOwner{individual=$individual, prongs=$prongs, companyTitle=$companyTitle, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EntityCreateBeneficialOwnerParams && - entityId == other.entityId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(entityId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "EntityCreateBeneficialOwnerParams{entityId=$entityId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsync.kt index caea11956..c66efd9ef 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsync.kt @@ -7,7 +7,6 @@ import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor import com.increase.api.models.entities.Entity import com.increase.api.models.entities.EntityArchiveParams -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityListPageAsync import com.increase.api.models.entities.EntityListParams @@ -154,31 +153,6 @@ interface EntityServiceAsync { fun archive(entityId: String, requestOptions: RequestOptions): CompletableFuture = archive(entityId, EntityArchiveParams.none(), requestOptions) - /** Create a beneficial owner for a corporate Entity */ - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - ): CompletableFuture = createBeneficialOwner(entityId, params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - createBeneficialOwner(params.toBuilder().entityId(entityId).build(), requestOptions) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams - ): CompletableFuture = createBeneficialOwner(params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - /** * A view of [EntityServiceAsync] that provides access to raw HTTP responses for each method. */ @@ -347,35 +321,5 @@ interface EntityServiceAsync { requestOptions: RequestOptions, ): CompletableFuture> = archive(entityId, EntityArchiveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /entities/{entity_id}/create_beneficial_owner`, but - * is otherwise the same as [EntityServiceAsync.createBeneficialOwner]. - */ - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - ): CompletableFuture> = - createBeneficialOwner(entityId, params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - createBeneficialOwner(params.toBuilder().entityId(entityId).build(), requestOptions) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams - ): CompletableFuture> = - createBeneficialOwner(params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> } } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsyncImpl.kt index 1d0a25348..7ddeb4f4a 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/EntityServiceAsyncImpl.kt @@ -18,7 +18,6 @@ import com.increase.api.core.http.parseable import com.increase.api.core.prepareAsync import com.increase.api.models.entities.Entity import com.increase.api.models.entities.EntityArchiveParams -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityListPageAsync import com.increase.api.models.entities.EntityListPageResponse @@ -76,13 +75,6 @@ class EntityServiceAsyncImpl internal constructor(private val clientOptions: Cli // post /entities/{entity_id}/archive withRawResponse().archive(params, requestOptions).thenApply { it.parse() } - override fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /entities/{entity_id}/create_beneficial_owner - withRawResponse().createBeneficialOwner(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EntityServiceAsync.WithRawResponse { @@ -261,39 +253,5 @@ class EntityServiceAsyncImpl internal constructor(private val clientOptions: Cli } } } - - private val createBeneficialOwnerHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("entityId", params.entityId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("entities", params._pathParam(0), "create_beneficial_owner") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createBeneficialOwnerHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityService.kt index 76e96fbba..14d03335d 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityService.kt @@ -8,7 +8,6 @@ import com.increase.api.core.RequestOptions import com.increase.api.core.http.HttpResponseFor import com.increase.api.models.entities.Entity import com.increase.api.models.entities.EntityArchiveParams -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityListPage import com.increase.api.models.entities.EntityListParams @@ -141,27 +140,6 @@ interface EntityService { fun archive(entityId: String, requestOptions: RequestOptions): Entity = archive(entityId, EntityArchiveParams.none(), requestOptions) - /** Create a beneficial owner for a corporate Entity */ - fun createBeneficialOwner(entityId: String, params: EntityCreateBeneficialOwnerParams): Entity = - createBeneficialOwner(entityId, params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Entity = createBeneficialOwner(params.toBuilder().entityId(entityId).build(), requestOptions) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner(params: EntityCreateBeneficialOwnerParams): Entity = - createBeneficialOwner(params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): Entity - /** A view of [EntityService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -333,37 +311,5 @@ interface EntityService { @MustBeClosed fun archive(entityId: String, requestOptions: RequestOptions): HttpResponseFor = archive(entityId, EntityArchiveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `post /entities/{entity_id}/create_beneficial_owner`, but - * is otherwise the same as [EntityService.createBeneficialOwner]. - */ - @MustBeClosed - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - ): HttpResponseFor = createBeneficialOwner(entityId, params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - @MustBeClosed - fun createBeneficialOwner( - entityId: String, - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - createBeneficialOwner(params.toBuilder().entityId(entityId).build(), requestOptions) - - /** @see createBeneficialOwner */ - @MustBeClosed - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams - ): HttpResponseFor = createBeneficialOwner(params, RequestOptions.none()) - - /** @see createBeneficialOwner */ - @MustBeClosed - fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor } } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityServiceImpl.kt index 70496be92..8c1266f8d 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/EntityServiceImpl.kt @@ -18,7 +18,6 @@ import com.increase.api.core.http.parseable import com.increase.api.core.prepare import com.increase.api.models.entities.Entity import com.increase.api.models.entities.EntityArchiveParams -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityListPage import com.increase.api.models.entities.EntityListPageResponse @@ -60,13 +59,6 @@ class EntityServiceImpl internal constructor(private val clientOptions: ClientOp // post /entities/{entity_id}/archive withRawResponse().archive(params, requestOptions).parse() - override fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions, - ): Entity = - // post /entities/{entity_id}/create_beneficial_owner - withRawResponse().createBeneficialOwner(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : EntityService.WithRawResponse { @@ -229,36 +221,5 @@ class EntityServiceImpl internal constructor(private val clientOptions: ClientOp } } } - - private val createBeneficialOwnerHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun createBeneficialOwner( - params: EntityCreateBeneficialOwnerParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("entityId", params.entityId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("entities", params._pathParam(0), "create_beneficial_owner") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createBeneficialOwnerHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt deleted file mode 100644 index 383205c60..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/entities/EntityCreateBeneficialOwnerParamsTest.kt +++ /dev/null @@ -1,368 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.entities - -import java.time.LocalDate -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class EntityCreateBeneficialOwnerParamsTest { - - @Test - fun create() { - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .line2("x") - .state("NY") - .zip("10045") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .driversLicense( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .DriversLicense - .builder() - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .state("x") - .backFileId("back_file_id") - .build() - ) - .other( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Other - .builder() - .country("x") - .description("x") - .fileId("file_id") - .backFileId("back_file_id") - .expirationDate(LocalDate.parse("2019-12-27")) - .build() - ) - .passport( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Passport - .builder() - .country("x") - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .build() - ) - .build() - ) - .name("Ian Crease") - .confirmedNoUsTaxId(true) - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .companyTitle("CEO") - .build() - ) - .build() - } - - @Test - fun pathParams() { - val params = - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .build() - ) - .name("Ian Crease") - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .build() - ) - .build() - - assertThat(params._pathParam(0)).isEqualTo("entity_n8y8tnk2p9339ti393yi") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun body() { - val params = - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .line2("x") - .state("NY") - .zip("10045") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .driversLicense( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .DriversLicense - .builder() - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .state("x") - .backFileId("back_file_id") - .build() - ) - .other( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Other - .builder() - .country("x") - .description("x") - .fileId("file_id") - .backFileId("back_file_id") - .expirationDate(LocalDate.parse("2019-12-27")) - .build() - ) - .passport( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Passport - .builder() - .country("x") - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .build() - ) - .build() - ) - .name("Ian Crease") - .confirmedNoUsTaxId(true) - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .companyTitle("CEO") - .build() - ) - .build() - - val body = params._body() - - assertThat(body.beneficialOwner()) - .isEqualTo( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .line2("x") - .state("NY") - .zip("10045") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .driversLicense( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .DriversLicense - .builder() - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .state("x") - .backFileId("back_file_id") - .build() - ) - .other( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Other - .builder() - .country("x") - .description("x") - .fileId("file_id") - .backFileId("back_file_id") - .expirationDate(LocalDate.parse("2019-12-27")) - .build() - ) - .passport( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Passport - .builder() - .country("x") - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .build() - ) - .build() - ) - .name("Ian Crease") - .confirmedNoUsTaxId(true) - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .companyTitle("CEO") - .build() - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .build() - ) - .name("Ian Crease") - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .build() - ) - .build() - - val body = params._body() - - assertThat(body.beneficialOwner()) - .isEqualTo( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual.Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .build() - ) - .name("Ian Crease") - .build() - ) - .addProng(EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL) - .build() - ) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt index 7d719c1da..a7888d1ad 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/EntityServiceAsyncTest.kt @@ -4,7 +4,6 @@ package com.increase.api.services.async import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityUpdateParams import java.time.LocalDate @@ -595,102 +594,4 @@ internal class EntityServiceAsyncTest { val entity = entityFuture.get() entity.validate() } - - @Test - fun createBeneficialOwner() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val entityServiceAsync = client.entities() - - val entityFuture = - entityServiceAsync.createBeneficialOwner( - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .line2("x") - .state("NY") - .zip("10045") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .driversLicense( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .DriversLicense - .builder() - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .state("x") - .backFileId("back_file_id") - .build() - ) - .other( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Other - .builder() - .country("x") - .description("x") - .fileId("file_id") - .backFileId("back_file_id") - .expirationDate(LocalDate.parse("2019-12-27")) - .build() - ) - .passport( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Passport - .builder() - .country("x") - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .build() - ) - .build() - ) - .name("Ian Crease") - .confirmedNoUsTaxId(true) - .build() - ) - .addProng( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL - ) - .companyTitle("CEO") - .build() - ) - .build() - ) - - val entity = entityFuture.get() - entity.validate() - } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt index c2ef29f19..b36b4beca 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/EntityServiceTest.kt @@ -4,7 +4,6 @@ package com.increase.api.services.blocking import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClient -import com.increase.api.models.entities.EntityCreateBeneficialOwnerParams import com.increase.api.models.entities.EntityCreateParams import com.increase.api.models.entities.EntityUpdateParams import java.time.LocalDate @@ -590,101 +589,4 @@ internal class EntityServiceTest { entity.validate() } - - @Test - fun createBeneficialOwner() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val entityService = client.entities() - - val entity = - entityService.createBeneficialOwner( - EntityCreateBeneficialOwnerParams.builder() - .entityId("entity_n8y8tnk2p9339ti393yi") - .beneficialOwner( - EntityCreateBeneficialOwnerParams.BeneficialOwner.builder() - .individual( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .builder() - .address( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Address - .builder() - .city("New York") - .country("US") - .line1("33 Liberty Street") - .line2("x") - .state("NY") - .zip("10045") - .build() - ) - .dateOfBirth(LocalDate.parse("1970-01-31")) - .identification( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Individual - .Identification - .builder() - .method( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Method - .SOCIAL_SECURITY_NUMBER - ) - .number("078051120") - .driversLicense( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .DriversLicense - .builder() - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .state("x") - .backFileId("back_file_id") - .build() - ) - .other( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Other - .builder() - .country("x") - .description("x") - .fileId("file_id") - .backFileId("back_file_id") - .expirationDate(LocalDate.parse("2019-12-27")) - .build() - ) - .passport( - EntityCreateBeneficialOwnerParams.BeneficialOwner - .Individual - .Identification - .Passport - .builder() - .country("x") - .expirationDate(LocalDate.parse("2019-12-27")) - .fileId("file_id") - .build() - ) - .build() - ) - .name("Ian Crease") - .confirmedNoUsTaxId(true) - .build() - ) - .addProng( - EntityCreateBeneficialOwnerParams.BeneficialOwner.Prong.CONTROL - ) - .companyTitle("CEO") - .build() - ) - .build() - ) - - entity.validate() - } } From b8233b37a3511a99da486fd8c8b63edf9c9c4309 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 16:28:36 +0000 Subject: [PATCH 3/3] release: 0.470.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index aaa9928e9..62c7b030b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.469.0" + ".": "0.470.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bc27ccb79..57ccd6e38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 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) + +### Features + +* **api:** api update ([f40da24](https://github.com/Increase/increase-java/commit/f40da246ad6e98f954edcab0931eace92ed4cd3f)) +* **api:** api update ([7470b8e](https://github.com/Increase/increase-java/commit/7470b8e77eb0ff806b41158136ec6b2346270330)) + ## 0.469.0 (2026-03-12) Full Changelog: [v0.468.0...v0.469.0](https://github.com/Increase/increase-java/compare/v0.468.0...v0.469.0) diff --git a/README.md b/README.md index 734d4ad4e..00db06e8b 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.469.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.469.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.469.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.470.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.470.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.470.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.469.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.470.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.469.0") +implementation("com.increase.api:increase-java:0.470.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.469.0") com.increase.api increase-java - 0.469.0 + 0.470.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index c1f86fc17..d3a71b9de 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.469.0" // x-release-please-version + version = "0.470.0" // x-release-please-version } subprojects {