diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 508a7081b..19c0e9cca 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.103.0"
+ ".": "0.104.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index bfde9d73c..829e46b33 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 169
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-117e0ee9b030a2efc3b09e189e445fb1a26fd32f1c563f385b9d7071a959c550.yml
-openapi_spec_hash: e529a3fa8c3a79d3664db391683334c3
-config_hash: 22e4b128e110e2767daa9d95428ebf9d
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-1d44bb7fad99487af1161eb24dfd5369440eda7e80ed237cbc1acc6802a7d212.yml
+openapi_spec_hash: 1b6b6215b60094b76b91c56b925a251a
+config_hash: ac676e77c8ca051c7aad978c26e96345
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e96859fd2..1b01a30fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.104.0 (2025-09-09)
+
+Full Changelog: [v0.103.0...v0.104.0](https://github.com/lithic-com/lithic-java/compare/v0.103.0...v0.104.0)
+
+### Features
+
+* **api:** adds support for unpauseing external bank accounts ([1dadb0f](https://github.com/lithic-com/lithic-java/commit/1dadb0f3e894c3ab7c38bf263e6974e81381d971))
+
## 0.103.0 (2025-09-03)
Full Changelog: [v0.102.2...v0.103.0](https://github.com/lithic-com/lithic-java/compare/v0.102.2...v0.103.0)
diff --git a/README.md b/README.md
index cef9e62fb..622f13707 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.103.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.103.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.104.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.104.0)
@@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc
-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.103.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.104.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.103.0")
+implementation("com.lithic.api:lithic-java:0.104.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.103.0")
com.lithic.api
lithic-java
- 0.103.0
+ 0.104.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index c51a2cf97..f72139c39 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.103.0" // x-release-please-version
+ version = "0.104.0" // x-release-please-version
}
subprojects {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
index 5bdb4b636..821c4fe1d 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
@@ -8,7 +8,6 @@ import com.lithic.api.core.JsonField
import com.lithic.api.core.Params
import com.lithic.api.core.http.Headers
import com.lithic.api.core.http.QueryParams
-import com.lithic.api.core.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
@@ -27,9 +26,9 @@ private constructor(
private val endingBefore: String?,
private val financialAccountToken: String?,
private val pageSize: Long?,
- private val result: List?,
+ private val result: Result?,
private val startingAfter: String?,
- private val status: List?,
+ private val status: Status?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -68,7 +67,7 @@ private constructor(
fun pageSize(): Optional = Optional.ofNullable(pageSize)
/** Filter by transaction result */
- fun result(): Optional> = Optional.ofNullable(result)
+ fun result(): Optional = Optional.ofNullable(result)
/**
* A cursor representing an item's token after which a page of results should begin. Used to
@@ -77,7 +76,7 @@ private constructor(
fun startingAfter(): Optional = Optional.ofNullable(startingAfter)
/** Filter by transaction status */
- fun status(): Optional> = Optional.ofNullable(status)
+ fun status(): Optional = Optional.ofNullable(status)
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -108,9 +107,9 @@ private constructor(
private var endingBefore: String? = null
private var financialAccountToken: String? = null
private var pageSize: Long? = null
- private var result: MutableList? = null
+ private var result: Result? = null
private var startingAfter: String? = null
- private var status: MutableList? = null
+ private var status: Status? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -124,9 +123,9 @@ private constructor(
endingBefore = accountActivityListParams.endingBefore
financialAccountToken = accountActivityListParams.financialAccountToken
pageSize = accountActivityListParams.pageSize
- result = accountActivityListParams.result?.toMutableList()
+ result = accountActivityListParams.result
startingAfter = accountActivityListParams.startingAfter
- status = accountActivityListParams.status?.toMutableList()
+ status = accountActivityListParams.status
additionalHeaders = accountActivityListParams.additionalHeaders.toBuilder()
additionalQueryParams = accountActivityListParams.additionalQueryParams.toBuilder()
}
@@ -208,19 +207,10 @@ private constructor(
fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull())
/** Filter by transaction result */
- fun result(result: List?) = apply { this.result = result?.toMutableList() }
+ fun result(result: Result?) = apply { this.result = result }
/** Alias for calling [Builder.result] with `result.orElse(null)`. */
- fun result(result: Optional>) = result(result.getOrNull())
-
- /**
- * Adds a single [Result] to [Builder.result].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addResult(result: Result) = apply {
- this.result = (this.result ?: mutableListOf()).apply { add(result) }
- }
+ fun result(result: Optional) = result(result.getOrNull())
/**
* A cursor representing an item's token after which a page of results should begin. Used to
@@ -233,19 +223,10 @@ private constructor(
startingAfter(startingAfter.getOrNull())
/** Filter by transaction status */
- fun status(status: List?) = apply { this.status = status?.toMutableList() }
+ fun status(status: Status?) = apply { this.status = status }
/** Alias for calling [Builder.status] with `status.orElse(null)`. */
- fun status(status: Optional>) = status(status.getOrNull())
-
- /**
- * Adds a single [Status] to [Builder.status].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addStatus(status: Status) = apply {
- this.status = (this.status ?: mutableListOf()).apply { add(status) }
- }
+ fun status(status: Optional) = status(status.getOrNull())
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
@@ -360,9 +341,9 @@ private constructor(
endingBefore,
financialAccountToken,
pageSize,
- result?.toImmutable(),
+ result,
startingAfter,
- status?.toImmutable(),
+ status,
additionalHeaders.build(),
additionalQueryParams.build(),
)
@@ -381,9 +362,9 @@ private constructor(
endingBefore?.let { put("ending_before", it) }
financialAccountToken?.let { put("financial_account_token", it) }
pageSize?.let { put("page_size", it.toString()) }
- result?.let { put("result", it.joinToString(",") { it.toString() }) }
+ result?.let { put("result", it.toString()) }
startingAfter?.let { put("starting_after", it) }
- status?.let { put("status", it.joinToString(",") { it.toString() }) }
+ status?.let { put("status", it.toString()) }
putAll(additionalQueryParams)
}
.build()
@@ -585,6 +566,7 @@ private constructor(
override fun toString() = value.toString()
}
+ /** Filter by transaction result */
class Result @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -710,6 +692,7 @@ private constructor(
override fun toString() = value.toString()
}
+ /** Filter by transaction status */
class Status @JsonCreator private constructor(private val value: JsonField) : Enum {
/**
@@ -730,14 +713,14 @@ private constructor(
@JvmField val PENDING = of("PENDING")
- @JvmField val SETTLED = of("SETTLED")
-
- @JvmField val VOIDED = of("VOIDED")
-
@JvmField val RETURNED = of("RETURNED")
@JvmField val REVERSED = of("REVERSED")
+ @JvmField val SETTLED = of("SETTLED")
+
+ @JvmField val VOIDED = of("VOIDED")
+
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
}
@@ -746,10 +729,10 @@ private constructor(
DECLINED,
EXPIRED,
PENDING,
- SETTLED,
- VOIDED,
RETURNED,
REVERSED,
+ SETTLED,
+ VOIDED,
}
/**
@@ -765,10 +748,10 @@ private constructor(
DECLINED,
EXPIRED,
PENDING,
- SETTLED,
- VOIDED,
RETURNED,
REVERSED,
+ SETTLED,
+ VOIDED,
/** An enum member indicating that [Status] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -785,10 +768,10 @@ private constructor(
DECLINED -> Value.DECLINED
EXPIRED -> Value.EXPIRED
PENDING -> Value.PENDING
- SETTLED -> Value.SETTLED
- VOIDED -> Value.VOIDED
RETURNED -> Value.RETURNED
REVERSED -> Value.REVERSED
+ SETTLED -> Value.SETTLED
+ VOIDED -> Value.VOIDED
else -> Value._UNKNOWN
}
@@ -806,10 +789,10 @@ private constructor(
DECLINED -> Known.DECLINED
EXPIRED -> Known.EXPIRED
PENDING -> Known.PENDING
- SETTLED -> Known.SETTLED
- VOIDED -> Known.VOIDED
RETURNED -> Known.RETURNED
REVERSED -> Known.REVERSED
+ SETTLED -> Known.SETTLED
+ VOIDED -> Known.VOIDED
else -> throw LithicInvalidDataException("Unknown Status: $value")
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt
index 44946bf62..15d085c07 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt
@@ -498,6 +498,7 @@ private constructor(
class ApplyAuthRuleRequestAccountTokens
private constructor(
private val accountTokens: JsonField>,
+ private val businessAccountTokens: JsonField>,
private val additionalProperties: MutableMap,
) {
@@ -505,17 +506,29 @@ private constructor(
private constructor(
@JsonProperty("account_tokens")
@ExcludeMissing
- accountTokens: JsonField> = JsonMissing.of()
- ) : this(accountTokens, mutableMapOf())
+ accountTokens: JsonField> = JsonMissing.of(),
+ @JsonProperty("business_account_tokens")
+ @ExcludeMissing
+ businessAccountTokens: JsonField> = JsonMissing.of(),
+ ) : this(accountTokens, businessAccountTokens, mutableMapOf())
/**
* Account tokens to which the Auth Rule applies.
*
- * @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 accountTokens(): Optional> =
+ accountTokens.getOptional("account_tokens")
+
+ /**
+ * Business Account tokens to which the Auth Rule applies.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
*/
- fun accountTokens(): List = accountTokens.getRequired("account_tokens")
+ fun businessAccountTokens(): Optional> =
+ businessAccountTokens.getOptional("business_account_tokens")
/**
* Returns the raw JSON value of [accountTokens].
@@ -527,6 +540,16 @@ private constructor(
@ExcludeMissing
fun _accountTokens(): JsonField> = accountTokens
+ /**
+ * Returns the raw JSON value of [businessAccountTokens].
+ *
+ * Unlike [businessAccountTokens], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("business_account_tokens")
+ @ExcludeMissing
+ fun _businessAccountTokens(): JsonField> = businessAccountTokens
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -544,11 +567,6 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
* [ApplyAuthRuleRequestAccountTokens].
- *
- * The following fields are required:
- * ```java
- * .accountTokens()
- * ```
*/
@JvmStatic fun builder() = Builder()
}
@@ -557,6 +575,7 @@ private constructor(
class Builder internal constructor() {
private var accountTokens: JsonField>? = null
+ private var businessAccountTokens: JsonField>? = null
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -565,6 +584,10 @@ private constructor(
) = apply {
accountTokens =
applyAuthRuleRequestAccountTokens.accountTokens.map { it.toMutableList() }
+ businessAccountTokens =
+ applyAuthRuleRequestAccountTokens.businessAccountTokens.map {
+ it.toMutableList()
+ }
additionalProperties =
applyAuthRuleRequestAccountTokens.additionalProperties.toMutableMap()
}
@@ -596,6 +619,33 @@ private constructor(
}
}
+ /** Business Account tokens to which the Auth Rule applies. */
+ fun businessAccountTokens(businessAccountTokens: List) =
+ businessAccountTokens(JsonField.of(businessAccountTokens))
+
+ /**
+ * Sets [Builder.businessAccountTokens] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.businessAccountTokens] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun businessAccountTokens(businessAccountTokens: JsonField>) = apply {
+ this.businessAccountTokens = businessAccountTokens.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [businessAccountTokens].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addBusinessAccountToken(businessAccountToken: String) = apply {
+ businessAccountTokens =
+ (businessAccountTokens ?: JsonField.of(mutableListOf())).also {
+ checkKnown("businessAccountTokens", it).add(businessAccountToken)
+ }
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -622,17 +672,11 @@ private constructor(
* Returns an immutable instance of [ApplyAuthRuleRequestAccountTokens].
*
* Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .accountTokens()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
*/
fun build(): ApplyAuthRuleRequestAccountTokens =
ApplyAuthRuleRequestAccountTokens(
- checkRequired("accountTokens", accountTokens).map { it.toImmutable() },
+ (accountTokens ?: JsonMissing.of()).map { it.toImmutable() },
+ (businessAccountTokens ?: JsonMissing.of()).map { it.toImmutable() },
additionalProperties.toMutableMap(),
)
}
@@ -645,6 +689,7 @@ private constructor(
}
accountTokens()
+ businessAccountTokens()
validated = true
}
@@ -663,7 +708,9 @@ private constructor(
* Used for best match union deserialization.
*/
@JvmSynthetic
- internal fun validity(): Int = (accountTokens.asKnown().getOrNull()?.size ?: 0)
+ internal fun validity(): Int =
+ (accountTokens.asKnown().getOrNull()?.size ?: 0) +
+ (businessAccountTokens.asKnown().getOrNull()?.size ?: 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -672,15 +719,18 @@ private constructor(
return other is ApplyAuthRuleRequestAccountTokens &&
accountTokens == other.accountTokens &&
+ businessAccountTokens == other.businessAccountTokens &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(accountTokens, additionalProperties) }
+ private val hashCode: Int by lazy {
+ Objects.hash(accountTokens, businessAccountTokens, additionalProperties)
+ }
override fun hashCode(): Int = hashCode
override fun toString() =
- "ApplyAuthRuleRequestAccountTokens{accountTokens=$accountTokens, additionalProperties=$additionalProperties}"
+ "ApplyAuthRuleRequestAccountTokens{accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, additionalProperties=$additionalProperties}"
}
class ApplyAuthRuleRequestCardTokens
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt
index badd04900..00e4b9b98 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2BacktestCreateParams.kt
@@ -36,7 +36,7 @@ import kotlin.jvm.optionals.getOrNull
* backtest reports on-demand through the
* `/v2/auth_rules/{auth_rule_token}/backtests/{auth_rule_backtest_token}` endpoint.
*
- * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / `CONDITIONAL_3DS_ACTION` rules.
+ * Lithic currently supports backtesting for `CONDITIONAL_BLOCK` / `CONDITIONAL_ACTION` rules.
* Backtesting for `VELOCITY_LIMIT` rules is generally not supported. In specific cases (i.e. where
* Lithic has pre-calculated the requested velocity metrics for historical transactions), a backtest
* may be feasible. However, such cases are uncommon and customers should not anticipate support for
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
index 1f7ae4040..9efad1fd0 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
@@ -482,6 +482,8 @@ private constructor(
class CreateAuthRuleRequestAccountTokens
private constructor(
private val accountTokens: JsonField>,
+ private val businessAccountTokens: JsonField>,
+ private val eventStream: JsonField,
private val name: JsonField,
private val parameters: JsonField,
private val type: JsonField,
@@ -493,6 +495,12 @@ private constructor(
@JsonProperty("account_tokens")
@ExcludeMissing
accountTokens: JsonField> = JsonMissing.of(),
+ @JsonProperty("business_account_tokens")
+ @ExcludeMissing
+ businessAccountTokens: JsonField> = JsonMissing.of(),
+ @JsonProperty("event_stream")
+ @ExcludeMissing
+ eventStream: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
@JsonProperty("parameters")
@ExcludeMissing
@@ -500,16 +508,41 @@ private constructor(
@JsonProperty("type")
@ExcludeMissing
type: JsonField = JsonMissing.of(),
- ) : this(accountTokens, name, parameters, type, mutableMapOf())
+ ) : this(
+ accountTokens,
+ businessAccountTokens,
+ eventStream,
+ name,
+ parameters,
+ type,
+ mutableMapOf(),
+ )
/**
* Account tokens to which the Auth Rule applies.
*
- * @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 accountTokens(): Optional> =
+ accountTokens.getOptional("account_tokens")
+
+ /**
+ * Business Account tokens to which the Auth Rule applies.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun businessAccountTokens(): Optional> =
+ businessAccountTokens.getOptional("business_account_tokens")
+
+ /**
+ * The event stream during which the rule will be evaluated.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
*/
- fun accountTokens(): List = accountTokens.getRequired("account_tokens")
+ fun eventStream(): Optional = eventStream.getOptional("event_stream")
/**
* Auth Rule Name
@@ -528,12 +561,13 @@ private constructor(
fun parameters(): Optional = parameters.getOptional("parameters")
/**
- * The type of Auth Rule. Effectively determines the event stream during which it will
- * be evaluated.
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of several
+ * event streams, the effective one is defined by the separate `event_stream` field.
* - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
*
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -550,6 +584,26 @@ private constructor(
@ExcludeMissing
fun _accountTokens(): JsonField> = accountTokens
+ /**
+ * Returns the raw JSON value of [businessAccountTokens].
+ *
+ * Unlike [businessAccountTokens], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("business_account_tokens")
+ @ExcludeMissing
+ fun _businessAccountTokens(): JsonField> = businessAccountTokens
+
+ /**
+ * Returns the raw JSON value of [eventStream].
+ *
+ * Unlike [eventStream], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("event_stream")
+ @ExcludeMissing
+ fun _eventStream(): JsonField = eventStream
+
/**
* Returns the raw JSON value of [name].
*
@@ -591,11 +645,6 @@ private constructor(
/**
* Returns a mutable builder for constructing an instance of
* [CreateAuthRuleRequestAccountTokens].
- *
- * The following fields are required:
- * ```java
- * .accountTokens()
- * ```
*/
@JvmStatic fun builder() = Builder()
}
@@ -604,6 +653,8 @@ private constructor(
class Builder internal constructor() {
private var accountTokens: JsonField>? = null
+ private var businessAccountTokens: JsonField>? = null
+ private var eventStream: JsonField = JsonMissing.of()
private var name: JsonField = JsonMissing.of()
private var parameters: JsonField = JsonMissing.of()
private var type: JsonField = JsonMissing.of()
@@ -615,6 +666,11 @@ private constructor(
) = apply {
accountTokens =
createAuthRuleRequestAccountTokens.accountTokens.map { it.toMutableList() }
+ businessAccountTokens =
+ createAuthRuleRequestAccountTokens.businessAccountTokens.map {
+ it.toMutableList()
+ }
+ eventStream = createAuthRuleRequestAccountTokens.eventStream
name = createAuthRuleRequestAccountTokens.name
parameters = createAuthRuleRequestAccountTokens.parameters
type = createAuthRuleRequestAccountTokens.type
@@ -649,6 +705,47 @@ private constructor(
}
}
+ /** Business Account tokens to which the Auth Rule applies. */
+ fun businessAccountTokens(businessAccountTokens: List) =
+ businessAccountTokens(JsonField.of(businessAccountTokens))
+
+ /**
+ * Sets [Builder.businessAccountTokens] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.businessAccountTokens] with a well-typed
+ * `List` value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun businessAccountTokens(businessAccountTokens: JsonField>) = apply {
+ this.businessAccountTokens = businessAccountTokens.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [businessAccountTokens].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addBusinessAccountToken(businessAccountToken: String) = apply {
+ businessAccountTokens =
+ (businessAccountTokens ?: JsonField.of(mutableListOf())).also {
+ checkKnown("businessAccountTokens", it).add(businessAccountToken)
+ }
+ }
+
+ /** The event stream during which the rule will be evaluated. */
+ fun eventStream(eventStream: EventStream) = eventStream(JsonField.of(eventStream))
+
+ /**
+ * Sets [Builder.eventStream] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.eventStream] with a well-typed [EventStream]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun eventStream(eventStream: JsonField) = apply {
+ this.eventStream = eventStream
+ }
+
/** Auth Rule Name */
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -706,12 +803,26 @@ private constructor(
parameters(Parameters.ofConditional3dsAction(conditional3dsAction))
/**
- * The type of Auth Rule. Effectively determines the event stream during which it
- * will be evaluated.
+ * Alias for calling [parameters] with
+ * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`.
+ */
+ fun parameters(
+ conditionalAuthorizationAction:
+ Parameters.ConditionalAuthorizationActionParameters
+ ) =
+ parameters(
+ Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)
+ )
+
+ /**
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of
+ * several event streams, the effective one is defined by the separate
+ * `event_stream` field.
* - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
*/
fun type(type: AuthRuleType) = type(JsonField.of(type))
@@ -750,17 +861,12 @@ private constructor(
* Returns an immutable instance of [CreateAuthRuleRequestAccountTokens].
*
* Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .accountTokens()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
*/
fun build(): CreateAuthRuleRequestAccountTokens =
CreateAuthRuleRequestAccountTokens(
- checkRequired("accountTokens", accountTokens).map { it.toImmutable() },
+ (accountTokens ?: JsonMissing.of()).map { it.toImmutable() },
+ (businessAccountTokens ?: JsonMissing.of()).map { it.toImmutable() },
+ eventStream,
name,
parameters,
type,
@@ -776,6 +882,8 @@ private constructor(
}
accountTokens()
+ businessAccountTokens()
+ eventStream().ifPresent { it.validate() }
name()
parameters().ifPresent { it.validate() }
type().ifPresent { it.validate() }
@@ -799,10 +907,145 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(accountTokens.asKnown().getOrNull()?.size ?: 0) +
+ (businessAccountTokens.asKnown().getOrNull()?.size ?: 0) +
+ (eventStream.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(parameters.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
+ /** The event stream during which the rule will be evaluated. */
+ class EventStream
+ @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 AUTHORIZATION = of("AUTHORIZATION")
+
+ @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION")
+
+ @JvmStatic fun of(value: String) = EventStream(JsonField.of(value))
+ }
+
+ /** An enum containing [EventStream]'s known values. */
+ enum class Known {
+ AUTHORIZATION,
+ THREE_DS_AUTHENTICATION,
+ }
+
+ /**
+ * An enum containing [EventStream]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EventStream] 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 {
+ AUTHORIZATION,
+ THREE_DS_AUTHENTICATION,
+ /**
+ * An enum member indicating that [EventStream] 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) {
+ AUTHORIZATION -> Value.AUTHORIZATION
+ THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION
+ 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) {
+ AUTHORIZATION -> Known.AUTHORIZATION
+ THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION
+ else -> throw LithicInvalidDataException("Unknown EventStream: $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(): EventStream = 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 EventStream && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
/** Parameters for the Auth Rule */
@JsonDeserialize(using = Parameters.Deserializer::class)
@JsonSerialize(using = Parameters.Serializer::class)
@@ -812,6 +1055,9 @@ private constructor(
private val velocityLimitParams: VelocityLimitParams? = null,
private val merchantLock: MerchantLockParameters? = null,
private val conditional3dsAction: Conditional3dsActionParameters? = null,
+ private val conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters? =
+ null,
private val _json: JsonValue? = null,
) {
@@ -827,6 +1073,10 @@ private constructor(
fun conditional3dsAction(): Optional =
Optional.ofNullable(conditional3dsAction)
+ fun conditionalAuthorizationAction():
+ Optional =
+ Optional.ofNullable(conditionalAuthorizationAction)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
@@ -835,6 +1085,9 @@ private constructor(
fun isConditional3dsAction(): Boolean = conditional3dsAction != null
+ fun isConditionalAuthorizationAction(): Boolean =
+ conditionalAuthorizationAction != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
@@ -847,6 +1100,9 @@ private constructor(
fun asConditional3dsAction(): Conditional3dsActionParameters =
conditional3dsAction.getOrThrow("conditional3dsAction")
+ fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters =
+ conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -857,6 +1113,10 @@ private constructor(
merchantLock != null -> visitor.visitMerchantLock(merchantLock)
conditional3dsAction != null ->
visitor.visitConditional3dsAction(conditional3dsAction)
+ conditionalAuthorizationAction != null ->
+ visitor.visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction
+ )
else -> visitor.unknown(_json)
}
@@ -890,6 +1150,13 @@ private constructor(
) {
conditional3dsAction.validate()
}
+
+ override fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters
+ ) {
+ conditionalAuthorizationAction.validate()
+ }
}
)
validated = true
@@ -928,6 +1195,11 @@ private constructor(
conditional3dsAction: Conditional3dsActionParameters
) = conditional3dsAction.validity()
+ override fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters
+ ) = conditionalAuthorizationAction.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -941,7 +1213,8 @@ private constructor(
conditionalBlock == other.conditionalBlock &&
velocityLimitParams == other.velocityLimitParams &&
merchantLock == other.merchantLock &&
- conditional3dsAction == other.conditional3dsAction
+ conditional3dsAction == other.conditional3dsAction &&
+ conditionalAuthorizationAction == other.conditionalAuthorizationAction
}
override fun hashCode(): Int =
@@ -950,6 +1223,7 @@ private constructor(
velocityLimitParams,
merchantLock,
conditional3dsAction,
+ conditionalAuthorizationAction,
)
override fun toString(): String =
@@ -960,6 +1234,8 @@ private constructor(
merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
conditional3dsAction != null ->
"Parameters{conditional3dsAction=$conditional3dsAction}"
+ conditionalAuthorizationAction != null ->
+ "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -982,6 +1258,11 @@ private constructor(
fun ofConditional3dsAction(
conditional3dsAction: Conditional3dsActionParameters
) = Parameters(conditional3dsAction = conditional3dsAction)
+
+ @JvmStatic
+ fun ofConditionalAuthorizationAction(
+ conditionalAuthorizationAction: ConditionalAuthorizationActionParameters
+ ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction)
}
/**
@@ -1000,6 +1281,10 @@ private constructor(
conditional3dsAction: Conditional3dsActionParameters
): T
+ fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction: ConditionalAuthorizationActionParameters
+ ): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -1040,6 +1325,18 @@ private constructor(
?.let {
Parameters(conditional3dsAction = it, _json = json)
},
+ tryDeserialize(
+ node,
+ jacksonTypeRef<
+ ConditionalAuthorizationActionParameters
+ >(),
+ )
+ ?.let {
+ Parameters(
+ conditionalAuthorizationAction = it,
+ _json = json,
+ )
+ },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -1073,71 +1370,1533 @@ private constructor(
value.merchantLock != null -> generator.writeObject(value.merchantLock)
value.conditional3dsAction != null ->
generator.writeObject(value.conditional3dsAction)
+ value.conditionalAuthorizationAction != null ->
+ generator.writeObject(value.conditionalAuthorizationAction)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
- }
- /**
- * The type of Auth Rule. Effectively determines the event stream during which it will
- * be evaluated.
- * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
- * - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
- * - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
- */
- class AuthRuleType
- @JsonCreator
- private constructor(private val value: JsonField) : Enum {
+ class ConditionalAuthorizationActionParameters
+ private constructor(
+ private val action: JsonField,
+ private val conditions: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("action")
+ @ExcludeMissing
+ action: JsonField = JsonMissing.of(),
+ @JsonProperty("conditions")
+ @ExcludeMissing
+ conditions: JsonField> = JsonMissing.of(),
+ ) : this(action, conditions, mutableMapOf())
- /**
- * 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
+ /**
+ * The action to take if the conditions are met.
+ *
+ * @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 action(): Action = action.getRequired("action")
- companion object {
+ /**
+ * @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 conditions(): List = conditions.getRequired("conditions")
- @JvmField val CONDITIONAL_BLOCK = of("CONDITIONAL_BLOCK")
+ /**
+ * Returns the raw JSON value of [action].
+ *
+ * Unlike [action], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("action")
+ @ExcludeMissing
+ fun _action(): JsonField = action
- @JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT")
+ /**
+ * Returns the raw JSON value of [conditions].
+ *
+ * Unlike [conditions], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("conditions")
+ @ExcludeMissing
+ fun _conditions(): JsonField> = conditions
- @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
- @JvmField val CONDITIONAL_3DS_ACTION = of("CONDITIONAL_3DS_ACTION")
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of
+ * [ConditionalAuthorizationActionParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .action()
+ * .conditions()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
- @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
- }
+ /** A builder for [ConditionalAuthorizationActionParameters]. */
+ class Builder internal constructor() {
+
+ private var action: JsonField? = null
+ private var conditions: JsonField>? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ conditionalAuthorizationActionParameters:
+ ConditionalAuthorizationActionParameters
+ ) = apply {
+ action = conditionalAuthorizationActionParameters.action
+ conditions =
+ conditionalAuthorizationActionParameters.conditions.map {
+ it.toMutableList()
+ }
+ additionalProperties =
+ conditionalAuthorizationActionParameters.additionalProperties
+ .toMutableMap()
+ }
- /** An enum containing [AuthRuleType]'s known values. */
- enum class Known {
- CONDITIONAL_BLOCK,
- VELOCITY_LIMIT,
- MERCHANT_LOCK,
- CONDITIONAL_3DS_ACTION,
- }
+ /** The action to take if the conditions are met. */
+ fun action(action: Action) = action(JsonField.of(action))
+
+ /**
+ * Sets [Builder.action] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.action] with a well-typed [Action] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun action(action: JsonField) = apply { this.action = action }
+
+ fun conditions(conditions: List) =
+ conditions(JsonField.of(conditions))
+
+ /**
+ * Sets [Builder.conditions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.conditions] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun conditions(conditions: JsonField>) = apply {
+ this.conditions = conditions.map { it.toMutableList() }
+ }
- /**
- * An enum containing [AuthRuleType]'s known values, as well as an [_UNKNOWN]
- * member.
- *
- * An instance of [AuthRuleType] 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 {
+ /**
+ * Adds a single [Condition] to [conditions].
+ *
+ * @throws IllegalStateException if the field was previously set to a
+ * non-list.
+ */
+ fun addCondition(condition: Condition) = apply {
+ conditions =
+ (conditions ?: JsonField.of(mutableListOf())).also {
+ checkKnown("conditions", it).add(condition)
+ }
+ }
+
+ 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
+ * [ConditionalAuthorizationActionParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .action()
+ * .conditions()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ConditionalAuthorizationActionParameters =
+ ConditionalAuthorizationActionParameters(
+ checkRequired("action", action),
+ checkRequired("conditions", conditions).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ConditionalAuthorizationActionParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ action().validate()
+ conditions().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 =
+ (action.asKnown().getOrNull()?.validity() ?: 0) +
+ (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /** The action to take if the conditions are met. */
+ class Action
+ @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) = Action(JsonField.of(value))
+ }
+
+ /** An enum containing [Action]'s known values. */
+ enum class Known {
+ DECLINE,
+ CHALLENGE,
+ }
+
+ /**
+ * An enum containing [Action]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [Action] 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 [Action] 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 Action: $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(): Action = 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 Action && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Condition
+ private constructor(
+ private val attribute: JsonField,
+ private val operation: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("attribute")
+ @ExcludeMissing
+ attribute: JsonField = JsonMissing.of(),
+ @JsonProperty("operation")
+ @ExcludeMissing
+ operation: JsonField = JsonMissing.of(),
+ @JsonProperty("value")
+ @ExcludeMissing
+ value: JsonField = JsonMissing.of(),
+ ) : this(attribute, operation, value, mutableMapOf())
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1)
+ * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT
+ * for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the
+ * issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account
+ * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`,
+ * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`,
+ * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`,
+ * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or
+ * `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the
+ * acquirer fee field in the settlement/cardholder billing currency. This
+ * is the amount the issuer should authorize against unless the issuer is
+ * paying the acquirer fee on behalf of the cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level associated
+ * with a given authorization. Scores are on a range of 0-999, with 0
+ * representing the lowest risk and 999 representing the highest risk. For
+ * Visa transactions, where the raw score has a range of 0-99, Lithic will
+ * normalize the score by multiplying the raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in
+ * the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in
+ * the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in
+ * the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token, indicates
+ * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
+ * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun attribute(): Optional = attribute.getOptional("attribute")
+
+ /**
+ * The operation to apply to the attribute
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun operation(): Optional = operation.getOptional("operation")
+
+ /**
+ * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun value(): Optional = value.getOptional("value")
+
+ /**
+ * Returns the raw JSON value of [attribute].
+ *
+ * Unlike [attribute], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("attribute")
+ @ExcludeMissing
+ fun _attribute(): JsonField = attribute
+
+ /**
+ * Returns the raw JSON value of [operation].
+ *
+ * Unlike [operation], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("operation")
+ @ExcludeMissing
+ fun _operation(): JsonField = operation
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("value")
+ @ExcludeMissing
+ fun _value(): JsonField = value
+
+ @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
+ * [Condition].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Condition]. */
+ class Builder internal constructor() {
+
+ private var attribute: JsonField = JsonMissing.of()
+ private var operation: JsonField = JsonMissing.of()
+ private var value: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(condition: Condition) = apply {
+ attribute = condition.attribute
+ operation = condition.operation
+ value = condition.value
+ additionalProperties = condition.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are:
+ * (1) all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and
+ * (3) ANT for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to
+ * the issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary
+ * account number (PAN) was entered. Valid values are `AUTO_ENTRY`,
+ * `BAR_CODE`, `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`,
+ * `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`,
+ * `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`,
+ * `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus
+ * the acquirer fee field in the settlement/cardholder billing
+ * currency. This is the amount the issuer should authorize against
+ * unless the issuer is paying the acquirer fee on behalf of the
+ * cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level
+ * associated with a given authorization. Scores are on a range of
+ * 0-999, with 0 representing the lowest risk and 999 representing the
+ * highest risk. For Visa transactions, where the raw score has a
+ * range of 0-99, Lithic will normalize the score by multiplying the
+ * raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the
+ * card in the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card
+ * in the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the
+ * card in the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token,
+ * indicates the source of the token. Valid values are `APPLE_PAY`,
+ * `GOOGLE_PAY`, `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`,
+ * `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ */
+ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute))
+
+ /**
+ * Sets [Builder.attribute] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.attribute] with a well-typed
+ * [Attribute] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun attribute(attribute: JsonField) = apply {
+ this.attribute = attribute
+ }
+
+ /** The operation to apply to the attribute */
+ fun operation(operation: Operation) = operation(JsonField.of(operation))
+
+ /**
+ * Sets [Builder.operation] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.operation] with a well-typed
+ * [Operation] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun operation(operation: JsonField) = apply {
+ this.operation = operation
+ }
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun value(value: Value) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [Value]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ /** Alias for calling [value] with `Value.ofRegex(regex)`. */
+ fun value(regex: String) = value(Value.ofRegex(regex))
+
+ /** Alias for calling [value] with `Value.ofNumber(number)`. */
+ fun value(number: Long) = value(Value.ofNumber(number))
+
+ /**
+ * Alias for calling [value] with
+ * `Value.ofListOfStrings(listOfStrings)`.
+ */
+ fun valueOfListOfStrings(listOfStrings: List) =
+ value(Value.ofListOfStrings(listOfStrings))
+
+ 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 [Condition].
+ *
+ * Further updates to this [Builder] will not mutate the returned
+ * instance.
+ */
+ fun build(): Condition =
+ Condition(
+ attribute,
+ operation,
+ value,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Condition = apply {
+ if (validated) {
+ return@apply
+ }
+
+ attribute().ifPresent { it.validate() }
+ operation().ifPresent { it.validate() }
+ value().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 =
+ (attribute.asKnown().getOrNull()?.validity() ?: 0) +
+ (operation.asKnown().getOrNull()?.validity() ?: 0) +
+ (value.asKnown().getOrNull()?.validity() ?: 0)
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1)
+ * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT
+ * for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the
+ * issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account
+ * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`,
+ * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`,
+ * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`,
+ * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or
+ * `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the
+ * acquirer fee field in the settlement/cardholder billing currency. This
+ * is the amount the issuer should authorize against unless the issuer is
+ * paying the acquirer fee on behalf of the cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level associated
+ * with a given authorization. Scores are on a range of 0-999, with 0
+ * representing the lowest risk and 999 representing the highest risk. For
+ * Visa transactions, where the raw score has a range of 0-99, Lithic will
+ * normalize the score by multiplying the raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in
+ * the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in
+ * the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in
+ * the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token, indicates
+ * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
+ * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ */
+ class Attribute
+ @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 MCC = of("MCC")
+
+ @JvmField val COUNTRY = of("COUNTRY")
+
+ @JvmField val CURRENCY = of("CURRENCY")
+
+ @JvmField val MERCHANT_ID = of("MERCHANT_ID")
+
+ @JvmField val DESCRIPTOR = of("DESCRIPTOR")
+
+ @JvmField val LIABILITY_SHIFT = of("LIABILITY_SHIFT")
+
+ @JvmField val PAN_ENTRY_MODE = of("PAN_ENTRY_MODE")
+
+ @JvmField val TRANSACTION_AMOUNT = of("TRANSACTION_AMOUNT")
+
+ @JvmField val RISK_SCORE = of("RISK_SCORE")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_15_M = of("CARD_TRANSACTION_COUNT_15M")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_1_H = of("CARD_TRANSACTION_COUNT_1H")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_24_H = of("CARD_TRANSACTION_COUNT_24H")
+
+ @JvmField val CARD_STATE = of("CARD_STATE")
+
+ @JvmField val PIN_ENTERED = of("PIN_ENTERED")
+
+ @JvmField val PIN_STATUS = of("PIN_STATUS")
+
+ @JvmField val WALLET_TYPE = of("WALLET_TYPE")
+
+ @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR")
+
+ @JvmStatic fun of(value: String) = Attribute(JsonField.of(value))
+ }
+
+ /** An enum containing [Attribute]'s known values. */
+ enum class Known {
+ MCC,
+ COUNTRY,
+ CURRENCY,
+ MERCHANT_ID,
+ DESCRIPTOR,
+ LIABILITY_SHIFT,
+ PAN_ENTRY_MODE,
+ TRANSACTION_AMOUNT,
+ RISK_SCORE,
+ CARD_TRANSACTION_COUNT_15_M,
+ CARD_TRANSACTION_COUNT_1_H,
+ CARD_TRANSACTION_COUNT_24_H,
+ CARD_STATE,
+ PIN_ENTERED,
+ PIN_STATUS,
+ WALLET_TYPE,
+ TRANSACTION_INITIATOR,
+ }
+
+ /**
+ * An enum containing [Attribute]'s known values, as well as an
+ * [_UNKNOWN] member.
+ *
+ * An instance of [Attribute] 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 {
+ MCC,
+ COUNTRY,
+ CURRENCY,
+ MERCHANT_ID,
+ DESCRIPTOR,
+ LIABILITY_SHIFT,
+ PAN_ENTRY_MODE,
+ TRANSACTION_AMOUNT,
+ RISK_SCORE,
+ CARD_TRANSACTION_COUNT_15_M,
+ CARD_TRANSACTION_COUNT_1_H,
+ CARD_TRANSACTION_COUNT_24_H,
+ CARD_STATE,
+ PIN_ENTERED,
+ PIN_STATUS,
+ WALLET_TYPE,
+ TRANSACTION_INITIATOR,
+ /**
+ * An enum member indicating that [Attribute] 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) {
+ MCC -> Value.MCC
+ COUNTRY -> Value.COUNTRY
+ CURRENCY -> Value.CURRENCY
+ MERCHANT_ID -> Value.MERCHANT_ID
+ DESCRIPTOR -> Value.DESCRIPTOR
+ LIABILITY_SHIFT -> Value.LIABILITY_SHIFT
+ PAN_ENTRY_MODE -> Value.PAN_ENTRY_MODE
+ TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT
+ RISK_SCORE -> Value.RISK_SCORE
+ CARD_TRANSACTION_COUNT_15_M -> Value.CARD_TRANSACTION_COUNT_15_M
+ CARD_TRANSACTION_COUNT_1_H -> Value.CARD_TRANSACTION_COUNT_1_H
+ CARD_TRANSACTION_COUNT_24_H -> Value.CARD_TRANSACTION_COUNT_24_H
+ CARD_STATE -> Value.CARD_STATE
+ PIN_ENTERED -> Value.PIN_ENTERED
+ PIN_STATUS -> Value.PIN_STATUS
+ WALLET_TYPE -> Value.WALLET_TYPE
+ TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR
+ 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) {
+ MCC -> Known.MCC
+ COUNTRY -> Known.COUNTRY
+ CURRENCY -> Known.CURRENCY
+ MERCHANT_ID -> Known.MERCHANT_ID
+ DESCRIPTOR -> Known.DESCRIPTOR
+ LIABILITY_SHIFT -> Known.LIABILITY_SHIFT
+ PAN_ENTRY_MODE -> Known.PAN_ENTRY_MODE
+ TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT
+ RISK_SCORE -> Known.RISK_SCORE
+ CARD_TRANSACTION_COUNT_15_M -> Known.CARD_TRANSACTION_COUNT_15_M
+ CARD_TRANSACTION_COUNT_1_H -> Known.CARD_TRANSACTION_COUNT_1_H
+ CARD_TRANSACTION_COUNT_24_H -> Known.CARD_TRANSACTION_COUNT_24_H
+ CARD_STATE -> Known.CARD_STATE
+ PIN_ENTERED -> Known.PIN_ENTERED
+ PIN_STATUS -> Known.PIN_STATUS
+ WALLET_TYPE -> Known.WALLET_TYPE
+ TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR
+ else ->
+ throw LithicInvalidDataException(
+ "Unknown Attribute: $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(): Attribute = 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 Attribute && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The operation to apply to the attribute */
+ class Operation
+ @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 IS_ONE_OF = of("IS_ONE_OF")
+
+ @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF")
+
+ @JvmField val MATCHES = of("MATCHES")
+
+ @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH")
+
+ @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO")
+
+ @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO")
+
+ @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN")
+
+ @JvmField
+ val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO")
+
+ @JvmField val IS_LESS_THAN = of("IS_LESS_THAN")
+
+ @JvmField
+ val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO")
+
+ @JvmStatic fun of(value: String) = Operation(JsonField.of(value))
+ }
+
+ /** An enum containing [Operation]'s known values. */
+ enum class Known {
+ IS_ONE_OF,
+ IS_NOT_ONE_OF,
+ MATCHES,
+ DOES_NOT_MATCH,
+ IS_EQUAL_TO,
+ IS_NOT_EQUAL_TO,
+ IS_GREATER_THAN,
+ IS_GREATER_THAN_OR_EQUAL_TO,
+ IS_LESS_THAN,
+ IS_LESS_THAN_OR_EQUAL_TO,
+ }
+
+ /**
+ * An enum containing [Operation]'s known values, as well as an
+ * [_UNKNOWN] member.
+ *
+ * An instance of [Operation] 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 {
+ IS_ONE_OF,
+ IS_NOT_ONE_OF,
+ MATCHES,
+ DOES_NOT_MATCH,
+ IS_EQUAL_TO,
+ IS_NOT_EQUAL_TO,
+ IS_GREATER_THAN,
+ IS_GREATER_THAN_OR_EQUAL_TO,
+ IS_LESS_THAN,
+ IS_LESS_THAN_OR_EQUAL_TO,
+ /**
+ * An enum member indicating that [Operation] 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) {
+ IS_ONE_OF -> Value.IS_ONE_OF
+ IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF
+ MATCHES -> Value.MATCHES
+ DOES_NOT_MATCH -> Value.DOES_NOT_MATCH
+ IS_EQUAL_TO -> Value.IS_EQUAL_TO
+ IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO
+ IS_GREATER_THAN -> Value.IS_GREATER_THAN
+ IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO
+ IS_LESS_THAN -> Value.IS_LESS_THAN
+ IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO
+ 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) {
+ IS_ONE_OF -> Known.IS_ONE_OF
+ IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF
+ MATCHES -> Known.MATCHES
+ DOES_NOT_MATCH -> Known.DOES_NOT_MATCH
+ IS_EQUAL_TO -> Known.IS_EQUAL_TO
+ IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO
+ IS_GREATER_THAN -> Known.IS_GREATER_THAN
+ IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO
+ IS_LESS_THAN -> Known.IS_LESS_THAN
+ IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO
+ else ->
+ throw LithicInvalidDataException(
+ "Unknown Operation: $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(): Operation = 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 Operation && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ @JsonDeserialize(using = Value.Deserializer::class)
+ @JsonSerialize(using = Value.Serializer::class)
+ class Value
+ private constructor(
+ private val regex: String? = null,
+ private val number: Long? = null,
+ private val listOfStrings: List? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun regex(): Optional = Optional.ofNullable(regex)
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun number(): Optional = Optional.ofNullable(number)
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF`
+ */
+ fun listOfStrings(): Optional> =
+ Optional.ofNullable(listOfStrings)
+
+ fun isRegex(): Boolean = regex != null
+
+ fun isNumber(): Boolean = number != null
+
+ fun isListOfStrings(): Boolean = listOfStrings != null
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun asRegex(): String = regex.getOrThrow("regex")
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun asNumber(): Long = number.getOrThrow("number")
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF`
+ */
+ fun asListOfStrings(): List =
+ listOfStrings.getOrThrow("listOfStrings")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ regex != null -> visitor.visitRegex(regex)
+ number != null -> visitor.visitNumber(number)
+ listOfStrings != null ->
+ visitor.visitListOfStrings(listOfStrings)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Value = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitRegex(regex: String) {}
+
+ override fun visitNumber(number: Long) {}
+
+ override fun visitListOfStrings(
+ listOfStrings: List
+ ) {}
+ }
+ )
+ 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 visitRegex(regex: String) = 1
+
+ override fun visitNumber(number: Long) = 1
+
+ override fun visitListOfStrings(
+ listOfStrings: List
+ ) = listOfStrings.size
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Value &&
+ regex == other.regex &&
+ number == other.number &&
+ listOfStrings == other.listOfStrings
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(regex, number, listOfStrings)
+
+ override fun toString(): String =
+ when {
+ regex != null -> "Value{regex=$regex}"
+ number != null -> "Value{number=$number}"
+ listOfStrings != null -> "Value{listOfStrings=$listOfStrings}"
+ _json != null -> "Value{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Value")
+ }
+
+ companion object {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ @JvmStatic fun ofRegex(regex: String) = Value(regex = regex)
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ @JvmStatic fun ofNumber(number: Long) = Value(number = number)
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or
+ * `IS_NOT_ONE_OF`
+ */
+ @JvmStatic
+ fun ofListOfStrings(listOfStrings: List) =
+ Value(listOfStrings = listOfStrings.toImmutable())
+ }
+
+ /**
+ * An interface that defines how to map each variant of [Value] to a
+ * value of type [T].
+ */
+ interface Visitor {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun visitRegex(regex: String): T
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun visitNumber(number: Long): T
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or
+ * `IS_NOT_ONE_OF`
+ */
+ fun visitListOfStrings(listOfStrings: List): T
+
+ /**
+ * Maps an unknown variant of [Value] to a value of type [T].
+ *
+ * An instance of [Value] 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 Value: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Value::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Value {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Value(regex = it, _json = json) },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Value(number = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef>())
+ ?.let {
+ Value(listOfStrings = 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 object).
+ 0 -> Value(_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(Value::class) {
+
+ override fun serialize(
+ value: Value,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.regex != null -> generator.writeObject(value.regex)
+ value.number != null -> generator.writeObject(value.number)
+ value.listOfStrings != null ->
+ generator.writeObject(value.listOfStrings)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Value")
+ }
+ }
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Condition &&
+ attribute == other.attribute &&
+ operation == other.operation &&
+ value == other.value &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(attribute, operation, value, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ConditionalAuthorizationActionParameters &&
+ action == other.action &&
+ conditions == other.conditions &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(action, conditions, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ConditionalAuthorizationActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}"
+ }
+ }
+
+ /**
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of several
+ * event streams, the effective one is defined by the separate `event_stream` field.
+ * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
+ * - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
+ * - `MERCHANT_LOCK`: AUTHORIZATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
+ */
+ class AuthRuleType
+ @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 CONDITIONAL_BLOCK = of("CONDITIONAL_BLOCK")
+
+ @JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT")
+
+ @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
+
+ @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION")
+
+ @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
+ }
+
+ /** An enum containing [AuthRuleType]'s known values. */
+ enum class Known {
+ CONDITIONAL_BLOCK,
+ VELOCITY_LIMIT,
+ MERCHANT_LOCK,
+ CONDITIONAL_ACTION,
+ }
+
+ /**
+ * An enum containing [AuthRuleType]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [AuthRuleType] 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 {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
MERCHANT_LOCK,
- CONDITIONAL_3DS_ACTION,
+ CONDITIONAL_ACTION,
/**
* An enum member indicating that [AuthRuleType] was instantiated with an
* unknown value.
@@ -1157,7 +2916,7 @@ private constructor(
CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Value.VELOCITY_LIMIT
MERCHANT_LOCK -> Value.MERCHANT_LOCK
- CONDITIONAL_3DS_ACTION -> Value.CONDITIONAL_3DS_ACTION
+ CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION
else -> Value._UNKNOWN
}
@@ -1175,7 +2934,7 @@ private constructor(
CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Known.VELOCITY_LIMIT
MERCHANT_LOCK -> Known.MERCHANT_LOCK
- CONDITIONAL_3DS_ACTION -> Known.CONDITIONAL_3DS_ACTION
+ CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION
else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value")
}
@@ -1240,6 +2999,8 @@ private constructor(
return other is CreateAuthRuleRequestAccountTokens &&
accountTokens == other.accountTokens &&
+ businessAccountTokens == other.businessAccountTokens &&
+ eventStream == other.eventStream &&
name == other.name &&
parameters == other.parameters &&
type == other.type &&
@@ -1247,18 +3008,27 @@ private constructor(
}
private val hashCode: Int by lazy {
- Objects.hash(accountTokens, name, parameters, type, additionalProperties)
+ Objects.hash(
+ accountTokens,
+ businessAccountTokens,
+ eventStream,
+ name,
+ parameters,
+ type,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "CreateAuthRuleRequestAccountTokens{accountTokens=$accountTokens, name=$name, parameters=$parameters, type=$type, additionalProperties=$additionalProperties}"
+ "CreateAuthRuleRequestAccountTokens{accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, eventStream=$eventStream, name=$name, parameters=$parameters, type=$type, additionalProperties=$additionalProperties}"
}
class CreateAuthRuleRequestCardTokens
private constructor(
private val cardTokens: JsonField>,
+ private val eventStream: JsonField,
private val name: JsonField,
private val parameters: JsonField,
private val type: JsonField,
@@ -1270,6 +3040,9 @@ private constructor(
@JsonProperty("card_tokens")
@ExcludeMissing
cardTokens: JsonField> = JsonMissing.of(),
+ @JsonProperty("event_stream")
+ @ExcludeMissing
+ eventStream: JsonField = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
@JsonProperty("parameters")
@ExcludeMissing
@@ -1277,7 +3050,7 @@ private constructor(
@JsonProperty("type")
@ExcludeMissing
type: JsonField = JsonMissing.of(),
- ) : this(cardTokens, name, parameters, type, mutableMapOf())
+ ) : this(cardTokens, eventStream, name, parameters, type, mutableMapOf())
/**
* Card tokens to which the Auth Rule applies.
@@ -1288,6 +3061,14 @@ private constructor(
*/
fun cardTokens(): List = cardTokens.getRequired("card_tokens")
+ /**
+ * The event stream during which the rule will be evaluated.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun eventStream(): Optional = eventStream.getOptional("event_stream")
+
/**
* Auth Rule Name
*
@@ -1305,12 +3086,13 @@ private constructor(
fun parameters(): Optional = parameters.getOptional("parameters")
/**
- * The type of Auth Rule. Effectively determines the event stream during which it will
- * be evaluated.
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of several
+ * event streams, the effective one is defined by the separate `event_stream` field.
* - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
*
* @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -1327,6 +3109,16 @@ private constructor(
@ExcludeMissing
fun _cardTokens(): JsonField> = cardTokens
+ /**
+ * Returns the raw JSON value of [eventStream].
+ *
+ * Unlike [eventStream], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("event_stream")
+ @ExcludeMissing
+ fun _eventStream(): JsonField = eventStream
+
/**
* Returns the raw JSON value of [name].
*
@@ -1381,6 +3173,7 @@ private constructor(
class Builder internal constructor() {
private var cardTokens: JsonField>? = null
+ private var eventStream: JsonField = JsonMissing.of()
private var name: JsonField = JsonMissing.of()
private var parameters: JsonField = JsonMissing.of()
private var type: JsonField = JsonMissing.of()
@@ -1392,6 +3185,7 @@ private constructor(
) = apply {
cardTokens =
createAuthRuleRequestCardTokens.cardTokens.map { it.toMutableList() }
+ eventStream = createAuthRuleRequestCardTokens.eventStream
name = createAuthRuleRequestCardTokens.name
parameters = createAuthRuleRequestCardTokens.parameters
type = createAuthRuleRequestCardTokens.type
@@ -1425,6 +3219,20 @@ private constructor(
}
}
+ /** The event stream during which the rule will be evaluated. */
+ fun eventStream(eventStream: EventStream) = eventStream(JsonField.of(eventStream))
+
+ /**
+ * Sets [Builder.eventStream] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.eventStream] with a well-typed [EventStream]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun eventStream(eventStream: JsonField) = apply {
+ this.eventStream = eventStream
+ }
+
/** Auth Rule Name */
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -1482,12 +3290,26 @@ private constructor(
parameters(Parameters.ofConditional3dsAction(conditional3dsAction))
/**
- * The type of Auth Rule. Effectively determines the event stream during which it
- * will be evaluated.
+ * Alias for calling [parameters] with
+ * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`.
+ */
+ fun parameters(
+ conditionalAuthorizationAction:
+ Parameters.ConditionalAuthorizationActionParameters
+ ) =
+ parameters(
+ Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)
+ )
+
+ /**
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of
+ * several event streams, the effective one is defined by the separate
+ * `event_stream` field.
* - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
*/
fun type(type: AuthRuleType) = type(JsonField.of(type))
@@ -1537,6 +3359,7 @@ private constructor(
fun build(): CreateAuthRuleRequestCardTokens =
CreateAuthRuleRequestCardTokens(
checkRequired("cardTokens", cardTokens).map { it.toImmutable() },
+ eventStream,
name,
parameters,
type,
@@ -1552,6 +3375,7 @@ private constructor(
}
cardTokens()
+ eventStream().ifPresent { it.validate() }
name()
parameters().ifPresent { it.validate() }
type().ifPresent { it.validate() }
@@ -1575,26 +3399,163 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(cardTokens.asKnown().getOrNull()?.size ?: 0) +
+ (eventStream.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(parameters.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
- /** Parameters for the Auth Rule */
- @JsonDeserialize(using = Parameters.Deserializer::class)
- @JsonSerialize(using = Parameters.Serializer::class)
- class Parameters
- private constructor(
- private val conditionalBlock: ConditionalBlockParameters? = null,
- private val velocityLimitParams: VelocityLimitParams? = null,
- private val merchantLock: MerchantLockParameters? = null,
- private val conditional3dsAction: Conditional3dsActionParameters? = null,
- private val _json: JsonValue? = null,
- ) {
-
- fun conditionalBlock(): Optional =
- Optional.ofNullable(conditionalBlock)
+ /** The event stream during which the rule will be evaluated. */
+ class EventStream
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
- fun velocityLimitParams(): Optional =
+ /**
+ * 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 AUTHORIZATION = of("AUTHORIZATION")
+
+ @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION")
+
+ @JvmStatic fun of(value: String) = EventStream(JsonField.of(value))
+ }
+
+ /** An enum containing [EventStream]'s known values. */
+ enum class Known {
+ AUTHORIZATION,
+ THREE_DS_AUTHENTICATION,
+ }
+
+ /**
+ * An enum containing [EventStream]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [EventStream] 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 {
+ AUTHORIZATION,
+ THREE_DS_AUTHENTICATION,
+ /**
+ * An enum member indicating that [EventStream] 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) {
+ AUTHORIZATION -> Value.AUTHORIZATION
+ THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION
+ 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) {
+ AUTHORIZATION -> Known.AUTHORIZATION
+ THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION
+ else -> throw LithicInvalidDataException("Unknown EventStream: $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(): EventStream = 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 EventStream && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** Parameters for the Auth Rule */
+ @JsonDeserialize(using = Parameters.Deserializer::class)
+ @JsonSerialize(using = Parameters.Serializer::class)
+ class Parameters
+ private constructor(
+ private val conditionalBlock: ConditionalBlockParameters? = null,
+ private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
+ private val conditional3dsAction: Conditional3dsActionParameters? = null,
+ private val conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters? =
+ null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun conditionalBlock(): Optional =
+ Optional.ofNullable(conditionalBlock)
+
+ fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
fun merchantLock(): Optional =
@@ -1603,6 +3564,10 @@ private constructor(
fun conditional3dsAction(): Optional =
Optional.ofNullable(conditional3dsAction)
+ fun conditionalAuthorizationAction():
+ Optional =
+ Optional.ofNullable(conditionalAuthorizationAction)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
@@ -1611,6 +3576,9 @@ private constructor(
fun isConditional3dsAction(): Boolean = conditional3dsAction != null
+ fun isConditionalAuthorizationAction(): Boolean =
+ conditionalAuthorizationAction != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
@@ -1623,6 +3591,9 @@ private constructor(
fun asConditional3dsAction(): Conditional3dsActionParameters =
conditional3dsAction.getOrThrow("conditional3dsAction")
+ fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters =
+ conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -1633,6 +3604,10 @@ private constructor(
merchantLock != null -> visitor.visitMerchantLock(merchantLock)
conditional3dsAction != null ->
visitor.visitConditional3dsAction(conditional3dsAction)
+ conditionalAuthorizationAction != null ->
+ visitor.visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction
+ )
else -> visitor.unknown(_json)
}
@@ -1666,6 +3641,13 @@ private constructor(
) {
conditional3dsAction.validate()
}
+
+ override fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters
+ ) {
+ conditionalAuthorizationAction.validate()
+ }
}
)
validated = true
@@ -1704,6 +3686,11 @@ private constructor(
conditional3dsAction: Conditional3dsActionParameters
) = conditional3dsAction.validity()
+ override fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction:
+ ConditionalAuthorizationActionParameters
+ ) = conditionalAuthorizationAction.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -1717,7 +3704,8 @@ private constructor(
conditionalBlock == other.conditionalBlock &&
velocityLimitParams == other.velocityLimitParams &&
merchantLock == other.merchantLock &&
- conditional3dsAction == other.conditional3dsAction
+ conditional3dsAction == other.conditional3dsAction &&
+ conditionalAuthorizationAction == other.conditionalAuthorizationAction
}
override fun hashCode(): Int =
@@ -1726,6 +3714,7 @@ private constructor(
velocityLimitParams,
merchantLock,
conditional3dsAction,
+ conditionalAuthorizationAction,
)
override fun toString(): String =
@@ -1736,6 +3725,8 @@ private constructor(
merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
conditional3dsAction != null ->
"Parameters{conditional3dsAction=$conditional3dsAction}"
+ conditionalAuthorizationAction != null ->
+ "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -1758,6 +3749,11 @@ private constructor(
fun ofConditional3dsAction(
conditional3dsAction: Conditional3dsActionParameters
) = Parameters(conditional3dsAction = conditional3dsAction)
+
+ @JvmStatic
+ fun ofConditionalAuthorizationAction(
+ conditionalAuthorizationAction: ConditionalAuthorizationActionParameters
+ ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction)
}
/**
@@ -1776,6 +3772,10 @@ private constructor(
conditional3dsAction: Conditional3dsActionParameters
): T
+ fun visitConditionalAuthorizationAction(
+ conditionalAuthorizationAction: ConditionalAuthorizationActionParameters
+ ): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -1816,6 +3816,18 @@ private constructor(
?.let {
Parameters(conditional3dsAction = it, _json = json)
},
+ tryDeserialize(
+ node,
+ jacksonTypeRef<
+ ConditionalAuthorizationActionParameters
+ >(),
+ )
+ ?.let {
+ Parameters(
+ conditionalAuthorizationAction = it,
+ _json = json,
+ )
+ },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -1849,20 +3861,1482 @@ private constructor(
value.merchantLock != null -> generator.writeObject(value.merchantLock)
value.conditional3dsAction != null ->
generator.writeObject(value.conditional3dsAction)
+ value.conditionalAuthorizationAction != null ->
+ generator.writeObject(value.conditionalAuthorizationAction)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class ConditionalAuthorizationActionParameters
+ private constructor(
+ private val action: JsonField,
+ private val conditions: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("action")
+ @ExcludeMissing
+ action: JsonField = JsonMissing.of(),
+ @JsonProperty("conditions")
+ @ExcludeMissing
+ conditions: JsonField> = JsonMissing.of(),
+ ) : this(action, conditions, mutableMapOf())
+
+ /**
+ * The action to take if the conditions are met.
+ *
+ * @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 action(): Action = action.getRequired("action")
+
+ /**
+ * @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 conditions(): List = conditions.getRequired("conditions")
+
+ /**
+ * Returns the raw JSON value of [action].
+ *
+ * Unlike [action], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("action")
+ @ExcludeMissing
+ fun _action(): JsonField = action
+
+ /**
+ * Returns the raw JSON value of [conditions].
+ *
+ * Unlike [conditions], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("conditions")
+ @ExcludeMissing
+ fun _conditions(): JsonField> = conditions
+
+ @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
+ * [ConditionalAuthorizationActionParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .action()
+ * .conditions()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ConditionalAuthorizationActionParameters]. */
+ class Builder internal constructor() {
+
+ private var action: JsonField? = null
+ private var conditions: JsonField>? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(
+ conditionalAuthorizationActionParameters:
+ ConditionalAuthorizationActionParameters
+ ) = apply {
+ action = conditionalAuthorizationActionParameters.action
+ conditions =
+ conditionalAuthorizationActionParameters.conditions.map {
+ it.toMutableList()
+ }
+ additionalProperties =
+ conditionalAuthorizationActionParameters.additionalProperties
+ .toMutableMap()
+ }
+
+ /** The action to take if the conditions are met. */
+ fun action(action: Action) = action(JsonField.of(action))
+
+ /**
+ * Sets [Builder.action] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.action] with a well-typed [Action] value
+ * instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun action(action: JsonField) = apply { this.action = action }
+
+ fun conditions(conditions: List) =
+ conditions(JsonField.of(conditions))
+
+ /**
+ * Sets [Builder.conditions] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.conditions] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun conditions(conditions: JsonField>) = apply {
+ this.conditions = conditions.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Condition] to [conditions].
+ *
+ * @throws IllegalStateException if the field was previously set to a
+ * non-list.
+ */
+ fun addCondition(condition: Condition) = apply {
+ conditions =
+ (conditions ?: JsonField.of(mutableListOf())).also {
+ checkKnown("conditions", it).add(condition)
+ }
+ }
+
+ 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
+ * [ConditionalAuthorizationActionParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .action()
+ * .conditions()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ConditionalAuthorizationActionParameters =
+ ConditionalAuthorizationActionParameters(
+ checkRequired("action", action),
+ checkRequired("conditions", conditions).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): ConditionalAuthorizationActionParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ action().validate()
+ conditions().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 =
+ (action.asKnown().getOrNull()?.validity() ?: 0) +
+ (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /** The action to take if the conditions are met. */
+ class Action
+ @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) = Action(JsonField.of(value))
+ }
+
+ /** An enum containing [Action]'s known values. */
+ enum class Known {
+ DECLINE,
+ CHALLENGE,
+ }
+
+ /**
+ * An enum containing [Action]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [Action] 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 [Action] 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 Action: $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(): Action = 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 Action && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ class Condition
+ private constructor(
+ private val attribute: JsonField,
+ private val operation: JsonField,
+ private val value: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("attribute")
+ @ExcludeMissing
+ attribute: JsonField = JsonMissing.of(),
+ @JsonProperty("operation")
+ @ExcludeMissing
+ operation: JsonField = JsonMissing.of(),
+ @JsonProperty("value")
+ @ExcludeMissing
+ value: JsonField = JsonMissing.of(),
+ ) : this(attribute, operation, value, mutableMapOf())
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1)
+ * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT
+ * for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the
+ * issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account
+ * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`,
+ * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`,
+ * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`,
+ * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or
+ * `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the
+ * acquirer fee field in the settlement/cardholder billing currency. This
+ * is the amount the issuer should authorize against unless the issuer is
+ * paying the acquirer fee on behalf of the cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level associated
+ * with a given authorization. Scores are on a range of 0-999, with 0
+ * representing the lowest risk and 999 representing the highest risk. For
+ * Visa transactions, where the raw score has a range of 0-99, Lithic will
+ * normalize the score by multiplying the raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in
+ * the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in
+ * the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in
+ * the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token, indicates
+ * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
+ * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun attribute(): Optional = attribute.getOptional("attribute")
+
+ /**
+ * The operation to apply to the attribute
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun operation(): Optional = operation.getOptional("operation")
+
+ /**
+ * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH`
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun value(): Optional = value.getOptional("value")
+
+ /**
+ * Returns the raw JSON value of [attribute].
+ *
+ * Unlike [attribute], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("attribute")
+ @ExcludeMissing
+ fun _attribute(): JsonField = attribute
+
+ /**
+ * Returns the raw JSON value of [operation].
+ *
+ * Unlike [operation], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("operation")
+ @ExcludeMissing
+ fun _operation(): JsonField = operation
+
+ /**
+ * Returns the raw JSON value of [value].
+ *
+ * Unlike [value], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("value")
+ @ExcludeMissing
+ fun _value(): JsonField = value
+
+ @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
+ * [Condition].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Condition]. */
+ class Builder internal constructor() {
+
+ private var attribute: JsonField = JsonMissing.of()
+ private var operation: JsonField = JsonMissing.of()
+ private var value: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(condition: Condition) = apply {
+ attribute = condition.attribute
+ operation = condition.operation
+ value = condition.value
+ additionalProperties = condition.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are:
+ * (1) all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and
+ * (3) ANT for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to
+ * the issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary
+ * account number (PAN) was entered. Valid values are `AUTO_ENTRY`,
+ * `BAR_CODE`, `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`,
+ * `ERROR_MAGNETIC_STRIPE`, `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`,
+ * `MANUAL`, `OCR`, `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`,
+ * `CREDENTIAL_ON_FILE`, or `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus
+ * the acquirer fee field in the settlement/cardholder billing
+ * currency. This is the amount the issuer should authorize against
+ * unless the issuer is paying the acquirer fee on behalf of the
+ * cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level
+ * associated with a given authorization. Scores are on a range of
+ * 0-999, with 0 representing the lowest risk and 999 representing the
+ * highest risk. For Visa transactions, where the raw score has a
+ * range of 0-99, Lithic will normalize the score by multiplying the
+ * raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the
+ * card in the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card
+ * in the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the
+ * card in the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token,
+ * indicates the source of the token. Valid values are `APPLE_PAY`,
+ * `GOOGLE_PAY`, `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`,
+ * `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ */
+ fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute))
+
+ /**
+ * Sets [Builder.attribute] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.attribute] with a well-typed
+ * [Attribute] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun attribute(attribute: JsonField) = apply {
+ this.attribute = attribute
+ }
+
+ /** The operation to apply to the attribute */
+ fun operation(operation: Operation) = operation(JsonField.of(operation))
+
+ /**
+ * Sets [Builder.operation] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.operation] with a well-typed
+ * [Operation] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun operation(operation: JsonField) = apply {
+ this.operation = operation
+ }
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun value(value: Value) = value(JsonField.of(value))
+
+ /**
+ * Sets [Builder.value] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.value] with a well-typed [Value]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun value(value: JsonField) = apply { this.value = value }
+
+ /** Alias for calling [value] with `Value.ofRegex(regex)`. */
+ fun value(regex: String) = value(Value.ofRegex(regex))
+
+ /** Alias for calling [value] with `Value.ofNumber(number)`. */
+ fun value(number: Long) = value(Value.ofNumber(number))
+
+ /**
+ * Alias for calling [value] with
+ * `Value.ofListOfStrings(listOfStrings)`.
+ */
+ fun valueOfListOfStrings(listOfStrings: List) =
+ value(Value.ofListOfStrings(listOfStrings))
+
+ 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 [Condition].
+ *
+ * Further updates to this [Builder] will not mutate the returned
+ * instance.
+ */
+ fun build(): Condition =
+ Condition(
+ attribute,
+ operation,
+ value,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Condition = apply {
+ if (validated) {
+ return@apply
+ }
+
+ attribute().ifPresent { it.validate() }
+ operation().ifPresent { it.validate() }
+ value().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 =
+ (attribute.asKnown().getOrNull()?.validity() ?: 0) +
+ (operation.asKnown().getOrNull()?.validity() ?: 0) +
+ (value.asKnown().getOrNull()?.validity() ?: 0)
+
+ /**
+ * The attribute to target.
+ *
+ * The following attributes may be targeted:
+ * - `MCC`: A four-digit number listed in ISO 18245. An MCC is used to
+ * classify a business by the types of goods or services it provides.
+ * - `COUNTRY`: Country of entity of card acceptor. Possible values are: (1)
+ * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT
+ * for Netherlands Antilles.
+ * - `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant
+ * currency of the transaction.
+ * - `MERCHANT_ID`: Unique alphanumeric identifier for the payment card
+ * acceptor (merchant).
+ * - `DESCRIPTOR`: Short description of card acceptor.
+ * - `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the
+ * issuer applies to the transaction. Valid values are `NONE`,
+ * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`.
+ * - `PAN_ENTRY_MODE`: The method by which the cardholder's primary account
+ * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`,
+ * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`,
+ * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`,
+ * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or
+ * `ECOMMERCE`.
+ * - `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the
+ * acquirer fee field in the settlement/cardholder billing currency. This
+ * is the amount the issuer should authorize against unless the issuer is
+ * paying the acquirer fee on behalf of the cardholder.
+ * - `RISK_SCORE`: Network-provided score assessing risk level associated
+ * with a given authorization. Scores are on a range of 0-999, with 0
+ * representing the lowest risk and 999 representing the highest risk. For
+ * Visa transactions, where the raw score has a range of 0-99, Lithic will
+ * normalize the score by multiplying the raw score by 10x.
+ * - `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in
+ * the trailing 15 minutes before the authorization.
+ * - `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in
+ * the trailing hour up and until the authorization.
+ * - `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in
+ * the trailing 24 hours up and until the authorization.
+ * - `CARD_STATE`: The current state of the card associated with the
+ * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`,
+ * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`.
+ * - `PIN_ENTERED`: Indicates whether a PIN was entered during the
+ * transaction. Valid values are `TRUE`, `FALSE`.
+ * - `PIN_STATUS`: The current state of card's PIN. Valid values are
+ * `NOT_SET`, `OK`, `BLOCKED`.
+ * - `WALLET_TYPE`: For transactions using a digital wallet token, indicates
+ * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`,
+ * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`.
+ * - `TRANSACTION_INITIATOR`: The entity that initiated the transaction
+ * indicates the source of the token. Valid values are `CARDHOLDER`,
+ * `MERCHANT`, `UNKNOWN`.
+ */
+ class Attribute
+ @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 MCC = of("MCC")
+
+ @JvmField val COUNTRY = of("COUNTRY")
+
+ @JvmField val CURRENCY = of("CURRENCY")
+
+ @JvmField val MERCHANT_ID = of("MERCHANT_ID")
+
+ @JvmField val DESCRIPTOR = of("DESCRIPTOR")
+
+ @JvmField val LIABILITY_SHIFT = of("LIABILITY_SHIFT")
+
+ @JvmField val PAN_ENTRY_MODE = of("PAN_ENTRY_MODE")
+
+ @JvmField val TRANSACTION_AMOUNT = of("TRANSACTION_AMOUNT")
+
+ @JvmField val RISK_SCORE = of("RISK_SCORE")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_15_M = of("CARD_TRANSACTION_COUNT_15M")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_1_H = of("CARD_TRANSACTION_COUNT_1H")
+
+ @JvmField
+ val CARD_TRANSACTION_COUNT_24_H = of("CARD_TRANSACTION_COUNT_24H")
+
+ @JvmField val CARD_STATE = of("CARD_STATE")
+
+ @JvmField val PIN_ENTERED = of("PIN_ENTERED")
+
+ @JvmField val PIN_STATUS = of("PIN_STATUS")
+
+ @JvmField val WALLET_TYPE = of("WALLET_TYPE")
+
+ @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR")
+
+ @JvmStatic fun of(value: String) = Attribute(JsonField.of(value))
+ }
+
+ /** An enum containing [Attribute]'s known values. */
+ enum class Known {
+ MCC,
+ COUNTRY,
+ CURRENCY,
+ MERCHANT_ID,
+ DESCRIPTOR,
+ LIABILITY_SHIFT,
+ PAN_ENTRY_MODE,
+ TRANSACTION_AMOUNT,
+ RISK_SCORE,
+ CARD_TRANSACTION_COUNT_15_M,
+ CARD_TRANSACTION_COUNT_1_H,
+ CARD_TRANSACTION_COUNT_24_H,
+ CARD_STATE,
+ PIN_ENTERED,
+ PIN_STATUS,
+ WALLET_TYPE,
+ TRANSACTION_INITIATOR,
+ }
+
+ /**
+ * An enum containing [Attribute]'s known values, as well as an
+ * [_UNKNOWN] member.
+ *
+ * An instance of [Attribute] 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 {
+ MCC,
+ COUNTRY,
+ CURRENCY,
+ MERCHANT_ID,
+ DESCRIPTOR,
+ LIABILITY_SHIFT,
+ PAN_ENTRY_MODE,
+ TRANSACTION_AMOUNT,
+ RISK_SCORE,
+ CARD_TRANSACTION_COUNT_15_M,
+ CARD_TRANSACTION_COUNT_1_H,
+ CARD_TRANSACTION_COUNT_24_H,
+ CARD_STATE,
+ PIN_ENTERED,
+ PIN_STATUS,
+ WALLET_TYPE,
+ TRANSACTION_INITIATOR,
+ /**
+ * An enum member indicating that [Attribute] 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) {
+ MCC -> Value.MCC
+ COUNTRY -> Value.COUNTRY
+ CURRENCY -> Value.CURRENCY
+ MERCHANT_ID -> Value.MERCHANT_ID
+ DESCRIPTOR -> Value.DESCRIPTOR
+ LIABILITY_SHIFT -> Value.LIABILITY_SHIFT
+ PAN_ENTRY_MODE -> Value.PAN_ENTRY_MODE
+ TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT
+ RISK_SCORE -> Value.RISK_SCORE
+ CARD_TRANSACTION_COUNT_15_M -> Value.CARD_TRANSACTION_COUNT_15_M
+ CARD_TRANSACTION_COUNT_1_H -> Value.CARD_TRANSACTION_COUNT_1_H
+ CARD_TRANSACTION_COUNT_24_H -> Value.CARD_TRANSACTION_COUNT_24_H
+ CARD_STATE -> Value.CARD_STATE
+ PIN_ENTERED -> Value.PIN_ENTERED
+ PIN_STATUS -> Value.PIN_STATUS
+ WALLET_TYPE -> Value.WALLET_TYPE
+ TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR
+ 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) {
+ MCC -> Known.MCC
+ COUNTRY -> Known.COUNTRY
+ CURRENCY -> Known.CURRENCY
+ MERCHANT_ID -> Known.MERCHANT_ID
+ DESCRIPTOR -> Known.DESCRIPTOR
+ LIABILITY_SHIFT -> Known.LIABILITY_SHIFT
+ PAN_ENTRY_MODE -> Known.PAN_ENTRY_MODE
+ TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT
+ RISK_SCORE -> Known.RISK_SCORE
+ CARD_TRANSACTION_COUNT_15_M -> Known.CARD_TRANSACTION_COUNT_15_M
+ CARD_TRANSACTION_COUNT_1_H -> Known.CARD_TRANSACTION_COUNT_1_H
+ CARD_TRANSACTION_COUNT_24_H -> Known.CARD_TRANSACTION_COUNT_24_H
+ CARD_STATE -> Known.CARD_STATE
+ PIN_ENTERED -> Known.PIN_ENTERED
+ PIN_STATUS -> Known.PIN_STATUS
+ WALLET_TYPE -> Known.WALLET_TYPE
+ TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR
+ else ->
+ throw LithicInvalidDataException(
+ "Unknown Attribute: $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(): Attribute = 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 Attribute && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** The operation to apply to the attribute */
+ class Operation
+ @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 IS_ONE_OF = of("IS_ONE_OF")
+
+ @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF")
+
+ @JvmField val MATCHES = of("MATCHES")
+
+ @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH")
+
+ @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO")
+
+ @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO")
+
+ @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN")
+
+ @JvmField
+ val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO")
+
+ @JvmField val IS_LESS_THAN = of("IS_LESS_THAN")
+
+ @JvmField
+ val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO")
+
+ @JvmStatic fun of(value: String) = Operation(JsonField.of(value))
+ }
+
+ /** An enum containing [Operation]'s known values. */
+ enum class Known {
+ IS_ONE_OF,
+ IS_NOT_ONE_OF,
+ MATCHES,
+ DOES_NOT_MATCH,
+ IS_EQUAL_TO,
+ IS_NOT_EQUAL_TO,
+ IS_GREATER_THAN,
+ IS_GREATER_THAN_OR_EQUAL_TO,
+ IS_LESS_THAN,
+ IS_LESS_THAN_OR_EQUAL_TO,
+ }
+
+ /**
+ * An enum containing [Operation]'s known values, as well as an
+ * [_UNKNOWN] member.
+ *
+ * An instance of [Operation] 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 {
+ IS_ONE_OF,
+ IS_NOT_ONE_OF,
+ MATCHES,
+ DOES_NOT_MATCH,
+ IS_EQUAL_TO,
+ IS_NOT_EQUAL_TO,
+ IS_GREATER_THAN,
+ IS_GREATER_THAN_OR_EQUAL_TO,
+ IS_LESS_THAN,
+ IS_LESS_THAN_OR_EQUAL_TO,
+ /**
+ * An enum member indicating that [Operation] 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) {
+ IS_ONE_OF -> Value.IS_ONE_OF
+ IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF
+ MATCHES -> Value.MATCHES
+ DOES_NOT_MATCH -> Value.DOES_NOT_MATCH
+ IS_EQUAL_TO -> Value.IS_EQUAL_TO
+ IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO
+ IS_GREATER_THAN -> Value.IS_GREATER_THAN
+ IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO
+ IS_LESS_THAN -> Value.IS_LESS_THAN
+ IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO
+ 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) {
+ IS_ONE_OF -> Known.IS_ONE_OF
+ IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF
+ MATCHES -> Known.MATCHES
+ DOES_NOT_MATCH -> Known.DOES_NOT_MATCH
+ IS_EQUAL_TO -> Known.IS_EQUAL_TO
+ IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO
+ IS_GREATER_THAN -> Known.IS_GREATER_THAN
+ IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO
+ IS_LESS_THAN -> Known.IS_LESS_THAN
+ IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO
+ else ->
+ throw LithicInvalidDataException(
+ "Unknown Operation: $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(): Operation = 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 Operation && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ @JsonDeserialize(using = Value.Deserializer::class)
+ @JsonSerialize(using = Value.Serializer::class)
+ class Value
+ private constructor(
+ private val regex: String? = null,
+ private val number: Long? = null,
+ private val listOfStrings: List? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun regex(): Optional = Optional.ofNullable(regex)
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun number(): Optional = Optional.ofNullable(number)
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF`
+ */
+ fun listOfStrings(): Optional> =
+ Optional.ofNullable(listOfStrings)
+
+ fun isRegex(): Boolean = regex != null
+
+ fun isNumber(): Boolean = number != null
+
+ fun isListOfStrings(): Boolean = listOfStrings != null
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun asRegex(): String = regex.getOrThrow("regex")
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun asNumber(): Long = number.getOrThrow("number")
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF`
+ */
+ fun asListOfStrings(): List =
+ listOfStrings.getOrThrow("listOfStrings")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ regex != null -> visitor.visitRegex(regex)
+ number != null -> visitor.visitNumber(number)
+ listOfStrings != null ->
+ visitor.visitListOfStrings(listOfStrings)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Value = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitRegex(regex: String) {}
+
+ override fun visitNumber(number: Long) {}
+
+ override fun visitListOfStrings(
+ listOfStrings: List
+ ) {}
+ }
+ )
+ 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 visitRegex(regex: String) = 1
+
+ override fun visitNumber(number: Long) = 1
+
+ override fun visitListOfStrings(
+ listOfStrings: List
+ ) = listOfStrings.size
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Value &&
+ regex == other.regex &&
+ number == other.number &&
+ listOfStrings == other.listOfStrings
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(regex, number, listOfStrings)
+
+ override fun toString(): String =
+ when {
+ regex != null -> "Value{regex=$regex}"
+ number != null -> "Value{number=$number}"
+ listOfStrings != null -> "Value{listOfStrings=$listOfStrings}"
+ _json != null -> "Value{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Value")
+ }
+
+ companion object {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ @JvmStatic fun ofRegex(regex: String) = Value(regex = regex)
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ @JvmStatic fun ofNumber(number: Long) = Value(number = number)
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or
+ * `IS_NOT_ONE_OF`
+ */
+ @JvmStatic
+ fun ofListOfStrings(listOfStrings: List) =
+ Value(listOfStrings = listOfStrings.toImmutable())
+ }
+
+ /**
+ * An interface that defines how to map each variant of [Value] to a
+ * value of type [T].
+ */
+ interface Visitor {
+
+ /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */
+ fun visitRegex(regex: String): T
+
+ /**
+ * A number, to be used with `IS_GREATER_THAN`,
+ * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`,
+ * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO`
+ */
+ fun visitNumber(number: Long): T
+
+ /**
+ * An array of strings, to be used with `IS_ONE_OF` or
+ * `IS_NOT_ONE_OF`
+ */
+ fun visitListOfStrings(listOfStrings: List): T
+
+ /**
+ * Maps an unknown variant of [Value] to a value of type [T].
+ *
+ * An instance of [Value] 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 Value: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Value::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Value {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Value(regex = it, _json = json) },
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Value(number = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef>())
+ ?.let {
+ Value(listOfStrings = 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 object).
+ 0 -> Value(_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(Value::class) {
+
+ override fun serialize(
+ value: Value,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.regex != null -> generator.writeObject(value.regex)
+ value.number != null -> generator.writeObject(value.number)
+ value.listOfStrings != null ->
+ generator.writeObject(value.listOfStrings)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Value")
+ }
+ }
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Condition &&
+ attribute == other.attribute &&
+ operation == other.operation &&
+ value == other.value &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(attribute, operation, value, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ConditionalAuthorizationActionParameters &&
+ action == other.action &&
+ conditions == other.conditions &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(action, conditions, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ConditionalAuthorizationActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}"
+ }
}
/**
- * The type of Auth Rule. Effectively determines the event stream during which it will
- * be evaluated.
+ * The type of Auth Rule. For certain rule types, this determines the event stream
+ * during which it will be evaluated. For rules that can be applied to one of several
+ * event streams, the effective one is defined by the separate `event_stream` field.
* - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream.
* - `VELOCITY_LIMIT`: AUTHORIZATION event stream.
* - `MERCHANT_LOCK`: AUTHORIZATION event stream.
- * - `CONDITIONAL_3DS_ACTION`: THREE_DS_AUTHENTICATION event stream.
+ * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream.
*/
class AuthRuleType
@JsonCreator
@@ -1886,7 +5360,7 @@ private constructor(
@JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
- @JvmField val CONDITIONAL_3DS_ACTION = of("CONDITIONAL_3DS_ACTION")
+ @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION")
@JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
}
@@ -1896,7 +5370,7 @@ private constructor(
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
MERCHANT_LOCK,
- CONDITIONAL_3DS_ACTION,
+ CONDITIONAL_ACTION,
}
/**
@@ -1913,7 +5387,7 @@ private constructor(
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
MERCHANT_LOCK,
- CONDITIONAL_3DS_ACTION,
+ CONDITIONAL_ACTION,
/**
* An enum member indicating that [AuthRuleType] was instantiated with an
* unknown value.
@@ -1933,7 +5407,7 @@ private constructor(
CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Value.VELOCITY_LIMIT
MERCHANT_LOCK -> Value.MERCHANT_LOCK
- CONDITIONAL_3DS_ACTION -> Value.CONDITIONAL_3DS_ACTION
+ CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION
else -> Value._UNKNOWN
}
@@ -1951,7 +5425,7 @@ private constructor(
CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Known.VELOCITY_LIMIT
MERCHANT_LOCK -> Known.MERCHANT_LOCK
- CONDITIONAL_3DS_ACTION -> Known.CONDITIONAL_3DS_ACTION
+ CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION
else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value")
}
@@ -2016,6 +5490,7 @@ private constructor(
return other is CreateAuthRuleRequestCardTokens &&
cardTokens == other.cardTokens &&
+ eventStream == other.eventStream &&
name == other.name &&
parameters == other.parameters &&
type == other.type &&
@@ -2023,18 +5498,19 @@ private constructor(
}
private val hashCode: Int by lazy {
- Objects.hash(cardTokens, name, parameters, type, additionalProperties)
+ Objects.hash(cardTokens, eventStream, name, parameters, type, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "CreateAuthRuleRequestCardTokens{cardTokens=$cardTokens, name=$name, parameters=$parameters, type=$type, additionalProperties=$additionalProperties}"
+ "CreateAuthRuleRequestCardTokens{cardTokens=$cardTokens, eventStream=$eventStream, name=$name, parameters=$parameters, type=$type, additionalProperties=$additionalProperties}"
}
class CreateAuthRuleRequestProgramLevel
private constructor(
private val programLevel: JsonField,
+ private val eventStream: JsonField,
private val excludedCardTokens: JsonField>,
private val name: JsonField,
private val parameters: JsonField,
@@ -2047,6 +5523,9 @@ private constructor(
@JsonProperty("program_level")
@ExcludeMissing
programLevel: JsonField