From 20e681f87cc67eb4aaad477acf4f5a00ef664834 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:14:50 +0000 Subject: [PATCH 1/7] feat(api): add action_counts to rule performance reports and code to authorization actions --- .stats.yml | 6 +- .../api/models/AuthRuleV2ListResultsParams.kt | 48 +- .../com/lithic/api/models/BacktestResults.kt | 45 +- .../models/{RuleStats.kt => BacktestStats.kt} | 96 +- .../models/ConditionalAchActionParameters.kt | 69 +- ...ConditionalTokenizationActionParameters.kt | 83 +- .../com/lithic/api/models/ReportStats.kt | 5079 +++++++++++++++++ .../api/models/V2ListResultsResponse.kt | 1752 +++++- .../api/models/V2RetrieveReportResponse.kt | 36 +- .../AuthRuleV2ListResultsPageResponseTest.kt | 39 +- .../models/AuthRuleV2ListResultsParamsTest.kt | 7 + ...esBacktestReportCreatedWebhookEventTest.kt | 42 +- .../lithic/api/models/BacktestResultsTest.kt | 42 +- ...{RuleStatsTest.kt => BacktestStatsTest.kt} | 43 +- .../ConditionalAchActionParametersTest.kt | 14 +- ...itionalTokenizationActionParametersTest.kt | 29 +- .../api/models/ParsedWebhookEventTest.kt | 28 +- .../com/lithic/api/models/ReportStatsTest.kt | 125 + .../api/models/V2ListResultsResponseTest.kt | 58 +- .../models/V2RetrieveReportResponseTest.kt | 175 +- 20 files changed, 7183 insertions(+), 633 deletions(-) rename lithic-java-core/src/main/kotlin/com/lithic/api/models/{RuleStats.kt => BacktestStats.kt} (88%) create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/ReportStats.kt rename lithic-java-core/src/test/kotlin/com/lithic/api/models/{RuleStatsTest.kt => BacktestStatsTest.kt} (58%) create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportStatsTest.kt diff --git a/.stats.yml b/.stats.yml index c89f84085..17f87283f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 185 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-a45946df228eec554b3cd2491f658bd5a45cb91509da0a9f92d50468ea88072f.yml -openapi_spec_hash: 24c7c13e1e7385cab5442ca66091ffc6 -config_hash: 50031f78031362c2e4900222b9ce7ada +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b29a4bd5ca21348ef426162cbd1fa21070f695572626e4e6faabfa14af38f0b0.yml +openapi_spec_hash: e7c285d6b7006d040ecb50a9d0d2fc17 +config_hash: fb5070d41fcabdedbc084b83964b592a diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParams.kt index 99101e4b9..f2fbdd2ce 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParams.kt @@ -5,6 +5,8 @@ package com.lithic.api.models import com.lithic.api.core.Params import com.lithic.api.core.http.Headers import com.lithic.api.core.http.QueryParams +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -20,6 +22,8 @@ import kotlin.jvm.optionals.getOrNull class AuthRuleV2ListResultsParams private constructor( private val authRuleToken: String?, + private val begin: OffsetDateTime?, + private val end: OffsetDateTime?, private val endingBefore: String?, private val eventToken: String?, private val hasActions: Boolean?, @@ -32,6 +36,18 @@ private constructor( /** Filter by Auth Rule token */ fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) + /** + * Date string in RFC 3339 format. Only events evaluated after the specified time will be + * included. UTC time zone. + */ + fun begin(): Optional = Optional.ofNullable(begin) + + /** + * Date string in RFC 3339 format. Only events evaluated before the specified time will be + * included. UTC time zone. + */ + fun end(): Optional = Optional.ofNullable(end) + /** * A cursor representing an item's token before which a page of results should end. Used to * retrieve the previous page of results before this item. @@ -78,6 +94,8 @@ private constructor( class Builder internal constructor() { private var authRuleToken: String? = null + private var begin: OffsetDateTime? = null + private var end: OffsetDateTime? = null private var endingBefore: String? = null private var eventToken: String? = null private var hasActions: Boolean? = null @@ -89,6 +107,8 @@ private constructor( @JvmSynthetic internal fun from(authRuleV2ListResultsParams: AuthRuleV2ListResultsParams) = apply { authRuleToken = authRuleV2ListResultsParams.authRuleToken + begin = authRuleV2ListResultsParams.begin + end = authRuleV2ListResultsParams.end endingBefore = authRuleV2ListResultsParams.endingBefore eventToken = authRuleV2ListResultsParams.eventToken hasActions = authRuleV2ListResultsParams.hasActions @@ -105,6 +125,24 @@ private constructor( fun authRuleToken(authRuleToken: Optional) = authRuleToken(authRuleToken.getOrNull()) + /** + * Date string in RFC 3339 format. Only events evaluated after the specified time will be + * included. UTC time zone. + */ + fun begin(begin: OffsetDateTime?) = apply { this.begin = begin } + + /** Alias for calling [Builder.begin] with `begin.orElse(null)`. */ + fun begin(begin: Optional) = begin(begin.getOrNull()) + + /** + * Date string in RFC 3339 format. Only events evaluated before the specified time will be + * included. UTC time zone. + */ + fun end(end: OffsetDateTime?) = apply { this.end = end } + + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ + fun end(end: Optional) = end(end.getOrNull()) + /** * A cursor representing an item's token before which a page of results should end. Used to * retrieve the previous page of results before this item. @@ -265,6 +303,8 @@ private constructor( fun build(): AuthRuleV2ListResultsParams = AuthRuleV2ListResultsParams( authRuleToken, + begin, + end, endingBefore, eventToken, hasActions, @@ -281,6 +321,8 @@ private constructor( QueryParams.builder() .apply { authRuleToken?.let { put("auth_rule_token", it) } + begin?.let { put("begin", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } + end?.let { put("end", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } endingBefore?.let { put("ending_before", it) } eventToken?.let { put("event_token", it) } hasActions?.let { put("has_actions", it.toString()) } @@ -297,6 +339,8 @@ private constructor( return other is AuthRuleV2ListResultsParams && authRuleToken == other.authRuleToken && + begin == other.begin && + end == other.end && endingBefore == other.endingBefore && eventToken == other.eventToken && hasActions == other.hasActions && @@ -309,6 +353,8 @@ private constructor( override fun hashCode(): Int = Objects.hash( authRuleToken, + begin, + end, endingBefore, eventToken, hasActions, @@ -319,5 +365,5 @@ private constructor( ) override fun toString() = - "AuthRuleV2ListResultsParams{authRuleToken=$authRuleToken, endingBefore=$endingBefore, eventToken=$eventToken, hasActions=$hasActions, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "AuthRuleV2ListResultsParams{authRuleToken=$authRuleToken, begin=$begin, end=$end, endingBefore=$endingBefore, eventToken=$eventToken, hasActions=$hasActions, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt index 3fd1186b4..9d6be5751 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestResults.kt @@ -243,8 +243,8 @@ private constructor( class Results @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val currentVersion: JsonField, - private val draftVersion: JsonField, + private val currentVersion: JsonField, + private val draftVersion: JsonField, private val additionalProperties: MutableMap, ) { @@ -252,23 +252,24 @@ private constructor( private constructor( @JsonProperty("current_version") @ExcludeMissing - currentVersion: JsonField = JsonMissing.of(), + currentVersion: JsonField = JsonMissing.of(), @JsonProperty("draft_version") @ExcludeMissing - draftVersion: JsonField = JsonMissing.of(), + draftVersion: JsonField = JsonMissing.of(), ) : this(currentVersion, draftVersion, mutableMapOf()) /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currentVersion(): Optional = currentVersion.getOptional("current_version") + fun currentVersion(): Optional = + currentVersion.getOptional("current_version") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun draftVersion(): Optional = draftVersion.getOptional("draft_version") + fun draftVersion(): Optional = draftVersion.getOptional("draft_version") /** * Returns the raw JSON value of [currentVersion]. @@ -278,7 +279,7 @@ private constructor( */ @JsonProperty("current_version") @ExcludeMissing - fun _currentVersion(): JsonField = currentVersion + fun _currentVersion(): JsonField = currentVersion /** * Returns the raw JSON value of [draftVersion]. @@ -288,7 +289,7 @@ private constructor( */ @JsonProperty("draft_version") @ExcludeMissing - fun _draftVersion(): JsonField = draftVersion + fun _draftVersion(): JsonField = draftVersion @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -311,8 +312,8 @@ private constructor( /** A builder for [Results]. */ class Builder internal constructor() { - private var currentVersion: JsonField = JsonMissing.of() - private var draftVersion: JsonField = JsonMissing.of() + private var currentVersion: JsonField = JsonMissing.of() + private var draftVersion: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -322,39 +323,39 @@ private constructor( additionalProperties = results.additionalProperties.toMutableMap() } - fun currentVersion(currentVersion: RuleStats?) = + fun currentVersion(currentVersion: BacktestStats?) = currentVersion(JsonField.ofNullable(currentVersion)) /** Alias for calling [Builder.currentVersion] with `currentVersion.orElse(null)`. */ - fun currentVersion(currentVersion: Optional) = + fun currentVersion(currentVersion: Optional) = currentVersion(currentVersion.getOrNull()) /** * Sets [Builder.currentVersion] to an arbitrary JSON value. * - * You should usually call [Builder.currentVersion] with a well-typed [RuleStats] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.currentVersion] with a well-typed [BacktestStats] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun currentVersion(currentVersion: JsonField) = apply { + fun currentVersion(currentVersion: JsonField) = apply { this.currentVersion = currentVersion } - fun draftVersion(draftVersion: RuleStats?) = + fun draftVersion(draftVersion: BacktestStats?) = draftVersion(JsonField.ofNullable(draftVersion)) /** Alias for calling [Builder.draftVersion] with `draftVersion.orElse(null)`. */ - fun draftVersion(draftVersion: Optional) = + fun draftVersion(draftVersion: Optional) = draftVersion(draftVersion.getOrNull()) /** * Sets [Builder.draftVersion] to an arbitrary JSON value. * - * You should usually call [Builder.draftVersion] with a well-typed [RuleStats] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.draftVersion] with a well-typed [BacktestStats] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun draftVersion(draftVersion: JsonField) = apply { + fun draftVersion(draftVersion: JsonField) = apply { this.draftVersion = draftVersion } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestStats.kt similarity index 88% rename from lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt rename to lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestStats.kt index 9b2b46f11..53c43e847 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleStats.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BacktestStats.kt @@ -20,7 +20,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -class RuleStats +class BacktestStats @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val approved: JsonField, @@ -43,7 +43,7 @@ private constructor( ) : this(approved, challenged, declined, examples, version, mutableMapOf()) /** - * The total number of historical transactions approved by this rule during the relevant period, + * The total number of historical transactions approved by this rule during the backtest period, * or the number of transactions that would have been approved if the rule was evaluated in * shadow mode. * @@ -53,7 +53,7 @@ private constructor( fun approved(): Optional = approved.getOptional("approved") /** - * The total number of historical transactions challenged by this rule during the relevant + * The total number of historical transactions challenged by this rule during the backtest * period, or the number of transactions that would have been challenged if the rule was * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. * @@ -63,7 +63,7 @@ private constructor( fun challenged(): Optional = challenged.getOptional("challenged") /** - * The total number of historical transactions declined by this rule during the relevant period, + * The total number of historical transactions declined by this rule during the backtest period, * or the number of transactions that would have been declined if the rule was evaluated in * shadow mode. * @@ -137,11 +137,11 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [RuleStats]. */ + /** Returns a mutable builder for constructing an instance of [BacktestStats]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [RuleStats]. */ + /** A builder for [BacktestStats]. */ class Builder internal constructor() { private var approved: JsonField = JsonMissing.of() @@ -152,17 +152,17 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(ruleStats: RuleStats) = apply { - approved = ruleStats.approved - challenged = ruleStats.challenged - declined = ruleStats.declined - examples = ruleStats.examples.map { it.toMutableList() } - version = ruleStats.version - additionalProperties = ruleStats.additionalProperties.toMutableMap() + internal fun from(backtestStats: BacktestStats) = apply { + approved = backtestStats.approved + challenged = backtestStats.challenged + declined = backtestStats.declined + examples = backtestStats.examples.map { it.toMutableList() } + version = backtestStats.version + additionalProperties = backtestStats.additionalProperties.toMutableMap() } /** - * The total number of historical transactions approved by this rule during the relevant + * The total number of historical transactions approved by this rule during the backtest * period, or the number of transactions that would have been approved if the rule was * evaluated in shadow mode. */ @@ -177,7 +177,7 @@ private constructor( fun approved(approved: JsonField) = apply { this.approved = approved } /** - * The total number of historical transactions challenged by this rule during the relevant + * The total number of historical transactions challenged by this rule during the backtest * period, or the number of transactions that would have been challenged if the rule was * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. */ @@ -192,7 +192,7 @@ private constructor( fun challenged(challenged: JsonField) = apply { this.challenged = challenged } /** - * The total number of historical transactions declined by this rule during the relevant + * The total number of historical transactions declined by this rule during the backtest * period, or the number of transactions that would have been declined if the rule was * evaluated in shadow mode. */ @@ -263,12 +263,12 @@ private constructor( } /** - * Returns an immutable instance of [RuleStats]. + * Returns an immutable instance of [BacktestStats]. * * Further updates to this [Builder] will not mutate the returned instance. */ - fun build(): RuleStats = - RuleStats( + fun build(): BacktestStats = + BacktestStats( approved, challenged, declined, @@ -280,7 +280,7 @@ private constructor( private var validated: Boolean = false - fun validate(): RuleStats = apply { + fun validate(): BacktestStats = apply { if (validated) { return@apply } @@ -317,7 +317,6 @@ private constructor( class Example @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val approved: JsonField, private val decision: JsonField, private val eventToken: JsonField, private val timestamp: JsonField, @@ -326,9 +325,6 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("approved") - @ExcludeMissing - approved: JsonField = JsonMissing.of(), @JsonProperty("decision") @ExcludeMissing decision: JsonField = JsonMissing.of(), @@ -338,15 +334,7 @@ private constructor( @JsonProperty("timestamp") @ExcludeMissing timestamp: JsonField = JsonMissing.of(), - ) : this(approved, decision, eventToken, timestamp, mutableMapOf()) - - /** - * Whether the rule would have approved the request. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun approved(): Optional = approved.getOptional("approved") + ) : this(decision, eventToken, timestamp, mutableMapOf()) /** * The decision made by the rule for this event. @@ -372,13 +360,6 @@ private constructor( */ fun timestamp(): Optional = timestamp.getOptional("timestamp") - /** - * Returns the raw JSON value of [approved]. - * - * Unlike [approved], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("approved") @ExcludeMissing fun _approved(): JsonField = approved - /** * Returns the raw JSON value of [decision]. * @@ -425,7 +406,6 @@ private constructor( /** A builder for [Example]. */ class Builder internal constructor() { - private var approved: JsonField = JsonMissing.of() private var decision: JsonField = JsonMissing.of() private var eventToken: JsonField = JsonMissing.of() private var timestamp: JsonField = JsonMissing.of() @@ -433,25 +413,12 @@ private constructor( @JvmSynthetic internal fun from(example: Example) = apply { - approved = example.approved decision = example.decision eventToken = example.eventToken timestamp = example.timestamp additionalProperties = example.additionalProperties.toMutableMap() } - /** Whether the rule would have approved the request. */ - fun approved(approved: Boolean) = approved(JsonField.of(approved)) - - /** - * Sets [Builder.approved] to an arbitrary JSON value. - * - * You should usually call [Builder.approved] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun approved(approved: JsonField) = apply { this.approved = approved } - /** The decision made by the rule for this event. */ fun decision(decision: Decision) = decision(JsonField.of(decision)) @@ -515,13 +482,7 @@ private constructor( * Further updates to this [Builder] will not mutate the returned instance. */ fun build(): Example = - Example( - approved, - decision, - eventToken, - timestamp, - additionalProperties.toMutableMap(), - ) + Example(decision, eventToken, timestamp, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -531,7 +492,6 @@ private constructor( return@apply } - approved() decision().ifPresent { it.validate() } eventToken() timestamp() @@ -554,8 +514,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (approved.asKnown().isPresent) 1 else 0) + - (decision.asKnown().getOrNull()?.validity() ?: 0) + + (decision.asKnown().getOrNull()?.validity() ?: 0) + (if (eventToken.asKnown().isPresent) 1 else 0) + (if (timestamp.asKnown().isPresent) 1 else 0) @@ -702,7 +661,6 @@ private constructor( } return other is Example && - approved == other.approved && decision == other.decision && eventToken == other.eventToken && timestamp == other.timestamp && @@ -710,13 +668,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash(approved, decision, eventToken, timestamp, additionalProperties) + Objects.hash(decision, eventToken, timestamp, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Example{approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" + "Example{decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -724,7 +682,7 @@ private constructor( return true } - return other is RuleStats && + return other is BacktestStats && approved == other.approved && challenged == other.challenged && declined == other.declined && @@ -740,5 +698,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "RuleStats{approved=$approved, challenged=$challenged, declined=$declined, examples=$examples, version=$version, additionalProperties=$additionalProperties}" + "BacktestStats{approved=$approved, challenged=$challenged, declined=$declined, examples=$examples, version=$version, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt index a1bb64f6e..e0ae0a4ad 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt @@ -131,8 +131,9 @@ private constructor( */ fun action(action: JsonField) = apply { this.action = action } - /** Alias for calling [action] with `Action.ofApprove(approve)`. */ - fun action(approve: Action.ApproveAction) = action(Action.ofApprove(approve)) + /** Alias for calling [action] with `Action.ofApproveActionAch(approveActionAch)`. */ + fun action(approveActionAch: Action.ApproveActionAch) = + action(Action.ofApproveActionAch(approveActionAch)) /** Alias for calling [action] with `Action.ofReturnAction(returnAction)`. */ fun action(returnAction: Action.ReturnAction) = action(Action.ofReturnAction(returnAction)) @@ -237,20 +238,20 @@ private constructor( @JsonSerialize(using = Action.Serializer::class) class Action private constructor( - private val approve: ApproveAction? = null, + private val approveActionAch: ApproveActionAch? = null, private val returnAction: ReturnAction? = null, private val _json: JsonValue? = null, ) { - fun approve(): Optional = Optional.ofNullable(approve) + fun approveActionAch(): Optional = Optional.ofNullable(approveActionAch) fun returnAction(): Optional = Optional.ofNullable(returnAction) - fun isApprove(): Boolean = approve != null + fun isApproveActionAch(): Boolean = approveActionAch != null fun isReturnAction(): Boolean = returnAction != null - fun asApprove(): ApproveAction = approve.getOrThrow("approve") + fun asApproveActionAch(): ApproveActionAch = approveActionAch.getOrThrow("approveActionAch") fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") @@ -258,7 +259,7 @@ private constructor( fun accept(visitor: Visitor): T = when { - approve != null -> visitor.visitApprove(approve) + approveActionAch != null -> visitor.visitApproveActionAch(approveActionAch) returnAction != null -> visitor.visitReturnAction(returnAction) else -> visitor.unknown(_json) } @@ -272,8 +273,8 @@ private constructor( accept( object : Visitor { - override fun visitApprove(approve: ApproveAction) { - approve.validate() + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) { + approveActionAch.validate() } override fun visitReturnAction(returnAction: ReturnAction) { @@ -302,7 +303,8 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitApprove(approve: ApproveAction) = approve.validity() + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) = + approveActionAch.validity() override fun visitReturnAction(returnAction: ReturnAction) = returnAction.validity() @@ -316,14 +318,16 @@ private constructor( return true } - return other is Action && approve == other.approve && returnAction == other.returnAction + return other is Action && + approveActionAch == other.approveActionAch && + returnAction == other.returnAction } - override fun hashCode(): Int = Objects.hash(approve, returnAction) + override fun hashCode(): Int = Objects.hash(approveActionAch, returnAction) override fun toString(): String = when { - approve != null -> "Action{approve=$approve}" + approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" returnAction != null -> "Action{returnAction=$returnAction}" _json != null -> "Action{_unknown=$_json}" else -> throw IllegalStateException("Invalid Action") @@ -331,7 +335,9 @@ private constructor( companion object { - @JvmStatic fun ofApprove(approve: ApproveAction) = Action(approve = approve) + @JvmStatic + fun ofApproveActionAch(approveActionAch: ApproveActionAch) = + Action(approveActionAch = approveActionAch) @JvmStatic fun ofReturnAction(returnAction: ReturnAction) = Action(returnAction = returnAction) @@ -340,7 +346,7 @@ private constructor( /** An interface that defines how to map each variant of [Action] to a value of type [T]. */ interface Visitor { - fun visitApprove(approve: ApproveAction): T + fun visitApproveActionAch(approveActionAch: ApproveActionAch): T fun visitReturnAction(returnAction: ReturnAction): T @@ -366,8 +372,8 @@ private constructor( val bestMatches = sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Action(approve = it, _json = json) + tryDeserialize(node, jacksonTypeRef())?.let { + Action(approveActionAch = it, _json = json) }, tryDeserialize(node, jacksonTypeRef())?.let { Action(returnAction = it, _json = json) @@ -397,7 +403,7 @@ private constructor( provider: SerializerProvider, ) { when { - value.approve != null -> generator.writeObject(value.approve) + value.approveActionAch != null -> generator.writeObject(value.approveActionAch) value.returnAction != null -> generator.writeObject(value.returnAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Action") @@ -405,7 +411,7 @@ private constructor( } } - class ApproveAction + class ApproveActionAch @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -448,7 +454,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ApproveAction]. + * Returns a mutable builder for constructing an instance of [ApproveActionAch]. * * The following fields are required: * ```java @@ -458,16 +464,16 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ApproveAction]. */ + /** A builder for [ApproveActionAch]. */ class Builder internal constructor() { private var type: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(approveAction: ApproveAction) = apply { - type = approveAction.type - additionalProperties = approveAction.additionalProperties.toMutableMap() + internal fun from(approveActionAch: ApproveActionAch) = apply { + type = approveActionAch.type + additionalProperties = approveActionAch.additionalProperties.toMutableMap() } /** Approve the ACH transaction */ @@ -505,7 +511,7 @@ private constructor( } /** - * Returns an immutable instance of [ApproveAction]. + * Returns an immutable instance of [ApproveActionAch]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -516,13 +522,16 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ApproveAction = - ApproveAction(checkRequired("type", type), additionalProperties.toMutableMap()) + fun build(): ApproveActionAch = + ApproveActionAch( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false - fun validate(): ApproveAction = apply { + fun validate(): ApproveActionAch = apply { if (validated) { return@apply } @@ -678,7 +687,7 @@ private constructor( return true } - return other is ApproveAction && + return other is ApproveActionAch && type == other.type && additionalProperties == other.additionalProperties } @@ -688,7 +697,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ApproveAction{type=$type, additionalProperties=$additionalProperties}" + "ApproveActionAch{type=$type, additionalProperties=$additionalProperties}" } class ReturnAction diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt index b7d6aa597..792291b0d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt @@ -134,8 +134,12 @@ private constructor( */ fun action(action: JsonField) = apply { this.action = action } - /** Alias for calling [action] with `Action.ofDecline(decline)`. */ - fun action(decline: Action.DeclineAction) = action(Action.ofDecline(decline)) + /** + * Alias for calling [action] with + * `Action.ofDeclineActionTokenization(declineActionTokenization)`. + */ + fun action(declineActionTokenization: Action.DeclineActionTokenization) = + action(Action.ofDeclineActionTokenization(declineActionTokenization)) /** Alias for calling [action] with `Action.ofRequireTfa(requireTfa)`. */ fun action(requireTfa: Action.RequireTfaAction) = action(Action.ofRequireTfa(requireTfa)) @@ -240,20 +244,22 @@ private constructor( @JsonSerialize(using = Action.Serializer::class) class Action private constructor( - private val decline: DeclineAction? = null, + private val declineActionTokenization: DeclineActionTokenization? = null, private val requireTfa: RequireTfaAction? = null, private val _json: JsonValue? = null, ) { - fun decline(): Optional = Optional.ofNullable(decline) + fun declineActionTokenization(): Optional = + Optional.ofNullable(declineActionTokenization) fun requireTfa(): Optional = Optional.ofNullable(requireTfa) - fun isDecline(): Boolean = decline != null + fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null fun isRequireTfa(): Boolean = requireTfa != null - fun asDecline(): DeclineAction = decline.getOrThrow("decline") + fun asDeclineActionTokenization(): DeclineActionTokenization = + declineActionTokenization.getOrThrow("declineActionTokenization") fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") @@ -261,7 +267,8 @@ private constructor( fun accept(visitor: Visitor): T = when { - decline != null -> visitor.visitDecline(decline) + declineActionTokenization != null -> + visitor.visitDeclineActionTokenization(declineActionTokenization) requireTfa != null -> visitor.visitRequireTfa(requireTfa) else -> visitor.unknown(_json) } @@ -275,8 +282,10 @@ private constructor( accept( object : Visitor { - override fun visitDecline(decline: DeclineAction) { - decline.validate() + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) { + declineActionTokenization.validate() } override fun visitRequireTfa(requireTfa: RequireTfaAction) { @@ -305,7 +314,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitDecline(decline: DeclineAction) = decline.validity() + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = declineActionTokenization.validity() override fun visitRequireTfa(requireTfa: RequireTfaAction) = requireTfa.validity() @@ -319,14 +330,17 @@ private constructor( return true } - return other is Action && decline == other.decline && requireTfa == other.requireTfa + return other is Action && + declineActionTokenization == other.declineActionTokenization && + requireTfa == other.requireTfa } - override fun hashCode(): Int = Objects.hash(decline, requireTfa) + override fun hashCode(): Int = Objects.hash(declineActionTokenization, requireTfa) override fun toString(): String = when { - decline != null -> "Action{decline=$decline}" + declineActionTokenization != null -> + "Action{declineActionTokenization=$declineActionTokenization}" requireTfa != null -> "Action{requireTfa=$requireTfa}" _json != null -> "Action{_unknown=$_json}" else -> throw IllegalStateException("Invalid Action") @@ -334,7 +348,9 @@ private constructor( companion object { - @JvmStatic fun ofDecline(decline: DeclineAction) = Action(decline = decline) + @JvmStatic + fun ofDeclineActionTokenization(declineActionTokenization: DeclineActionTokenization) = + Action(declineActionTokenization = declineActionTokenization) @JvmStatic fun ofRequireTfa(requireTfa: RequireTfaAction) = Action(requireTfa = requireTfa) @@ -343,7 +359,9 @@ private constructor( /** An interface that defines how to map each variant of [Action] to a value of type [T]. */ interface Visitor { - fun visitDecline(decline: DeclineAction): T + fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ): T fun visitRequireTfa(requireTfa: RequireTfaAction): T @@ -369,8 +387,8 @@ private constructor( val bestMatches = sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Action(decline = it, _json = json) + tryDeserialize(node, jacksonTypeRef())?.let { + Action(declineActionTokenization = it, _json = json) }, tryDeserialize(node, jacksonTypeRef())?.let { Action(requireTfa = it, _json = json) @@ -400,7 +418,8 @@ private constructor( provider: SerializerProvider, ) { when { - value.decline != null -> generator.writeObject(value.decline) + value.declineActionTokenization != null -> + generator.writeObject(value.declineActionTokenization) value.requireTfa != null -> generator.writeObject(value.requireTfa) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Action") @@ -408,7 +427,7 @@ private constructor( } } - class DeclineAction + class DeclineActionTokenization @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -468,7 +487,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DeclineAction]. + * Returns a mutable builder for constructing an instance of + * [DeclineActionTokenization]. * * The following fields are required: * ```java @@ -478,7 +498,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DeclineAction]. */ + /** A builder for [DeclineActionTokenization]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -486,10 +506,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(declineAction: DeclineAction) = apply { - type = declineAction.type - reason = declineAction.reason - additionalProperties = declineAction.additionalProperties.toMutableMap() + internal fun from(declineActionTokenization: DeclineActionTokenization) = apply { + type = declineActionTokenization.type + reason = declineActionTokenization.reason + additionalProperties = + declineActionTokenization.additionalProperties.toMutableMap() } /** Decline the tokenization request */ @@ -539,7 +560,7 @@ private constructor( } /** - * Returns an immutable instance of [DeclineAction]. + * Returns an immutable instance of [DeclineActionTokenization]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -550,8 +571,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DeclineAction = - DeclineAction( + fun build(): DeclineActionTokenization = + DeclineActionTokenization( checkRequired("type", type), reason, additionalProperties.toMutableMap(), @@ -560,7 +581,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DeclineAction = apply { + fun validate(): DeclineActionTokenization = apply { if (validated) { return@apply } @@ -922,7 +943,7 @@ private constructor( return true } - return other is DeclineAction && + return other is DeclineActionTokenization && type == other.type && reason == other.reason && additionalProperties == other.additionalProperties @@ -933,7 +954,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DeclineAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + "DeclineActionTokenization{type=$type, reason=$reason, additionalProperties=$additionalProperties}" } class RequireTfaAction diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ReportStats.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ReportStats.kt new file mode 100644 index 000000000..9ec9d2f6f --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ReportStats.kt @@ -0,0 +1,5079 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ReportStats +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val actionCounts: JsonField, + private val approved: JsonField, + private val challenged: JsonField, + private val declined: JsonField, + private val examples: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("action_counts") + @ExcludeMissing + actionCounts: JsonField = JsonMissing.of(), + @JsonProperty("approved") @ExcludeMissing approved: JsonField = JsonMissing.of(), + @JsonProperty("challenged") @ExcludeMissing challenged: JsonField = JsonMissing.of(), + @JsonProperty("declined") @ExcludeMissing declined: JsonField = JsonMissing.of(), + @JsonProperty("examples") + @ExcludeMissing + examples: JsonField> = JsonMissing.of(), + ) : this(actionCounts, approved, challenged, declined, examples, mutableMapOf()) + + /** + * A mapping of action types to the number of times that action was returned by this rule during + * the relevant period. Actions are the possible outcomes of a rule evaluation, such as DECLINE, + * CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger any action, it's counted under + * NO_ACTION key. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun actionCounts(): Optional = actionCounts.getOptional("action_counts") + + /** + * The total number of historical transactions approved by this rule during the relevant period, + * or the number of transactions that would have been approved if the rule was evaluated in + * shadow mode. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") fun approved(): Optional = approved.getOptional("approved") + + /** + * The total number of historical transactions challenged by this rule during the relevant + * period, or the number of transactions that would have been challenged if the rule was + * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun challenged(): Optional = challenged.getOptional("challenged") + + /** + * The total number of historical transactions declined by this rule during the relevant period, + * or the number of transactions that would have been declined if the rule was evaluated in + * shadow mode. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") fun declined(): Optional = declined.getOptional("declined") + + /** + * Example events and their outcomes. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun examples(): Optional> = examples.getOptional("examples") + + /** + * Returns the raw JSON value of [actionCounts]. + * + * Unlike [actionCounts], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("action_counts") + @ExcludeMissing + fun _actionCounts(): JsonField = actionCounts + + /** + * Returns the raw JSON value of [approved]. + * + * Unlike [approved], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("approved") + @ExcludeMissing + fun _approved(): JsonField = approved + + /** + * Returns the raw JSON value of [challenged]. + * + * Unlike [challenged], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("challenged") + @ExcludeMissing + fun _challenged(): JsonField = challenged + + /** + * Returns the raw JSON value of [declined]. + * + * Unlike [declined], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("declined") + @ExcludeMissing + fun _declined(): JsonField = declined + + /** + * Returns the raw JSON value of [examples]. + * + * Unlike [examples], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("examples") @ExcludeMissing fun _examples(): JsonField> = examples + + @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 [ReportStats]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReportStats]. */ + class Builder internal constructor() { + + private var actionCounts: JsonField = JsonMissing.of() + private var approved: JsonField = JsonMissing.of() + private var challenged: JsonField = JsonMissing.of() + private var declined: JsonField = JsonMissing.of() + private var examples: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(reportStats: ReportStats) = apply { + actionCounts = reportStats.actionCounts + approved = reportStats.approved + challenged = reportStats.challenged + declined = reportStats.declined + examples = reportStats.examples.map { it.toMutableList() } + additionalProperties = reportStats.additionalProperties.toMutableMap() + } + + /** + * A mapping of action types to the number of times that action was returned by this rule + * during the relevant period. Actions are the possible outcomes of a rule evaluation, such + * as DECLINE, CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger any action, it's + * counted under NO_ACTION key. + */ + fun actionCounts(actionCounts: ActionCounts) = actionCounts(JsonField.of(actionCounts)) + + /** + * Sets [Builder.actionCounts] to an arbitrary JSON value. + * + * You should usually call [Builder.actionCounts] with a well-typed [ActionCounts] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun actionCounts(actionCounts: JsonField) = apply { + this.actionCounts = actionCounts + } + + /** + * The total number of historical transactions approved by this rule during the relevant + * period, or the number of transactions that would have been approved if the rule was + * evaluated in shadow mode. + */ + @Deprecated("deprecated") fun approved(approved: Long) = approved(JsonField.of(approved)) + + /** + * Sets [Builder.approved] to an arbitrary JSON value. + * + * You should usually call [Builder.approved] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + @Deprecated("deprecated") + fun approved(approved: JsonField) = apply { this.approved = approved } + + /** + * The total number of historical transactions challenged by this rule during the relevant + * period, or the number of transactions that would have been challenged if the rule was + * evaluated in shadow mode. Currently applicable only for 3DS Auth Rules. + */ + @Deprecated("deprecated") + fun challenged(challenged: Long) = challenged(JsonField.of(challenged)) + + /** + * Sets [Builder.challenged] to an arbitrary JSON value. + * + * You should usually call [Builder.challenged] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + @Deprecated("deprecated") + fun challenged(challenged: JsonField) = apply { this.challenged = challenged } + + /** + * The total number of historical transactions declined by this rule during the relevant + * period, or the number of transactions that would have been declined if the rule was + * evaluated in shadow mode. + */ + @Deprecated("deprecated") fun declined(declined: Long) = declined(JsonField.of(declined)) + + /** + * Sets [Builder.declined] to an arbitrary JSON value. + * + * You should usually call [Builder.declined] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + @Deprecated("deprecated") + fun declined(declined: JsonField) = apply { this.declined = declined } + + /** Example events and their outcomes. */ + fun examples(examples: List) = examples(JsonField.of(examples)) + + /** + * Sets [Builder.examples] to an arbitrary JSON value. + * + * You should usually call [Builder.examples] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun examples(examples: JsonField>) = apply { + this.examples = examples.map { it.toMutableList() } + } + + /** + * Adds a single [Example] to [examples]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addExample(example: Example) = apply { + examples = + (examples ?: JsonField.of(mutableListOf())).also { + checkKnown("examples", it).add(example) + } + } + + 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 [ReportStats]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ReportStats = + ReportStats( + actionCounts, + approved, + challenged, + declined, + (examples ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReportStats = apply { + if (validated) { + return@apply + } + + actionCounts().ifPresent { it.validate() } + approved() + challenged() + declined() + examples().ifPresent { it.forEach { it.validate() } } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (actionCounts.asKnown().getOrNull()?.validity() ?: 0) + + (if (approved.asKnown().isPresent) 1 else 0) + + (if (challenged.asKnown().isPresent) 1 else 0) + + (if (declined.asKnown().isPresent) 1 else 0) + + (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** + * A mapping of action types to the number of times that action was returned by this rule during + * the relevant period. Actions are the possible outcomes of a rule evaluation, such as DECLINE, + * CHALLENGE, REQUIRE_TFA, etc. In case rule didn't trigger any action, it's counted under + * NO_ACTION key. + */ + class ActionCounts + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ActionCounts]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ActionCounts]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(actionCounts: ActionCounts) = apply { + additionalProperties = actionCounts.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ActionCounts]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ActionCounts = ActionCounts(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + fun validate(): ActionCounts = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ActionCounts && additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ActionCounts{additionalProperties=$additionalProperties}" + } + + class Example + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val actions: JsonField>, + private val approved: JsonField, + private val decision: JsonField, + private val eventToken: JsonField, + private val timestamp: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("actions") + @ExcludeMissing + actions: JsonField> = JsonMissing.of(), + @JsonProperty("approved") + @ExcludeMissing + approved: JsonField = JsonMissing.of(), + @JsonProperty("decision") + @ExcludeMissing + decision: JsonField = JsonMissing.of(), + @JsonProperty("event_token") + @ExcludeMissing + eventToken: JsonField = JsonMissing.of(), + @JsonProperty("timestamp") + @ExcludeMissing + timestamp: JsonField = JsonMissing.of(), + ) : this(actions, approved, decision, eventToken, timestamp, mutableMapOf()) + + /** + * The actions taken by the rule for this event. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun actions(): Optional> = actions.getOptional("actions") + + /** + * Whether the rule would have approved the request. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun approved(): Optional = approved.getOptional("approved") + + /** + * The decision made by the rule for this event. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + @Deprecated("deprecated") + fun decision(): Optional = decision.getOptional("decision") + + /** + * The event token. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun eventToken(): Optional = eventToken.getOptional("event_token") + + /** + * The timestamp of the event. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun timestamp(): Optional = timestamp.getOptional("timestamp") + + /** + * Returns the raw JSON value of [actions]. + * + * Unlike [actions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("actions") @ExcludeMissing fun _actions(): JsonField> = actions + + /** + * Returns the raw JSON value of [approved]. + * + * Unlike [approved], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("approved") + @ExcludeMissing + fun _approved(): JsonField = approved + + /** + * Returns the raw JSON value of [decision]. + * + * Unlike [decision], this method doesn't throw if the JSON field has an unexpected type. + */ + @Deprecated("deprecated") + @JsonProperty("decision") + @ExcludeMissing + fun _decision(): JsonField = decision + + /** + * Returns the raw JSON value of [eventToken]. + * + * Unlike [eventToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_token") + @ExcludeMissing + fun _eventToken(): JsonField = eventToken + + /** + * Returns the raw JSON value of [timestamp]. + * + * Unlike [timestamp], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("timestamp") + @ExcludeMissing + fun _timestamp(): JsonField = timestamp + + @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 [Example]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Example]. */ + class Builder internal constructor() { + + private var actions: JsonField>? = null + private var approved: JsonField = JsonMissing.of() + private var decision: JsonField = JsonMissing.of() + private var eventToken: JsonField = JsonMissing.of() + private var timestamp: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(example: Example) = apply { + actions = example.actions.map { it.toMutableList() } + approved = example.approved + decision = example.decision + eventToken = example.eventToken + timestamp = example.timestamp + additionalProperties = example.additionalProperties.toMutableMap() + } + + /** The actions taken by the rule for this event. */ + fun actions(actions: List) = actions(JsonField.of(actions)) + + /** + * Sets [Builder.actions] to an arbitrary JSON value. + * + * You should usually call [Builder.actions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun actions(actions: JsonField>) = apply { + this.actions = actions.map { it.toMutableList() } + } + + /** + * Adds a single [Action] to [actions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAction(action: Action) = apply { + actions = + (actions ?: JsonField.of(mutableListOf())).also { + checkKnown("actions", it).add(action) + } + } + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionAuthorization(declineActionAuthorization)`. + */ + fun addAction(declineActionAuthorization: Action.DeclineActionAuthorization) = + addAction(Action.ofDeclineActionAuthorization(declineActionAuthorization)) + + /** + * Alias for calling [addAction] with + * `Action.ofChallengeActionAuthorization(challengeActionAuthorization)`. + */ + fun addAction(challengeActionAuthorization: Action.ChallengeActionAuthorization) = + addAction(Action.ofChallengeActionAuthorization(challengeActionAuthorization)) + + /** + * Alias for calling [addAction] with + * `Action.ofResultAuthentication3ds(resultAuthentication3ds)`. + */ + fun addAction(resultAuthentication3ds: Action.ResultAuthentication3dsAction) = + addAction(Action.ofResultAuthentication3ds(resultAuthentication3ds)) + + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionTokenization(declineActionTokenization)`. + */ + fun addAction(declineActionTokenization: Action.DeclineActionTokenization) = + addAction(Action.ofDeclineActionTokenization(declineActionTokenization)) + + /** Alias for calling [addAction] with `Action.ofRequireTfa(requireTfa)`. */ + fun addAction(requireTfa: Action.RequireTfaAction) = + addAction(Action.ofRequireTfa(requireTfa)) + + /** Alias for calling [addAction] with `Action.ofApproveActionAch(approveActionAch)`. */ + fun addAction(approveActionAch: Action.ApproveActionAch) = + addAction(Action.ofApproveActionAch(approveActionAch)) + + /** Alias for calling [addAction] with `Action.ofReturnAction(returnAction)`. */ + fun addAction(returnAction: Action.ReturnAction) = + addAction(Action.ofReturnAction(returnAction)) + + /** Whether the rule would have approved the request. */ + @Deprecated("deprecated") + fun approved(approved: Boolean) = approved(JsonField.of(approved)) + + /** + * Sets [Builder.approved] to an arbitrary JSON value. + * + * You should usually call [Builder.approved] with a well-typed [Boolean] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun approved(approved: JsonField) = apply { this.approved = approved } + + /** The decision made by the rule for this event. */ + @Deprecated("deprecated") + fun decision(decision: Decision) = decision(JsonField.of(decision)) + + /** + * Sets [Builder.decision] to an arbitrary JSON value. + * + * You should usually call [Builder.decision] with a well-typed [Decision] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + @Deprecated("deprecated") + fun decision(decision: JsonField) = apply { this.decision = decision } + + /** The event token. */ + fun eventToken(eventToken: String) = eventToken(JsonField.of(eventToken)) + + /** + * Sets [Builder.eventToken] to an arbitrary JSON value. + * + * You should usually call [Builder.eventToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun eventToken(eventToken: JsonField) = apply { this.eventToken = eventToken } + + /** The timestamp of the event. */ + fun timestamp(timestamp: OffsetDateTime) = timestamp(JsonField.of(timestamp)) + + /** + * Sets [Builder.timestamp] to an arbitrary JSON value. + * + * You should usually call [Builder.timestamp] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun timestamp(timestamp: JsonField) = apply { + this.timestamp = timestamp + } + + 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 [Example]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Example = + Example( + (actions ?: JsonMissing.of()).map { it.toImmutable() }, + approved, + decision, + eventToken, + timestamp, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Example = apply { + if (validated) { + return@apply + } + + actions().ifPresent { it.forEach { it.validate() } } + approved() + decision().ifPresent { it.validate() } + eventToken() + timestamp() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (actions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (approved.asKnown().isPresent) 1 else 0) + + (decision.asKnown().getOrNull()?.validity() ?: 0) + + (if (eventToken.asKnown().isPresent) 1 else 0) + + (if (timestamp.asKnown().isPresent) 1 else 0) + + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) + class Action + private constructor( + private val declineActionAuthorization: DeclineActionAuthorization? = null, + private val challengeActionAuthorization: ChallengeActionAuthorization? = null, + private val resultAuthentication3ds: ResultAuthentication3dsAction? = null, + private val declineActionTokenization: DeclineActionTokenization? = null, + private val requireTfa: RequireTfaAction? = null, + private val approveActionAch: ApproveActionAch? = null, + private val returnAction: ReturnAction? = null, + private val _json: JsonValue? = null, + ) { + + fun declineActionAuthorization(): Optional = + Optional.ofNullable(declineActionAuthorization) + + fun challengeActionAuthorization(): Optional = + Optional.ofNullable(challengeActionAuthorization) + + fun resultAuthentication3ds(): Optional = + Optional.ofNullable(resultAuthentication3ds) + + fun declineActionTokenization(): Optional = + Optional.ofNullable(declineActionTokenization) + + fun requireTfa(): Optional = Optional.ofNullable(requireTfa) + + fun approveActionAch(): Optional = + Optional.ofNullable(approveActionAch) + + fun returnAction(): Optional = Optional.ofNullable(returnAction) + + fun isDeclineActionAuthorization(): Boolean = declineActionAuthorization != null + + fun isChallengeActionAuthorization(): Boolean = challengeActionAuthorization != null + + fun isResultAuthentication3ds(): Boolean = resultAuthentication3ds != null + + fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null + + fun isRequireTfa(): Boolean = requireTfa != null + + fun isApproveActionAch(): Boolean = approveActionAch != null + + fun isReturnAction(): Boolean = returnAction != null + + fun asDeclineActionAuthorization(): DeclineActionAuthorization = + declineActionAuthorization.getOrThrow("declineActionAuthorization") + + fun asChallengeActionAuthorization(): ChallengeActionAuthorization = + challengeActionAuthorization.getOrThrow("challengeActionAuthorization") + + fun asResultAuthentication3ds(): ResultAuthentication3dsAction = + resultAuthentication3ds.getOrThrow("resultAuthentication3ds") + + fun asDeclineActionTokenization(): DeclineActionTokenization = + declineActionTokenization.getOrThrow("declineActionTokenization") + + fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") + + fun asApproveActionAch(): ApproveActionAch = + approveActionAch.getOrThrow("approveActionAch") + + fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + declineActionAuthorization != null -> + visitor.visitDeclineActionAuthorization(declineActionAuthorization) + challengeActionAuthorization != null -> + visitor.visitChallengeActionAuthorization(challengeActionAuthorization) + resultAuthentication3ds != null -> + visitor.visitResultAuthentication3ds(resultAuthentication3ds) + declineActionTokenization != null -> + visitor.visitDeclineActionTokenization(declineActionTokenization) + requireTfa != null -> visitor.visitRequireTfa(requireTfa) + approveActionAch != null -> visitor.visitApproveActionAch(approveActionAch) + returnAction != null -> visitor.visitReturnAction(returnAction) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) { + declineActionAuthorization.validate() + } + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) { + challengeActionAuthorization.validate() + } + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) { + resultAuthentication3ds.validate() + } + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) { + declineActionTokenization.validate() + } + + override fun visitRequireTfa(requireTfa: RequireTfaAction) { + requireTfa.validate() + } + + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) { + approveActionAch.validate() + } + + override fun visitReturnAction(returnAction: ReturnAction) { + returnAction.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = declineActionAuthorization.validity() + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = challengeActionAuthorization.validity() + + override fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = resultAuthentication3ds.validity() + + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = declineActionTokenization.validity() + + override fun visitRequireTfa(requireTfa: RequireTfaAction) = + requireTfa.validity() + + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) = + approveActionAch.validity() + + override fun visitReturnAction(returnAction: ReturnAction) = + returnAction.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && + declineActionAuthorization == other.declineActionAuthorization && + challengeActionAuthorization == other.challengeActionAuthorization && + resultAuthentication3ds == other.resultAuthentication3ds && + declineActionTokenization == other.declineActionTokenization && + requireTfa == other.requireTfa && + approveActionAch == other.approveActionAch && + returnAction == other.returnAction + } + + override fun hashCode(): Int = + Objects.hash( + declineActionAuthorization, + challengeActionAuthorization, + resultAuthentication3ds, + declineActionTokenization, + requireTfa, + approveActionAch, + returnAction, + ) + + override fun toString(): String = + when { + declineActionAuthorization != null -> + "Action{declineActionAuthorization=$declineActionAuthorization}" + challengeActionAuthorization != null -> + "Action{challengeActionAuthorization=$challengeActionAuthorization}" + resultAuthentication3ds != null -> + "Action{resultAuthentication3ds=$resultAuthentication3ds}" + declineActionTokenization != null -> + "Action{declineActionTokenization=$declineActionTokenization}" + requireTfa != null -> "Action{requireTfa=$requireTfa}" + approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" + returnAction != null -> "Action{returnAction=$returnAction}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") + } + + companion object { + + @JvmStatic + fun ofDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = Action(declineActionAuthorization = declineActionAuthorization) + + @JvmStatic + fun ofChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = Action(challengeActionAuthorization = challengeActionAuthorization) + + @JvmStatic + fun ofResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ) = Action(resultAuthentication3ds = resultAuthentication3ds) + + @JvmStatic + fun ofDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = Action(declineActionTokenization = declineActionTokenization) + + @JvmStatic + fun ofRequireTfa(requireTfa: RequireTfaAction) = Action(requireTfa = requireTfa) + + @JvmStatic + fun ofApproveActionAch(approveActionAch: ApproveActionAch) = + Action(approveActionAch = approveActionAch) + + @JvmStatic + fun ofReturnAction(returnAction: ReturnAction) = Action(returnAction = returnAction) + } + + /** + * An interface that defines how to map each variant of [Action] to a value of type [T]. + */ + interface Visitor { + + fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ): T + + fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ): T + + fun visitResultAuthentication3ds( + resultAuthentication3ds: ResultAuthentication3dsAction + ): T + + fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ): T + + fun visitRequireTfa(requireTfa: RequireTfaAction): T + + fun visitApproveActionAch(approveActionAch: ApproveActionAch): T + + fun visitReturnAction(returnAction: ReturnAction): T + + /** + * Maps an unknown variant of [Action] to a value of type [T]. + * + * An instance of [Action] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(declineActionAuthorization = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { + Action(challengeActionAuthorization = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Action(resultAuthentication3ds = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(declineActionTokenization = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(requireTfa = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(approveActionAch = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(returnAction = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible + // with all the possible variants (e.g. deserializing from boolean). + 0 -> Action(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the + // first completely valid match, or simply the first match if none are + // completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.declineActionAuthorization != null -> + generator.writeObject(value.declineActionAuthorization) + value.challengeActionAuthorization != null -> + generator.writeObject(value.challengeActionAuthorization) + value.resultAuthentication3ds != null -> + generator.writeObject(value.resultAuthentication3ds) + value.declineActionTokenization != null -> + generator.writeObject(value.declineActionTokenization) + value.requireTfa != null -> generator.writeObject(value.requireTfa) + value.approveActionAch != null -> + generator.writeObject(value.approveActionAch) + value.returnAction != null -> generator.writeObject(value.returnAction) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class DeclineActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * The detailed result code explaining the specific reason for the decline + * + * @throws LithicInvalidDataException 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 code(): DetailedResult = code.getRequired("code") + + /** + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 + * [DeclineActionAuthorization]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionAuthorization]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(declineActionAuthorization: DeclineActionAuthorization) = + apply { + code = declineActionAuthorization.code + type = declineActionAuthorization.type + additionalProperties = + declineActionAuthorization.additionalProperties.toMutableMap() + } + + /** The detailed result code explaining the specific reason for the decline */ + fun code(code: DetailedResult) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [DetailedResult] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + 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 [DeclineActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionAuthorization = + DeclineActionAuthorization( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionAuthorization = apply { + if (validated) { + return@apply + } + + code().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** The detailed result code explaining the specific reason for the decline */ + class DetailedResult + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField + val ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_DELINQUENT = of("ACCOUNT_DELINQUENT") + + @JvmField val ACCOUNT_INACTIVE = of("ACCOUNT_INACTIVE") + + @JvmField + val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED") + + @JvmField + val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_PAUSED = of("ACCOUNT_PAUSED") + + @JvmField val ACCOUNT_UNDER_REVIEW = of("ACCOUNT_UNDER_REVIEW") + + @JvmField val ADDRESS_INCORRECT = of("ADDRESS_INCORRECT") + + @JvmField val APPROVED = of("APPROVED") + + @JvmField val AUTH_RULE_ALLOWED_COUNTRY = of("AUTH_RULE_ALLOWED_COUNTRY") + + @JvmField val AUTH_RULE_ALLOWED_MCC = of("AUTH_RULE_ALLOWED_MCC") + + @JvmField val AUTH_RULE_BLOCKED_COUNTRY = of("AUTH_RULE_BLOCKED_COUNTRY") + + @JvmField val AUTH_RULE_BLOCKED_MCC = of("AUTH_RULE_BLOCKED_MCC") + + @JvmField val AUTH_RULE = of("AUTH_RULE") + + @JvmField val CARD_CLOSED = of("CARD_CLOSED") + + @JvmField + val CARD_CRYPTOGRAM_VALIDATION_FAILURE = + of("CARD_CRYPTOGRAM_VALIDATION_FAILURE") + + @JvmField val CARD_EXPIRED = of("CARD_EXPIRED") + + @JvmField val CARD_EXPIRY_DATE_INCORRECT = of("CARD_EXPIRY_DATE_INCORRECT") + + @JvmField val CARD_INVALID = of("CARD_INVALID") + + @JvmField val CARD_NOT_ACTIVATED = of("CARD_NOT_ACTIVATED") + + @JvmField val CARD_PAUSED = of("CARD_PAUSED") + + @JvmField val CARD_PIN_INCORRECT = of("CARD_PIN_INCORRECT") + + @JvmField val CARD_RESTRICTED = of("CARD_RESTRICTED") + + @JvmField + val CARD_SECURITY_CODE_INCORRECT = of("CARD_SECURITY_CODE_INCORRECT") + + @JvmField val CARD_SPEND_LIMIT_EXCEEDED = of("CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val CONTACT_CARD_ISSUER = of("CONTACT_CARD_ISSUER") + + @JvmField val CUSTOMER_ASA_TIMEOUT = of("CUSTOMER_ASA_TIMEOUT") + + @JvmField val CUSTOM_ASA_RESULT = of("CUSTOM_ASA_RESULT") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val DO_NOT_HONOR = of("DO_NOT_HONOR") + + @JvmField val DRIVER_NUMBER_INVALID = of("DRIVER_NUMBER_INVALID") + + @JvmField val FORMAT_ERROR = of("FORMAT_ERROR") + + @JvmField + val INSUFFICIENT_FUNDING_SOURCE_BALANCE = + of("INSUFFICIENT_FUNDING_SOURCE_BALANCE") + + @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmField val LITHIC_SYSTEM_ERROR = of("LITHIC_SYSTEM_ERROR") + + @JvmField val LITHIC_SYSTEM_RATE_LIMIT = of("LITHIC_SYSTEM_RATE_LIMIT") + + @JvmField val MALFORMED_ASA_RESPONSE = of("MALFORMED_ASA_RESPONSE") + + @JvmField val MERCHANT_INVALID = of("MERCHANT_INVALID") + + @JvmField + val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE = + of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE") + + @JvmField val MERCHANT_NOT_PERMITTED = of("MERCHANT_NOT_PERMITTED") + + @JvmField val OVER_REVERSAL_ATTEMPTED = of("OVER_REVERSAL_ATTEMPTED") + + @JvmField val PIN_BLOCKED = of("PIN_BLOCKED") + + @JvmField + val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED = + of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val PROGRAM_SUSPENDED = of("PROGRAM_SUSPENDED") + + @JvmField val PROGRAM_USAGE_RESTRICTION = of("PROGRAM_USAGE_RESTRICTION") + + @JvmField val REVERSAL_UNMATCHED = of("REVERSAL_UNMATCHED") + + @JvmField val SECURITY_VIOLATION = of("SECURITY_VIOLATION") + + @JvmField + val SINGLE_USE_CARD_REATTEMPTED = of("SINGLE_USE_CARD_REATTEMPTED") + + @JvmField val SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val TRANSACTION_INVALID = of("TRANSACTION_INVALID") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL = + of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER = + of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER") + + @JvmField + val TRANSACTION_PREVIOUSLY_COMPLETED = + of("TRANSACTION_PREVIOUSLY_COMPLETED") + + @JvmField val UNAUTHORIZED_MERCHANT = of("UNAUTHORIZED_MERCHANT") + + @JvmField val VEHICLE_NUMBER_INVALID = of("VEHICLE_NUMBER_INVALID") + + @JvmField val CARDHOLDER_CHALLENGED = of("CARDHOLDER_CHALLENGED") + + @JvmField + val CARDHOLDER_CHALLENGE_FAILED = of("CARDHOLDER_CHALLENGE_FAILED") + + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) + } + + /** An enum containing [DetailedResult]'s known values. */ + enum class Known { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + } + + /** + * An enum containing [DetailedResult]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DetailedResult] 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 { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + /** + * An enum member indicating that [DetailedResult] 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) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Value.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT + APPROVED -> Value.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Value.AUTH_RULE + CARD_CLOSED -> Value.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Value.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Value.CARD_INVALID + CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED + CARD_PAUSED -> Value.CARD_PAUSED + CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Value.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> Value.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT + DECLINED -> Value.DECLINED + DO_NOT_HONOR -> Value.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Value.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Value.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Value.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Value.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Value.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + TRANSACTION_PREVIOUSLY_COMPLETED -> + Value.TRANSACTION_PREVIOUSLY_COMPLETED + UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT + VEHICLE_NUMBER_INVALID -> Value.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Value.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Value.CARDHOLDER_CHALLENGE_FAILED + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Known.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT + APPROVED -> Known.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Known.AUTH_RULE + CARD_CLOSED -> Known.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Known.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Known.CARD_INVALID + CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED + CARD_PAUSED -> Known.CARD_PAUSED + CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Known.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> Known.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT + DECLINED -> Known.DECLINED + DO_NOT_HONOR -> Known.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Known.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Known.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Known.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Known.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Known.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + TRANSACTION_PREVIOUSLY_COMPLETED -> + Known.TRANSACTION_PREVIOUSLY_COMPLETED + UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT + VEHICLE_NUMBER_INVALID -> Known.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Known.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Known.CARDHOLDER_CHALLENGE_FAILED + else -> + throw LithicInvalidDataException("Unknown DetailedResult: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): DetailedResult = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 DetailedResult && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + DECLINE, + /** + * An enum member indicating that [Type] 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) { + DECLINE -> Value.DECLINE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 DeclineActionAuthorization && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(code, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionAuthorization{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + + class ChallengeActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 + * [ChallengeActionAuthorization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ChallengeActionAuthorization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(challengeActionAuthorization: ChallengeActionAuthorization) = + apply { + type = challengeActionAuthorization.type + additionalProperties = + challengeActionAuthorization.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + 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 [ChallengeActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ChallengeActionAuthorization = + ChallengeActionAuthorization( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ChallengeActionAuthorization = apply { + if (validated) { + return@apply + } + + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHALLENGE = of("CHALLENGE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CHALLENGE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + CHALLENGE, + /** + * An enum member indicating that [Type] 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) { + CHALLENGE -> Value.CHALLENGE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CHALLENGE -> Known.CHALLENGE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 ChallengeActionAuthorization && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ChallengeActionAuthorization{type=$type, additionalProperties=$additionalProperties}" + } + + class ResultAuthentication3dsAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * @throws LithicInvalidDataException 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 type(): Authentication3dsAction = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") + @ExcludeMissing + fun _type(): JsonField = type + + @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 + * [ResultAuthentication3dsAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ResultAuthentication3dsAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + resultAuthentication3dsAction: ResultAuthentication3dsAction + ) = apply { + type = resultAuthentication3dsAction.type + additionalProperties = + resultAuthentication3dsAction.additionalProperties.toMutableMap() + } + + fun type(type: Authentication3dsAction) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed + * [Authentication3dsAction] value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + 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 [ResultAuthentication3dsAction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ResultAuthentication3dsAction = + ResultAuthentication3dsAction( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ResultAuthentication3dsAction = apply { + if (validated) { + return@apply + } + + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + class Authentication3dsAction + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DECLINE = of("DECLINE") + + @JvmField val CHALLENGE = of("CHALLENGE") + + @JvmStatic + fun of(value: String) = Authentication3dsAction(JsonField.of(value)) + } + + /** An enum containing [Authentication3dsAction]'s known values. */ + enum class Known { + DECLINE, + CHALLENGE, + } + + /** + * An enum containing [Authentication3dsAction]'s known values, as well as an + * [_UNKNOWN] member. + * + * An instance of [Authentication3dsAction] 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 { + DECLINE, + CHALLENGE, + /** + * An enum member indicating that [Authentication3dsAction] 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) { + DECLINE -> Value.DECLINE + CHALLENGE -> Value.CHALLENGE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + CHALLENGE -> Known.CHALLENGE + else -> + throw LithicInvalidDataException( + "Unknown Authentication3dsAction: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Authentication3dsAction = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Authentication3dsAction && 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 ResultAuthentication3dsAction && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ResultAuthentication3dsAction{type=$type, additionalProperties=$additionalProperties}" + } + + class DeclineActionTokenization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Decline the tokenization request + * + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Reason code for declining the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + @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 + * [DeclineActionTokenization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionTokenization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(declineActionTokenization: DeclineActionTokenization) = + apply { + type = declineActionTokenization.type + reason = declineActionTokenization.reason + additionalProperties = + declineActionTokenization.additionalProperties.toMutableMap() + } + + /** Decline the tokenization request */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Reason code for declining the tokenization request */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + 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 [DeclineActionTokenization]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionTokenization = + DeclineActionTokenization( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionTokenization = apply { + if (validated) { + return@apply + } + + type().validate() + reason().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Decline the tokenization request */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + DECLINE, + /** + * An enum member indicating that [Type] 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) { + DECLINE -> Value.DECLINE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason code for declining the tokenization request */ + class Reason + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val ACCOUNT_SCORE_1 = of("ACCOUNT_SCORE_1") + + @JvmField val DEVICE_SCORE_1 = of("DEVICE_SCORE_1") + + @JvmField + val ALL_WALLET_DECLINE_REASONS_PRESENT = + of("ALL_WALLET_DECLINE_REASONS_PRESENT") + + @JvmField + val WALLET_RECOMMENDED_DECISION_RED = of("WALLET_RECOMMENDED_DECISION_RED") + + @JvmField val CVC_MISMATCH = of("CVC_MISMATCH") + + @JvmField val CARD_EXPIRY_MONTH_MISMATCH = of("CARD_EXPIRY_MONTH_MISMATCH") + + @JvmField val CARD_EXPIRY_YEAR_MISMATCH = of("CARD_EXPIRY_YEAR_MISMATCH") + + @JvmField val CARD_INVALID_STATE = of("CARD_INVALID_STATE") + + @JvmField val CUSTOMER_RED_PATH = of("CUSTOMER_RED_PATH") + + @JvmField val INVALID_CUSTOMER_RESPONSE = of("INVALID_CUSTOMER_RESPONSE") + + @JvmField val NETWORK_FAILURE = of("NETWORK_FAILURE") + + @JvmField val GENERIC_DECLINE = of("GENERIC_DECLINE") + + @JvmField val DIGITAL_CARD_ART_REQUIRED = of("DIGITAL_CARD_ART_REQUIRED") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] 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 { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + /** + * An enum member indicating that [Reason] 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) { + ACCOUNT_SCORE_1 -> Value.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Value.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Value.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> Value.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Value.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Value.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Value.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Value.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Value.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Value.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Value.NETWORK_FAILURE + GENERIC_DECLINE -> Value.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Value.DIGITAL_CARD_ART_REQUIRED + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNT_SCORE_1 -> Known.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Known.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Known.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> Known.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Known.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Known.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Known.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Known.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Known.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Known.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Known.NETWORK_FAILURE + GENERIC_DECLINE -> Known.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Known.DIGITAL_CARD_ART_REQUIRED + else -> throw LithicInvalidDataException("Unknown Reason: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Reason && 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 DeclineActionTokenization && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionTokenization{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class RequireTfaAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Require two-factor authentication for the tokenization request + * + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Reason code for requiring two-factor authentication + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + @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 [RequireTfaAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RequireTfaAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(requireTfaAction: RequireTfaAction) = apply { + type = requireTfaAction.type + reason = requireTfaAction.reason + additionalProperties = requireTfaAction.additionalProperties.toMutableMap() + } + + /** Require two-factor authentication for the tokenization request */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Reason code for requiring two-factor authentication */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + 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 [RequireTfaAction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RequireTfaAction = + RequireTfaAction( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RequireTfaAction = apply { + if (validated) { + return@apply + } + + type().validate() + reason().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Require two-factor authentication for the tokenization request */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val REQUIRE_TFA = of("REQUIRE_TFA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + REQUIRE_TFA + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + REQUIRE_TFA, + /** + * An enum member indicating that [Type] 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) { + REQUIRE_TFA -> Value.REQUIRE_TFA + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + REQUIRE_TFA -> Known.REQUIRE_TFA + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason code for requiring two-factor authentication */ + class Reason + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val WALLET_RECOMMENDED_TFA = of("WALLET_RECOMMENDED_TFA") + + @JvmField val SUSPICIOUS_ACTIVITY = of("SUSPICIOUS_ACTIVITY") + + @JvmField val DEVICE_RECENTLY_LOST = of("DEVICE_RECENTLY_LOST") + + @JvmField val TOO_MANY_RECENT_ATTEMPTS = of("TOO_MANY_RECENT_ATTEMPTS") + + @JvmField val TOO_MANY_RECENT_TOKENS = of("TOO_MANY_RECENT_TOKENS") + + @JvmField + val TOO_MANY_DIFFERENT_CARDHOLDERS = of("TOO_MANY_DIFFERENT_CARDHOLDERS") + + @JvmField val OUTSIDE_HOME_TERRITORY = of("OUTSIDE_HOME_TERRITORY") + + @JvmField val HAS_SUSPENDED_TOKENS = of("HAS_SUSPENDED_TOKENS") + + @JvmField val HIGH_RISK = of("HIGH_RISK") + + @JvmField val ACCOUNT_SCORE_LOW = of("ACCOUNT_SCORE_LOW") + + @JvmField val DEVICE_SCORE_LOW = of("DEVICE_SCORE_LOW") + + @JvmField val CARD_STATE_TFA = of("CARD_STATE_TFA") + + @JvmField val HARDCODED_TFA = of("HARDCODED_TFA") + + @JvmField val CUSTOMER_RULE_TFA = of("CUSTOMER_RULE_TFA") + + @JvmField val DEVICE_HOST_CARD_EMULATION = of("DEVICE_HOST_CARD_EMULATION") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] 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 { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + /** + * An enum member indicating that [Reason] 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) { + WALLET_RECOMMENDED_TFA -> Value.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Value.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Value.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Value.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Value.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> Value.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Value.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Value.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Value.HIGH_RISK + ACCOUNT_SCORE_LOW -> Value.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Value.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Value.CARD_STATE_TFA + HARDCODED_TFA -> Value.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Value.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Value.DEVICE_HOST_CARD_EMULATION + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + WALLET_RECOMMENDED_TFA -> Known.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Known.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Known.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Known.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Known.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> Known.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Known.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Known.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Known.HIGH_RISK + ACCOUNT_SCORE_LOW -> Known.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Known.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Known.CARD_STATE_TFA + HARDCODED_TFA -> Known.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Known.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Known.DEVICE_HOST_CARD_EMULATION + else -> throw LithicInvalidDataException("Unknown Reason: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Reason && 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 RequireTfaAction && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(type, reason, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RequireTfaAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class ApproveActionAch + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * Approve the ACH transaction + * + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 [ApproveActionAch]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ApproveActionAch]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(approveActionAch: ApproveActionAch) = apply { + type = approveActionAch.type + additionalProperties = approveActionAch.additionalProperties.toMutableMap() + } + + /** Approve the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + 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 [ApproveActionAch]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ApproveActionAch = + ApproveActionAch( + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ApproveActionAch = apply { + if (validated) { + return@apply + } + + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Approve the ACH transaction */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val APPROVE = of("APPROVE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + APPROVE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + APPROVE, + /** + * An enum member indicating that [Type] 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) { + APPROVE -> Value.APPROVE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + APPROVE -> Known.APPROVE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 ApproveActionAch && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ApproveActionAch{type=$type, additionalProperties=$additionalProperties}" + } + + class ReturnAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * NACHA return code to use when returning the transaction. Note that the list of + * available return codes is subject to an allowlist configured at the program level + * + * @throws LithicInvalidDataException 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 code(): Code = code.getRequired("code") + + /** + * Return the ACH transaction + * + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @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 [ReturnAction]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReturnAction]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(returnAction: ReturnAction) = apply { + code = returnAction.code + type = returnAction.type + additionalProperties = returnAction.additionalProperties.toMutableMap() + } + + /** + * NACHA return code to use when returning the transaction. Note that the list + * of available return codes is subject to an allowlist configured at the + * program level + */ + fun code(code: Code) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Code] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** Return the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + 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 [ReturnAction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReturnAction = + ReturnAction( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReturnAction = apply { + if (validated) { + return@apply + } + + code().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * NACHA return code to use when returning the transaction. Note that the list of + * available return codes is subject to an allowlist configured at the program level + */ + class Code @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val R01 = of("R01") + + @JvmField val R02 = of("R02") + + @JvmField val R03 = of("R03") + + @JvmField val R04 = of("R04") + + @JvmField val R05 = of("R05") + + @JvmField val R06 = of("R06") + + @JvmField val R07 = of("R07") + + @JvmField val R08 = of("R08") + + @JvmField val R09 = of("R09") + + @JvmField val R10 = of("R10") + + @JvmField val R11 = of("R11") + + @JvmField val R12 = of("R12") + + @JvmField val R13 = of("R13") + + @JvmField val R14 = of("R14") + + @JvmField val R15 = of("R15") + + @JvmField val R16 = of("R16") + + @JvmField val R17 = of("R17") + + @JvmField val R18 = of("R18") + + @JvmField val R19 = of("R19") + + @JvmField val R20 = of("R20") + + @JvmField val R21 = of("R21") + + @JvmField val R22 = of("R22") + + @JvmField val R23 = of("R23") + + @JvmField val R24 = of("R24") + + @JvmField val R25 = of("R25") + + @JvmField val R26 = of("R26") + + @JvmField val R27 = of("R27") + + @JvmField val R28 = of("R28") + + @JvmField val R29 = of("R29") + + @JvmField val R30 = of("R30") + + @JvmField val R31 = of("R31") + + @JvmField val R32 = of("R32") + + @JvmField val R33 = of("R33") + + @JvmField val R34 = of("R34") + + @JvmField val R35 = of("R35") + + @JvmField val R36 = of("R36") + + @JvmField val R37 = of("R37") + + @JvmField val R38 = of("R38") + + @JvmField val R39 = of("R39") + + @JvmField val R40 = of("R40") + + @JvmField val R41 = of("R41") + + @JvmField val R42 = of("R42") + + @JvmField val R43 = of("R43") + + @JvmField val R44 = of("R44") + + @JvmField val R45 = of("R45") + + @JvmField val R46 = of("R46") + + @JvmField val R47 = of("R47") + + @JvmField val R50 = of("R50") + + @JvmField val R51 = of("R51") + + @JvmField val R52 = of("R52") + + @JvmField val R53 = of("R53") + + @JvmField val R61 = of("R61") + + @JvmField val R62 = of("R62") + + @JvmField val R67 = of("R67") + + @JvmField val R68 = of("R68") + + @JvmField val R69 = of("R69") + + @JvmField val R70 = of("R70") + + @JvmField val R71 = of("R71") + + @JvmField val R72 = of("R72") + + @JvmField val R73 = of("R73") + + @JvmField val R74 = of("R74") + + @JvmField val R75 = of("R75") + + @JvmField val R76 = of("R76") + + @JvmField val R77 = of("R77") + + @JvmField val R80 = of("R80") + + @JvmField val R81 = of("R81") + + @JvmField val R82 = of("R82") + + @JvmField val R83 = of("R83") + + @JvmField val R84 = of("R84") + + @JvmField val R85 = of("R85") + + @JvmStatic fun of(value: String) = Code(JsonField.of(value)) + } + + /** An enum containing [Code]'s known values. */ + enum class Known { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + } + + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Code] 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 { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + /** + * An enum member indicating that [Code] 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) { + R01 -> Value.R01 + R02 -> Value.R02 + R03 -> Value.R03 + R04 -> Value.R04 + R05 -> Value.R05 + R06 -> Value.R06 + R07 -> Value.R07 + R08 -> Value.R08 + R09 -> Value.R09 + R10 -> Value.R10 + R11 -> Value.R11 + R12 -> Value.R12 + R13 -> Value.R13 + R14 -> Value.R14 + R15 -> Value.R15 + R16 -> Value.R16 + R17 -> Value.R17 + R18 -> Value.R18 + R19 -> Value.R19 + R20 -> Value.R20 + R21 -> Value.R21 + R22 -> Value.R22 + R23 -> Value.R23 + R24 -> Value.R24 + R25 -> Value.R25 + R26 -> Value.R26 + R27 -> Value.R27 + R28 -> Value.R28 + R29 -> Value.R29 + R30 -> Value.R30 + R31 -> Value.R31 + R32 -> Value.R32 + R33 -> Value.R33 + R34 -> Value.R34 + R35 -> Value.R35 + R36 -> Value.R36 + R37 -> Value.R37 + R38 -> Value.R38 + R39 -> Value.R39 + R40 -> Value.R40 + R41 -> Value.R41 + R42 -> Value.R42 + R43 -> Value.R43 + R44 -> Value.R44 + R45 -> Value.R45 + R46 -> Value.R46 + R47 -> Value.R47 + R50 -> Value.R50 + R51 -> Value.R51 + R52 -> Value.R52 + R53 -> Value.R53 + R61 -> Value.R61 + R62 -> Value.R62 + R67 -> Value.R67 + R68 -> Value.R68 + R69 -> Value.R69 + R70 -> Value.R70 + R71 -> Value.R71 + R72 -> Value.R72 + R73 -> Value.R73 + R74 -> Value.R74 + R75 -> Value.R75 + R76 -> Value.R76 + R77 -> Value.R77 + R80 -> Value.R80 + R81 -> Value.R81 + R82 -> Value.R82 + R83 -> Value.R83 + R84 -> Value.R84 + R85 -> Value.R85 + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + R01 -> Known.R01 + R02 -> Known.R02 + R03 -> Known.R03 + R04 -> Known.R04 + R05 -> Known.R05 + R06 -> Known.R06 + R07 -> Known.R07 + R08 -> Known.R08 + R09 -> Known.R09 + R10 -> Known.R10 + R11 -> Known.R11 + R12 -> Known.R12 + R13 -> Known.R13 + R14 -> Known.R14 + R15 -> Known.R15 + R16 -> Known.R16 + R17 -> Known.R17 + R18 -> Known.R18 + R19 -> Known.R19 + R20 -> Known.R20 + R21 -> Known.R21 + R22 -> Known.R22 + R23 -> Known.R23 + R24 -> Known.R24 + R25 -> Known.R25 + R26 -> Known.R26 + R27 -> Known.R27 + R28 -> Known.R28 + R29 -> Known.R29 + R30 -> Known.R30 + R31 -> Known.R31 + R32 -> Known.R32 + R33 -> Known.R33 + R34 -> Known.R34 + R35 -> Known.R35 + R36 -> Known.R36 + R37 -> Known.R37 + R38 -> Known.R38 + R39 -> Known.R39 + R40 -> Known.R40 + R41 -> Known.R41 + R42 -> Known.R42 + R43 -> Known.R43 + R44 -> Known.R44 + R45 -> Known.R45 + R46 -> Known.R46 + R47 -> Known.R47 + R50 -> Known.R50 + R51 -> Known.R51 + R52 -> Known.R52 + R53 -> Known.R53 + R61 -> Known.R61 + R62 -> Known.R62 + R67 -> Known.R67 + R68 -> Known.R68 + R69 -> Known.R69 + R70 -> Known.R70 + R71 -> Known.R71 + R72 -> Known.R72 + R73 -> Known.R73 + R74 -> Known.R74 + R75 -> Known.R75 + R76 -> Known.R76 + R77 -> Known.R77 + R80 -> Known.R80 + R81 -> Known.R81 + R82 -> Known.R82 + R83 -> Known.R83 + R84 -> Known.R84 + R85 -> Known.R85 + else -> throw LithicInvalidDataException("Unknown Code: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Code = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Code && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Return the ACH transaction */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val RETURN = of("RETURN") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + RETURN + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + RETURN, + /** + * An enum member indicating that [Type] 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) { + RETURN -> Value.RETURN + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RETURN -> Known.RETURN + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 ReturnAction && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(code, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReturnAction{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + } + + /** The decision made by the rule for this event. */ + @Deprecated("deprecated") + class Decision @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val APPROVED = of("APPROVED") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val CHALLENGED = of("CHALLENGED") + + @JvmStatic fun of(value: String) = Decision(JsonField.of(value)) + } + + /** An enum containing [Decision]'s known values. */ + enum class Known { + APPROVED, + DECLINED, + CHALLENGED, + } + + /** + * An enum containing [Decision]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Decision] 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 { + APPROVED, + DECLINED, + CHALLENGED, + /** + * An enum member indicating that [Decision] 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) { + APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED + CHALLENGED -> Value.CHALLENGED + 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 LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + DECLINED -> Known.DECLINED + CHALLENGED -> Known.CHALLENGED + else -> throw LithicInvalidDataException("Unknown Decision: $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 LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Decision = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Decision && 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 Example && + actions == other.actions && + approved == other.approved && + decision == other.decision && + eventToken == other.eventToken && + timestamp == other.timestamp && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actions, approved, decision, eventToken, timestamp, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Example{actions=$actions, approved=$approved, decision=$decision, eventToken=$eventToken, timestamp=$timestamp, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReportStats && + actionCounts == other.actionCounts && + approved == other.approved && + challenged == other.challenged && + declined == other.declined && + examples == other.examples && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(actionCounts, approved, challenged, declined, examples, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReportStats{actionCounts=$actionCounts, approved=$approved, challenged=$challenged, declined=$declined, examples=$examples, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResultsResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResultsResponse.kt index b6f7b2a64..e4db2a28f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResultsResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResultsResponse.kt @@ -557,6 +557,20 @@ private constructor( } } + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionAuthorization(declineActionAuthorization)`. + */ + fun addAction(declineActionAuthorization: Action.DeclineActionAuthorization) = + addAction(Action.ofDeclineActionAuthorization(declineActionAuthorization)) + + /** + * Alias for calling [addAction] with + * `Action.ofChallengeActionAuthorization(challengeActionAuthorization)`. + */ + fun addAction(challengeActionAuthorization: Action.ChallengeActionAuthorization) = + addAction(Action.ofChallengeActionAuthorization(challengeActionAuthorization)) + /** The Auth Rule token */ fun authRuleToken(authRuleToken: String) = authRuleToken(JsonField.of(authRuleToken)) @@ -731,162 +745,42 @@ private constructor( (mode.asKnown().getOrNull()?.validity() ?: 0) + (if (ruleVersion.asKnown().isPresent) 1 else 0) + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) class Action - @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val type: JsonField, - private val explanation: JsonField, - private val additionalProperties: MutableMap, + private val declineActionAuthorization: DeclineActionAuthorization? = null, + private val challengeActionAuthorization: ChallengeActionAuthorization? = null, + private val _json: JsonValue? = null, ) { - @JsonCreator - private constructor( - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - ) : this(type, explanation, mutableMapOf()) - - /** - * @throws LithicInvalidDataException 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 type(): AuthorizationAction = type.getRequired("type") - - /** - * Optional explanation for why this action was taken - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun explanation(): Optional = explanation.getOptional("explanation") - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [explanation]. - * - * Unlike [explanation], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("explanation") - @ExcludeMissing - fun _explanation(): JsonField = explanation - - @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 [Action]. - * - * The following fields are required: - * ```java - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Action]. */ - class Builder internal constructor() { - - private var type: JsonField? = null - private var explanation: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(action: Action) = apply { - type = action.type - explanation = action.explanation - additionalProperties = action.additionalProperties.toMutableMap() - } - - fun type(type: AuthorizationAction) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [AuthorizationAction] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } + fun declineActionAuthorization(): Optional = + Optional.ofNullable(declineActionAuthorization) - /** Optional explanation for why this action was taken */ - fun explanation(explanation: String) = explanation(JsonField.of(explanation)) + fun challengeActionAuthorization(): Optional = + Optional.ofNullable(challengeActionAuthorization) - /** - * Sets [Builder.explanation] to an arbitrary JSON value. - * - * You should usually call [Builder.explanation] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun explanation(explanation: JsonField) = apply { - this.explanation = explanation - } + fun isDeclineActionAuthorization(): Boolean = declineActionAuthorization != null - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } + fun isChallengeActionAuthorization(): Boolean = challengeActionAuthorization != null - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } + fun asDeclineActionAuthorization(): DeclineActionAuthorization = + declineActionAuthorization.getOrThrow("declineActionAuthorization") - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } + fun asChallengeActionAuthorization(): ChallengeActionAuthorization = + challengeActionAuthorization.getOrThrow("challengeActionAuthorization") - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } + fun _json(): Optional = Optional.ofNullable(_json) - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) + fun accept(visitor: Visitor): T = + when { + declineActionAuthorization != null -> + visitor.visitDeclineActionAuthorization(declineActionAuthorization) + challengeActionAuthorization != null -> + visitor.visitChallengeActionAuthorization(challengeActionAuthorization) + else -> visitor.unknown(_json) } - /** - * Returns an immutable instance of [Action]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Action = - Action( - checkRequired("type", type), - explanation, - additionalProperties.toMutableMap(), - ) - } - private var validated: Boolean = false fun validate(): Action = apply { @@ -894,8 +788,21 @@ private constructor( return@apply } - type().validate() - explanation() + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) { + declineActionAuthorization.validate() + } + + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) { + challengeActionAuthorization.validate() + } + } + ) validated = true } @@ -915,112 +822,1188 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (type.asKnown().getOrNull()?.validity() ?: 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + accept( + object : Visitor { + override fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = declineActionAuthorization.validity() - class AuthorizationAction - @JsonCreator - private constructor(private val value: JsonField) : Enum { + override fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = challengeActionAuthorization.validity() - /** - * 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 + override fun unknown(json: JsonValue?) = 0 + } + ) - companion object { + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } - @JvmField val DECLINE = of("DECLINE") + return other is Action && + declineActionAuthorization == other.declineActionAuthorization && + challengeActionAuthorization == other.challengeActionAuthorization + } - @JvmField val CHALLENGE = of("CHALLENGE") + override fun hashCode(): Int = + Objects.hash(declineActionAuthorization, challengeActionAuthorization) - @JvmStatic fun of(value: String) = AuthorizationAction(JsonField.of(value)) + override fun toString(): String = + when { + declineActionAuthorization != null -> + "Action{declineActionAuthorization=$declineActionAuthorization}" + challengeActionAuthorization != null -> + "Action{challengeActionAuthorization=$challengeActionAuthorization}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") } - /** An enum containing [AuthorizationAction]'s known values. */ - enum class Known { - DECLINE, - CHALLENGE, - } + companion object { + + @JvmStatic + fun ofDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ) = Action(declineActionAuthorization = declineActionAuthorization) + + @JvmStatic + fun ofChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ) = Action(challengeActionAuthorization = challengeActionAuthorization) + } + + /** + * An interface that defines how to map each variant of [Action] to a value of type [T]. + */ + interface Visitor { + + fun visitDeclineActionAuthorization( + declineActionAuthorization: DeclineActionAuthorization + ): T + + fun visitChallengeActionAuthorization( + challengeActionAuthorization: ChallengeActionAuthorization + ): T /** - * An enum containing [AuthorizationAction]'s known values, as well as an [_UNKNOWN] - * member. + * Maps an unknown variant of [Action] to a value of type [T]. * - * An instance of [AuthorizationAction] 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. + * An instance of [Action] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an + * older version than the API, then the API may respond with new variants that the + * SDK is unaware of. + * + * @throws LithicInvalidDataException in the default implementation. */ - enum class Value { - DECLINE, - CHALLENGE, + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(declineActionAuthorization = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { + Action(challengeActionAuthorization = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible + // with all the possible variants (e.g. deserializing from boolean). + 0 -> Action(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the + // first completely valid match, or simply the first match if none are + // completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.declineActionAuthorization != null -> + generator.writeObject(value.declineActionAuthorization) + value.challengeActionAuthorization != null -> + generator.writeObject(value.challengeActionAuthorization) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class DeclineActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val explanation: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of(), + ) : this(code, type, explanation, mutableMapOf()) + + /** + * The detailed result code explaining the specific reason for the decline + * + * @throws LithicInvalidDataException 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 code(): DetailedResult = code.getRequired("code") + + /** + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Optional explanation for why this action was taken + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun explanation(): Optional = explanation.getOptional("explanation") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [explanation]. + * + * Unlike [explanation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("explanation") + @ExcludeMissing + fun _explanation(): JsonField = explanation + + @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 + * [DeclineActionAuthorization]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineActionAuthorization]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var explanation: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(declineActionAuthorization: DeclineActionAuthorization) = + apply { + code = declineActionAuthorization.code + type = declineActionAuthorization.type + explanation = declineActionAuthorization.explanation + additionalProperties = + declineActionAuthorization.additionalProperties.toMutableMap() + } + + /** The detailed result code explaining the specific reason for the decline */ + fun code(code: DetailedResult) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [DetailedResult] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Optional explanation for why this action was taken */ + fun explanation(explanation: String) = explanation(JsonField.of(explanation)) + + /** + * Sets [Builder.explanation] to an arbitrary JSON value. + * + * You should usually call [Builder.explanation] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun explanation(explanation: JsonField) = apply { + this.explanation = explanation + } + + 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 [DeclineActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DeclineActionAuthorization = + DeclineActionAuthorization( + checkRequired("code", code), + checkRequired("type", type), + explanation, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineActionAuthorization = apply { + if (validated) { + return@apply + } + + code().validate() + type().validate() + explanation() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + + /** The detailed result code explaining the specific reason for the decline */ + class DetailedResult + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField + val ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_DELINQUENT = of("ACCOUNT_DELINQUENT") + + @JvmField val ACCOUNT_INACTIVE = of("ACCOUNT_INACTIVE") + + @JvmField + val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED") + + @JvmField + val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED = + of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED") + + @JvmField val ACCOUNT_PAUSED = of("ACCOUNT_PAUSED") + + @JvmField val ACCOUNT_UNDER_REVIEW = of("ACCOUNT_UNDER_REVIEW") + + @JvmField val ADDRESS_INCORRECT = of("ADDRESS_INCORRECT") + + @JvmField val APPROVED = of("APPROVED") + + @JvmField val AUTH_RULE_ALLOWED_COUNTRY = of("AUTH_RULE_ALLOWED_COUNTRY") + + @JvmField val AUTH_RULE_ALLOWED_MCC = of("AUTH_RULE_ALLOWED_MCC") + + @JvmField val AUTH_RULE_BLOCKED_COUNTRY = of("AUTH_RULE_BLOCKED_COUNTRY") + + @JvmField val AUTH_RULE_BLOCKED_MCC = of("AUTH_RULE_BLOCKED_MCC") + + @JvmField val AUTH_RULE = of("AUTH_RULE") + + @JvmField val CARD_CLOSED = of("CARD_CLOSED") + + @JvmField + val CARD_CRYPTOGRAM_VALIDATION_FAILURE = + of("CARD_CRYPTOGRAM_VALIDATION_FAILURE") + + @JvmField val CARD_EXPIRED = of("CARD_EXPIRED") + + @JvmField val CARD_EXPIRY_DATE_INCORRECT = of("CARD_EXPIRY_DATE_INCORRECT") + + @JvmField val CARD_INVALID = of("CARD_INVALID") + + @JvmField val CARD_NOT_ACTIVATED = of("CARD_NOT_ACTIVATED") + + @JvmField val CARD_PAUSED = of("CARD_PAUSED") + + @JvmField val CARD_PIN_INCORRECT = of("CARD_PIN_INCORRECT") + + @JvmField val CARD_RESTRICTED = of("CARD_RESTRICTED") + + @JvmField + val CARD_SECURITY_CODE_INCORRECT = of("CARD_SECURITY_CODE_INCORRECT") + + @JvmField val CARD_SPEND_LIMIT_EXCEEDED = of("CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val CONTACT_CARD_ISSUER = of("CONTACT_CARD_ISSUER") + + @JvmField val CUSTOMER_ASA_TIMEOUT = of("CUSTOMER_ASA_TIMEOUT") + + @JvmField val CUSTOM_ASA_RESULT = of("CUSTOM_ASA_RESULT") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val DO_NOT_HONOR = of("DO_NOT_HONOR") + + @JvmField val DRIVER_NUMBER_INVALID = of("DRIVER_NUMBER_INVALID") + + @JvmField val FORMAT_ERROR = of("FORMAT_ERROR") + + @JvmField + val INSUFFICIENT_FUNDING_SOURCE_BALANCE = + of("INSUFFICIENT_FUNDING_SOURCE_BALANCE") + + @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmField val LITHIC_SYSTEM_ERROR = of("LITHIC_SYSTEM_ERROR") + + @JvmField val LITHIC_SYSTEM_RATE_LIMIT = of("LITHIC_SYSTEM_RATE_LIMIT") + + @JvmField val MALFORMED_ASA_RESPONSE = of("MALFORMED_ASA_RESPONSE") + + @JvmField val MERCHANT_INVALID = of("MERCHANT_INVALID") + + @JvmField + val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE = + of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE") + + @JvmField val MERCHANT_NOT_PERMITTED = of("MERCHANT_NOT_PERMITTED") + + @JvmField val OVER_REVERSAL_ATTEMPTED = of("OVER_REVERSAL_ATTEMPTED") + + @JvmField val PIN_BLOCKED = of("PIN_BLOCKED") + + @JvmField + val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED = + of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED") + + @JvmField val PROGRAM_SUSPENDED = of("PROGRAM_SUSPENDED") + + @JvmField val PROGRAM_USAGE_RESTRICTION = of("PROGRAM_USAGE_RESTRICTION") + + @JvmField val REVERSAL_UNMATCHED = of("REVERSAL_UNMATCHED") + + @JvmField val SECURITY_VIOLATION = of("SECURITY_VIOLATION") + + @JvmField + val SINGLE_USE_CARD_REATTEMPTED = of("SINGLE_USE_CARD_REATTEMPTED") + + @JvmField val SUSPECTED_FRAUD = of("SUSPECTED_FRAUD") + + @JvmField val TRANSACTION_INVALID = of("TRANSACTION_INVALID") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL = + of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL") + + @JvmField + val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER = + of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER") + + @JvmField + val TRANSACTION_PREVIOUSLY_COMPLETED = + of("TRANSACTION_PREVIOUSLY_COMPLETED") + + @JvmField val UNAUTHORIZED_MERCHANT = of("UNAUTHORIZED_MERCHANT") + + @JvmField val VEHICLE_NUMBER_INVALID = of("VEHICLE_NUMBER_INVALID") + + @JvmField val CARDHOLDER_CHALLENGED = of("CARDHOLDER_CHALLENGED") + + @JvmField + val CARDHOLDER_CHALLENGE_FAILED = of("CARDHOLDER_CHALLENGE_FAILED") + + @JvmStatic fun of(value: String) = DetailedResult(JsonField.of(value)) + } + + /** An enum containing [DetailedResult]'s known values. */ + enum class Known { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + } + + /** + * An enum containing [DetailedResult]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [DetailedResult] 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 { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_DELINQUENT, + ACCOUNT_INACTIVE, + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED, + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED, + ACCOUNT_PAUSED, + ACCOUNT_UNDER_REVIEW, + ADDRESS_INCORRECT, + APPROVED, + AUTH_RULE_ALLOWED_COUNTRY, + AUTH_RULE_ALLOWED_MCC, + AUTH_RULE_BLOCKED_COUNTRY, + AUTH_RULE_BLOCKED_MCC, + AUTH_RULE, + CARD_CLOSED, + CARD_CRYPTOGRAM_VALIDATION_FAILURE, + CARD_EXPIRED, + CARD_EXPIRY_DATE_INCORRECT, + CARD_INVALID, + CARD_NOT_ACTIVATED, + CARD_PAUSED, + CARD_PIN_INCORRECT, + CARD_RESTRICTED, + CARD_SECURITY_CODE_INCORRECT, + CARD_SPEND_LIMIT_EXCEEDED, + CONTACT_CARD_ISSUER, + CUSTOMER_ASA_TIMEOUT, + CUSTOM_ASA_RESULT, + DECLINED, + DO_NOT_HONOR, + DRIVER_NUMBER_INVALID, + FORMAT_ERROR, + INSUFFICIENT_FUNDING_SOURCE_BALANCE, + INSUFFICIENT_FUNDS, + LITHIC_SYSTEM_ERROR, + LITHIC_SYSTEM_RATE_LIMIT, + MALFORMED_ASA_RESPONSE, + MERCHANT_INVALID, + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE, + MERCHANT_NOT_PERMITTED, + OVER_REVERSAL_ATTEMPTED, + PIN_BLOCKED, + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED, + PROGRAM_SUSPENDED, + PROGRAM_USAGE_RESTRICTION, + REVERSAL_UNMATCHED, + SECURITY_VIOLATION, + SINGLE_USE_CARD_REATTEMPTED, + SUSPECTED_FRAUD, + TRANSACTION_INVALID, + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL, + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER, + TRANSACTION_PREVIOUSLY_COMPLETED, + UNAUTHORIZED_MERCHANT, + VEHICLE_NUMBER_INVALID, + CARDHOLDER_CHALLENGED, + CARDHOLDER_CHALLENGE_FAILED, + /** + * An enum member indicating that [DetailedResult] 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) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Value.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT + APPROVED -> Value.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Value.AUTH_RULE + CARD_CLOSED -> Value.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Value.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Value.CARD_INVALID + CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED + CARD_PAUSED -> Value.CARD_PAUSED + CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Value.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> Value.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT + DECLINED -> Value.DECLINED + DO_NOT_HONOR -> Value.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Value.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Value.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Value.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Value.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Value.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Value.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + TRANSACTION_PREVIOUSLY_COMPLETED -> + Value.TRANSACTION_PREVIOUSLY_COMPLETED + UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT + VEHICLE_NUMBER_INVALID -> Value.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Value.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Value.CARDHOLDER_CHALLENGE_FAILED + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED + ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT + ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE + ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED + ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED -> + Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED + ACCOUNT_PAUSED -> Known.ACCOUNT_PAUSED + ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW + ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT + APPROVED -> Known.APPROVED + AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY + AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC + AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY + AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC + AUTH_RULE -> Known.AUTH_RULE + CARD_CLOSED -> Known.CARD_CLOSED + CARD_CRYPTOGRAM_VALIDATION_FAILURE -> + Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE + CARD_EXPIRED -> Known.CARD_EXPIRED + CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT + CARD_INVALID -> Known.CARD_INVALID + CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED + CARD_PAUSED -> Known.CARD_PAUSED + CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT + CARD_RESTRICTED -> Known.CARD_RESTRICTED + CARD_SECURITY_CODE_INCORRECT -> Known.CARD_SECURITY_CODE_INCORRECT + CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED + CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER + CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT + CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT + DECLINED -> Known.DECLINED + DO_NOT_HONOR -> Known.DO_NOT_HONOR + DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID + FORMAT_ERROR -> Known.FORMAT_ERROR + INSUFFICIENT_FUNDING_SOURCE_BALANCE -> + Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR + LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT + MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE + MERCHANT_INVALID -> Known.MERCHANT_INVALID + MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE -> + Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE + MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED + OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED + PIN_BLOCKED -> Known.PIN_BLOCKED + PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> + Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED + PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED + PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION + REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED + SECURITY_VIOLATION -> Known.SECURITY_VIOLATION + SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED + SUSPECTED_FRAUD -> Known.SUSPECTED_FRAUD + TRANSACTION_INVALID -> Known.TRANSACTION_INVALID + TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL -> + Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL + TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER -> + Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER + TRANSACTION_PREVIOUSLY_COMPLETED -> + Known.TRANSACTION_PREVIOUSLY_COMPLETED + UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT + VEHICLE_NUMBER_INVALID -> Known.VEHICLE_NUMBER_INVALID + CARDHOLDER_CHALLENGED -> Known.CARDHOLDER_CHALLENGED + CARDHOLDER_CHALLENGE_FAILED -> Known.CARDHOLDER_CHALLENGE_FAILED + else -> + throw LithicInvalidDataException("Unknown DetailedResult: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): DetailedResult = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 DetailedResult && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + DECLINE, + /** + * An enum member indicating that [Type] 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) { + DECLINE -> Value.DECLINE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 DeclineActionAuthorization && + code == other.code && + type == other.type && + explanation == other.explanation && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, type, explanation, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineActionAuthorization{code=$code, type=$type, explanation=$explanation, additionalProperties=$additionalProperties}" + } + + class ChallengeActionAuthorization + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val explanation: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of(), + ) : this(type, explanation, mutableMapOf()) + + /** + * @throws LithicInvalidDataException 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 type(): Type = type.getRequired("type") + + /** + * Optional explanation for why this action was taken + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun explanation(): Optional = explanation.getOptional("explanation") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [explanation]. + * + * Unlike [explanation], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("explanation") + @ExcludeMissing + fun _explanation(): JsonField = explanation + + @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 + * [ChallengeActionAuthorization]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ChallengeActionAuthorization]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var explanation: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(challengeActionAuthorization: ChallengeActionAuthorization) = + apply { + type = challengeActionAuthorization.type + explanation = challengeActionAuthorization.explanation + additionalProperties = + challengeActionAuthorization.additionalProperties.toMutableMap() + } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Optional explanation for why this action was taken */ + fun explanation(explanation: String) = explanation(JsonField.of(explanation)) + /** - * An enum member indicating that [AuthorizationAction] was instantiated with an - * unknown value. + * Sets [Builder.explanation] to an arbitrary JSON value. + * + * You should usually call [Builder.explanation] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - _UNKNOWN, - } + fun explanation(explanation: JsonField) = apply { + this.explanation = explanation + } - /** - * 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) { - DECLINE -> Value.DECLINE - CHALLENGE -> Value.CHALLENGE - else -> Value._UNKNOWN + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) } - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - DECLINE -> Known.DECLINE - CHALLENGE -> Known.CHALLENGE - else -> - throw LithicInvalidDataException("Unknown AuthorizationAction: $value") + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, 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 LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") + 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 [ChallengeActionAuthorization]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ChallengeActionAuthorization = + ChallengeActionAuthorization( + checkRequired("type", type), + explanation, + additionalProperties.toMutableMap(), + ) + } + private var validated: Boolean = false - fun validate(): AuthorizationAction = apply { + fun validate(): ChallengeActionAuthorization = apply { if (validated) { return@apply } - known() + type().validate() + explanation() validated = true } @@ -1038,40 +2021,158 @@ private constructor( * * Used for best match union deserialization. */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val CHALLENGE = of("CHALLENGE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CHALLENGE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] 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 { + CHALLENGE, + /** + * An enum member indicating that [Type] 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) { + CHALLENGE -> Value.CHALLENGE + 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 LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + CHALLENGE -> Known.CHALLENGE + else -> throw LithicInvalidDataException("Unknown Type: $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 LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 Type && 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 AuthorizationAction && value == other.value + return other is ChallengeActionAuthorization && + type == other.type && + explanation == other.explanation && + additionalProperties == other.additionalProperties } - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true + private val hashCode: Int by lazy { + Objects.hash(type, explanation, additionalProperties) } - return other is Action && - type == other.type && - explanation == other.explanation && - additionalProperties == other.additionalProperties - } + override fun hashCode(): Int = hashCode - private val hashCode: Int by lazy { - Objects.hash(type, explanation, additionalProperties) + override fun toString() = + "ChallengeActionAuthorization{type=$type, explanation=$explanation, additionalProperties=$additionalProperties}" } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Action{type=$type, explanation=$explanation, additionalProperties=$additionalProperties}" } /** The event stream during which the rule was evaluated */ @@ -2737,8 +3838,12 @@ private constructor( } } - /** Alias for calling [addAction] with `Action.ofDecline(decline)`. */ - fun addAction(decline: Action.DeclineAction) = addAction(Action.ofDecline(decline)) + /** + * Alias for calling [addAction] with + * `Action.ofDeclineActionTokenization(declineActionTokenization)`. + */ + fun addAction(declineActionTokenization: Action.DeclineActionTokenization) = + addAction(Action.ofDeclineActionTokenization(declineActionTokenization)) /** Alias for calling [addAction] with `Action.ofRequireTfa(requireTfa)`. */ fun addAction(requireTfa: Action.RequireTfaAction) = @@ -2922,20 +4027,22 @@ private constructor( @JsonSerialize(using = Action.Serializer::class) class Action private constructor( - private val decline: DeclineAction? = null, + private val declineActionTokenization: DeclineActionTokenization? = null, private val requireTfa: RequireTfaAction? = null, private val _json: JsonValue? = null, ) { - fun decline(): Optional = Optional.ofNullable(decline) + fun declineActionTokenization(): Optional = + Optional.ofNullable(declineActionTokenization) fun requireTfa(): Optional = Optional.ofNullable(requireTfa) - fun isDecline(): Boolean = decline != null + fun isDeclineActionTokenization(): Boolean = declineActionTokenization != null fun isRequireTfa(): Boolean = requireTfa != null - fun asDecline(): DeclineAction = decline.getOrThrow("decline") + fun asDeclineActionTokenization(): DeclineActionTokenization = + declineActionTokenization.getOrThrow("declineActionTokenization") fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") @@ -2943,7 +4050,8 @@ private constructor( fun accept(visitor: Visitor): T = when { - decline != null -> visitor.visitDecline(decline) + declineActionTokenization != null -> + visitor.visitDeclineActionTokenization(declineActionTokenization) requireTfa != null -> visitor.visitRequireTfa(requireTfa) else -> visitor.unknown(_json) } @@ -2957,8 +4065,10 @@ private constructor( accept( object : Visitor { - override fun visitDecline(decline: DeclineAction) { - decline.validate() + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) { + declineActionTokenization.validate() } override fun visitRequireTfa(requireTfa: RequireTfaAction) { @@ -2987,7 +4097,9 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitDecline(decline: DeclineAction) = decline.validity() + override fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = declineActionTokenization.validity() override fun visitRequireTfa(requireTfa: RequireTfaAction) = requireTfa.validity() @@ -3001,14 +4113,17 @@ private constructor( return true } - return other is Action && decline == other.decline && requireTfa == other.requireTfa + return other is Action && + declineActionTokenization == other.declineActionTokenization && + requireTfa == other.requireTfa } - override fun hashCode(): Int = Objects.hash(decline, requireTfa) + override fun hashCode(): Int = Objects.hash(declineActionTokenization, requireTfa) override fun toString(): String = when { - decline != null -> "Action{decline=$decline}" + declineActionTokenization != null -> + "Action{declineActionTokenization=$declineActionTokenization}" requireTfa != null -> "Action{requireTfa=$requireTfa}" _json != null -> "Action{_unknown=$_json}" else -> throw IllegalStateException("Invalid Action") @@ -3016,7 +4131,10 @@ private constructor( companion object { - @JvmStatic fun ofDecline(decline: DeclineAction) = Action(decline = decline) + @JvmStatic + fun ofDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ) = Action(declineActionTokenization = declineActionTokenization) @JvmStatic fun ofRequireTfa(requireTfa: RequireTfaAction) = Action(requireTfa = requireTfa) @@ -3027,7 +4145,9 @@ private constructor( */ interface Visitor { - fun visitDecline(decline: DeclineAction): T + fun visitDeclineActionTokenization( + declineActionTokenization: DeclineActionTokenization + ): T fun visitRequireTfa(requireTfa: RequireTfaAction): T @@ -3053,9 +4173,8 @@ private constructor( val bestMatches = sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Action(decline = it, _json = json) - }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Action(declineActionTokenization = it, _json = json) }, tryDeserialize(node, jacksonTypeRef())?.let { Action(requireTfa = it, _json = json) }, @@ -3084,7 +4203,8 @@ private constructor( provider: SerializerProvider, ) { when { - value.decline != null -> generator.writeObject(value.decline) + value.declineActionTokenization != null -> + generator.writeObject(value.declineActionTokenization) value.requireTfa != null -> generator.writeObject(value.requireTfa) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Action") @@ -3092,7 +4212,7 @@ private constructor( } } - class DeclineAction + class DeclineActionTokenization @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -3178,7 +4298,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [DeclineAction]. + * Returns a mutable builder for constructing an instance of + * [DeclineActionTokenization]. * * The following fields are required: * ```java @@ -3188,7 +4309,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [DeclineAction]. */ + /** A builder for [DeclineActionTokenization]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -3197,12 +4318,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(declineAction: DeclineAction) = apply { - type = declineAction.type - explanation = declineAction.explanation - reason = declineAction.reason - additionalProperties = declineAction.additionalProperties.toMutableMap() - } + internal fun from(declineActionTokenization: DeclineActionTokenization) = + apply { + type = declineActionTokenization.type + explanation = declineActionTokenization.explanation + reason = declineActionTokenization.reason + additionalProperties = + declineActionTokenization.additionalProperties.toMutableMap() + } /** Decline the tokenization request */ fun type(type: Type) = type(JsonField.of(type)) @@ -3265,7 +4388,7 @@ private constructor( } /** - * Returns an immutable instance of [DeclineAction]. + * Returns an immutable instance of [DeclineActionTokenization]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3276,8 +4399,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): DeclineAction = - DeclineAction( + fun build(): DeclineActionTokenization = + DeclineActionTokenization( checkRequired("type", type), explanation, reason, @@ -3287,7 +4410,7 @@ private constructor( private var validated: Boolean = false - fun validate(): DeclineAction = apply { + fun validate(): DeclineActionTokenization = apply { if (validated) { return@apply } @@ -3657,7 +4780,7 @@ private constructor( return true } - return other is DeclineAction && + return other is DeclineActionTokenization && type == other.type && explanation == other.explanation && reason == other.reason && @@ -3671,7 +4794,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "DeclineAction{type=$type, explanation=$explanation, reason=$reason, additionalProperties=$additionalProperties}" + "DeclineActionTokenization{type=$type, explanation=$explanation, reason=$reason, additionalProperties=$additionalProperties}" } class RequireTfaAction @@ -4836,8 +5959,9 @@ private constructor( } } - /** Alias for calling [addAction] with `Action.ofApprove(approve)`. */ - fun addAction(approve: Action.ApproveAction) = addAction(Action.ofApprove(approve)) + /** Alias for calling [addAction] with `Action.ofApproveActionAch(approveActionAch)`. */ + fun addAction(approveActionAch: Action.ApproveActionAch) = + addAction(Action.ofApproveActionAch(approveActionAch)) /** Alias for calling [addAction] with `Action.ofReturnAction(returnAction)`. */ fun addAction(returnAction: Action.ReturnAction) = @@ -5021,20 +6145,22 @@ private constructor( @JsonSerialize(using = Action.Serializer::class) class Action private constructor( - private val approve: ApproveAction? = null, + private val approveActionAch: ApproveActionAch? = null, private val returnAction: ReturnAction? = null, private val _json: JsonValue? = null, ) { - fun approve(): Optional = Optional.ofNullable(approve) + fun approveActionAch(): Optional = + Optional.ofNullable(approveActionAch) fun returnAction(): Optional = Optional.ofNullable(returnAction) - fun isApprove(): Boolean = approve != null + fun isApproveActionAch(): Boolean = approveActionAch != null fun isReturnAction(): Boolean = returnAction != null - fun asApprove(): ApproveAction = approve.getOrThrow("approve") + fun asApproveActionAch(): ApproveActionAch = + approveActionAch.getOrThrow("approveActionAch") fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") @@ -5042,7 +6168,7 @@ private constructor( fun accept(visitor: Visitor): T = when { - approve != null -> visitor.visitApprove(approve) + approveActionAch != null -> visitor.visitApproveActionAch(approveActionAch) returnAction != null -> visitor.visitReturnAction(returnAction) else -> visitor.unknown(_json) } @@ -5056,8 +6182,8 @@ private constructor( accept( object : Visitor { - override fun visitApprove(approve: ApproveAction) { - approve.validate() + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) { + approveActionAch.validate() } override fun visitReturnAction(returnAction: ReturnAction) { @@ -5086,7 +6212,8 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitApprove(approve: ApproveAction) = approve.validity() + override fun visitApproveActionAch(approveActionAch: ApproveActionAch) = + approveActionAch.validity() override fun visitReturnAction(returnAction: ReturnAction) = returnAction.validity() @@ -5101,15 +6228,15 @@ private constructor( } return other is Action && - approve == other.approve && + approveActionAch == other.approveActionAch && returnAction == other.returnAction } - override fun hashCode(): Int = Objects.hash(approve, returnAction) + override fun hashCode(): Int = Objects.hash(approveActionAch, returnAction) override fun toString(): String = when { - approve != null -> "Action{approve=$approve}" + approveActionAch != null -> "Action{approveActionAch=$approveActionAch}" returnAction != null -> "Action{returnAction=$returnAction}" _json != null -> "Action{_unknown=$_json}" else -> throw IllegalStateException("Invalid Action") @@ -5117,7 +6244,9 @@ private constructor( companion object { - @JvmStatic fun ofApprove(approve: ApproveAction) = Action(approve = approve) + @JvmStatic + fun ofApproveActionAch(approveActionAch: ApproveActionAch) = + Action(approveActionAch = approveActionAch) @JvmStatic fun ofReturnAction(returnAction: ReturnAction) = Action(returnAction = returnAction) @@ -5128,7 +6257,7 @@ private constructor( */ interface Visitor { - fun visitApprove(approve: ApproveAction): T + fun visitApproveActionAch(approveActionAch: ApproveActionAch): T fun visitReturnAction(returnAction: ReturnAction): T @@ -5154,8 +6283,8 @@ private constructor( val bestMatches = sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Action(approve = it, _json = json) + tryDeserialize(node, jacksonTypeRef())?.let { + Action(approveActionAch = it, _json = json) }, tryDeserialize(node, jacksonTypeRef())?.let { Action(returnAction = it, _json = json) @@ -5185,7 +6314,8 @@ private constructor( provider: SerializerProvider, ) { when { - value.approve != null -> generator.writeObject(value.approve) + value.approveActionAch != null -> + generator.writeObject(value.approveActionAch) value.returnAction != null -> generator.writeObject(value.returnAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Action") @@ -5193,7 +6323,7 @@ private constructor( } } - class ApproveAction + class ApproveActionAch @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -5259,7 +6389,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [ApproveAction]. + * Returns a mutable builder for constructing an instance of [ApproveActionAch]. * * The following fields are required: * ```java @@ -5269,7 +6399,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [ApproveAction]. */ + /** A builder for [ApproveActionAch]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -5277,10 +6407,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(approveAction: ApproveAction) = apply { - type = approveAction.type - explanation = approveAction.explanation - additionalProperties = approveAction.additionalProperties.toMutableMap() + internal fun from(approveActionAch: ApproveActionAch) = apply { + type = approveActionAch.type + explanation = approveActionAch.explanation + additionalProperties = approveActionAch.additionalProperties.toMutableMap() } /** Approve the ACH transaction */ @@ -5332,7 +6462,7 @@ private constructor( } /** - * Returns an immutable instance of [ApproveAction]. + * Returns an immutable instance of [ApproveActionAch]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -5343,8 +6473,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): ApproveAction = - ApproveAction( + fun build(): ApproveActionAch = + ApproveActionAch( checkRequired("type", type), explanation, additionalProperties.toMutableMap(), @@ -5353,7 +6483,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ApproveAction = apply { + fun validate(): ApproveActionAch = apply { if (validated) { return@apply } @@ -5515,7 +6645,7 @@ private constructor( return true } - return other is ApproveAction && + return other is ApproveActionAch && type == other.type && explanation == other.explanation && additionalProperties == other.additionalProperties @@ -5528,7 +6658,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "ApproveAction{type=$type, explanation=$explanation, additionalProperties=$additionalProperties}" + "ApproveActionAch{type=$type, explanation=$explanation, additionalProperties=$additionalProperties}" } class ReturnAction diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt index ea585e7e5..710774785 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveReportResponse.kt @@ -296,9 +296,9 @@ private constructor( class DailyStatistic @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val currentVersionStatistics: JsonField, + private val currentVersionStatistics: JsonField, private val date: JsonField, - private val draftVersionStatistics: JsonField, + private val draftVersionStatistics: JsonField, private val additionalProperties: MutableMap, ) { @@ -306,11 +306,11 @@ private constructor( private constructor( @JsonProperty("current_version_statistics") @ExcludeMissing - currentVersionStatistics: JsonField = JsonMissing.of(), + currentVersionStatistics: JsonField = JsonMissing.of(), @JsonProperty("date") @ExcludeMissing date: JsonField = JsonMissing.of(), @JsonProperty("draft_version_statistics") @ExcludeMissing - draftVersionStatistics: JsonField = JsonMissing.of(), + draftVersionStatistics: JsonField = JsonMissing.of(), ) : this(currentVersionStatistics, date, draftVersionStatistics, mutableMapOf()) /** @@ -319,7 +319,7 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun currentVersionStatistics(): Optional = + fun currentVersionStatistics(): Optional = currentVersionStatistics.getOptional("current_version_statistics") /** @@ -336,7 +336,7 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun draftVersionStatistics(): Optional = + fun draftVersionStatistics(): Optional = draftVersionStatistics.getOptional("draft_version_statistics") /** @@ -347,7 +347,7 @@ private constructor( */ @JsonProperty("current_version_statistics") @ExcludeMissing - fun _currentVersionStatistics(): JsonField = currentVersionStatistics + fun _currentVersionStatistics(): JsonField = currentVersionStatistics /** * Returns the raw JSON value of [date]. @@ -364,7 +364,7 @@ private constructor( */ @JsonProperty("draft_version_statistics") @ExcludeMissing - fun _draftVersionStatistics(): JsonField = draftVersionStatistics + fun _draftVersionStatistics(): JsonField = draftVersionStatistics @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -396,9 +396,9 @@ private constructor( /** A builder for [DailyStatistic]. */ class Builder internal constructor() { - private var currentVersionStatistics: JsonField? = null + private var currentVersionStatistics: JsonField? = null private var date: JsonField? = null - private var draftVersionStatistics: JsonField? = null + private var draftVersionStatistics: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -410,24 +410,24 @@ private constructor( } /** Detailed statistics for the current version of the rule. */ - fun currentVersionStatistics(currentVersionStatistics: RuleStats?) = + fun currentVersionStatistics(currentVersionStatistics: ReportStats?) = currentVersionStatistics(JsonField.ofNullable(currentVersionStatistics)) /** * Alias for calling [Builder.currentVersionStatistics] with * `currentVersionStatistics.orElse(null)`. */ - fun currentVersionStatistics(currentVersionStatistics: Optional) = + fun currentVersionStatistics(currentVersionStatistics: Optional) = currentVersionStatistics(currentVersionStatistics.getOrNull()) /** * Sets [Builder.currentVersionStatistics] to an arbitrary JSON value. * * You should usually call [Builder.currentVersionStatistics] with a well-typed - * [RuleStats] value instead. This method is primarily for setting the field to an + * [ReportStats] value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun currentVersionStatistics(currentVersionStatistics: JsonField) = apply { + fun currentVersionStatistics(currentVersionStatistics: JsonField) = apply { this.currentVersionStatistics = currentVersionStatistics } @@ -444,24 +444,24 @@ private constructor( fun date(date: JsonField) = apply { this.date = date } /** Detailed statistics for the draft version of the rule. */ - fun draftVersionStatistics(draftVersionStatistics: RuleStats?) = + fun draftVersionStatistics(draftVersionStatistics: ReportStats?) = draftVersionStatistics(JsonField.ofNullable(draftVersionStatistics)) /** * Alias for calling [Builder.draftVersionStatistics] with * `draftVersionStatistics.orElse(null)`. */ - fun draftVersionStatistics(draftVersionStatistics: Optional) = + fun draftVersionStatistics(draftVersionStatistics: Optional) = draftVersionStatistics(draftVersionStatistics.getOrNull()) /** * Sets [Builder.draftVersionStatistics] to an arbitrary JSON value. * * You should usually call [Builder.draftVersionStatistics] with a well-typed - * [RuleStats] value instead. This method is primarily for setting the field to an + * [ReportStats] value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun draftVersionStatistics(draftVersionStatistics: JsonField) = apply { + fun draftVersionStatistics(draftVersionStatistics: JsonField) = apply { this.draftVersionStatistics = draftVersionStatistics } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsPageResponseTest.kt index 944710842..c0b2782cc 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsPageResponseTest.kt @@ -18,10 +18,19 @@ internal class AuthRuleV2ListResultsPageResponseTest { V2ListResultsResponse.AuthorizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AuthorizationResult.Action.builder() + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .builder() + .code( + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) .type( V2ListResultsResponse.AuthorizationResult.Action - .AuthorizationAction + .DeclineActionAuthorization + .Type .DECLINE ) .explanation("explanation") @@ -46,10 +55,19 @@ internal class AuthRuleV2ListResultsPageResponseTest { V2ListResultsResponse.AuthorizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AuthorizationResult.Action.builder() + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .builder() + .code( + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) .type( V2ListResultsResponse.AuthorizationResult.Action - .AuthorizationAction + .DeclineActionAuthorization + .Type .DECLINE ) .explanation("explanation") @@ -78,10 +96,19 @@ internal class AuthRuleV2ListResultsPageResponseTest { V2ListResultsResponse.AuthorizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AuthorizationResult.Action.builder() + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .builder() + .code( + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) .type( V2ListResultsResponse.AuthorizationResult.Action - .AuthorizationAction + .DeclineActionAuthorization + .Type .DECLINE ) .explanation("explanation") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParamsTest.kt index 0a1326fad..a0fffcdcf 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListResultsParamsTest.kt @@ -3,6 +3,7 @@ package com.lithic.api.models import com.lithic.api.core.http.QueryParams +import java.time.OffsetDateTime import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -12,6 +13,8 @@ internal class AuthRuleV2ListResultsParamsTest { fun create() { AuthRuleV2ListResultsParams.builder() .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .hasActions(true) @@ -25,6 +28,8 @@ internal class AuthRuleV2ListResultsParamsTest { val params = AuthRuleV2ListResultsParams.builder() .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .hasActions(true) @@ -38,6 +43,8 @@ internal class AuthRuleV2ListResultsParamsTest { .isEqualTo( QueryParams.builder() .put("auth_rule_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("begin", "2019-12-27T18:11:19.117Z") + .put("end", "2019-12-27T18:11:19.117Z") .put("ending_before", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .put("event_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .put("has_actions", "true") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt index 3b2be4c8f..96857e2d3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRulesBacktestReportCreatedWebhookEventTest.kt @@ -18,14 +18,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -34,14 +33,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -70,14 +68,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .isEqualTo( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -86,14 +83,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -127,14 +123,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -143,14 +138,13 @@ internal class AuthRulesBacktestReportCreatedWebhookEventTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt index 0b40a4e77..3c32883a6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestResultsTest.kt @@ -18,14 +18,13 @@ internal class BacktestResultsTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -34,14 +33,13 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -66,14 +64,13 @@ internal class BacktestResultsTest { .isEqualTo( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -82,14 +79,13 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -118,14 +114,13 @@ internal class BacktestResultsTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -134,14 +129,13 @@ internal class BacktestResultsTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestStatsTest.kt similarity index 58% rename from lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt rename to lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestStatsTest.kt index 2ce16cb05..41bcacf6d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleStatsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BacktestStatsTest.kt @@ -9,19 +9,18 @@ import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test -internal class RuleStatsTest { +internal class BacktestStatsTest { @Test fun create() { - val ruleStats = - RuleStats.builder() + val backtestStats = + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -29,33 +28,31 @@ internal class RuleStatsTest { .version(0L) .build() - assertThat(ruleStats.approved()).contains(0L) - assertThat(ruleStats.challenged()).contains(0L) - assertThat(ruleStats.declined()).contains(0L) - assertThat(ruleStats.examples().getOrNull()) + assertThat(backtestStats.approved()).contains(0L) + assertThat(backtestStats.challenged()).contains(0L) + assertThat(backtestStats.declined()).contains(0L) + assertThat(backtestStats.examples().getOrNull()) .containsExactly( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - assertThat(ruleStats.version()).contains(0L) + assertThat(backtestStats.version()).contains(0L) } @Test fun roundtrip() { val jsonMapper = jsonMapper() - val ruleStats = - RuleStats.builder() + val backtestStats = + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -63,12 +60,12 @@ internal class RuleStatsTest { .version(0L) .build() - val roundtrippedRuleStats = + val roundtrippedBacktestStats = jsonMapper.readValue( - jsonMapper.writeValueAsString(ruleStats), - jacksonTypeRef(), + jsonMapper.writeValueAsString(backtestStats), + jacksonTypeRef(), ) - assertThat(roundtrippedRuleStats).isEqualTo(ruleStats) + assertThat(roundtrippedBacktestStats).isEqualTo(backtestStats) } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt index aa1dda148..3b5c58744 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt @@ -14,8 +14,8 @@ internal class ConditionalAchActionParametersTest { val conditionalAchActionParameters = ConditionalAchActionParameters.builder() .action( - ConditionalAchActionParameters.Action.ApproveAction.builder() - .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + ConditionalAchActionParameters.Action.ApproveActionAch.builder() + .type(ConditionalAchActionParameters.Action.ApproveActionAch.Type.APPROVE) .build() ) .addCondition( @@ -29,9 +29,9 @@ internal class ConditionalAchActionParametersTest { assertThat(conditionalAchActionParameters.action()) .isEqualTo( - ConditionalAchActionParameters.Action.ofApprove( - ConditionalAchActionParameters.Action.ApproveAction.builder() - .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + ConditionalAchActionParameters.Action.ofApproveActionAch( + ConditionalAchActionParameters.Action.ApproveActionAch.builder() + .type(ConditionalAchActionParameters.Action.ApproveActionAch.Type.APPROVE) .build() ) ) @@ -51,8 +51,8 @@ internal class ConditionalAchActionParametersTest { val conditionalAchActionParameters = ConditionalAchActionParameters.builder() .action( - ConditionalAchActionParameters.Action.ApproveAction.builder() - .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + ConditionalAchActionParameters.Action.ApproveActionAch.builder() + .type(ConditionalAchActionParameters.Action.ApproveActionAch.Type.APPROVE) .build() ) .addCondition( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt index 115ba4bad..75d2da9ba 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt @@ -14,13 +14,16 @@ internal class ConditionalTokenizationActionParametersTest { val conditionalTokenizationActionParameters = ConditionalTokenizationActionParameters.builder() .action( - ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .builder() .type( - ConditionalTokenizationActionParameters.Action.DeclineAction.Type + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Type .DECLINE ) .reason( - ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Reason .ACCOUNT_SCORE_1 ) .build() @@ -38,14 +41,17 @@ internal class ConditionalTokenizationActionParametersTest { assertThat(conditionalTokenizationActionParameters.action()) .isEqualTo( - ConditionalTokenizationActionParameters.Action.ofDecline( - ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + ConditionalTokenizationActionParameters.Action.ofDeclineActionTokenization( + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .builder() .type( - ConditionalTokenizationActionParameters.Action.DeclineAction.Type + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Type .DECLINE ) .reason( - ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Reason .ACCOUNT_SCORE_1 ) .build() @@ -69,13 +75,16 @@ internal class ConditionalTokenizationActionParametersTest { val conditionalTokenizationActionParameters = ConditionalTokenizationActionParameters.builder() .action( - ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .builder() .type( - ConditionalTokenizationActionParameters.Action.DeclineAction.Type + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Type .DECLINE ) .reason( - ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + ConditionalTokenizationActionParameters.Action.DeclineActionTokenization + .Reason .ACCOUNT_SCORE_1 ) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 85ff561dd..d3cb7652d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -1661,14 +1661,13 @@ internal class ParsedWebhookEventTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1677,14 +1676,13 @@ internal class ParsedWebhookEventTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() @@ -1783,14 +1781,13 @@ internal class ParsedWebhookEventTest { .results( BacktestResults.Results.builder() .currentVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") @@ -1801,14 +1798,13 @@ internal class ParsedWebhookEventTest { .build() ) .draftVersion( - RuleStats.builder() + BacktestStats.builder() .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() - .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + BacktestStats.Example.builder() + .decision(BacktestStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp( OffsetDateTime.parse("2019-12-27T18:11:19.117Z") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportStatsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportStatsTest.kt new file mode 100644 index 000000000..f3ee4f3b7 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportStatsTest.kt @@ -0,0 +1,125 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ReportStatsTest { + + @Test + fun create() { + val reportStats = + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization.builder() + .code( + ReportStats.Example.Action.DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action.DeclineActionAuthorization.Type + .DECLINE + ) + .build() + ) + .approved(true) + .decision(ReportStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .build() + + assertThat(reportStats.actionCounts()) + .contains( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + assertThat(reportStats.approved()).contains(0L) + assertThat(reportStats.challenged()).contains(0L) + assertThat(reportStats.declined()).contains(0L) + assertThat(reportStats.examples().getOrNull()) + .containsExactly( + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization.builder() + .code( + ReportStats.Example.Action.DeclineActionAuthorization.DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action.DeclineActionAuthorization.Type.DECLINE + ) + .build() + ) + .approved(true) + .decision(ReportStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val reportStats = + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .approved(0L) + .challenged(0L) + .declined(0L) + .addExample( + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization.builder() + .code( + ReportStats.Example.Action.DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action.DeclineActionAuthorization.Type + .DECLINE + ) + .build() + ) + .approved(true) + .decision(ReportStats.Example.Decision.APPROVED) + .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .build() + + val roundtrippedReportStats = + jsonMapper.readValue( + jsonMapper.writeValueAsString(reportStats), + jacksonTypeRef(), + ) + + assertThat(roundtrippedReportStats).isEqualTo(reportStats) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResultsResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResultsResponseTest.kt index 251ecab84..88a7d41c2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResultsResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResultsResponseTest.kt @@ -21,9 +21,18 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.AuthorizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AuthorizationResult.Action.builder() + V2ListResultsResponse.AuthorizationResult.Action.DeclineActionAuthorization + .builder() + .code( + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) .type( - V2ListResultsResponse.AuthorizationResult.Action.AuthorizationAction + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .Type .DECLINE ) .explanation("explanation") @@ -53,9 +62,18 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.AuthorizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AuthorizationResult.Action.builder() + V2ListResultsResponse.AuthorizationResult.Action.DeclineActionAuthorization + .builder() + .code( + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) .type( - V2ListResultsResponse.AuthorizationResult.Action.AuthorizationAction + V2ListResultsResponse.AuthorizationResult.Action + .DeclineActionAuthorization + .Type .DECLINE ) .explanation("explanation") @@ -161,14 +179,19 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.TokenizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.builder() + V2ListResultsResponse.TokenizationResult.Action.DeclineActionTokenization + .builder() .type( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.Type + V2ListResultsResponse.TokenizationResult.Action + .DeclineActionTokenization + .Type .DECLINE ) .explanation("explanation") .reason( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.Reason + V2ListResultsResponse.TokenizationResult.Action + .DeclineActionTokenization + .Reason .ACCOUNT_SCORE_1 ) .build() @@ -197,14 +220,19 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.TokenizationResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.builder() + V2ListResultsResponse.TokenizationResult.Action.DeclineActionTokenization + .builder() .type( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.Type + V2ListResultsResponse.TokenizationResult.Action + .DeclineActionTokenization + .Type .DECLINE ) .explanation("explanation") .reason( - V2ListResultsResponse.TokenizationResult.Action.DeclineAction.Reason + V2ListResultsResponse.TokenizationResult.Action + .DeclineActionTokenization + .Reason .ACCOUNT_SCORE_1 ) .build() @@ -233,8 +261,8 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.AchResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AchResult.Action.ApproveAction.builder() - .type(V2ListResultsResponse.AchResult.Action.ApproveAction.Type.APPROVE) + V2ListResultsResponse.AchResult.Action.ApproveActionAch.builder() + .type(V2ListResultsResponse.AchResult.Action.ApproveActionAch.Type.APPROVE) .explanation("explanation") .build() ) @@ -262,8 +290,10 @@ internal class V2ListResultsResponseTest { V2ListResultsResponse.AchResult.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addAction( - V2ListResultsResponse.AchResult.Action.ApproveAction.builder() - .type(V2ListResultsResponse.AchResult.Action.ApproveAction.Type.APPROVE) + V2ListResultsResponse.AchResult.Action.ApproveActionAch.builder() + .type( + V2ListResultsResponse.AchResult.Action.ApproveActionAch.Type.APPROVE + ) .explanation("explanation") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt index 850307335..5638c0679 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveReportResponseTest.kt @@ -3,6 +3,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue import com.lithic.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime @@ -20,36 +21,78 @@ internal class V2RetrieveReportResponseTest { .addDailyStatistic( V2RetrieveReportResponse.DailyStatistic.builder() .currentVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .date(LocalDate.parse("2019-12-27")) .draftVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .build() @@ -64,36 +107,78 @@ internal class V2RetrieveReportResponseTest { .containsExactly( V2RetrieveReportResponse.DailyStatistic.builder() .currentVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .date(LocalDate.parse("2019-12-27")) .draftVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .build() @@ -111,36 +196,78 @@ internal class V2RetrieveReportResponseTest { .addDailyStatistic( V2RetrieveReportResponse.DailyStatistic.builder() .currentVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .date(LocalDate.parse("2019-12-27")) .draftVersionStatistics( - RuleStats.builder() + ReportStats.builder() + .actionCounts( + ReportStats.ActionCounts.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) .approved(0L) .challenged(0L) .declined(0L) .addExample( - RuleStats.Example.builder() + ReportStats.Example.builder() + .addAction( + ReportStats.Example.Action.DeclineActionAuthorization + .builder() + .code( + ReportStats.Example.Action + .DeclineActionAuthorization + .DetailedResult + .APPROVED + ) + .type( + ReportStats.Example.Action + .DeclineActionAuthorization + .Type + .DECLINE + ) + .build() + ) .approved(true) - .decision(RuleStats.Example.Decision.APPROVED) + .decision(ReportStats.Example.Decision.APPROVED) .eventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .timestamp(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) - .version(0L) .build() ) .build() From 9208b918e410d7829e59cba6e43304eb0f3489b3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 19:49:04 +0000 Subject: [PATCH 2/7] feat(api): Remove deprecated beneficial owner entities field --- .stats.yml | 4 +- .../com/lithic/api/models/AccountHolder.kt | 765 ++++++++--------- .../models/AccountHolderEntityCreateParams.kt | 8 +- .../models/AccountHolderEntityDeleteParams.kt | 4 +- ...tHolderSimulateEnrollmentReviewResponse.kt | 64 +- .../api/models/AccountHolderUpdateParams.kt | 774 ++++++++---------- .../api/models/AccountHolderUpdateResponse.kt | 64 +- .../AccountHolderUpdatedWebhookEvent.kt | 82 +- .../main/kotlin/com/lithic/api/models/Kyb.kt | 66 +- .../lithic/api/models/ParsedWebhookEvent.kt | 82 +- .../accountHolders/EntityServiceAsync.kt | 12 +- .../blocking/accountHolders/EntityService.kt | 12 +- .../models/AccountHolderCreateParamsTest.kt | 57 -- .../AccountHolderListPageResponseTest.kt | 60 -- ...derSimulateEnrollmentReviewResponseTest.kt | 60 -- .../lithic/api/models/AccountHolderTest.kt | 61 -- .../models/AccountHolderUpdateParamsTest.kt | 63 -- .../models/AccountHolderUpdateResponseTest.kt | 38 - .../AccountHolderUpdatedWebhookEventTest.kt | 38 - .../kotlin/com/lithic/api/models/KybTest.kt | 59 -- .../api/models/ParsedWebhookEventTest.kt | 38 - .../async/AccountHolderServiceAsyncTest.kt | 41 - .../blocking/AccountHolderServiceTest.kt | 41 - 23 files changed, 731 insertions(+), 1762 deletions(-) diff --git a/.stats.yml b/.stats.yml index 17f87283f..1cea7b96e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 185 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-b29a4bd5ca21348ef426162cbd1fa21070f695572626e4e6faabfa14af38f0b0.yml -openapi_spec_hash: e7c285d6b7006d040ecb50a9d0d2fc17 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-df289940d26615072a7c5c9dd4d32b9bc7a86d977642b377c58abbe7a4cb93d0.yml +openapi_spec_hash: 836bb078df7ac5f8d2dd5081c2e833be config_hash: fb5070d41fcabdedbc084b83964b592a diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolder.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolder.kt index 0bf76e54e..2c2f571fe 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolder.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolder.kt @@ -27,7 +27,6 @@ private constructor( private val token: JsonField, private val created: JsonField, private val accountToken: JsonField, - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessAccountToken: JsonField, private val businessEntity: JsonField, @@ -57,9 +56,6 @@ private constructor( @JsonProperty("account_token") @ExcludeMissing accountToken: JsonField = JsonMissing.of(), - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = @@ -108,7 +104,6 @@ private constructor( token, created, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -153,16 +148,6 @@ private constructor( */ fun accountToken(): Optional = accountToken.getOptional("account_token") - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and indirect * individuals with 25% or more ownership in the company. A maximum of 4 beneficial owners can @@ -359,18 +344,6 @@ private constructor( @ExcludeMissing fun _accountToken(): JsonField = accountToken - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = - beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -551,9 +524,6 @@ private constructor( private var token: JsonField? = null private var created: JsonField? = null private var accountToken: JsonField = JsonMissing.of() - private var beneficialOwnerEntities: - JsonField>? = - null private var beneficialOwnerIndividuals: JsonField>? = null @@ -581,8 +551,6 @@ private constructor( token = accountHolder.token created = accountHolder.created accountToken = accountHolder.accountToken - beneficialOwnerEntities = - accountHolder.beneficialOwnerEntities.map { it.toMutableList() } beneficialOwnerIndividuals = accountHolder.beneficialOwnerIndividuals.map { it.toMutableList() } businessAccountToken = accountHolder.businessAccountToken @@ -641,38 +609,6 @@ private constructor( this.accountToken = accountToken } - /** Deprecated. */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities( - beneficialOwnerEntities: JsonField> - ) = apply { - this.beneficialOwnerEntities = beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [AccountHolderBusinessResponse] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - @Deprecated("deprecated") - fun addBeneficialOwnerEntity(beneficialOwnerEntity: AccountHolderBusinessResponse) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and * indirect individuals with 25% or more ownership in the company. A maximum of 4 beneficial @@ -1040,7 +976,6 @@ private constructor( checkRequired("token", token), checkRequired("created", created), accountToken, - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessAccountToken, businessEntity, @@ -1072,7 +1007,6 @@ private constructor( token() created() accountToken() - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessAccountToken() businessEntity().ifPresent { it.validate() } @@ -1111,7 +1045,6 @@ private constructor( (if (token.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + (if (accountToken.asKnown().isPresent) 1 else 0) + - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (businessAccountToken.asKnown().isPresent) 1 else 0) + @@ -1131,54 +1064,44 @@ private constructor( (verificationApplication.asKnown().getOrNull()?.validity() ?: 0) + (if (websiteUrl.asKnown().isPresent) 1 else 0) - class AccountHolderBusinessResponse + /** + * Information about an individual associated with an account holder. A subset of the + * information provided via KYC. For example, we do not return the government id. + */ + class AccountHolderIndividualResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val address: JsonField
, - private val dbaBusinessName: JsonField, + private val dob: JsonField, + private val email: JsonField, private val entityToken: JsonField, - private val governmentId: JsonField, - private val legalBusinessName: JsonField, - private val phoneNumbers: JsonField>, - private val parentCompany: JsonField, + private val firstName: JsonField, + private val lastName: JsonField, + private val phoneNumber: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), - @JsonProperty("dba_business_name") - @ExcludeMissing - dbaBusinessName: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), @JsonProperty("entity_token") @ExcludeMissing entityToken: JsonField = JsonMissing.of(), - @JsonProperty("government_id") - @ExcludeMissing - governmentId: JsonField = JsonMissing.of(), - @JsonProperty("legal_business_name") + @JsonProperty("first_name") @ExcludeMissing - legalBusinessName: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") + firstName: JsonField = JsonMissing.of(), + @JsonProperty("last_name") @ExcludeMissing - phoneNumbers: JsonField> = JsonMissing.of(), - @JsonProperty("parent_company") + lastName: JsonField = JsonMissing.of(), + @JsonProperty("phone_number") @ExcludeMissing - parentCompany: JsonField = JsonMissing.of(), - ) : this( - address, - dbaBusinessName, - entityToken, - governmentId, - legalBusinessName, - phoneNumbers, - parentCompany, - mutableMapOf(), - ) + phoneNumber: JsonField = JsonMissing.of(), + ) : this(address, dob, email, entityToken, firstName, lastName, phoneNumber, mutableMapOf()) /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not acceptable; - * APO/FPO are acceptable. + * Individual's current address * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1186,54 +1109,52 @@ private constructor( fun address(): Address = address.getRequired("address") /** - * Any name that the business operates under that is not its legal business name (if - * applicable). + * Individual's date of birth, as an RFC 3339 date. * * @throws LithicInvalidDataException 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 dbaBusinessName(): String = dbaBusinessName.getRequired("dba_business_name") + fun dob(): String = dob.getRequired("dob") /** - * Globally unique identifier for the entity. + * Individual's email address. * * @throws LithicInvalidDataException 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 entityToken(): String = entityToken.getRequired("entity_token") + fun email(): String = email.getRequired("email") /** - * Government-issued identification number. US Federal Employer Identification Numbers (EIN) - * are currently supported, entered as full nine-digits, with or without hyphens. + * Globally unique identifier for the entity. * * @throws LithicInvalidDataException 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 governmentId(): String = governmentId.getRequired("government_id") + fun entityToken(): String = entityToken.getRequired("entity_token") /** - * Legal (formal) business name. + * Individual's first name, as it appears on government-issued identity documents. * * @throws LithicInvalidDataException 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 legalBusinessName(): String = legalBusinessName.getRequired("legal_business_name") + fun firstName(): String = firstName.getRequired("first_name") /** - * One or more of the business's phone number(s), entered as a list in E.164 format. + * Individual's last name, as it appears on government-issued identity documents. * * @throws LithicInvalidDataException 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 phoneNumbers(): List = phoneNumbers.getRequired("phone_numbers") + fun lastName(): String = lastName.getRequired("last_name") /** - * Parent company name (if applicable). + * Individual's phone number, entered in E.164 format. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException 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 parentCompany(): Optional = parentCompany.getOptional("parent_company") + fun phoneNumber(): String = phoneNumber.getRequired("phone_number") /** * Returns the raw JSON value of [address]. @@ -1243,63 +1164,50 @@ private constructor( @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address /** - * Returns the raw JSON value of [dbaBusinessName]. + * Returns the raw JSON value of [dob]. * - * Unlike [dbaBusinessName], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("dba_business_name") - @ExcludeMissing - fun _dbaBusinessName(): JsonField = dbaBusinessName + @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob /** - * Returns the raw JSON value of [entityToken]. + * Returns the raw JSON value of [email]. * - * Unlike [entityToken], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("entity_token") - @ExcludeMissing - fun _entityToken(): JsonField = entityToken + @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email /** - * Returns the raw JSON value of [governmentId]. + * Returns the raw JSON value of [entityToken]. * - * Unlike [governmentId], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [entityToken], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("government_id") + @JsonProperty("entity_token") @ExcludeMissing - fun _governmentId(): JsonField = governmentId + fun _entityToken(): JsonField = entityToken /** - * Returns the raw JSON value of [legalBusinessName]. + * Returns the raw JSON value of [firstName]. * - * Unlike [legalBusinessName], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("legal_business_name") - @ExcludeMissing - fun _legalBusinessName(): JsonField = legalBusinessName + @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName /** - * Returns the raw JSON value of [phoneNumbers]. + * Returns the raw JSON value of [lastName]. * - * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("phone_numbers") - @ExcludeMissing - fun _phoneNumbers(): JsonField> = phoneNumbers + @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName /** - * Returns the raw JSON value of [parentCompany]. + * Returns the raw JSON value of [phoneNumber]. * - * Unlike [parentCompany], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("parent_company") + @JsonProperty("phone_number") @ExcludeMissing - fun _parentCompany(): JsonField = parentCompany + fun _phoneNumber(): JsonField = phoneNumber @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -1317,52 +1225,49 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [AccountHolderBusinessResponse]. + * [AccountHolderIndividualResponse]. * * The following fields are required: * ```java * .address() - * .dbaBusinessName() + * .dob() + * .email() * .entityToken() - * .governmentId() - * .legalBusinessName() - * .phoneNumbers() + * .firstName() + * .lastName() + * .phoneNumber() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [AccountHolderBusinessResponse]. */ + /** A builder for [AccountHolderIndividualResponse]. */ class Builder internal constructor() { private var address: JsonField
? = null - private var dbaBusinessName: JsonField? = null + private var dob: JsonField? = null + private var email: JsonField? = null private var entityToken: JsonField? = null - private var governmentId: JsonField? = null - private var legalBusinessName: JsonField? = null - private var phoneNumbers: JsonField>? = null - private var parentCompany: JsonField = JsonMissing.of() + private var firstName: JsonField? = null + private var lastName: JsonField? = null + private var phoneNumber: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(accountHolderBusinessResponse: AccountHolderBusinessResponse) = + internal fun from(accountHolderIndividualResponse: AccountHolderIndividualResponse) = apply { - address = accountHolderBusinessResponse.address - dbaBusinessName = accountHolderBusinessResponse.dbaBusinessName - entityToken = accountHolderBusinessResponse.entityToken - governmentId = accountHolderBusinessResponse.governmentId - legalBusinessName = accountHolderBusinessResponse.legalBusinessName - phoneNumbers = - accountHolderBusinessResponse.phoneNumbers.map { it.toMutableList() } - parentCompany = accountHolderBusinessResponse.parentCompany + address = accountHolderIndividualResponse.address + dob = accountHolderIndividualResponse.dob + email = accountHolderIndividualResponse.email + entityToken = accountHolderIndividualResponse.entityToken + firstName = accountHolderIndividualResponse.firstName + lastName = accountHolderIndividualResponse.lastName + phoneNumber = accountHolderIndividualResponse.phoneNumber additionalProperties = - accountHolderBusinessResponse.additionalProperties.toMutableMap() + accountHolderIndividualResponse.additionalProperties.toMutableMap() } - /** - * Business's physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. - */ + /** Individual's current address */ fun address(address: Address) = address(JsonField.of(address)) /** @@ -1374,23 +1279,29 @@ private constructor( */ fun address(address: JsonField
) = apply { this.address = address } + /** Individual's date of birth, as an RFC 3339 date. */ + fun dob(dob: String) = dob(JsonField.of(dob)) + /** - * Any name that the business operates under that is not its legal business name (if - * applicable). + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun dbaBusinessName(dbaBusinessName: String) = - dbaBusinessName(JsonField.of(dbaBusinessName)) + fun dob(dob: JsonField) = apply { this.dob = dob } + + /** Individual's email address. */ + fun email(email: String) = email(JsonField.of(email)) /** - * Sets [Builder.dbaBusinessName] to an arbitrary JSON value. + * Sets [Builder.email] to an arbitrary JSON value. * - * You should usually call [Builder.dbaBusinessName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.email] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun dbaBusinessName(dbaBusinessName: JsonField) = apply { - this.dbaBusinessName = dbaBusinessName - } + fun email(email: JsonField) = apply { this.email = email } /** Globally unique identifier for the entity. */ fun entityToken(entityToken: String) = entityToken(JsonField.of(entityToken)) @@ -1406,76 +1317,42 @@ private constructor( this.entityToken = entityToken } - /** - * Government-issued identification number. US Federal Employer Identification Numbers - * (EIN) are currently supported, entered as full nine-digits, with or without hyphens. - */ - fun governmentId(governmentId: String) = governmentId(JsonField.of(governmentId)) + /** Individual's first name, as it appears on government-issued identity documents. */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) /** - * Sets [Builder.governmentId] to an arbitrary JSON value. + * Sets [Builder.firstName] to an arbitrary JSON value. * - * You should usually call [Builder.governmentId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.firstName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun governmentId(governmentId: JsonField) = apply { - this.governmentId = governmentId - } + fun firstName(firstName: JsonField) = apply { this.firstName = firstName } - /** Legal (formal) business name. */ - fun legalBusinessName(legalBusinessName: String) = - legalBusinessName(JsonField.of(legalBusinessName)) + /** Individual's last name, as it appears on government-issued identity documents. */ + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) /** - * Sets [Builder.legalBusinessName] to an arbitrary JSON value. - * - * You should usually call [Builder.legalBusinessName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun legalBusinessName(legalBusinessName: JsonField) = apply { - this.legalBusinessName = legalBusinessName - } - - /** One or more of the business's phone number(s), entered as a list in E.164 format. */ - fun phoneNumbers(phoneNumbers: List) = phoneNumbers(JsonField.of(phoneNumbers)) - - /** - * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * Sets [Builder.lastName] to an arbitrary JSON value. * - * You should usually call [Builder.phoneNumbers] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.lastName] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun phoneNumbers(phoneNumbers: JsonField>) = apply { - this.phoneNumbers = phoneNumbers.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [phoneNumbers]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addPhoneNumber(phoneNumber: String) = apply { - phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("phoneNumbers", it).add(phoneNumber) - } - } + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - /** Parent company name (if applicable). */ - fun parentCompany(parentCompany: String) = parentCompany(JsonField.of(parentCompany)) + /** Individual's phone number, entered in E.164 format. */ + fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) /** - * Sets [Builder.parentCompany] to an arbitrary JSON value. + * Sets [Builder.phoneNumber] to an arbitrary JSON value. * - * You should usually call [Builder.parentCompany] with a well-typed [String] value + * You should usually call [Builder.phoneNumber] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun parentCompany(parentCompany: JsonField) = apply { - this.parentCompany = parentCompany + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber } fun additionalProperties(additionalProperties: Map) = apply { @@ -1498,49 +1375,50 @@ private constructor( } /** - * Returns an immutable instance of [AccountHolderBusinessResponse]. + * Returns an immutable instance of [AccountHolderIndividualResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .address() - * .dbaBusinessName() + * .dob() + * .email() * .entityToken() - * .governmentId() - * .legalBusinessName() - * .phoneNumbers() + * .firstName() + * .lastName() + * .phoneNumber() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): AccountHolderBusinessResponse = - AccountHolderBusinessResponse( + fun build(): AccountHolderIndividualResponse = + AccountHolderIndividualResponse( checkRequired("address", address), - checkRequired("dbaBusinessName", dbaBusinessName), + checkRequired("dob", dob), + checkRequired("email", email), checkRequired("entityToken", entityToken), - checkRequired("governmentId", governmentId), - checkRequired("legalBusinessName", legalBusinessName), - checkRequired("phoneNumbers", phoneNumbers).map { it.toImmutable() }, - parentCompany, + checkRequired("firstName", firstName), + checkRequired("lastName", lastName), + checkRequired("phoneNumber", phoneNumber), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): AccountHolderBusinessResponse = apply { + fun validate(): AccountHolderIndividualResponse = apply { if (validated) { return@apply } address().validate() - dbaBusinessName() + dob() + email() entityToken() - governmentId() - legalBusinessName() - phoneNumbers() - parentCompany() + firstName() + lastName() + phoneNumber() validated = true } @@ -1561,38 +1439,38 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (address.asKnown().getOrNull()?.validity() ?: 0) + - (if (dbaBusinessName.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (if (email.asKnown().isPresent) 1 else 0) + (if (entityToken.asKnown().isPresent) 1 else 0) + - (if (governmentId.asKnown().isPresent) 1 else 0) + - (if (legalBusinessName.asKnown().isPresent) 1 else 0) + - (phoneNumbers.asKnown().getOrNull()?.size ?: 0) + - (if (parentCompany.asKnown().isPresent) 1 else 0) + (if (firstName.asKnown().isPresent) 1 else 0) + + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (phoneNumber.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is AccountHolderBusinessResponse && + return other is AccountHolderIndividualResponse && address == other.address && - dbaBusinessName == other.dbaBusinessName && + dob == other.dob && + email == other.email && entityToken == other.entityToken && - governmentId == other.governmentId && - legalBusinessName == other.legalBusinessName && - phoneNumbers == other.phoneNumbers && - parentCompany == other.parentCompany && + firstName == other.firstName && + lastName == other.lastName && + phoneNumber == other.phoneNumber && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( address, - dbaBusinessName, + dob, + email, entityToken, - governmentId, - legalBusinessName, - phoneNumbers, - parentCompany, + firstName, + lastName, + phoneNumber, additionalProperties, ) } @@ -1600,47 +1478,61 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccountHolderBusinessResponse{address=$address, dbaBusinessName=$dbaBusinessName, entityToken=$entityToken, governmentId=$governmentId, legalBusinessName=$legalBusinessName, phoneNumbers=$phoneNumbers, parentCompany=$parentCompany, additionalProperties=$additionalProperties}" + "AccountHolderIndividualResponse{address=$address, dob=$dob, email=$email, entityToken=$entityToken, firstName=$firstName, lastName=$lastName, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" } /** - * Information about an individual associated with an account holder. A subset of the - * information provided via KYC. For example, we do not return the government id. + * Only present when user_type == "BUSINESS". Information about the business for which the + * account is being opened and KYB is being run. */ - class AccountHolderIndividualResponse + class AccountHolderBusinessResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val address: JsonField
, - private val dob: JsonField, - private val email: JsonField, + private val dbaBusinessName: JsonField, private val entityToken: JsonField, - private val firstName: JsonField, - private val lastName: JsonField, - private val phoneNumber: JsonField, + private val governmentId: JsonField, + private val legalBusinessName: JsonField, + private val phoneNumbers: JsonField>, + private val parentCompany: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("address") @ExcludeMissing address: JsonField
= JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), - @JsonProperty("email") @ExcludeMissing email: JsonField = JsonMissing.of(), + @JsonProperty("dba_business_name") + @ExcludeMissing + dbaBusinessName: JsonField = JsonMissing.of(), @JsonProperty("entity_token") @ExcludeMissing entityToken: JsonField = JsonMissing.of(), - @JsonProperty("first_name") + @JsonProperty("government_id") @ExcludeMissing - firstName: JsonField = JsonMissing.of(), - @JsonProperty("last_name") + governmentId: JsonField = JsonMissing.of(), + @JsonProperty("legal_business_name") @ExcludeMissing - lastName: JsonField = JsonMissing.of(), - @JsonProperty("phone_number") + legalBusinessName: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") @ExcludeMissing - phoneNumber: JsonField = JsonMissing.of(), - ) : this(address, dob, email, entityToken, firstName, lastName, phoneNumber, mutableMapOf()) + phoneNumbers: JsonField> = JsonMissing.of(), + @JsonProperty("parent_company") + @ExcludeMissing + parentCompany: JsonField = JsonMissing.of(), + ) : this( + address, + dbaBusinessName, + entityToken, + governmentId, + legalBusinessName, + phoneNumbers, + parentCompany, + mutableMapOf(), + ) /** - * Individual's current address + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not acceptable; + * APO/FPO are acceptable. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -1648,52 +1540,54 @@ private constructor( fun address(): Address = address.getRequired("address") /** - * Individual's date of birth, as an RFC 3339 date. + * Any name that the business operates under that is not its legal business name (if + * applicable). * * @throws LithicInvalidDataException 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 dob(): String = dob.getRequired("dob") + fun dbaBusinessName(): String = dbaBusinessName.getRequired("dba_business_name") /** - * Individual's email address. + * Globally unique identifier for the entity. * * @throws LithicInvalidDataException 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 email(): String = email.getRequired("email") + fun entityToken(): String = entityToken.getRequired("entity_token") /** - * Globally unique identifier for the entity. + * Government-issued identification number. US Federal Employer Identification Numbers (EIN) + * are currently supported, entered as full nine-digits, with or without hyphens. * * @throws LithicInvalidDataException 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 entityToken(): String = entityToken.getRequired("entity_token") + fun governmentId(): String = governmentId.getRequired("government_id") /** - * Individual's first name, as it appears on government-issued identity documents. + * Legal (formal) business name. * * @throws LithicInvalidDataException 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 firstName(): String = firstName.getRequired("first_name") + fun legalBusinessName(): String = legalBusinessName.getRequired("legal_business_name") /** - * Individual's last name, as it appears on government-issued identity documents. + * One or more of the business's phone number(s), entered as a list in E.164 format. * * @throws LithicInvalidDataException 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 lastName(): String = lastName.getRequired("last_name") + fun phoneNumbers(): List = phoneNumbers.getRequired("phone_numbers") /** - * Individual's phone number, entered in E.164 format. + * Parent company name (if applicable). * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun phoneNumber(): String = phoneNumber.getRequired("phone_number") + fun parentCompany(): Optional = parentCompany.getOptional("parent_company") /** * Returns the raw JSON value of [address]. @@ -1703,18 +1597,14 @@ private constructor( @JsonProperty("address") @ExcludeMissing fun _address(): JsonField
= address /** - * Returns the raw JSON value of [dob]. - * - * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob - - /** - * Returns the raw JSON value of [email]. + * Returns the raw JSON value of [dbaBusinessName]. * - * Unlike [email], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [dbaBusinessName], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email + @JsonProperty("dba_business_name") + @ExcludeMissing + fun _dbaBusinessName(): JsonField = dbaBusinessName /** * Returns the raw JSON value of [entityToken]. @@ -1726,27 +1616,44 @@ private constructor( fun _entityToken(): JsonField = entityToken /** - * Returns the raw JSON value of [firstName]. + * Returns the raw JSON value of [governmentId]. * - * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [governmentId], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("first_name") @ExcludeMissing fun _firstName(): JsonField = firstName + @JsonProperty("government_id") + @ExcludeMissing + fun _governmentId(): JsonField = governmentId /** - * Returns the raw JSON value of [lastName]. + * Returns the raw JSON value of [legalBusinessName]. * - * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [legalBusinessName], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("last_name") @ExcludeMissing fun _lastName(): JsonField = lastName + @JsonProperty("legal_business_name") + @ExcludeMissing + fun _legalBusinessName(): JsonField = legalBusinessName /** - * Returns the raw JSON value of [phoneNumber]. + * Returns the raw JSON value of [phoneNumbers]. * - * Unlike [phoneNumber], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("phone_number") + @JsonProperty("phone_numbers") @ExcludeMissing - fun _phoneNumber(): JsonField = phoneNumber + fun _phoneNumbers(): JsonField> = phoneNumbers + + /** + * Returns the raw JSON value of [parentCompany]. + * + * Unlike [parentCompany], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("parent_company") + @ExcludeMissing + fun _parentCompany(): JsonField = parentCompany @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -1764,49 +1671,52 @@ private constructor( /** * Returns a mutable builder for constructing an instance of - * [AccountHolderIndividualResponse]. + * [AccountHolderBusinessResponse]. * * The following fields are required: * ```java * .address() - * .dob() - * .email() + * .dbaBusinessName() * .entityToken() - * .firstName() - * .lastName() - * .phoneNumber() + * .governmentId() + * .legalBusinessName() + * .phoneNumbers() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [AccountHolderIndividualResponse]. */ + /** A builder for [AccountHolderBusinessResponse]. */ class Builder internal constructor() { private var address: JsonField
? = null - private var dob: JsonField? = null - private var email: JsonField? = null + private var dbaBusinessName: JsonField? = null private var entityToken: JsonField? = null - private var firstName: JsonField? = null - private var lastName: JsonField? = null - private var phoneNumber: JsonField? = null + private var governmentId: JsonField? = null + private var legalBusinessName: JsonField? = null + private var phoneNumbers: JsonField>? = null + private var parentCompany: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(accountHolderIndividualResponse: AccountHolderIndividualResponse) = + internal fun from(accountHolderBusinessResponse: AccountHolderBusinessResponse) = apply { - address = accountHolderIndividualResponse.address - dob = accountHolderIndividualResponse.dob - email = accountHolderIndividualResponse.email - entityToken = accountHolderIndividualResponse.entityToken - firstName = accountHolderIndividualResponse.firstName - lastName = accountHolderIndividualResponse.lastName - phoneNumber = accountHolderIndividualResponse.phoneNumber + address = accountHolderBusinessResponse.address + dbaBusinessName = accountHolderBusinessResponse.dbaBusinessName + entityToken = accountHolderBusinessResponse.entityToken + governmentId = accountHolderBusinessResponse.governmentId + legalBusinessName = accountHolderBusinessResponse.legalBusinessName + phoneNumbers = + accountHolderBusinessResponse.phoneNumbers.map { it.toMutableList() } + parentCompany = accountHolderBusinessResponse.parentCompany additionalProperties = - accountHolderIndividualResponse.additionalProperties.toMutableMap() + accountHolderBusinessResponse.additionalProperties.toMutableMap() } - /** Individual's current address */ + /** + * Business's physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. + */ fun address(address: Address) = address(JsonField.of(address)) /** @@ -1818,29 +1728,23 @@ private constructor( */ fun address(address: JsonField
) = apply { this.address = address } - /** Individual's date of birth, as an RFC 3339 date. */ - fun dob(dob: String) = dob(JsonField.of(dob)) - /** - * Sets [Builder.dob] to an arbitrary JSON value. - * - * You should usually call [Builder.dob] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. + * Any name that the business operates under that is not its legal business name (if + * applicable). */ - fun dob(dob: JsonField) = apply { this.dob = dob } - - /** Individual's email address. */ - fun email(email: String) = email(JsonField.of(email)) + fun dbaBusinessName(dbaBusinessName: String) = + dbaBusinessName(JsonField.of(dbaBusinessName)) /** - * Sets [Builder.email] to an arbitrary JSON value. + * Sets [Builder.dbaBusinessName] to an arbitrary JSON value. * - * You should usually call [Builder.email] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.dbaBusinessName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun email(email: JsonField) = apply { this.email = email } + fun dbaBusinessName(dbaBusinessName: JsonField) = apply { + this.dbaBusinessName = dbaBusinessName + } /** Globally unique identifier for the entity. */ fun entityToken(entityToken: String) = entityToken(JsonField.of(entityToken)) @@ -1856,42 +1760,76 @@ private constructor( this.entityToken = entityToken } - /** Individual's first name, as it appears on government-issued identity documents. */ - fun firstName(firstName: String) = firstName(JsonField.of(firstName)) + /** + * Government-issued identification number. US Federal Employer Identification Numbers + * (EIN) are currently supported, entered as full nine-digits, with or without hyphens. + */ + fun governmentId(governmentId: String) = governmentId(JsonField.of(governmentId)) /** - * Sets [Builder.firstName] to an arbitrary JSON value. + * Sets [Builder.governmentId] to an arbitrary JSON value. * - * You should usually call [Builder.firstName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.governmentId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun firstName(firstName: JsonField) = apply { this.firstName = firstName } + fun governmentId(governmentId: JsonField) = apply { + this.governmentId = governmentId + } - /** Individual's last name, as it appears on government-issued identity documents. */ - fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + /** Legal (formal) business name. */ + fun legalBusinessName(legalBusinessName: String) = + legalBusinessName(JsonField.of(legalBusinessName)) /** - * Sets [Builder.lastName] to an arbitrary JSON value. + * Sets [Builder.legalBusinessName] to an arbitrary JSON value. * - * You should usually call [Builder.lastName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet + * You should usually call [Builder.legalBusinessName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + fun legalBusinessName(legalBusinessName: JsonField) = apply { + this.legalBusinessName = legalBusinessName + } - /** Individual's phone number, entered in E.164 format. */ - fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) + /** One or more of the business's phone number(s), entered as a list in E.164 format. */ + fun phoneNumbers(phoneNumbers: List) = phoneNumbers(JsonField.of(phoneNumbers)) /** - * Sets [Builder.phoneNumber] to an arbitrary JSON value. + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. * - * You should usually call [Builder.phoneNumber] with a well-typed [String] value + * You should usually call [Builder.phoneNumbers] with a well-typed `List` value * instead. This method is primarily for setting the field to an undocumented or not yet * supported value. */ - fun phoneNumber(phoneNumber: JsonField) = apply { - this.phoneNumber = phoneNumber + fun phoneNumbers(phoneNumbers: JsonField>) = apply { + this.phoneNumbers = phoneNumbers.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [phoneNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addPhoneNumber(phoneNumber: String) = apply { + phoneNumbers = + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) + } + } + + /** Parent company name (if applicable). */ + fun parentCompany(parentCompany: String) = parentCompany(JsonField.of(parentCompany)) + + /** + * Sets [Builder.parentCompany] to an arbitrary JSON value. + * + * You should usually call [Builder.parentCompany] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun parentCompany(parentCompany: JsonField) = apply { + this.parentCompany = parentCompany } fun additionalProperties(additionalProperties: Map) = apply { @@ -1914,50 +1852,49 @@ private constructor( } /** - * Returns an immutable instance of [AccountHolderIndividualResponse]. + * Returns an immutable instance of [AccountHolderBusinessResponse]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java * .address() - * .dob() - * .email() + * .dbaBusinessName() * .entityToken() - * .firstName() - * .lastName() - * .phoneNumber() + * .governmentId() + * .legalBusinessName() + * .phoneNumbers() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): AccountHolderIndividualResponse = - AccountHolderIndividualResponse( + fun build(): AccountHolderBusinessResponse = + AccountHolderBusinessResponse( checkRequired("address", address), - checkRequired("dob", dob), - checkRequired("email", email), + checkRequired("dbaBusinessName", dbaBusinessName), checkRequired("entityToken", entityToken), - checkRequired("firstName", firstName), - checkRequired("lastName", lastName), - checkRequired("phoneNumber", phoneNumber), + checkRequired("governmentId", governmentId), + checkRequired("legalBusinessName", legalBusinessName), + checkRequired("phoneNumbers", phoneNumbers).map { it.toImmutable() }, + parentCompany, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): AccountHolderIndividualResponse = apply { + fun validate(): AccountHolderBusinessResponse = apply { if (validated) { return@apply } address().validate() - dob() - email() + dbaBusinessName() entityToken() - firstName() - lastName() - phoneNumber() + governmentId() + legalBusinessName() + phoneNumbers() + parentCompany() validated = true } @@ -1978,38 +1915,38 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (address.asKnown().getOrNull()?.validity() ?: 0) + - (if (dob.asKnown().isPresent) 1 else 0) + - (if (email.asKnown().isPresent) 1 else 0) + + (if (dbaBusinessName.asKnown().isPresent) 1 else 0) + (if (entityToken.asKnown().isPresent) 1 else 0) + - (if (firstName.asKnown().isPresent) 1 else 0) + - (if (lastName.asKnown().isPresent) 1 else 0) + - (if (phoneNumber.asKnown().isPresent) 1 else 0) + (if (governmentId.asKnown().isPresent) 1 else 0) + + (if (legalBusinessName.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.size ?: 0) + + (if (parentCompany.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is AccountHolderIndividualResponse && + return other is AccountHolderBusinessResponse && address == other.address && - dob == other.dob && - email == other.email && + dbaBusinessName == other.dbaBusinessName && entityToken == other.entityToken && - firstName == other.firstName && - lastName == other.lastName && - phoneNumber == other.phoneNumber && + governmentId == other.governmentId && + legalBusinessName == other.legalBusinessName && + phoneNumbers == other.phoneNumbers && + parentCompany == other.parentCompany && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( address, - dob, - email, + dbaBusinessName, entityToken, - firstName, - lastName, - phoneNumber, + governmentId, + legalBusinessName, + phoneNumbers, + parentCompany, additionalProperties, ) } @@ -2017,7 +1954,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccountHolderIndividualResponse{address=$address, dob=$dob, email=$email, entityToken=$entityToken, firstName=$firstName, lastName=$lastName, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" + "AccountHolderBusinessResponse{address=$address, dbaBusinessName=$dbaBusinessName, entityToken=$entityToken, governmentId=$governmentId, legalBusinessName=$legalBusinessName, phoneNumbers=$phoneNumbers, parentCompany=$parentCompany, additionalProperties=$additionalProperties}" } /** The type of KYC exemption for a KYC-Exempt Account Holder. */ @@ -3256,7 +3193,6 @@ private constructor( token == other.token && created == other.created && accountToken == other.accountToken && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessAccountToken == other.businessAccountToken && businessEntity == other.businessEntity && @@ -3282,7 +3218,6 @@ private constructor( token, created, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -3307,5 +3242,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccountHolder{token=$token, created=$created, accountToken=$accountToken, beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" + "AccountHolder{token=$token, created=$created, accountToken=$accountToken, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt index c3bd16e4b..fc08f3045 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityCreateParams.kt @@ -22,10 +22,10 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Create a new beneficial owner or replace the control person entity on an existing KYB account - * holder. This endpoint is only applicable for account holders enrolled through a KYB workflow with - * the Persona KYB provider. A new control person can only replace the existing one. A maximum of 4 - * beneficial owners can be associated with an account holder. + * Create a new beneficial owner individual or replace the control person entity on an existing KYB + * account holder. This endpoint is only applicable for account holders enrolled through a KYB + * workflow with the Persona KYB provider. A new control person can only replace the existing one. A + * maximum of 4 beneficial owners can be associated with an account holder. */ class AccountHolderEntityCreateParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt index 4b2486caf..4d08d0866 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderEntityDeleteParams.kt @@ -13,8 +13,8 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Deactivate a beneficial owner entity on an existing KYB account holder. Only beneficial owner - * entities can be deactivated. + * Deactivate a beneficial owner individual on an existing KYB account holder. Only beneficial owner + * individuals can be deactivated. */ class AccountHolderEntityDeleteParams private constructor( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt index 9ec3b45e9..380871128 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt @@ -26,7 +26,6 @@ class AccountHolderSimulateEnrollmentReviewResponse private constructor( private val token: JsonField, private val accountToken: JsonField, - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessAccountToken: JsonField, private val businessEntity: JsonField, @@ -54,9 +53,6 @@ private constructor( @JsonProperty("account_token") @ExcludeMissing accountToken: JsonField = JsonMissing.of(), - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = JsonMissing.of(), @@ -106,7 +102,6 @@ private constructor( ) : this( token, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -144,15 +139,6 @@ private constructor( */ fun accountToken(): Optional = accountToken.getOptional("account_token") - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and indirect * individuals with 25% or more ownership in the company. A maximum of 4 beneficial owners can @@ -351,16 +337,6 @@ private constructor( @ExcludeMissing fun _accountToken(): JsonField = accountToken - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -540,7 +516,6 @@ private constructor( private var token: JsonField = JsonMissing.of() private var accountToken: JsonField = JsonMissing.of() - private var beneficialOwnerEntities: JsonField>? = null private var beneficialOwnerIndividuals: JsonField>? = null private var businessAccountToken: JsonField = JsonMissing.of() private var businessEntity: JsonField = JsonMissing.of() @@ -568,10 +543,6 @@ private constructor( ) = apply { token = accountHolderSimulateEnrollmentReviewResponse.token accountToken = accountHolderSimulateEnrollmentReviewResponse.accountToken - beneficialOwnerEntities = - accountHolderSimulateEnrollmentReviewResponse.beneficialOwnerEntities.map { - it.toMutableList() - } beneficialOwnerIndividuals = accountHolderSimulateEnrollmentReviewResponse.beneficialOwnerIndividuals.map { it.toMutableList() @@ -630,34 +601,6 @@ private constructor( this.accountToken = accountToken } - /** Deprecated. */ - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun beneficialOwnerEntities(beneficialOwnerEntities: JsonField>) = - apply { - this.beneficialOwnerEntities = beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [KybBusinessEntity] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addBeneficialOwnerEntity(beneficialOwnerEntity: KybBusinessEntity) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and * indirect individuals with 25% or more ownership in the company. A maximum of 4 beneficial @@ -1035,7 +978,6 @@ private constructor( AccountHolderSimulateEnrollmentReviewResponse( token, accountToken, - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessAccountToken, businessEntity, @@ -1067,7 +1009,6 @@ private constructor( token() accountToken() - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessAccountToken() businessEntity().ifPresent { it.validate() } @@ -1106,7 +1047,6 @@ private constructor( internal fun validity(): Int = (if (token.asKnown().isPresent) 1 else 0) + (if (accountToken.asKnown().isPresent) 1 else 0) + - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (businessAccountToken.asKnown().isPresent) 1 else 0) + @@ -3473,7 +3413,6 @@ private constructor( return other is AccountHolderSimulateEnrollmentReviewResponse && token == other.token && accountToken == other.accountToken && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessAccountToken == other.businessAccountToken && businessEntity == other.businessEntity && @@ -3499,7 +3438,6 @@ private constructor( Objects.hash( token, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -3525,5 +3463,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccountHolderSimulateEnrollmentReviewResponse{token=$token, accountToken=$accountToken, beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, created=$created, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" + "AccountHolderSimulateEnrollmentReviewResponse{token=$token, accountToken=$accountToken, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, created=$created, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateParams.kt index 54a08bcce..0dea077b0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateParams.kt @@ -468,7 +468,6 @@ private constructor( class KybPatchRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessEntity: JsonField, private val controlPerson: JsonField, @@ -481,9 +480,6 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = JsonMissing.of(), @@ -506,7 +502,6 @@ private constructor( @ExcludeMissing websiteUrl: JsonField = JsonMissing.of(), ) : this( - beneficialOwnerEntities, beneficialOwnerIndividuals, businessEntity, controlPerson, @@ -517,16 +512,6 @@ private constructor( mutableMapOf(), ) - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") - /** * You must submit a list of all direct and indirect individuals with 25% or more * ownership in the company. A maximum of 4 beneficial owners can be submitted. If no @@ -600,18 +585,6 @@ private constructor( */ fun websiteUrl(): Optional = websiteUrl.getOptional("website_url") - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = - beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -704,9 +677,6 @@ private constructor( /** A builder for [KybPatchRequest]. */ class Builder internal constructor() { - private var beneficialOwnerEntities: - JsonField>? = - null private var beneficialOwnerIndividuals: JsonField>? = null private var businessEntity: JsonField = JsonMissing.of() @@ -719,8 +689,6 @@ private constructor( @JvmSynthetic internal fun from(kybPatchRequest: KybPatchRequest) = apply { - beneficialOwnerEntities = - kybPatchRequest.beneficialOwnerEntities.map { it.toMutableList() } beneficialOwnerIndividuals = kybPatchRequest.beneficialOwnerIndividuals.map { it.toMutableList() } businessEntity = kybPatchRequest.businessEntity @@ -732,40 +700,6 @@ private constructor( additionalProperties = kybPatchRequest.additionalProperties.toMutableMap() } - /** Deprecated. */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for - * setting the field to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities( - beneficialOwnerEntities: JsonField> - ) = apply { - this.beneficialOwnerEntities = - beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [KybBusinessEntityPatch] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - @Deprecated("deprecated") - fun addBeneficialOwnerEntity(beneficialOwnerEntity: KybBusinessEntityPatch) = - apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * You must submit a list of all direct and indirect individuals with 25% or more * ownership in the company. A maximum of 4 beneficial owners can be submitted. If @@ -940,7 +874,6 @@ private constructor( */ fun build(): KybPatchRequest = KybPatchRequest( - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessEntity, controlPerson, @@ -959,7 +892,6 @@ private constructor( return@apply } - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessEntity().ifPresent { it.validate() } controlPerson().ifPresent { it.validate() } @@ -986,11 +918,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { - it.validity().toInt() - } ?: 0) + (businessEntity.asKnown().getOrNull()?.validity() ?: 0) + (controlPerson.asKnown().getOrNull()?.validity() ?: 0) + (if (externalId.asKnown().isPresent) 1 else 0) + @@ -998,16 +927,18 @@ private constructor( (if (natureOfBusiness.asKnown().isPresent) 1 else 0) + (if (websiteUrl.asKnown().isPresent) 1 else 0) - class KybBusinessEntityPatch + /** Individuals associated with a KYB application. Phone number is optional. */ + class IndividualPatch @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val entityToken: JsonField, private val address: JsonField, - private val dbaBusinessName: JsonField, + private val dob: JsonField, + private val email: JsonField, + private val firstName: JsonField, private val governmentId: JsonField, - private val legalBusinessName: JsonField, - private val parentCompany: JsonField, - private val phoneNumbers: JsonField>, + private val lastName: JsonField, + private val phoneNumber: JsonField, private val additionalProperties: MutableMap, ) { @@ -1019,29 +950,31 @@ private constructor( @JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(), - @JsonProperty("dba_business_name") + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("email") @ExcludeMissing - dbaBusinessName: JsonField = JsonMissing.of(), + email: JsonField = JsonMissing.of(), + @JsonProperty("first_name") + @ExcludeMissing + firstName: JsonField = JsonMissing.of(), @JsonProperty("government_id") @ExcludeMissing governmentId: JsonField = JsonMissing.of(), - @JsonProperty("legal_business_name") - @ExcludeMissing - legalBusinessName: JsonField = JsonMissing.of(), - @JsonProperty("parent_company") + @JsonProperty("last_name") @ExcludeMissing - parentCompany: JsonField = JsonMissing.of(), - @JsonProperty("phone_numbers") + lastName: JsonField = JsonMissing.of(), + @JsonProperty("phone_number") @ExcludeMissing - phoneNumbers: JsonField> = JsonMissing.of(), + phoneNumber: JsonField = JsonMissing.of(), ) : this( entityToken, address, - dbaBusinessName, + dob, + email, + firstName, governmentId, - legalBusinessName, - parentCompany, - phoneNumbers, + lastName, + phoneNumber, mutableMapOf(), ) @@ -1055,8 +988,8 @@ private constructor( fun entityToken(): String = entityToken.getRequired("entity_token") /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1064,50 +997,56 @@ private constructor( fun address(): Optional = address.getOptional("address") /** - * Any name that the business operates under that is not its legal business name (if - * applicable). + * Individual's date of birth, as an RFC 3339 date. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun dbaBusinessName(): Optional = - dbaBusinessName.getOptional("dba_business_name") + fun dob(): Optional = dob.getOptional("dob") /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. + * Individual's email address. If utilizing Lithic for chargeback processing, this + * customer email address may be used to communicate dispute status and resolution. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun governmentId(): Optional = governmentId.getOptional("government_id") + fun email(): Optional = email.getOptional("email") /** - * Legal (formal) business name. + * Individual's first name, as it appears on government-issued identity documents. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun legalBusinessName(): Optional = - legalBusinessName.getOptional("legal_business_name") + fun firstName(): Optional = firstName.getOptional("first_name") /** - * Parent company name (if applicable). + * Government-issued identification number (required for identity verification and + * compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun parentCompany(): Optional = parentCompany.getOptional("parent_company") + fun governmentId(): Optional = governmentId.getOptional("government_id") /** - * One or more of the business's phone number(s), entered as a list in E.164 format. + * Individual's last name, as it appears on government-issued identity documents. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun phoneNumbers(): Optional> = - phoneNumbers.getOptional("phone_numbers") + fun lastName(): Optional = lastName.getOptional("last_name") + + /** + * Individual's phone number, entered in E.164 format. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") /** * Returns the raw JSON value of [entityToken]. @@ -1130,54 +1069,59 @@ private constructor( fun _address(): JsonField = address /** - * Returns the raw JSON value of [dbaBusinessName]. + * Returns the raw JSON value of [dob]. * - * Unlike [dbaBusinessName], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("dba_business_name") - @ExcludeMissing - fun _dbaBusinessName(): JsonField = dbaBusinessName + @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob /** - * Returns the raw JSON value of [governmentId]. + * Returns the raw JSON value of [email]. * - * Unlike [governmentId], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [email], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("government_id") + @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email + + /** + * Returns the raw JSON value of [firstName]. + * + * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("first_name") @ExcludeMissing - fun _governmentId(): JsonField = governmentId + fun _firstName(): JsonField = firstName /** - * Returns the raw JSON value of [legalBusinessName]. + * Returns the raw JSON value of [governmentId]. * - * Unlike [legalBusinessName], this method doesn't throw if the JSON field has an + * Unlike [governmentId], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("legal_business_name") + @JsonProperty("government_id") @ExcludeMissing - fun _legalBusinessName(): JsonField = legalBusinessName + fun _governmentId(): JsonField = governmentId /** - * Returns the raw JSON value of [parentCompany]. + * Returns the raw JSON value of [lastName]. * - * Unlike [parentCompany], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("parent_company") + @JsonProperty("last_name") @ExcludeMissing - fun _parentCompany(): JsonField = parentCompany + fun _lastName(): JsonField = lastName /** - * Returns the raw JSON value of [phoneNumbers]. + * Returns the raw JSON value of [phoneNumber]. * - * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an + * Unlike [phoneNumber], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("phone_numbers") + @JsonProperty("phone_number") @ExcludeMissing - fun _phoneNumbers(): JsonField> = phoneNumbers + fun _phoneNumber(): JsonField = phoneNumber @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -1194,8 +1138,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [KybBusinessEntityPatch]. + * Returns a mutable builder for constructing an instance of [IndividualPatch]. * * The following fields are required: * ```java @@ -1205,30 +1148,30 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [KybBusinessEntityPatch]. */ + /** A builder for [IndividualPatch]. */ class Builder internal constructor() { private var entityToken: JsonField? = null private var address: JsonField = JsonMissing.of() - private var dbaBusinessName: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var email: JsonField = JsonMissing.of() + private var firstName: JsonField = JsonMissing.of() private var governmentId: JsonField = JsonMissing.of() - private var legalBusinessName: JsonField = JsonMissing.of() - private var parentCompany: JsonField = JsonMissing.of() - private var phoneNumbers: JsonField>? = null + private var lastName: JsonField = JsonMissing.of() + private var phoneNumber: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(kybBusinessEntityPatch: KybBusinessEntityPatch) = apply { - entityToken = kybBusinessEntityPatch.entityToken - address = kybBusinessEntityPatch.address - dbaBusinessName = kybBusinessEntityPatch.dbaBusinessName - governmentId = kybBusinessEntityPatch.governmentId - legalBusinessName = kybBusinessEntityPatch.legalBusinessName - parentCompany = kybBusinessEntityPatch.parentCompany - phoneNumbers = - kybBusinessEntityPatch.phoneNumbers.map { it.toMutableList() } - additionalProperties = - kybBusinessEntityPatch.additionalProperties.toMutableMap() + internal fun from(individualPatch: IndividualPatch) = apply { + entityToken = individualPatch.entityToken + address = individualPatch.address + dob = individualPatch.dob + email = individualPatch.email + firstName = individualPatch.firstName + governmentId = individualPatch.governmentId + lastName = individualPatch.lastName + phoneNumber = individualPatch.phoneNumber + additionalProperties = individualPatch.additionalProperties.toMutableMap() } /** Globally unique identifier for an entity. */ @@ -1246,8 +1189,9 @@ private constructor( } /** - * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. + * Individual's current address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. Only USA addresses are currently + * supported. */ fun address(address: AddressUpdate) = address(JsonField.of(address)) @@ -1262,101 +1206,98 @@ private constructor( this.address = address } - /** - * Any name that the business operates under that is not its legal business name - * (if applicable). - */ - fun dbaBusinessName(dbaBusinessName: String) = - dbaBusinessName(JsonField.of(dbaBusinessName)) + /** Individual's date of birth, as an RFC 3339 date. */ + fun dob(dob: String) = dob(JsonField.of(dob)) /** - * Sets [Builder.dbaBusinessName] to an arbitrary JSON value. + * Sets [Builder.dob] to an arbitrary JSON value. * - * You should usually call [Builder.dbaBusinessName] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.dob] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun dbaBusinessName(dbaBusinessName: JsonField) = apply { - this.dbaBusinessName = dbaBusinessName - } + fun dob(dob: JsonField) = apply { this.dob = dob } /** - * Government-issued identification number. US Federal Employer Identification - * Numbers (EIN) are currently supported, entered as full nine-digits, with or - * without hyphens. + * Individual's email address. If utilizing Lithic for chargeback processing, + * this customer email address may be used to communicate dispute status and + * resolution. */ - fun governmentId(governmentId: String) = - governmentId(JsonField.of(governmentId)) + fun email(email: String) = email(JsonField.of(email)) /** - * Sets [Builder.governmentId] to an arbitrary JSON value. + * Sets [Builder.email] to an arbitrary JSON value. * - * You should usually call [Builder.governmentId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.email] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun governmentId(governmentId: JsonField) = apply { - this.governmentId = governmentId - } + fun email(email: JsonField) = apply { this.email = email } - /** Legal (formal) business name. */ - fun legalBusinessName(legalBusinessName: String) = - legalBusinessName(JsonField.of(legalBusinessName)) + /** + * Individual's first name, as it appears on government-issued identity + * documents. + */ + fun firstName(firstName: String) = firstName(JsonField.of(firstName)) /** - * Sets [Builder.legalBusinessName] to an arbitrary JSON value. + * Sets [Builder.firstName] to an arbitrary JSON value. * - * You should usually call [Builder.legalBusinessName] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.firstName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun legalBusinessName(legalBusinessName: JsonField) = apply { - this.legalBusinessName = legalBusinessName + fun firstName(firstName: JsonField) = apply { + this.firstName = firstName } - /** Parent company name (if applicable). */ - fun parentCompany(parentCompany: String) = - parentCompany(JsonField.of(parentCompany)) + /** + * Government-issued identification number (required for identity verification + * and compliance with banking regulations). Social Security Numbers (SSN) and + * Individual Taxpayer Identification Numbers (ITIN) are currently supported, + * entered as full nine-digits, with or without hyphens + */ + fun governmentId(governmentId: String) = + governmentId(JsonField.of(governmentId)) /** - * Sets [Builder.parentCompany] to an arbitrary JSON value. + * Sets [Builder.governmentId] to an arbitrary JSON value. * - * You should usually call [Builder.parentCompany] with a well-typed [String] + * You should usually call [Builder.governmentId] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun parentCompany(parentCompany: JsonField) = apply { - this.parentCompany = parentCompany + fun governmentId(governmentId: JsonField) = apply { + this.governmentId = governmentId } /** - * One or more of the business's phone number(s), entered as a list in E.164 - * format. + * Individual's last name, as it appears on government-issued identity + * documents. */ - fun phoneNumbers(phoneNumbers: List) = - phoneNumbers(JsonField.of(phoneNumbers)) + fun lastName(lastName: String) = lastName(JsonField.of(lastName)) /** - * Sets [Builder.phoneNumbers] to an arbitrary JSON value. + * Sets [Builder.lastName] to an arbitrary JSON value. * - * You should usually call [Builder.phoneNumbers] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. + * You should usually call [Builder.lastName] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun phoneNumbers(phoneNumbers: JsonField>) = apply { - this.phoneNumbers = phoneNumbers.map { it.toMutableList() } - } + fun lastName(lastName: JsonField) = apply { this.lastName = lastName } + + /** Individual's phone number, entered in E.164 format. */ + fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) /** - * Adds a single [String] to [phoneNumbers]. + * Sets [Builder.phoneNumber] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.phoneNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun addPhoneNumber(phoneNumber: String) = apply { - phoneNumbers = - (phoneNumbers ?: JsonField.of(mutableListOf())).also { - checkKnown("phoneNumbers", it).add(phoneNumber) - } + fun phoneNumber(phoneNumber: JsonField) = apply { + this.phoneNumber = phoneNumber } fun additionalProperties(additionalProperties: Map) = apply { @@ -1382,7 +1323,7 @@ private constructor( } /** - * Returns an immutable instance of [KybBusinessEntityPatch]. + * Returns an immutable instance of [IndividualPatch]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1393,33 +1334,35 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): KybBusinessEntityPatch = - KybBusinessEntityPatch( + fun build(): IndividualPatch = + IndividualPatch( checkRequired("entityToken", entityToken), address, - dbaBusinessName, + dob, + email, + firstName, governmentId, - legalBusinessName, - parentCompany, - (phoneNumbers ?: JsonMissing.of()).map { it.toImmutable() }, + lastName, + phoneNumber, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): KybBusinessEntityPatch = apply { + fun validate(): IndividualPatch = apply { if (validated) { return@apply } entityToken() address().ifPresent { it.validate() } - dbaBusinessName() + dob() + email() + firstName() governmentId() - legalBusinessName() - parentCompany() - phoneNumbers() + lastName() + phoneNumber() validated = true } @@ -1441,25 +1384,27 @@ private constructor( internal fun validity(): Int = (if (entityToken.asKnown().isPresent) 1 else 0) + (address.asKnown().getOrNull()?.validity() ?: 0) + - (if (dbaBusinessName.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (if (email.asKnown().isPresent) 1 else 0) + + (if (firstName.asKnown().isPresent) 1 else 0) + (if (governmentId.asKnown().isPresent) 1 else 0) + - (if (legalBusinessName.asKnown().isPresent) 1 else 0) + - (if (parentCompany.asKnown().isPresent) 1 else 0) + - (phoneNumbers.asKnown().getOrNull()?.size ?: 0) + (if (lastName.asKnown().isPresent) 1 else 0) + + (if (phoneNumber.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is KybBusinessEntityPatch && + return other is IndividualPatch && entityToken == other.entityToken && address == other.address && - dbaBusinessName == other.dbaBusinessName && + dob == other.dob && + email == other.email && + firstName == other.firstName && governmentId == other.governmentId && - legalBusinessName == other.legalBusinessName && - parentCompany == other.parentCompany && - phoneNumbers == other.phoneNumbers && + lastName == other.lastName && + phoneNumber == other.phoneNumber && additionalProperties == other.additionalProperties } @@ -1467,11 +1412,12 @@ private constructor( Objects.hash( entityToken, address, - dbaBusinessName, + dob, + email, + firstName, governmentId, - legalBusinessName, - parentCompany, - phoneNumbers, + lastName, + phoneNumber, additionalProperties, ) } @@ -1479,21 +1425,22 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "KybBusinessEntityPatch{entityToken=$entityToken, address=$address, dbaBusinessName=$dbaBusinessName, governmentId=$governmentId, legalBusinessName=$legalBusinessName, parentCompany=$parentCompany, phoneNumbers=$phoneNumbers, additionalProperties=$additionalProperties}" + "IndividualPatch{entityToken=$entityToken, address=$address, dob=$dob, email=$email, firstName=$firstName, governmentId=$governmentId, lastName=$lastName, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" } - /** Individuals associated with a KYB application. Phone number is optional. */ - class IndividualPatch + /** + * Information for business for which the account is being opened and KYB is being run. + */ + class KybBusinessEntityPatch @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val entityToken: JsonField, private val address: JsonField, - private val dob: JsonField, - private val email: JsonField, - private val firstName: JsonField, + private val dbaBusinessName: JsonField, private val governmentId: JsonField, - private val lastName: JsonField, - private val phoneNumber: JsonField, + private val legalBusinessName: JsonField, + private val parentCompany: JsonField, + private val phoneNumbers: JsonField>, private val additionalProperties: MutableMap, ) { @@ -1505,31 +1452,29 @@ private constructor( @JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(), - @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), - @JsonProperty("email") - @ExcludeMissing - email: JsonField = JsonMissing.of(), - @JsonProperty("first_name") + @JsonProperty("dba_business_name") @ExcludeMissing - firstName: JsonField = JsonMissing.of(), + dbaBusinessName: JsonField = JsonMissing.of(), @JsonProperty("government_id") @ExcludeMissing governmentId: JsonField = JsonMissing.of(), - @JsonProperty("last_name") + @JsonProperty("legal_business_name") @ExcludeMissing - lastName: JsonField = JsonMissing.of(), - @JsonProperty("phone_number") + legalBusinessName: JsonField = JsonMissing.of(), + @JsonProperty("parent_company") @ExcludeMissing - phoneNumber: JsonField = JsonMissing.of(), + parentCompany: JsonField = JsonMissing.of(), + @JsonProperty("phone_numbers") + @ExcludeMissing + phoneNumbers: JsonField> = JsonMissing.of(), ) : this( entityToken, address, - dob, - email, - firstName, + dbaBusinessName, governmentId, - lastName, - phoneNumber, + legalBusinessName, + parentCompany, + phoneNumbers, mutableMapOf(), ) @@ -1543,8 +1488,8 @@ private constructor( fun entityToken(): String = entityToken.getRequired("entity_token") /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently supported. + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). @@ -1552,56 +1497,50 @@ private constructor( fun address(): Optional = address.getOptional("address") /** - * Individual's date of birth, as an RFC 3339 date. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun dob(): Optional = dob.getOptional("dob") - - /** - * Individual's email address. If utilizing Lithic for chargeback processing, this - * customer email address may be used to communicate dispute status and resolution. + * Any name that the business operates under that is not its legal business name (if + * applicable). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun email(): Optional = email.getOptional("email") + fun dbaBusinessName(): Optional = + dbaBusinessName.getOptional("dba_business_name") /** - * Individual's first name, as it appears on government-issued identity documents. + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun firstName(): Optional = firstName.getOptional("first_name") + fun governmentId(): Optional = governmentId.getOptional("government_id") /** - * Government-issued identification number (required for identity verification and - * compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens + * Legal (formal) business name. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun governmentId(): Optional = governmentId.getOptional("government_id") + fun legalBusinessName(): Optional = + legalBusinessName.getOptional("legal_business_name") /** - * Individual's last name, as it appears on government-issued identity documents. + * Parent company name (if applicable). * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun lastName(): Optional = lastName.getOptional("last_name") + fun parentCompany(): Optional = parentCompany.getOptional("parent_company") /** - * Individual's phone number, entered in E.164 format. + * One or more of the business's phone number(s), entered as a list in E.164 format. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun phoneNumber(): Optional = phoneNumber.getOptional("phone_number") + fun phoneNumbers(): Optional> = + phoneNumbers.getOptional("phone_numbers") /** * Returns the raw JSON value of [entityToken]. @@ -1624,29 +1563,14 @@ private constructor( fun _address(): JsonField = address /** - * Returns the raw JSON value of [dob]. - * - * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob - - /** - * Returns the raw JSON value of [email]. - * - * Unlike [email], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("email") @ExcludeMissing fun _email(): JsonField = email - - /** - * Returns the raw JSON value of [firstName]. + * Returns the raw JSON value of [dbaBusinessName]. * - * Unlike [firstName], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [dbaBusinessName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("first_name") + @JsonProperty("dba_business_name") @ExcludeMissing - fun _firstName(): JsonField = firstName + fun _dbaBusinessName(): JsonField = dbaBusinessName /** * Returns the raw JSON value of [governmentId]. @@ -1659,24 +1583,34 @@ private constructor( fun _governmentId(): JsonField = governmentId /** - * Returns the raw JSON value of [lastName]. + * Returns the raw JSON value of [legalBusinessName]. * - * Unlike [lastName], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [legalBusinessName], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("last_name") + @JsonProperty("legal_business_name") @ExcludeMissing - fun _lastName(): JsonField = lastName + fun _legalBusinessName(): JsonField = legalBusinessName /** - * Returns the raw JSON value of [phoneNumber]. + * Returns the raw JSON value of [parentCompany]. * - * Unlike [phoneNumber], this method doesn't throw if the JSON field has an + * Unlike [parentCompany], this method doesn't throw if the JSON field has an * unexpected type. */ - @JsonProperty("phone_number") + @JsonProperty("parent_company") @ExcludeMissing - fun _phoneNumber(): JsonField = phoneNumber + fun _parentCompany(): JsonField = parentCompany + + /** + * Returns the raw JSON value of [phoneNumbers]. + * + * Unlike [phoneNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("phone_numbers") + @ExcludeMissing + fun _phoneNumbers(): JsonField> = phoneNumbers @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -1693,7 +1627,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IndividualPatch]. + * Returns a mutable builder for constructing an instance of + * [KybBusinessEntityPatch]. * * The following fields are required: * ```java @@ -1703,30 +1638,30 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IndividualPatch]. */ + /** A builder for [KybBusinessEntityPatch]. */ class Builder internal constructor() { private var entityToken: JsonField? = null private var address: JsonField = JsonMissing.of() - private var dob: JsonField = JsonMissing.of() - private var email: JsonField = JsonMissing.of() - private var firstName: JsonField = JsonMissing.of() + private var dbaBusinessName: JsonField = JsonMissing.of() private var governmentId: JsonField = JsonMissing.of() - private var lastName: JsonField = JsonMissing.of() - private var phoneNumber: JsonField = JsonMissing.of() + private var legalBusinessName: JsonField = JsonMissing.of() + private var parentCompany: JsonField = JsonMissing.of() + private var phoneNumbers: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(individualPatch: IndividualPatch) = apply { - entityToken = individualPatch.entityToken - address = individualPatch.address - dob = individualPatch.dob - email = individualPatch.email - firstName = individualPatch.firstName - governmentId = individualPatch.governmentId - lastName = individualPatch.lastName - phoneNumber = individualPatch.phoneNumber - additionalProperties = individualPatch.additionalProperties.toMutableMap() + internal fun from(kybBusinessEntityPatch: KybBusinessEntityPatch) = apply { + entityToken = kybBusinessEntityPatch.entityToken + address = kybBusinessEntityPatch.address + dbaBusinessName = kybBusinessEntityPatch.dbaBusinessName + governmentId = kybBusinessEntityPatch.governmentId + legalBusinessName = kybBusinessEntityPatch.legalBusinessName + parentCompany = kybBusinessEntityPatch.parentCompany + phoneNumbers = + kybBusinessEntityPatch.phoneNumbers.map { it.toMutableList() } + additionalProperties = + kybBusinessEntityPatch.additionalProperties.toMutableMap() } /** Globally unique identifier for an entity. */ @@ -1744,9 +1679,8 @@ private constructor( } /** - * Individual's current address - PO boxes, UPS drops, and FedEx drops are not - * acceptable; APO/FPO are acceptable. Only USA addresses are currently - * supported. + * Business''s physical address - PO boxes, UPS drops, and FedEx drops are not + * acceptable; APO/FPO are acceptable. */ fun address(address: AddressUpdate) = address(JsonField.of(address)) @@ -1761,98 +1695,101 @@ private constructor( this.address = address } - /** Individual's date of birth, as an RFC 3339 date. */ - fun dob(dob: String) = dob(JsonField.of(dob)) + /** + * Any name that the business operates under that is not its legal business name + * (if applicable). + */ + fun dbaBusinessName(dbaBusinessName: String) = + dbaBusinessName(JsonField.of(dbaBusinessName)) /** - * Sets [Builder.dob] to an arbitrary JSON value. + * Sets [Builder.dbaBusinessName] to an arbitrary JSON value. * - * You should usually call [Builder.dob] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.dbaBusinessName] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun dob(dob: JsonField) = apply { this.dob = dob } + fun dbaBusinessName(dbaBusinessName: JsonField) = apply { + this.dbaBusinessName = dbaBusinessName + } /** - * Individual's email address. If utilizing Lithic for chargeback processing, - * this customer email address may be used to communicate dispute status and - * resolution. + * Government-issued identification number. US Federal Employer Identification + * Numbers (EIN) are currently supported, entered as full nine-digits, with or + * without hyphens. */ - fun email(email: String) = email(JsonField.of(email)) + fun governmentId(governmentId: String) = + governmentId(JsonField.of(governmentId)) /** - * Sets [Builder.email] to an arbitrary JSON value. + * Sets [Builder.governmentId] to an arbitrary JSON value. * - * You should usually call [Builder.email] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.governmentId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun email(email: JsonField) = apply { this.email = email } + fun governmentId(governmentId: JsonField) = apply { + this.governmentId = governmentId + } - /** - * Individual's first name, as it appears on government-issued identity - * documents. - */ - fun firstName(firstName: String) = firstName(JsonField.of(firstName)) + /** Legal (formal) business name. */ + fun legalBusinessName(legalBusinessName: String) = + legalBusinessName(JsonField.of(legalBusinessName)) /** - * Sets [Builder.firstName] to an arbitrary JSON value. + * Sets [Builder.legalBusinessName] to an arbitrary JSON value. * - * You should usually call [Builder.firstName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.legalBusinessName] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. */ - fun firstName(firstName: JsonField) = apply { - this.firstName = firstName + fun legalBusinessName(legalBusinessName: JsonField) = apply { + this.legalBusinessName = legalBusinessName } - /** - * Government-issued identification number (required for identity verification - * and compliance with banking regulations). Social Security Numbers (SSN) and - * Individual Taxpayer Identification Numbers (ITIN) are currently supported, - * entered as full nine-digits, with or without hyphens - */ - fun governmentId(governmentId: String) = - governmentId(JsonField.of(governmentId)) + /** Parent company name (if applicable). */ + fun parentCompany(parentCompany: String) = + parentCompany(JsonField.of(parentCompany)) /** - * Sets [Builder.governmentId] to an arbitrary JSON value. + * Sets [Builder.parentCompany] to an arbitrary JSON value. * - * You should usually call [Builder.governmentId] with a well-typed [String] + * You should usually call [Builder.parentCompany] with a well-typed [String] * value instead. This method is primarily for setting the field to an * undocumented or not yet supported value. */ - fun governmentId(governmentId: JsonField) = apply { - this.governmentId = governmentId + fun parentCompany(parentCompany: JsonField) = apply { + this.parentCompany = parentCompany } /** - * Individual's last name, as it appears on government-issued identity - * documents. + * One or more of the business's phone number(s), entered as a list in E.164 + * format. */ - fun lastName(lastName: String) = lastName(JsonField.of(lastName)) + fun phoneNumbers(phoneNumbers: List) = + phoneNumbers(JsonField.of(phoneNumbers)) /** - * Sets [Builder.lastName] to an arbitrary JSON value. + * Sets [Builder.phoneNumbers] to an arbitrary JSON value. * - * You should usually call [Builder.lastName] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.phoneNumbers] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. */ - fun lastName(lastName: JsonField) = apply { this.lastName = lastName } - - /** Individual's phone number, entered in E.164 format. */ - fun phoneNumber(phoneNumber: String) = phoneNumber(JsonField.of(phoneNumber)) + fun phoneNumbers(phoneNumbers: JsonField>) = apply { + this.phoneNumbers = phoneNumbers.map { it.toMutableList() } + } /** - * Sets [Builder.phoneNumber] to an arbitrary JSON value. + * Adds a single [String] to [phoneNumbers]. * - * You should usually call [Builder.phoneNumber] with a well-typed [String] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun phoneNumber(phoneNumber: JsonField) = apply { - this.phoneNumber = phoneNumber + fun addPhoneNumber(phoneNumber: String) = apply { + phoneNumbers = + (phoneNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("phoneNumbers", it).add(phoneNumber) + } } fun additionalProperties(additionalProperties: Map) = apply { @@ -1878,7 +1815,7 @@ private constructor( } /** - * Returns an immutable instance of [IndividualPatch]. + * Returns an immutable instance of [KybBusinessEntityPatch]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -1889,35 +1826,33 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IndividualPatch = - IndividualPatch( + fun build(): KybBusinessEntityPatch = + KybBusinessEntityPatch( checkRequired("entityToken", entityToken), address, - dob, - email, - firstName, + dbaBusinessName, governmentId, - lastName, - phoneNumber, + legalBusinessName, + parentCompany, + (phoneNumbers ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): IndividualPatch = apply { + fun validate(): KybBusinessEntityPatch = apply { if (validated) { return@apply } entityToken() address().ifPresent { it.validate() } - dob() - email() - firstName() + dbaBusinessName() governmentId() - lastName() - phoneNumber() + legalBusinessName() + parentCompany() + phoneNumbers() validated = true } @@ -1939,27 +1874,25 @@ private constructor( internal fun validity(): Int = (if (entityToken.asKnown().isPresent) 1 else 0) + (address.asKnown().getOrNull()?.validity() ?: 0) + - (if (dob.asKnown().isPresent) 1 else 0) + - (if (email.asKnown().isPresent) 1 else 0) + - (if (firstName.asKnown().isPresent) 1 else 0) + + (if (dbaBusinessName.asKnown().isPresent) 1 else 0) + (if (governmentId.asKnown().isPresent) 1 else 0) + - (if (lastName.asKnown().isPresent) 1 else 0) + - (if (phoneNumber.asKnown().isPresent) 1 else 0) + (if (legalBusinessName.asKnown().isPresent) 1 else 0) + + (if (parentCompany.asKnown().isPresent) 1 else 0) + + (phoneNumbers.asKnown().getOrNull()?.size ?: 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return other is IndividualPatch && + return other is KybBusinessEntityPatch && entityToken == other.entityToken && address == other.address && - dob == other.dob && - email == other.email && - firstName == other.firstName && + dbaBusinessName == other.dbaBusinessName && governmentId == other.governmentId && - lastName == other.lastName && - phoneNumber == other.phoneNumber && + legalBusinessName == other.legalBusinessName && + parentCompany == other.parentCompany && + phoneNumbers == other.phoneNumbers && additionalProperties == other.additionalProperties } @@ -1967,12 +1900,11 @@ private constructor( Objects.hash( entityToken, address, - dob, - email, - firstName, + dbaBusinessName, governmentId, - lastName, - phoneNumber, + legalBusinessName, + parentCompany, + phoneNumbers, additionalProperties, ) } @@ -1980,7 +1912,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "IndividualPatch{entityToken=$entityToken, address=$address, dob=$dob, email=$email, firstName=$firstName, governmentId=$governmentId, lastName=$lastName, phoneNumber=$phoneNumber, additionalProperties=$additionalProperties}" + "KybBusinessEntityPatch{entityToken=$entityToken, address=$address, dbaBusinessName=$dbaBusinessName, governmentId=$governmentId, legalBusinessName=$legalBusinessName, parentCompany=$parentCompany, phoneNumbers=$phoneNumbers, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -1989,7 +1921,6 @@ private constructor( } return other is KybPatchRequest && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessEntity == other.businessEntity && controlPerson == other.controlPerson && @@ -2002,7 +1933,6 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( - beneficialOwnerEntities, beneficialOwnerIndividuals, businessEntity, controlPerson, @@ -2017,7 +1947,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "KybPatchRequest{beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, externalId=$externalId, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" + "KybPatchRequest{beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, externalId=$externalId, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" } /** The KYC request payload for updating an account holder. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt index 2291db7d5..538514761 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt @@ -215,7 +215,6 @@ private constructor( private constructor( private val token: JsonField, private val accountToken: JsonField, - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessAccountToken: JsonField, private val businessEntity: JsonField, @@ -243,9 +242,6 @@ private constructor( @JsonProperty("account_token") @ExcludeMissing accountToken: JsonField = JsonMissing.of(), - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = JsonMissing.of(), @@ -299,7 +295,6 @@ private constructor( ) : this( token, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -337,15 +332,6 @@ private constructor( */ fun accountToken(): Optional = accountToken.getOptional("account_token") - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and * indirect individuals with 25% or more ownership in the company. A maximum of 4 beneficial @@ -548,16 +534,6 @@ private constructor( @ExcludeMissing fun _accountToken(): JsonField = accountToken - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -742,7 +718,6 @@ private constructor( private var token: JsonField = JsonMissing.of() private var accountToken: JsonField = JsonMissing.of() - private var beneficialOwnerEntities: JsonField>? = null private var beneficialOwnerIndividuals: JsonField>? = null private var businessAccountToken: JsonField = JsonMissing.of() private var businessEntity: JsonField = JsonMissing.of() @@ -768,8 +743,6 @@ private constructor( internal fun from(kybKycPatchResponse: KybKycPatchResponse) = apply { token = kybKycPatchResponse.token accountToken = kybKycPatchResponse.accountToken - beneficialOwnerEntities = - kybKycPatchResponse.beneficialOwnerEntities.map { it.toMutableList() } beneficialOwnerIndividuals = kybKycPatchResponse.beneficialOwnerIndividuals.map { it.toMutableList() } businessAccountToken = kybKycPatchResponse.businessAccountToken @@ -818,35 +791,6 @@ private constructor( this.accountToken = accountToken } - /** Deprecated. */ - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun beneficialOwnerEntities( - beneficialOwnerEntities: JsonField> - ) = apply { - this.beneficialOwnerEntities = beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [KybBusinessEntity] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addBeneficialOwnerEntity(beneficialOwnerEntity: KybBusinessEntity) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * Only present when user_type == "BUSINESS". You must submit a list of all direct and * indirect individuals with 25% or more ownership in the company. A maximum of 4 @@ -1235,7 +1179,6 @@ private constructor( KybKycPatchResponse( token, accountToken, - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessAccountToken, businessEntity, @@ -1267,7 +1210,6 @@ private constructor( token() accountToken() - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessAccountToken() businessEntity().ifPresent { it.validate() } @@ -1307,8 +1249,6 @@ private constructor( internal fun validity(): Int = (if (token.asKnown().isPresent) 1 else 0) + (if (accountToken.asKnown().isPresent) 1 else 0) + - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (businessAccountToken.asKnown().isPresent) 1 else 0) + @@ -3744,7 +3684,6 @@ private constructor( return other is KybKycPatchResponse && token == other.token && accountToken == other.accountToken && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessAccountToken == other.businessAccountToken && businessEntity == other.businessEntity && @@ -3770,7 +3709,6 @@ private constructor( Objects.hash( token, accountToken, - beneficialOwnerEntities, beneficialOwnerIndividuals, businessAccountToken, businessEntity, @@ -3796,7 +3734,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "KybKycPatchResponse{token=$token, accountToken=$accountToken, beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, created=$created, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" + "KybKycPatchResponse{token=$token, accountToken=$accountToken, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessAccountToken=$businessAccountToken, businessEntity=$businessEntity, controlPerson=$controlPerson, created=$created, email=$email, exemptionType=$exemptionType, externalId=$externalId, individual=$individual, naicsCode=$naicsCode, natureOfBusiness=$natureOfBusiness, phoneNumber=$phoneNumber, requiredDocuments=$requiredDocuments, status=$status, statusReasons=$statusReasons, userType=$userType, verificationApplication=$verificationApplication, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" } class PatchResponse diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEvent.kt index 2c1485c46..a23edbfc4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEvent.kt @@ -657,7 +657,6 @@ private constructor( class UpdateRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessEntity: JsonField, private val controlPerson: JsonField, @@ -666,9 +665,6 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = JsonMissing.of(), @@ -678,23 +674,7 @@ private constructor( @JsonProperty("control_person") @ExcludeMissing controlPerson: JsonField = JsonMissing.of(), - ) : this( - beneficialOwnerEntities, - beneficialOwnerIndividuals, - businessEntity, - controlPerson, - mutableMapOf(), - ) - - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") + ) : this(beneficialOwnerIndividuals, businessEntity, controlPerson, mutableMapOf()) /** * You must submit a list of all direct and indirect individuals with 25% or more @@ -734,18 +714,6 @@ private constructor( */ fun controlPerson(): Optional = controlPerson.getOptional("control_person") - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = - beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -798,8 +766,6 @@ private constructor( /** A builder for [UpdateRequest]. */ class Builder internal constructor() { - private var beneficialOwnerEntities: JsonField>? = - null private var beneficialOwnerIndividuals: JsonField>? = null private var businessEntity: JsonField = JsonMissing.of() private var controlPerson: JsonField = JsonMissing.of() @@ -807,8 +773,6 @@ private constructor( @JvmSynthetic internal fun from(updateRequest: UpdateRequest) = apply { - beneficialOwnerEntities = - updateRequest.beneficialOwnerEntities.map { it.toMutableList() } beneficialOwnerIndividuals = updateRequest.beneficialOwnerIndividuals.map { it.toMutableList() } businessEntity = updateRequest.businessEntity @@ -816,39 +780,6 @@ private constructor( additionalProperties = updateRequest.additionalProperties.toMutableMap() } - /** Deprecated. */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities( - beneficialOwnerEntities: JsonField> - ) = apply { - this.beneficialOwnerEntities = - beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [KybBusinessEntity] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - @Deprecated("deprecated") - fun addBeneficialOwnerEntity(beneficialOwnerEntity: KybBusinessEntity) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * You must submit a list of all direct and indirect individuals with 25% or more * ownership in the company. A maximum of 4 beneficial owners can be submitted. If @@ -958,7 +889,6 @@ private constructor( */ fun build(): UpdateRequest = UpdateRequest( - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessEntity, controlPerson, @@ -973,7 +903,6 @@ private constructor( return@apply } - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessEntity().ifPresent { it.validate() } controlPerson().ifPresent { it.validate() } @@ -996,11 +925,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { - it.validity().toInt() - } ?: 0) + (businessEntity.asKnown().getOrNull()?.validity() ?: 0) + (controlPerson.asKnown().getOrNull()?.validity() ?: 0) @@ -1860,7 +1786,6 @@ private constructor( } return other is UpdateRequest && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessEntity == other.businessEntity && controlPerson == other.controlPerson && @@ -1869,7 +1794,6 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( - beneficialOwnerEntities, beneficialOwnerIndividuals, businessEntity, controlPerson, @@ -1880,7 +1804,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UpdateRequest{beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, additionalProperties=$additionalProperties}" + "UpdateRequest{beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, additionalProperties=$additionalProperties}" } /** The type of event that occurred. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Kyb.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Kyb.kt index 34e9a22b7..6990a3f39 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Kyb.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Kyb.kt @@ -29,7 +29,6 @@ private constructor( private val natureOfBusiness: JsonField, private val tosTimestamp: JsonField, private val workflow: JsonField, - private val beneficialOwnerEntities: JsonField>, private val externalId: JsonField, private val kybPassedTimestamp: JsonField, private val naicsCode: JsonField, @@ -55,9 +54,6 @@ private constructor( @ExcludeMissing tosTimestamp: JsonField = JsonMissing.of(), @JsonProperty("workflow") @ExcludeMissing workflow: JsonField = JsonMissing.of(), - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("external_id") @ExcludeMissing externalId: JsonField = JsonMissing.of(), @@ -75,7 +71,6 @@ private constructor( natureOfBusiness, tosTimestamp, workflow, - beneficialOwnerEntities, externalId, kybPassedTimestamp, naicsCode, @@ -144,16 +139,6 @@ private constructor( */ fun workflow(): Workflow = workflow.getRequired("workflow") - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") - /** * A user provided id that can be used to link an account holder with an external system * @@ -244,17 +229,6 @@ private constructor( */ @JsonProperty("workflow") @ExcludeMissing fun _workflow(): JsonField = workflow - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = beneficialOwnerEntities - /** * Returns the raw JSON value of [externalId]. * @@ -325,7 +299,6 @@ private constructor( private var natureOfBusiness: JsonField? = null private var tosTimestamp: JsonField? = null private var workflow: JsonField? = null - private var beneficialOwnerEntities: JsonField>? = null private var externalId: JsonField = JsonMissing.of() private var kybPassedTimestamp: JsonField = JsonMissing.of() private var naicsCode: JsonField = JsonMissing.of() @@ -340,7 +313,6 @@ private constructor( natureOfBusiness = kyb.natureOfBusiness tosTimestamp = kyb.tosTimestamp workflow = kyb.workflow - beneficialOwnerEntities = kyb.beneficialOwnerEntities.map { it.toMutableList() } externalId = kyb.externalId kybPassedTimestamp = kyb.kybPassedTimestamp naicsCode = kyb.naicsCode @@ -468,37 +440,6 @@ private constructor( */ fun workflow(workflow: JsonField) = apply { this.workflow = workflow } - /** Deprecated. */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: JsonField>) = - apply { - this.beneficialOwnerEntities = beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [BusinessEntity] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - @Deprecated("deprecated") - fun addBeneficialOwnerEntity(beneficialOwnerEntity: BusinessEntity) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** A user provided id that can be used to link an account holder with an external system */ fun externalId(externalId: String) = externalId(JsonField.of(externalId)) @@ -601,7 +542,6 @@ private constructor( checkRequired("natureOfBusiness", natureOfBusiness), checkRequired("tosTimestamp", tosTimestamp), checkRequired("workflow", workflow), - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, externalId, kybPassedTimestamp, naicsCode, @@ -623,7 +563,6 @@ private constructor( natureOfBusiness() tosTimestamp() workflow().validate() - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } externalId() kybPassedTimestamp() naicsCode() @@ -652,7 +591,6 @@ private constructor( (if (natureOfBusiness.asKnown().isPresent) 1 else 0) + (if (tosTimestamp.asKnown().isPresent) 1 else 0) + (workflow.asKnown().getOrNull()?.validity() ?: 0) + - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (externalId.asKnown().isPresent) 1 else 0) + (if (kybPassedTimestamp.asKnown().isPresent) 1 else 0) + (if (naicsCode.asKnown().isPresent) 1 else 0) + @@ -1653,7 +1591,6 @@ private constructor( natureOfBusiness == other.natureOfBusiness && tosTimestamp == other.tosTimestamp && workflow == other.workflow && - beneficialOwnerEntities == other.beneficialOwnerEntities && externalId == other.externalId && kybPassedTimestamp == other.kybPassedTimestamp && naicsCode == other.naicsCode && @@ -1669,7 +1606,6 @@ private constructor( natureOfBusiness, tosTimestamp, workflow, - beneficialOwnerEntities, externalId, kybPassedTimestamp, naicsCode, @@ -1681,5 +1617,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Kyb{beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, natureOfBusiness=$natureOfBusiness, tosTimestamp=$tosTimestamp, workflow=$workflow, beneficialOwnerEntities=$beneficialOwnerEntities, externalId=$externalId, kybPassedTimestamp=$kybPassedTimestamp, naicsCode=$naicsCode, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" + "Kyb{beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, natureOfBusiness=$natureOfBusiness, tosTimestamp=$tosTimestamp, workflow=$workflow, externalId=$externalId, kybPassedTimestamp=$kybPassedTimestamp, naicsCode=$naicsCode, websiteUrl=$websiteUrl, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt index 1f4257ba1..e7bfa7baa 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt @@ -3010,7 +3010,6 @@ private constructor( class UpdateRequest @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val beneficialOwnerEntities: JsonField>, private val beneficialOwnerIndividuals: JsonField>, private val businessEntity: JsonField, private val controlPerson: JsonField, @@ -3019,9 +3018,6 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - beneficialOwnerEntities: JsonField> = JsonMissing.of(), @JsonProperty("beneficial_owner_individuals") @ExcludeMissing beneficialOwnerIndividuals: JsonField> = JsonMissing.of(), @@ -3031,23 +3027,7 @@ private constructor( @JsonProperty("control_person") @ExcludeMissing controlPerson: JsonField = JsonMissing.of(), - ) : this( - beneficialOwnerEntities, - beneficialOwnerIndividuals, - businessEntity, - controlPerson, - mutableMapOf(), - ) - - /** - * Deprecated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(): Optional> = - beneficialOwnerEntities.getOptional("beneficial_owner_entities") + ) : this(beneficialOwnerIndividuals, businessEntity, controlPerson, mutableMapOf()) /** * You must submit a list of all direct and indirect individuals with 25% or more @@ -3087,18 +3067,6 @@ private constructor( */ fun controlPerson(): Optional = controlPerson.getOptional("control_person") - /** - * Returns the raw JSON value of [beneficialOwnerEntities]. - * - * Unlike [beneficialOwnerEntities], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("beneficial_owner_entities") - @ExcludeMissing - fun _beneficialOwnerEntities(): JsonField> = - beneficialOwnerEntities - /** * Returns the raw JSON value of [beneficialOwnerIndividuals]. * @@ -3151,8 +3119,6 @@ private constructor( /** A builder for [UpdateRequest]. */ class Builder internal constructor() { - private var beneficialOwnerEntities: JsonField>? = - null private var beneficialOwnerIndividuals: JsonField>? = null private var businessEntity: JsonField = JsonMissing.of() private var controlPerson: JsonField = JsonMissing.of() @@ -3160,8 +3126,6 @@ private constructor( @JvmSynthetic internal fun from(updateRequest: UpdateRequest) = apply { - beneficialOwnerEntities = - updateRequest.beneficialOwnerEntities.map { it.toMutableList() } beneficialOwnerIndividuals = updateRequest.beneficialOwnerIndividuals.map { it.toMutableList() } businessEntity = updateRequest.businessEntity @@ -3169,39 +3133,6 @@ private constructor( additionalProperties = updateRequest.additionalProperties.toMutableMap() } - /** Deprecated. */ - @Deprecated("deprecated") - fun beneficialOwnerEntities(beneficialOwnerEntities: List) = - beneficialOwnerEntities(JsonField.of(beneficialOwnerEntities)) - - /** - * Sets [Builder.beneficialOwnerEntities] to an arbitrary JSON value. - * - * You should usually call [Builder.beneficialOwnerEntities] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun beneficialOwnerEntities( - beneficialOwnerEntities: JsonField> - ) = apply { - this.beneficialOwnerEntities = - beneficialOwnerEntities.map { it.toMutableList() } - } - - /** - * Adds a single [KybBusinessEntity] to [beneficialOwnerEntities]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - @Deprecated("deprecated") - fun addBeneficialOwnerEntity(beneficialOwnerEntity: KybBusinessEntity) = apply { - beneficialOwnerEntities = - (beneficialOwnerEntities ?: JsonField.of(mutableListOf())).also { - checkKnown("beneficialOwnerEntities", it).add(beneficialOwnerEntity) - } - } - /** * You must submit a list of all direct and indirect individuals with 25% or more * ownership in the company. A maximum of 4 beneficial owners can be submitted. If @@ -3311,7 +3242,6 @@ private constructor( */ fun build(): UpdateRequest = UpdateRequest( - (beneficialOwnerEntities ?: JsonMissing.of()).map { it.toImmutable() }, (beneficialOwnerIndividuals ?: JsonMissing.of()).map { it.toImmutable() }, businessEntity, controlPerson, @@ -3326,7 +3256,6 @@ private constructor( return@apply } - beneficialOwnerEntities().ifPresent { it.forEach { it.validate() } } beneficialOwnerIndividuals().ifPresent { it.forEach { it.validate() } } businessEntity().ifPresent { it.validate() } controlPerson().ifPresent { it.validate() } @@ -3349,11 +3278,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (beneficialOwnerEntities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (beneficialOwnerIndividuals.asKnown().getOrNull()?.sumOf { - it.validity().toInt() - } ?: 0) + (businessEntity.asKnown().getOrNull()?.validity() ?: 0) + (controlPerson.asKnown().getOrNull()?.validity() ?: 0) @@ -4213,7 +4139,6 @@ private constructor( } return other is UpdateRequest && - beneficialOwnerEntities == other.beneficialOwnerEntities && beneficialOwnerIndividuals == other.beneficialOwnerIndividuals && businessEntity == other.businessEntity && controlPerson == other.controlPerson && @@ -4222,7 +4147,6 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( - beneficialOwnerEntities, beneficialOwnerIndividuals, businessEntity, controlPerson, @@ -4233,7 +4157,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UpdateRequest{beneficialOwnerEntities=$beneficialOwnerEntities, beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, additionalProperties=$additionalProperties}" + "UpdateRequest{beneficialOwnerIndividuals=$beneficialOwnerIndividuals, businessEntity=$businessEntity, controlPerson=$controlPerson, additionalProperties=$additionalProperties}" } /** The type of event that occurred. */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/accountHolders/EntityServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/accountHolders/EntityServiceAsync.kt index 64d91bb01..019343df2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/accountHolders/EntityServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/accountHolders/EntityServiceAsync.kt @@ -27,10 +27,10 @@ interface EntityServiceAsync { fun withOptions(modifier: Consumer): EntityServiceAsync /** - * Create a new beneficial owner or replace the control person entity on an existing KYB account - * holder. This endpoint is only applicable for account holders enrolled through a KYB workflow - * with the Persona KYB provider. A new control person can only replace the existing one. A - * maximum of 4 beneficial owners can be associated with an account holder. + * Create a new beneficial owner individual or replace the control person entity on an existing + * KYB account holder. This endpoint is only applicable for account holders enrolled through a + * KYB workflow with the Persona KYB provider. A new control person can only replace the + * existing one. A maximum of 4 beneficial owners can be associated with an account holder. */ fun create( accountHolderToken: String, @@ -57,8 +57,8 @@ interface EntityServiceAsync { ): CompletableFuture /** - * Deactivate a beneficial owner entity on an existing KYB account holder. Only beneficial owner - * entities can be deactivated. + * Deactivate a beneficial owner individual on an existing KYB account holder. Only beneficial + * owner individuals can be deactivated. */ fun delete( entityToken: String, diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/accountHolders/EntityService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/accountHolders/EntityService.kt index e54c0b0cd..8ab5cd25b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/accountHolders/EntityService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/accountHolders/EntityService.kt @@ -27,10 +27,10 @@ interface EntityService { fun withOptions(modifier: Consumer): EntityService /** - * Create a new beneficial owner or replace the control person entity on an existing KYB account - * holder. This endpoint is only applicable for account holders enrolled through a KYB workflow - * with the Persona KYB provider. A new control person can only replace the existing one. A - * maximum of 4 beneficial owners can be associated with an account holder. + * Create a new beneficial owner individual or replace the control person entity on an existing + * KYB account holder. This endpoint is only applicable for account holders enrolled through a + * KYB workflow with the Persona KYB provider. A new control person can only replace the + * existing one. A maximum of 4 beneficial owners can be associated with an account holder. */ fun create( accountHolderToken: String, @@ -56,8 +56,8 @@ interface EntityService { ): EntityCreateResponse /** - * Deactivate a beneficial owner entity on an existing KYB account holder. Only beneficial owner - * entities can be deactivated. + * Deactivate a beneficial owner individual on an existing KYB account holder. Only beneficial + * owner individuals can be deactivated. */ fun delete(entityToken: String, params: AccountHolderEntityDeleteParams): AccountHolderEntity = delete(entityToken, params, RequestOptions.none()) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderCreateParamsTest.kt index c5b3e4f09..5323637c3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderCreateParamsTest.kt @@ -76,25 +76,6 @@ internal class AccountHolderCreateParamsTest { ) .tosTimestamp("2022-03-08T08:00:00Z") .workflow(Kyb.Workflow.KYB_BYO) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("300 Normal Forest Way") - .city("Portland") - .country("USA") - .postalCode("90210") - .state("OR") - .address2("address2") - .build() - ) - .governmentId("98-7654321") - .legalBusinessName("Majority Holdings LLC") - .addPhoneNumber("+15555555555") - .dbaBusinessName("MHoldings") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2022-03-08T08:00:00Z") .naicsCode("541512") @@ -174,25 +155,6 @@ internal class AccountHolderCreateParamsTest { ) .tosTimestamp("2022-03-08T08:00:00Z") .workflow(Kyb.Workflow.KYB_BYO) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("300 Normal Forest Way") - .city("Portland") - .country("USA") - .postalCode("90210") - .state("OR") - .address2("address2") - .build() - ) - .governmentId("98-7654321") - .legalBusinessName("Majority Holdings LLC") - .addPhoneNumber("+15555555555") - .dbaBusinessName("MHoldings") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2022-03-08T08:00:00Z") .naicsCode("541512") @@ -271,25 +233,6 @@ internal class AccountHolderCreateParamsTest { ) .tosTimestamp("2022-03-08T08:00:00Z") .workflow(Kyb.Workflow.KYB_BYO) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("300 Normal Forest Way") - .city("Portland") - .country("USA") - .postalCode("90210") - .state("OR") - .address2("address2") - .build() - ) - .governmentId("98-7654321") - .legalBusinessName("Majority Holdings LLC") - .addPhoneNumber("+15555555555") - .dbaBusinessName("MHoldings") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2022-03-08T08:00:00Z") .naicsCode("541512") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListPageResponseTest.kt index 998a06251..b1db993b3 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListPageResponseTest.kt @@ -19,26 +19,6 @@ internal class AccountHolderListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolder.AccountHolderIndividualResponse.builder() .address( @@ -162,26 +142,6 @@ internal class AccountHolderListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolder.AccountHolderIndividualResponse.builder() .address( @@ -308,26 +268,6 @@ internal class AccountHolderListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolder.AccountHolderIndividualResponse.builder() .address( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponseTest.kt index 0a8832f03..9e82194e8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponseTest.kt @@ -17,25 +17,6 @@ internal class AccountHolderSimulateEnrollmentReviewResponseTest { AccountHolderSimulateEnrollmentReviewResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderSimulateEnrollmentReviewResponse.Individual.builder() .address( @@ -165,28 +146,6 @@ internal class AccountHolderSimulateEnrollmentReviewResponseTest { .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(accountHolderSimulateEnrollmentReviewResponse.accountToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat( - accountHolderSimulateEnrollmentReviewResponse.beneficialOwnerEntities().getOrNull() - ) - .containsExactly( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) assertThat( accountHolderSimulateEnrollmentReviewResponse .beneficialOwnerIndividuals() @@ -333,25 +292,6 @@ internal class AccountHolderSimulateEnrollmentReviewResponseTest { AccountHolderSimulateEnrollmentReviewResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderSimulateEnrollmentReviewResponse.Individual.builder() .address( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderTest.kt index 151331ef1..e283d15d9 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderTest.kt @@ -18,26 +18,6 @@ internal class AccountHolderTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolder.AccountHolderIndividualResponse.builder() .address( @@ -153,27 +133,6 @@ internal class AccountHolderTest { assertThat(accountHolder.created()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(accountHolder.accountToken()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(accountHolder.beneficialOwnerEntities().getOrNull()) - .containsExactly( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) assertThat(accountHolder.beneficialOwnerIndividuals().getOrNull()) .containsExactly( AccountHolder.AccountHolderIndividualResponse.builder() @@ -302,26 +261,6 @@ internal class AccountHolderTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - AccountHolder.AccountHolderBusinessResponse.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .dbaBusinessName("dba_business_name") - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolder.AccountHolderIndividualResponse.builder() .address( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt index ed955519a..9297b6e1d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt @@ -13,27 +13,6 @@ internal class AccountHolderUpdateParamsTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -128,27 +107,6 @@ internal class AccountHolderUpdateParamsTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -228,27 +186,6 @@ internal class AccountHolderUpdateParamsTest { .isEqualTo( AccountHolderUpdateParams.Body.ofKybPatchRequest( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateResponseTest.kt index 61938f698..a49df7485 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateResponseTest.kt @@ -21,25 +21,6 @@ internal class AccountHolderUpdateResponseTest { AccountHolderUpdateResponse.KybKycPatchResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateResponse.KybKycPatchResponse.Individual.builder() .address( @@ -180,25 +161,6 @@ internal class AccountHolderUpdateResponseTest { AccountHolderUpdateResponse.KybKycPatchResponse.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateResponse.KybKycPatchResponse.Individual.builder() .address( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEventTest.kt index 0b07e515c..9e5fc260b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdatedWebhookEventTest.kt @@ -22,25 +22,6 @@ internal class AccountHolderUpdatedWebhookEventTest { .token("00000000-0000-0000-0000-000000000001") .updateRequest( AccountHolderUpdatedWebhookEvent.KybPayload.UpdateRequest.builder() - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdatedWebhookEvent.KybPayload.UpdateRequest.Individual .builder() @@ -136,25 +117,6 @@ internal class AccountHolderUpdatedWebhookEventTest { .token("00000000-0000-0000-0000-000000000001") .updateRequest( AccountHolderUpdatedWebhookEvent.KybPayload.UpdateRequest.builder() - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdatedWebhookEvent.KybPayload.UpdateRequest.Individual .builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/KybTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/KybTest.kt index ba2defb11..17ff217f2 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/KybTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/KybTest.kt @@ -4,7 +4,6 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.lithic.api.core.jsonMapper -import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -76,25 +75,6 @@ internal class KybTest { .natureOfBusiness("Software company selling solutions to the restaurant industry") .tosTimestamp("2018-05-29T21:16:05Z") .workflow(Kyb.Workflow.KYB_BASIC) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2018-05-29T21:16:05Z") .naicsCode("541512") @@ -167,26 +147,6 @@ internal class KybTest { .isEqualTo("Software company selling solutions to the restaurant industry") assertThat(kyb.tosTimestamp()).isEqualTo("2018-05-29T21:16:05Z") assertThat(kyb.workflow()).isEqualTo(Kyb.Workflow.KYB_BASIC) - assertThat(kyb.beneficialOwnerEntities().getOrNull()) - .containsExactly( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) assertThat(kyb.externalId()).contains("external_id") assertThat(kyb.kybPassedTimestamp()).contains("2018-05-29T21:16:05Z") assertThat(kyb.naicsCode()).contains("541512") @@ -260,25 +220,6 @@ internal class KybTest { .natureOfBusiness("Software company selling solutions to the restaurant industry") .tosTimestamp("2018-05-29T21:16:05Z") .workflow(Kyb.Workflow.KYB_BASIC) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2018-05-29T21:16:05Z") .naicsCode("541512") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index d3cb7652d..3ca6dece9 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -137,25 +137,6 @@ internal class ParsedWebhookEventTest { .token("00000000-0000-0000-0000-000000000001") .updateRequest( ParsedWebhookEvent.KybPayload.UpdateRequest.builder() - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( ParsedWebhookEvent.KybPayload.UpdateRequest.Individual.builder() .address( @@ -299,25 +280,6 @@ internal class ParsedWebhookEventTest { .token("00000000-0000-0000-0000-000000000001") .updateRequest( ParsedWebhookEvent.KybPayload.UpdateRequest.builder() - .addBeneficialOwnerEntity( - KybBusinessEntity.builder() - .address( - KybBusinessEntity.Address.builder() - .address1("123 Old Forest Way") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .address2("address2") - .build() - ) - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .addPhoneNumber("+15555555555") - .dbaBusinessName("dba_business_name") - .parentCompany("parent_company") - .build() - ) .addBeneficialOwnerIndividual( ParsedWebhookEvent.KybPayload.UpdateRequest.Individual.builder() .address( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt index 1c50429e1..226aea9fd 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt @@ -94,25 +94,6 @@ internal class AccountHolderServiceAsyncTest { ) .tosTimestamp("2022-03-08T08:00:00Z") .workflow(Kyb.Workflow.KYB_BYO) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("300 Normal Forest Way") - .city("Portland") - .country("USA") - .postalCode("90210") - .state("OR") - .address2("address2") - .build() - ) - .governmentId("98-7654321") - .legalBusinessName("Majority Holdings LLC") - .addPhoneNumber("+15555555555") - .dbaBusinessName("MHoldings") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2022-03-08T08:00:00Z") .naicsCode("541512") @@ -155,28 +136,6 @@ internal class AccountHolderServiceAsyncTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch .builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt index b39ad8b99..1c6db910b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt @@ -94,25 +94,6 @@ internal class AccountHolderServiceTest { ) .tosTimestamp("2022-03-08T08:00:00Z") .workflow(Kyb.Workflow.KYB_BYO) - .addBeneficialOwnerEntity( - Kyb.BusinessEntity.builder() - .address( - Address.builder() - .address1("300 Normal Forest Way") - .city("Portland") - .country("USA") - .postalCode("90210") - .state("OR") - .address2("address2") - .build() - ) - .governmentId("98-7654321") - .legalBusinessName("Majority Holdings LLC") - .addPhoneNumber("+15555555555") - .dbaBusinessName("MHoldings") - .parentCompany("parent_company") - .build() - ) .externalId("external_id") .kybPassedTimestamp("2022-03-08T08:00:00Z") .naicsCode("541512") @@ -152,28 +133,6 @@ internal class AccountHolderServiceTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) .addBeneficialOwnerIndividual( AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch .builder() From e84bda4371688459b68621dfe8defc0688da69bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 2 Mar 2026 23:04:03 +0000 Subject: [PATCH 3/7] feat(api): Add Hold API for financial account fund reservations --- .stats.yml | 4 +- .../lithic/api/models/PaymentCreateParams.kt | 221 +++++++++++++++++- .../api/models/PaymentCreateParamsTest.kt | 16 ++ .../services/async/PaymentServiceAsyncTest.kt | 5 + .../services/blocking/PaymentServiceTest.kt | 5 + 5 files changed, 248 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1cea7b96e..3301005bf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 185 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-df289940d26615072a7c5c9dd4d32b9bc7a86d977642b377c58abbe7a4cb93d0.yml -openapi_spec_hash: 836bb078df7ac5f8d2dd5081c2e833be +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-45bd51c1d7885bde620179da56671e3378571e301528c60975604c4fbaa2c800.yml +openapi_spec_hash: e1355583b829f269875b6f800078a9e0 config_hash: fb5070d41fcabdedbc084b83964b592a diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt index 1769e7802..c23de0e69 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateParams.kt @@ -74,6 +74,14 @@ private constructor( */ fun token(): Optional = body.token() + /** + * Optional hold to settle when this payment is initiated. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun hold(): Optional = body.hold() + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -138,6 +146,13 @@ private constructor( */ fun _token(): JsonField = body._token() + /** + * Returns the raw JSON value of [hold]. + * + * Unlike [hold], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _hold(): JsonField = body._hold() + /** * Returns the raw JSON value of [memo]. * @@ -297,6 +312,17 @@ private constructor( */ fun token(token: JsonField) = apply { body.token(token) } + /** Optional hold to settle when this payment is initiated. */ + fun hold(hold: Hold) = apply { body.hold(hold) } + + /** + * Sets [Builder.hold] to an arbitrary JSON value. + * + * You should usually call [Builder.hold] with a well-typed [Hold] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hold(hold: JsonField) = apply { body.hold(hold) } + fun memo(memo: String) = apply { body.memo(memo) } /** @@ -478,6 +504,7 @@ private constructor( private val methodAttributes: JsonField, private val type: JsonField, private val token: JsonField, + private val hold: JsonField, private val memo: JsonField, private val userDefinedId: JsonField, private val additionalProperties: MutableMap, @@ -498,6 +525,7 @@ private constructor( methodAttributes: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("hold") @ExcludeMissing hold: JsonField = JsonMissing.of(), @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), @JsonProperty("user_defined_id") @ExcludeMissing @@ -510,6 +538,7 @@ private constructor( methodAttributes, type, token, + hold, memo, userDefinedId, mutableMapOf(), @@ -563,6 +592,14 @@ private constructor( */ fun token(): Optional = token.getOptional("token") + /** + * Optional hold to settle when this payment is initiated. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun hold(): Optional = hold.getOptional("hold") + /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -633,6 +670,13 @@ private constructor( */ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + /** + * Returns the raw JSON value of [hold]. + * + * Unlike [hold], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("hold") @ExcludeMissing fun _hold(): JsonField = hold + /** * Returns the raw JSON value of [memo]. * @@ -690,6 +734,7 @@ private constructor( private var methodAttributes: JsonField? = null private var type: JsonField? = null private var token: JsonField = JsonMissing.of() + private var hold: JsonField = JsonMissing.of() private var memo: JsonField = JsonMissing.of() private var userDefinedId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -703,6 +748,7 @@ private constructor( methodAttributes = createPaymentRequest.methodAttributes type = createPaymentRequest.type token = createPaymentRequest.token + hold = createPaymentRequest.hold memo = createPaymentRequest.memo userDefinedId = createPaymentRequest.userDefinedId additionalProperties = createPaymentRequest.additionalProperties.toMutableMap() @@ -799,6 +845,18 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } + /** Optional hold to settle when this payment is initiated. */ + fun hold(hold: Hold) = hold(JsonField.of(hold)) + + /** + * Sets [Builder.hold] to an arbitrary JSON value. + * + * You should usually call [Builder.hold] with a well-typed [Hold] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun hold(hold: JsonField) = apply { this.hold = hold } + fun memo(memo: String) = memo(JsonField.of(memo)) /** @@ -868,6 +926,7 @@ private constructor( checkRequired("methodAttributes", methodAttributes), checkRequired("type", type), token, + hold, memo, userDefinedId, additionalProperties.toMutableMap(), @@ -888,6 +947,7 @@ private constructor( methodAttributes().validate() type().validate() token() + hold().ifPresent { it.validate() } memo() userDefinedId() validated = true @@ -916,6 +976,7 @@ private constructor( (methodAttributes.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (token.asKnown().isPresent) 1 else 0) + + (hold.asKnown().getOrNull()?.validity() ?: 0) + (if (memo.asKnown().isPresent) 1 else 0) + (if (userDefinedId.asKnown().isPresent) 1 else 0) @@ -932,6 +993,7 @@ private constructor( methodAttributes == other.methodAttributes && type == other.type && token == other.token && + hold == other.hold && memo == other.memo && userDefinedId == other.userDefinedId && additionalProperties == other.additionalProperties @@ -946,6 +1008,7 @@ private constructor( methodAttributes, type, token, + hold, memo, userDefinedId, additionalProperties, @@ -955,7 +1018,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CreatePaymentRequest{amount=$amount, externalBankAccountToken=$externalBankAccountToken, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, type=$type, token=$token, memo=$memo, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" + "CreatePaymentRequest{amount=$amount, externalBankAccountToken=$externalBankAccountToken, financialAccountToken=$financialAccountToken, method=$method, methodAttributes=$methodAttributes, type=$type, token=$token, hold=$hold, memo=$memo, userDefinedId=$userDefinedId, additionalProperties=$additionalProperties}" } class Method @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1586,6 +1649,162 @@ private constructor( override fun toString() = value.toString() } + /** Optional hold to settle when this payment is initiated. */ + class Hold + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val token: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of() + ) : this(token, mutableMapOf()) + + /** + * Token of the hold to settle when this payment is initiated. + * + * @throws LithicInvalidDataException 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 token(): String = token.getRequired("token") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + @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 [Hold]. + * + * The following fields are required: + * ```java + * .token() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Hold]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(hold: Hold) = apply { + token = hold.token + additionalProperties = hold.additionalProperties.toMutableMap() + } + + /** Token of the hold to settle when this payment is initiated. */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + 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 [Hold]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Hold = + Hold(checkRequired("token", token), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Hold = apply { + if (validated) { + return@apply + } + + token() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + 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 (token.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Hold && + token == other.token && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(token, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "Hold{token=$token, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt index 5538ea9dd..f94636cda 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateParamsTest.kt @@ -23,6 +23,11 @@ internal class PaymentCreateParamsTest { ) .type(PaymentCreateParams.Type.COLLECTION) .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .hold( + PaymentCreateParams.Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .memo("memo") .userDefinedId("user_defined_id") .build() @@ -45,6 +50,11 @@ internal class PaymentCreateParamsTest { ) .type(PaymentCreateParams.Type.COLLECTION) .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .hold( + PaymentCreateParams.Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .memo("memo") .userDefinedId("user_defined_id") .build() @@ -66,6 +76,12 @@ internal class PaymentCreateParamsTest { ) assertThat(body.type()).isEqualTo(PaymentCreateParams.Type.COLLECTION) assertThat(body.token()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.hold()) + .contains( + PaymentCreateParams.Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) assertThat(body.memo()).contains("memo") assertThat(body.userDefinedId()).contains("user_defined_id") } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt index 5d724cdda..df3aafba1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt @@ -42,6 +42,11 @@ internal class PaymentServiceAsyncTest { ) .type(PaymentCreateParams.Type.COLLECTION) .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .hold( + PaymentCreateParams.Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .memo("memo") .userDefinedId("user_defined_id") .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt index 4f8b9f9a1..82d833e09 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt @@ -42,6 +42,11 @@ internal class PaymentServiceTest { ) .type(PaymentCreateParams.Type.COLLECTION) .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .hold( + PaymentCreateParams.Hold.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) .memo("memo") .userDefinedId("user_defined_id") .build() From e6b968b0729d68b7b59b4044cb5beac9a97fddda Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 01:44:20 +0000 Subject: [PATCH 4/7] chore(internal): codegen related update From 3ae36b7a76645ec06a70c590f1023bfc413fc88a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 3 Mar 2026 22:11:51 +0000 Subject: [PATCH 5/7] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3301005bf..4f6a4f909 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 185 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-45bd51c1d7885bde620179da56671e3378571e301528c60975604c4fbaa2c800.yml -openapi_spec_hash: e1355583b829f269875b6f800078a9e0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-ee8607f0a2cdcaee420935050334a439db8dd097be83023fccdaf1d6f9a7de14.yml +openapi_spec_hash: 0f21c68cdddb7c5bd99f42356d507393 config_hash: fb5070d41fcabdedbc084b83964b592a From c3087996b1eded5d7072dcc496a25eb1a8a4cfd2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:05:22 +0000 Subject: [PATCH 6/7] chore(internal): codegen related update --- buildSrc/src/main/kotlin/lithic.java.gradle.kts | 2 +- .../com/lithic/api/core/http/RetryingHttpClient.kt | 9 ++------- scripts/mock | 13 ++++++++++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/lithic.java.gradle.kts b/buildSrc/src/main/kotlin/lithic.java.gradle.kts index 70fc33f41..8f4f902a6 100644 --- a/buildSrc/src/main/kotlin/lithic.java.gradle.kts +++ b/buildSrc/src/main/kotlin/lithic.java.gradle.kts @@ -45,7 +45,7 @@ tasks.withType().configureEach { val palantir by configurations.creating dependencies { - palantir("com.palantir.javaformat:palantir-java-format:2.73.0") + palantir("com.palantir.javaformat:palantir-java-format:2.89.0") } fun registerPalantir( diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt index a70bc12c2..733b9370a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/http/RetryingHttpClient.kt @@ -214,13 +214,8 @@ private constructor( } } ?.let { retryAfterNanos -> - // If the API asks us to wait a certain amount of time (and it's a reasonable - // amount), just - // do what it says. - val retryAfter = Duration.ofNanos(retryAfterNanos.toLong()) - if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) { - return retryAfter - } + // If the API asks us to wait a certain amount of time, do what it says. + return Duration.ofNanos(retryAfterNanos.toLong()) } // Apply exponential backoff, but not more than the max. diff --git a/scripts/mock b/scripts/mock index 0b28f6ea2..bcf3b392b 100755 --- a/scripts/mock +++ b/scripts/mock @@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}" # Run prism mock on the given spec if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version + npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - # Wait for server to come online + # Wait for server to come online (max 30s) echo -n "Waiting for server" + attempts=0 while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Prism server to start" + cat .prism.log + exit 1 + fi echo -n "." sleep 0.1 done From 5e3ae6dd6da7283f12bdf36d959caa2d7b1156cf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 5 Mar 2026 13:05:51 +0000 Subject: [PATCH 7/7] release: 0.119.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 16 ++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 617f75025..124b9841a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.118.0" + ".": "0.119.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index cb92ee630..afbe3e6a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 0.119.0 (2026-03-05) + +Full Changelog: [v0.118.0...v0.119.0](https://github.com/lithic-com/lithic-java/compare/v0.118.0...v0.119.0) + +### Features + +* **api:** add action_counts to rule performance reports and code to authorization actions ([20e681f](https://github.com/lithic-com/lithic-java/commit/20e681f87cc67eb4aaad477acf4f5a00ef664834)) +* **api:** Add Hold API for financial account fund reservations ([e84bda4](https://github.com/lithic-com/lithic-java/commit/e84bda4371688459b68621dfe8defc0688da69bd)) +* **api:** Remove deprecated beneficial owner entities field ([9208b91](https://github.com/lithic-com/lithic-java/commit/9208b918e410d7829e59cba6e43304eb0f3489b3)) + + +### Chores + +* **internal:** codegen related update ([c308799](https://github.com/lithic-com/lithic-java/commit/c3087996b1eded5d7072dcc496a25eb1a8a4cfd2)) +* **internal:** codegen related update ([e6b968b](https://github.com/lithic-com/lithic-java/commit/e6b968b0729d68b7b59b4044cb5beac9a97fddda)) + ## 0.118.0 (2026-02-27) Full Changelog: [v0.117.0...v0.118.0](https://github.com/lithic-com/lithic-java/compare/v0.117.0...v0.118.0) diff --git a/README.md b/README.md index dfe23ed44..cd00fb363 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.118.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.118.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.118.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.119.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.119.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.119.0) @@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.118.0). +The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.119.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.118.0") +implementation("com.lithic.api:lithic-java:0.119.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.118.0") com.lithic.api lithic-java - 0.118.0 + 0.119.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 433e6f126..322e98c9b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.118.0" // x-release-please-version + version = "0.119.0" // x-release-please-version } subprojects {