diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65b6e7b4e..37e997234 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.129.0" + ".": "0.130.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 3a6859322..d092e24ac 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 214 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-185b3d93b4e6ed5ae02c32f0bc9133b0ac99dcd1263a12b7aa9ba64e71a5461e.yml -openapi_spec_hash: 2418116f58a464afdd5611865e860d30 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-47e9f78d22682623e313f1689f5fa7e3420575ff285a14a2f4704c49ffb6b72e.yml +openapi_spec_hash: 4797fe46d942cb32e648a79015783d01 config_hash: 5bb913c05ebeb301ec925b16e75bb251 diff --git a/CHANGELOG.md b/CHANGELOG.md index 90efa91fb..88d1519c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.130.0 (2026-06-23) + +Full Changelog: [v0.129.0...v0.130.0](https://github.com/lithic-com/lithic-java/compare/v0.129.0...v0.130.0) + +### Features + +* **api:** add claim/claim_document webhook event types ([26c0566](https://github.com/lithic-com/lithic-java/commit/26c0566f986cd238d0640b51f4b762afea09757b)) +* **api:** add payment_velocity/consecutive_declines/ach_payment_history/bank_account features ([f51d491](https://github.com/lithic-com/lithic-java/commit/f51d491bf07272f886c03649821feb5cde265dbb)) + ## 0.129.0 (2026-06-22) Full Changelog: [v0.128.0...v0.129.0](https://github.com/lithic-com/lithic-java/compare/v0.128.0...v0.129.0) diff --git a/README.md b/README.md index 0f9664a8b..4aedcced5 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.129.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.129.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.129.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.lithic.api/lithic-java)](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.130.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.130.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.130.0) @@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.129.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.130.0). @@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.129.0") +implementation("com.lithic.api:lithic-java:0.130.0") ``` ### Maven @@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.129.0") com.lithic.api lithic-java - 0.129.0 + 0.130.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 2f1ae6ee0..32e805ce5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.129.0" // x-release-please-version + version = "0.130.0" // x-release-please-version } subprojects { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimCreatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimCreatedWebhookEvent.kt new file mode 100644 index 000000000..c5301bc1c --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimCreatedWebhookEvent.kt @@ -0,0 +1,1639 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ClaimCreatedWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val accountHolderToken: JsonField, + private val accountToken: JsonField, + private val cardTokens: JsonField>, + private val created: JsonField, + private val disputedTransactions: JsonField>, + private val eventType: JsonField, + private val outstandingRequirements: JsonField>, + private val reason: JsonField, + private val status: JsonField, + private val submitted: JsonField, + private val updated: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("account_holder_token") + @ExcludeMissing + accountHolderToken: JsonField = JsonMissing.of(), + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("card_tokens") + @ExcludeMissing + cardTokens: JsonField> = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("disputed_transactions") + @ExcludeMissing + disputedTransactions: JsonField> = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + @JsonProperty("outstanding_requirements") + @ExcludeMissing + outstandingRequirements: JsonField> = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("submitted") + @ExcludeMissing + submitted: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + ) : this( + token, + accountHolderToken, + accountToken, + cardTokens, + created, + disputedTransactions, + eventType, + outstandingRequirements, + reason, + status, + submitted, + updated, + mutableMapOf(), + ) + + /** + * Unique identifier for the claim, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * Token for the account holder that filed the claim + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accountHolderToken(): Optional = + accountHolderToken.getOptional("account_holder_token") + + /** + * Token for the account associated with the claim + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accountToken(): Optional = accountToken.getOptional("account_token") + + /** + * Tokens for the cards associated with the disputed transactions + * + * @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 cardTokens(): List = cardTokens.getRequired("card_tokens") + + /** + * When the claim was created + * + * @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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Transactions included in this claim + * + * @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 disputedTransactions(): List = + disputedTransactions.getRequired("disputed_transactions") + + /** + * The type of event that occurred. + * + * @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 eventType(): EventType = eventType.getRequired("event_type") + + /** + * Requirements that must be fulfilled before the claim can be submitted + * + * @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 outstandingRequirements(): List = + outstandingRequirements.getRequired("outstanding_requirements") + + /** + * Dispute reason code provided when creating the claim + * + * @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 reason(): Reason = reason.getRequired("reason") + + /** + * Current lifecycle status of the claim + * + * @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 status(): Status = status.getRequired("status") + + /** + * When the claim was submitted. Null until the claim reaches `SUBMITTED` status + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun submitted(): Optional = submitted.getOptional("submitted") + + /** + * When the claim was last updated + * + * @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 updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [accountHolderToken]. + * + * Unlike [accountHolderToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("account_holder_token") + @ExcludeMissing + fun _accountHolderToken(): JsonField = accountHolderToken + + /** + * Returns the raw JSON value of [accountToken]. + * + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("account_token") + @ExcludeMissing + fun _accountToken(): JsonField = accountToken + + /** + * Returns the raw JSON value of [cardTokens]. + * + * Unlike [cardTokens], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("card_tokens") + @ExcludeMissing + fun _cardTokens(): JsonField> = cardTokens + + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + + /** + * Returns the raw JSON value of [disputedTransactions]. + * + * Unlike [disputedTransactions], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("disputed_transactions") + @ExcludeMissing + fun _disputedTransactions(): JsonField> = disputedTransactions + + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + + /** + * Returns the raw JSON value of [outstandingRequirements]. + * + * Unlike [outstandingRequirements], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("outstanding_requirements") + @ExcludeMissing + fun _outstandingRequirements(): JsonField> = + outstandingRequirements + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [submitted]. + * + * Unlike [submitted], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("submitted") + @ExcludeMissing + fun _submitted(): JsonField = submitted + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + @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 [ClaimCreatedWebhookEvent]. + * + * The following fields are required: + * ```java + * .token() + * .accountHolderToken() + * .accountToken() + * .cardTokens() + * .created() + * .disputedTransactions() + * .eventType() + * .outstandingRequirements() + * .reason() + * .status() + * .submitted() + * .updated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ClaimCreatedWebhookEvent]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var accountHolderToken: JsonField? = null + private var accountToken: JsonField? = null + private var cardTokens: JsonField>? = null + private var created: JsonField? = null + private var disputedTransactions: JsonField>? = null + private var eventType: JsonField? = null + private var outstandingRequirements: JsonField>? = null + private var reason: JsonField? = null + private var status: JsonField? = null + private var submitted: JsonField? = null + private var updated: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(claimCreatedWebhookEvent: ClaimCreatedWebhookEvent) = apply { + token = claimCreatedWebhookEvent.token + accountHolderToken = claimCreatedWebhookEvent.accountHolderToken + accountToken = claimCreatedWebhookEvent.accountToken + cardTokens = claimCreatedWebhookEvent.cardTokens.map { it.toMutableList() } + created = claimCreatedWebhookEvent.created + disputedTransactions = + claimCreatedWebhookEvent.disputedTransactions.map { it.toMutableList() } + eventType = claimCreatedWebhookEvent.eventType + outstandingRequirements = + claimCreatedWebhookEvent.outstandingRequirements.map { it.toMutableList() } + reason = claimCreatedWebhookEvent.reason + status = claimCreatedWebhookEvent.status + submitted = claimCreatedWebhookEvent.submitted + updated = claimCreatedWebhookEvent.updated + additionalProperties = claimCreatedWebhookEvent.additionalProperties.toMutableMap() + } + + /** Unique identifier for the claim, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + /** Token for the account holder that filed the claim */ + fun accountHolderToken(accountHolderToken: String?) = + accountHolderToken(JsonField.ofNullable(accountHolderToken)) + + /** + * Alias for calling [Builder.accountHolderToken] with `accountHolderToken.orElse(null)`. + */ + fun accountHolderToken(accountHolderToken: Optional) = + accountHolderToken(accountHolderToken.getOrNull()) + + /** + * Sets [Builder.accountHolderToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accountHolderToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accountHolderToken(accountHolderToken: JsonField) = apply { + this.accountHolderToken = accountHolderToken + } + + /** Token for the account associated with the claim */ + fun accountToken(accountToken: String?) = accountToken(JsonField.ofNullable(accountToken)) + + /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */ + fun accountToken(accountToken: Optional) = accountToken(accountToken.getOrNull()) + + /** + * Sets [Builder.accountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accountToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun accountToken(accountToken: JsonField) = apply { + this.accountToken = accountToken + } + + /** Tokens for the cards associated with the disputed transactions */ + fun cardTokens(cardTokens: List) = cardTokens(JsonField.of(cardTokens)) + + /** + * Sets [Builder.cardTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.cardTokens] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun cardTokens(cardTokens: JsonField>) = apply { + this.cardTokens = cardTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [cardTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCardToken(cardToken: String) = apply { + cardTokens = + (cardTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("cardTokens", it).add(cardToken) + } + } + + /** When the claim was created */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) + + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun created(created: JsonField) = apply { this.created = created } + + /** Transactions included in this claim */ + fun disputedTransactions(disputedTransactions: List) = + disputedTransactions(JsonField.of(disputedTransactions)) + + /** + * Sets [Builder.disputedTransactions] to an arbitrary JSON value. + * + * You should usually call [Builder.disputedTransactions] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun disputedTransactions(disputedTransactions: JsonField>) = + apply { + this.disputedTransactions = disputedTransactions.map { it.toMutableList() } + } + + /** + * Adds a single [DisputedTransaction] to [disputedTransactions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDisputedTransaction(disputedTransaction: DisputedTransaction) = apply { + disputedTransactions = + (disputedTransactions ?: JsonField.of(mutableListOf())).also { + checkKnown("disputedTransactions", it).add(disputedTransaction) + } + } + + /** The type of event that occurred. */ + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + + /** Requirements that must be fulfilled before the claim can be submitted */ + fun outstandingRequirements(outstandingRequirements: List) = + outstandingRequirements(JsonField.of(outstandingRequirements)) + + /** + * Sets [Builder.outstandingRequirements] to an arbitrary JSON value. + * + * You should usually call [Builder.outstandingRequirements] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun outstandingRequirements( + outstandingRequirements: JsonField> + ) = apply { + this.outstandingRequirements = outstandingRequirements.map { it.toMutableList() } + } + + /** + * Adds a single [OutstandingRequirement] to [outstandingRequirements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addOutstandingRequirement(outstandingRequirement: OutstandingRequirement) = apply { + outstandingRequirements = + (outstandingRequirements ?: JsonField.of(mutableListOf())).also { + checkKnown("outstandingRequirements", it).add(outstandingRequirement) + } + } + + /** Dispute reason code provided when creating the claim */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + /** Current lifecycle status of the claim */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** When the claim was submitted. Null until the claim reaches `SUBMITTED` status */ + fun submitted(submitted: OffsetDateTime?) = submitted(JsonField.ofNullable(submitted)) + + /** Alias for calling [Builder.submitted] with `submitted.orElse(null)`. */ + fun submitted(submitted: Optional) = submitted(submitted.getOrNull()) + + /** + * Sets [Builder.submitted] to an arbitrary JSON value. + * + * You should usually call [Builder.submitted] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun submitted(submitted: JsonField) = apply { this.submitted = submitted } + + /** When the claim was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + 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 [ClaimCreatedWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .accountHolderToken() + * .accountToken() + * .cardTokens() + * .created() + * .disputedTransactions() + * .eventType() + * .outstandingRequirements() + * .reason() + * .status() + * .submitted() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ClaimCreatedWebhookEvent = + ClaimCreatedWebhookEvent( + checkRequired("token", token), + checkRequired("accountHolderToken", accountHolderToken), + checkRequired("accountToken", accountToken), + checkRequired("cardTokens", cardTokens).map { it.toImmutable() }, + checkRequired("created", created), + checkRequired("disputedTransactions", disputedTransactions).map { + it.toImmutable() + }, + checkRequired("eventType", eventType), + checkRequired("outstandingRequirements", outstandingRequirements).map { + it.toImmutable() + }, + checkRequired("reason", reason), + checkRequired("status", status), + checkRequired("submitted", submitted), + checkRequired("updated", updated), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ClaimCreatedWebhookEvent = apply { + if (validated) { + return@apply + } + + token() + accountHolderToken() + accountToken() + cardTokens() + created() + disputedTransactions().forEach { it.validate() } + eventType().validate() + outstandingRequirements().forEach { it.validate() } + reason().validate() + status().validate() + submitted() + updated() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (accountHolderToken.asKnown().isPresent) 1 else 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (cardTokens.asKnown().getOrNull()?.size ?: 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (disputedTransactions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (outstandingRequirements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (submitted.asKnown().isPresent) 1 else 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + /** A transaction included in a claim, along with the specific events being disputed. */ + class DisputedTransaction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val eventTokens: JsonField>, + private val transactionToken: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("event_tokens") + @ExcludeMissing + eventTokens: JsonField> = JsonMissing.of(), + @JsonProperty("transaction_token") + @ExcludeMissing + transactionToken: JsonField = JsonMissing.of(), + ) : this(eventTokens, transactionToken, mutableMapOf()) + + /** + * Tokens for the specific events within the transaction being disputed. Lithic creates one + * dispute per event token + * + * @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 eventTokens(): List = eventTokens.getRequired("event_tokens") + + /** + * Token for the transaction being disputed, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun transactionToken(): String = transactionToken.getRequired("transaction_token") + + /** + * Returns the raw JSON value of [eventTokens]. + * + * Unlike [eventTokens], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_tokens") + @ExcludeMissing + fun _eventTokens(): JsonField> = eventTokens + + /** + * Returns the raw JSON value of [transactionToken]. + * + * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_token") + @ExcludeMissing + fun _transactionToken(): JsonField = transactionToken + + @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 [DisputedTransaction]. + * + * The following fields are required: + * ```java + * .eventTokens() + * .transactionToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputedTransaction]. */ + class Builder internal constructor() { + + private var eventTokens: JsonField>? = null + private var transactionToken: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(disputedTransaction: DisputedTransaction) = apply { + eventTokens = disputedTransaction.eventTokens.map { it.toMutableList() } + transactionToken = disputedTransaction.transactionToken + additionalProperties = disputedTransaction.additionalProperties.toMutableMap() + } + + /** + * Tokens for the specific events within the transaction being disputed. Lithic creates + * one dispute per event token + */ + fun eventTokens(eventTokens: List) = eventTokens(JsonField.of(eventTokens)) + + /** + * Sets [Builder.eventTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.eventTokens] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun eventTokens(eventTokens: JsonField>) = apply { + this.eventTokens = eventTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [eventTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEventToken(eventToken: String) = apply { + eventTokens = + (eventTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("eventTokens", it).add(eventToken) + } + } + + /** Token for the transaction being disputed, in UUID format */ + fun transactionToken(transactionToken: String) = + transactionToken(JsonField.of(transactionToken)) + + /** + * Sets [Builder.transactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionToken(transactionToken: JsonField) = apply { + this.transactionToken = transactionToken + } + + 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 [DisputedTransaction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .eventTokens() + * .transactionToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputedTransaction = + DisputedTransaction( + checkRequired("eventTokens", eventTokens).map { it.toImmutable() }, + checkRequired("transactionToken", transactionToken), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DisputedTransaction = apply { + if (validated) { + return@apply + } + + eventTokens() + transactionToken() + 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 = + (eventTokens.asKnown().getOrNull()?.size ?: 0) + + (if (transactionToken.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputedTransaction && + eventTokens == other.eventTokens && + transactionToken == other.transactionToken && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(eventTokens, transactionToken, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DisputedTransaction{eventTokens=$eventTokens, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" + } + + /** The type of event that occurred. */ + class EventType @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 CLAIM_CREATED = of("claim.created") + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + CLAIM_CREATED + } + + /** + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EventType] 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 { + CLAIM_CREATED, + /** + * An enum member indicating that [EventType] 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) { + CLAIM_CREATED -> Value.CLAIM_CREATED + 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) { + CLAIM_CREATED -> Known.CLAIM_CREATED + else -> throw LithicInvalidDataException("Unknown EventType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EventType = 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 EventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class OutstandingRequirement + @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 QUESTIONNAIRE = of("QUESTIONNAIRE") + + @JvmField val DOCUMENTS = of("DOCUMENTS") + + @JvmStatic fun of(value: String) = OutstandingRequirement(JsonField.of(value)) + } + + /** An enum containing [OutstandingRequirement]'s known values. */ + enum class Known { + QUESTIONNAIRE, + DOCUMENTS, + } + + /** + * An enum containing [OutstandingRequirement]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [OutstandingRequirement] 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 { + QUESTIONNAIRE, + DOCUMENTS, + /** + * An enum member indicating that [OutstandingRequirement] 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) { + QUESTIONNAIRE -> Value.QUESTIONNAIRE + DOCUMENTS -> Value.DOCUMENTS + 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) { + QUESTIONNAIRE -> Known.QUESTIONNAIRE + DOCUMENTS -> Known.DOCUMENTS + else -> throw LithicInvalidDataException("Unknown OutstandingRequirement: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OutstandingRequirement = 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 OutstandingRequirement && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Dispute reason code provided when creating the claim */ + class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CARD_NOT_PRESENT = of("CARD_NOT_PRESENT") + + @JvmField val CARD_LOST = of("CARD_LOST") + + @JvmField val CARD_STOLEN = of("CARD_STOLEN") + + @JvmField val CARD_NEVER_RECEIVED = of("CARD_NEVER_RECEIVED") + + @JvmField val COUNTERFEIT = of("COUNTERFEIT") + + @JvmField val ACCOUNT_TAKEOVER = of("ACCOUNT_TAKEOVER") + + @JvmField val PRODUCT_NOT_RECEIVED = of("PRODUCT_NOT_RECEIVED") + + @JvmField val NOT_AS_DESCRIBED = of("NOT_AS_DESCRIBED") + + @JvmField val CREDIT_NOT_PROCESSED = of("CREDIT_NOT_PROCESSED") + + @JvmField val CANCELLED_RECURRING = of("CANCELLED_RECURRING") + + @JvmField val PAID_BY_OTHER_MEANS = of("PAID_BY_OTHER_MEANS") + + @JvmField val DUPLICATE_CHARGE = of("DUPLICATE_CHARGE") + + @JvmField val LATE_PRESENTMENT = of("LATE_PRESENTMENT") + + @JvmField val INCORRECT_TRANSACTION_CODE = of("INCORRECT_TRANSACTION_CODE") + + @JvmField val NO_AUTHORIZATION = of("NO_AUTHORIZATION") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") + + @JvmField val ATM_CASH_NOT_DISPENSED = of("ATM_CASH_NOT_DISPENSED") + + @JvmField val ATM_DEPOSIT_WRONG_AMOUNT = of("ATM_DEPOSIT_WRONG_AMOUNT") + + @JvmField val ATM_DEPOSIT_MISSING = of("ATM_DEPOSIT_MISSING") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + CARD_NOT_PRESENT, + CARD_LOST, + CARD_STOLEN, + CARD_NEVER_RECEIVED, + COUNTERFEIT, + ACCOUNT_TAKEOVER, + PRODUCT_NOT_RECEIVED, + NOT_AS_DESCRIBED, + CREDIT_NOT_PROCESSED, + CANCELLED_RECURRING, + PAID_BY_OTHER_MEANS, + DUPLICATE_CHARGE, + LATE_PRESENTMENT, + INCORRECT_TRANSACTION_CODE, + NO_AUTHORIZATION, + DECLINED, + INCORRECT_AMOUNT, + ATM_CASH_NOT_DISPENSED, + ATM_DEPOSIT_WRONG_AMOUNT, + ATM_DEPOSIT_MISSING, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_NOT_PRESENT, + CARD_LOST, + CARD_STOLEN, + CARD_NEVER_RECEIVED, + COUNTERFEIT, + ACCOUNT_TAKEOVER, + PRODUCT_NOT_RECEIVED, + NOT_AS_DESCRIBED, + CREDIT_NOT_PROCESSED, + CANCELLED_RECURRING, + PAID_BY_OTHER_MEANS, + DUPLICATE_CHARGE, + LATE_PRESENTMENT, + INCORRECT_TRANSACTION_CODE, + NO_AUTHORIZATION, + DECLINED, + INCORRECT_AMOUNT, + ATM_CASH_NOT_DISPENSED, + ATM_DEPOSIT_WRONG_AMOUNT, + ATM_DEPOSIT_MISSING, + /** An enum member indicating that [Reason] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_NOT_PRESENT -> Value.CARD_NOT_PRESENT + CARD_LOST -> Value.CARD_LOST + CARD_STOLEN -> Value.CARD_STOLEN + CARD_NEVER_RECEIVED -> Value.CARD_NEVER_RECEIVED + COUNTERFEIT -> Value.COUNTERFEIT + ACCOUNT_TAKEOVER -> Value.ACCOUNT_TAKEOVER + PRODUCT_NOT_RECEIVED -> Value.PRODUCT_NOT_RECEIVED + NOT_AS_DESCRIBED -> Value.NOT_AS_DESCRIBED + CREDIT_NOT_PROCESSED -> Value.CREDIT_NOT_PROCESSED + CANCELLED_RECURRING -> Value.CANCELLED_RECURRING + PAID_BY_OTHER_MEANS -> Value.PAID_BY_OTHER_MEANS + DUPLICATE_CHARGE -> Value.DUPLICATE_CHARGE + LATE_PRESENTMENT -> Value.LATE_PRESENTMENT + INCORRECT_TRANSACTION_CODE -> Value.INCORRECT_TRANSACTION_CODE + NO_AUTHORIZATION -> Value.NO_AUTHORIZATION + DECLINED -> Value.DECLINED + INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT + ATM_CASH_NOT_DISPENSED -> Value.ATM_CASH_NOT_DISPENSED + ATM_DEPOSIT_WRONG_AMOUNT -> Value.ATM_DEPOSIT_WRONG_AMOUNT + ATM_DEPOSIT_MISSING -> Value.ATM_DEPOSIT_MISSING + 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) { + CARD_NOT_PRESENT -> Known.CARD_NOT_PRESENT + CARD_LOST -> Known.CARD_LOST + CARD_STOLEN -> Known.CARD_STOLEN + CARD_NEVER_RECEIVED -> Known.CARD_NEVER_RECEIVED + COUNTERFEIT -> Known.COUNTERFEIT + ACCOUNT_TAKEOVER -> Known.ACCOUNT_TAKEOVER + PRODUCT_NOT_RECEIVED -> Known.PRODUCT_NOT_RECEIVED + NOT_AS_DESCRIBED -> Known.NOT_AS_DESCRIBED + CREDIT_NOT_PROCESSED -> Known.CREDIT_NOT_PROCESSED + CANCELLED_RECURRING -> Known.CANCELLED_RECURRING + PAID_BY_OTHER_MEANS -> Known.PAID_BY_OTHER_MEANS + DUPLICATE_CHARGE -> Known.DUPLICATE_CHARGE + LATE_PRESENTMENT -> Known.LATE_PRESENTMENT + INCORRECT_TRANSACTION_CODE -> Known.INCORRECT_TRANSACTION_CODE + NO_AUTHORIZATION -> Known.NO_AUTHORIZATION + DECLINED -> Known.DECLINED + INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT + ATM_CASH_NOT_DISPENSED -> Known.ATM_CASH_NOT_DISPENSED + ATM_DEPOSIT_WRONG_AMOUNT -> Known.ATM_DEPOSIT_WRONG_AMOUNT + ATM_DEPOSIT_MISSING -> Known.ATM_DEPOSIT_MISSING + else -> throw LithicInvalidDataException("Unknown Reason: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Reason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current lifecycle status of the claim */ + class Status @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 INITIALIZING = of("INITIALIZING") + + @JvmField val AWAITING_INFO = of("AWAITING_INFO") + + @JvmField val SUBMITTED = of("SUBMITTED") + + @JvmField val RESOLVED = of("RESOLVED") + + @JvmField val ABANDONED = of("ABANDONED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + INITIALIZING, + AWAITING_INFO, + SUBMITTED, + RESOLVED, + ABANDONED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] 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 { + INITIALIZING, + AWAITING_INFO, + SUBMITTED, + RESOLVED, + ABANDONED, + /** An enum member indicating that [Status] 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) { + INITIALIZING -> Value.INITIALIZING + AWAITING_INFO -> Value.AWAITING_INFO + SUBMITTED -> Value.SUBMITTED + RESOLVED -> Value.RESOLVED + ABANDONED -> Value.ABANDONED + 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) { + INITIALIZING -> Known.INITIALIZING + AWAITING_INFO -> Known.AWAITING_INFO + SUBMITTED -> Known.SUBMITTED + RESOLVED -> Known.RESOLVED + ABANDONED -> Known.ABANDONED + else -> throw LithicInvalidDataException("Unknown Status: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = 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 Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClaimCreatedWebhookEvent && + token == other.token && + accountHolderToken == other.accountHolderToken && + accountToken == other.accountToken && + cardTokens == other.cardTokens && + created == other.created && + disputedTransactions == other.disputedTransactions && + eventType == other.eventType && + outstandingRequirements == other.outstandingRequirements && + reason == other.reason && + status == other.status && + submitted == other.submitted && + updated == other.updated && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + accountHolderToken, + accountToken, + cardTokens, + created, + disputedTransactions, + eventType, + outstandingRequirements, + reason, + status, + submitted, + updated, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ClaimCreatedWebhookEvent{token=$token, accountHolderToken=$accountHolderToken, accountToken=$accountToken, cardTokens=$cardTokens, created=$created, disputedTransactions=$disputedTransactions, eventType=$eventType, outstandingRequirements=$outstandingRequirements, reason=$reason, status=$status, submitted=$submitted, updated=$updated, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEvent.kt new file mode 100644 index 000000000..3c8e70d76 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEvent.kt @@ -0,0 +1,1442 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ClaimDocumentAcceptedWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val created: JsonField, + private val downloadUrl: JsonField, + private val downloadUrlExpiresAt: JsonField, + private val eventType: JsonField, + private val failureReason: JsonField, + private val name: JsonField, + private val requirementId: JsonField, + private val status: JsonField, + private val updated: JsonField, + private val uploadConstraints: JsonField, + private val uploadUrl: JsonField, + private val uploadUrlExpiresAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("download_url") + @ExcludeMissing + downloadUrl: JsonField = JsonMissing.of(), + @JsonProperty("download_url_expires_at") + @ExcludeMissing + downloadUrlExpiresAt: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + @JsonProperty("failure_reason") + @ExcludeMissing + failureReason: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("requirement_id") + @ExcludeMissing + requirementId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + @JsonProperty("upload_constraints") + @ExcludeMissing + uploadConstraints: JsonField = JsonMissing.of(), + @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(), + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + uploadUrlExpiresAt: JsonField = JsonMissing.of(), + ) : this( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + mutableMapOf(), + ) + + /** + * Unique identifier for the document, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * When the document was created + * + * @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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrl(): Optional = downloadUrl.getOptional("download_url") + + /** + * When the download URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrlExpiresAt(): Optional = + downloadUrlExpiresAt.getOptional("download_url_expires_at") + + /** + * The type of event that occurred. + * + * @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 eventType(): EventType = eventType.getRequired("event_type") + + /** + * Reason the document failed validation. Null unless `status` is `REJECTED` + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun failureReason(): Optional = failureReason.getOptional("failure_reason") + + /** + * Name provided when the upload intent was created + * + * @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 name(): String = name.getRequired("name") + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requirementId(): Optional = requirementId.getOptional("requirement_id") + + /** + * Current validation status of the document + * + * @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 status(): Status = status.getRequired("status") + + /** + * When the document was last updated + * + * @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 updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * Constraints that an uploaded file must satisfy. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadConstraints(): Optional = + uploadConstraints.getOptional("upload_constraints") + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires or + * after the document has been validated + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url") + + /** + * When the upload URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrlExpiresAt(): Optional = + uploadUrlExpiresAt.getOptional("upload_url_expires_at") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + + /** + * Returns the raw JSON value of [downloadUrl]. + * + * Unlike [downloadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("download_url") + @ExcludeMissing + fun _downloadUrl(): JsonField = downloadUrl + + /** + * Returns the raw JSON value of [downloadUrlExpiresAt]. + * + * Unlike [downloadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("download_url_expires_at") + @ExcludeMissing + fun _downloadUrlExpiresAt(): JsonField = downloadUrlExpiresAt + + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + + /** + * Returns the raw JSON value of [failureReason]. + * + * Unlike [failureReason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("failure_reason") + @ExcludeMissing + fun _failureReason(): JsonField = failureReason + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [requirementId]. + * + * Unlike [requirementId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requirement_id") + @ExcludeMissing + fun _requirementId(): JsonField = requirementId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [uploadConstraints]. + * + * Unlike [uploadConstraints], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_constraints") + @ExcludeMissing + fun _uploadConstraints(): JsonField = uploadConstraints + + /** + * Returns the raw JSON value of [uploadUrl]. + * + * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl + + /** + * Returns the raw JSON value of [uploadUrlExpiresAt]. + * + * Unlike [uploadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + fun _uploadUrlExpiresAt(): JsonField = uploadUrlExpiresAt + + @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 + * [ClaimDocumentAcceptedWebhookEvent]. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ClaimDocumentAcceptedWebhookEvent]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var created: JsonField? = null + private var downloadUrl: JsonField? = null + private var downloadUrlExpiresAt: JsonField? = null + private var eventType: JsonField? = null + private var failureReason: JsonField? = null + private var name: JsonField? = null + private var requirementId: JsonField? = null + private var status: JsonField? = null + private var updated: JsonField? = null + private var uploadConstraints: JsonField? = null + private var uploadUrl: JsonField? = null + private var uploadUrlExpiresAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(claimDocumentAcceptedWebhookEvent: ClaimDocumentAcceptedWebhookEvent) = + apply { + token = claimDocumentAcceptedWebhookEvent.token + created = claimDocumentAcceptedWebhookEvent.created + downloadUrl = claimDocumentAcceptedWebhookEvent.downloadUrl + downloadUrlExpiresAt = claimDocumentAcceptedWebhookEvent.downloadUrlExpiresAt + eventType = claimDocumentAcceptedWebhookEvent.eventType + failureReason = claimDocumentAcceptedWebhookEvent.failureReason + name = claimDocumentAcceptedWebhookEvent.name + requirementId = claimDocumentAcceptedWebhookEvent.requirementId + status = claimDocumentAcceptedWebhookEvent.status + updated = claimDocumentAcceptedWebhookEvent.updated + uploadConstraints = claimDocumentAcceptedWebhookEvent.uploadConstraints + uploadUrl = claimDocumentAcceptedWebhookEvent.uploadUrl + uploadUrlExpiresAt = claimDocumentAcceptedWebhookEvent.uploadUrlExpiresAt + additionalProperties = + claimDocumentAcceptedWebhookEvent.additionalProperties.toMutableMap() + } + + /** Unique identifier for the document, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + /** When the document was created */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) + + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun created(created: JsonField) = apply { this.created = created } + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + */ + fun downloadUrl(downloadUrl: String?) = downloadUrl(JsonField.ofNullable(downloadUrl)) + + /** Alias for calling [Builder.downloadUrl] with `downloadUrl.orElse(null)`. */ + fun downloadUrl(downloadUrl: Optional) = downloadUrl(downloadUrl.getOrNull()) + + /** + * Sets [Builder.downloadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun downloadUrl(downloadUrl: JsonField) = apply { this.downloadUrl = downloadUrl } + + /** When the download URL expires */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: OffsetDateTime?) = + downloadUrlExpiresAt(JsonField.ofNullable(downloadUrlExpiresAt)) + + /** + * Alias for calling [Builder.downloadUrlExpiresAt] with + * `downloadUrlExpiresAt.orElse(null)`. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: Optional) = + downloadUrlExpiresAt(downloadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.downloadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: JsonField) = apply { + this.downloadUrlExpiresAt = downloadUrlExpiresAt + } + + /** The type of event that occurred. */ + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + fun failureReason(failureReason: FailureReason?) = + failureReason(JsonField.ofNullable(failureReason)) + + /** Alias for calling [Builder.failureReason] with `failureReason.orElse(null)`. */ + fun failureReason(failureReason: Optional) = + failureReason(failureReason.getOrNull()) + + /** + * Sets [Builder.failureReason] to an arbitrary JSON value. + * + * You should usually call [Builder.failureReason] with a well-typed [FailureReason] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun failureReason(failureReason: JsonField) = apply { + this.failureReason = failureReason + } + + /** Name provided when the upload intent was created */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + */ + fun requirementId(requirementId: String?) = + requirementId(JsonField.ofNullable(requirementId)) + + /** Alias for calling [Builder.requirementId] with `requirementId.orElse(null)`. */ + fun requirementId(requirementId: Optional) = + requirementId(requirementId.getOrNull()) + + /** + * Sets [Builder.requirementId] to an arbitrary JSON value. + * + * You should usually call [Builder.requirementId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun requirementId(requirementId: JsonField) = apply { + this.requirementId = requirementId + } + + /** Current validation status of the document */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** When the document was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + /** Constraints that an uploaded file must satisfy. */ + fun uploadConstraints(uploadConstraints: UploadConstraints2?) = + uploadConstraints(JsonField.ofNullable(uploadConstraints)) + + /** Alias for calling [Builder.uploadConstraints] with `uploadConstraints.orElse(null)`. */ + fun uploadConstraints(uploadConstraints: Optional) = + uploadConstraints(uploadConstraints.getOrNull()) + + /** + * Sets [Builder.uploadConstraints] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadConstraints] with a well-typed + * [UploadConstraints2] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun uploadConstraints(uploadConstraints: JsonField) = apply { + this.uploadConstraints = uploadConstraints + } + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires + * or after the document has been validated + */ + fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl)) + + /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */ + fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull()) + + /** + * Sets [Builder.uploadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl } + + /** When the upload URL expires */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: OffsetDateTime?) = + uploadUrlExpiresAt(JsonField.ofNullable(uploadUrlExpiresAt)) + + /** + * Alias for calling [Builder.uploadUrlExpiresAt] with `uploadUrlExpiresAt.orElse(null)`. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: Optional) = + uploadUrlExpiresAt(uploadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.uploadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: JsonField) = apply { + this.uploadUrlExpiresAt = uploadUrlExpiresAt + } + + 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 [ClaimDocumentAcceptedWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ClaimDocumentAcceptedWebhookEvent = + ClaimDocumentAcceptedWebhookEvent( + checkRequired("token", token), + checkRequired("created", created), + checkRequired("downloadUrl", downloadUrl), + checkRequired("downloadUrlExpiresAt", downloadUrlExpiresAt), + checkRequired("eventType", eventType), + checkRequired("failureReason", failureReason), + checkRequired("name", name), + checkRequired("requirementId", requirementId), + checkRequired("status", status), + checkRequired("updated", updated), + checkRequired("uploadConstraints", uploadConstraints), + checkRequired("uploadUrl", uploadUrl), + checkRequired("uploadUrlExpiresAt", uploadUrlExpiresAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ClaimDocumentAcceptedWebhookEvent = apply { + if (validated) { + return@apply + } + + token() + created() + downloadUrl() + downloadUrlExpiresAt() + eventType().validate() + failureReason().ifPresent { it.validate() } + name() + requirementId() + status().validate() + updated() + uploadConstraints().ifPresent { it.validate() } + uploadUrl() + uploadUrlExpiresAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (downloadUrl.asKnown().isPresent) 1 else 0) + + (if (downloadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (failureReason.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (requirementId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (uploadConstraints.asKnown().getOrNull()?.validity() ?: 0) + + (if (uploadUrl.asKnown().isPresent) 1 else 0) + + (if (uploadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + /** The type of event that occurred. */ + class EventType @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 CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + CLAIM_DOCUMENT_ACCEPTED + } + + /** + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EventType] 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 { + CLAIM_DOCUMENT_ACCEPTED, + /** + * An enum member indicating that [EventType] 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) { + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + 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) { + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + else -> throw LithicInvalidDataException("Unknown EventType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EventType = 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 EventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + class FailureReason @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 INVALID_MIME_TYPE = of("INVALID_MIME_TYPE") + + @JvmField val FILE_TOO_LARGE = of("FILE_TOO_LARGE") + + @JvmField val FILE_EMPTY = of("FILE_EMPTY") + + @JvmField val CORRUPT_FILE = of("CORRUPT_FILE") + + @JvmField val OTHER = of("OTHER") + + @JvmStatic fun of(value: String) = FailureReason(JsonField.of(value)) + } + + /** An enum containing [FailureReason]'s known values. */ + enum class Known { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + } + + /** + * An enum containing [FailureReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FailureReason] 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 { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + /** + * An enum member indicating that [FailureReason] 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) { + INVALID_MIME_TYPE -> Value.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Value.FILE_TOO_LARGE + FILE_EMPTY -> Value.FILE_EMPTY + CORRUPT_FILE -> Value.CORRUPT_FILE + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INVALID_MIME_TYPE -> Known.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Known.FILE_TOO_LARGE + FILE_EMPTY -> Known.FILE_EMPTY + CORRUPT_FILE -> Known.CORRUPT_FILE + OTHER -> Known.OTHER + else -> throw LithicInvalidDataException("Unknown FailureReason: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FailureReason = 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 FailureReason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current validation status of the document */ + class Status @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 PENDING = of("PENDING") + + @JvmField val VALIDATING = of("VALIDATING") + + @JvmField val ACCEPTED = of("ACCEPTED") + + @JvmField val REJECTED = of("REJECTED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] 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 { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + /** An enum member indicating that [Status] 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) { + PENDING -> Value.PENDING + VALIDATING -> Value.VALIDATING + ACCEPTED -> Value.ACCEPTED + REJECTED -> Value.REJECTED + 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) { + PENDING -> Known.PENDING + VALIDATING -> Known.VALIDATING + ACCEPTED -> Known.ACCEPTED + REJECTED -> Known.REJECTED + else -> throw LithicInvalidDataException("Unknown Status: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = 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 Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Constraints that an uploaded file must satisfy. */ + class UploadConstraints2 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acceptedMimeTypes: JsonField>, + private val maxSizeBytes: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("accepted_mime_types") + @ExcludeMissing + acceptedMimeTypes: JsonField> = JsonMissing.of(), + @JsonProperty("max_size_bytes") + @ExcludeMissing + maxSizeBytes: JsonField = JsonMissing.of(), + ) : this(acceptedMimeTypes, maxSizeBytes, mutableMapOf()) + + /** + * MIME types accepted for upload + * + * @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 acceptedMimeTypes(): List = acceptedMimeTypes.getRequired("accepted_mime_types") + + /** + * Maximum file size in bytes. Null if there is no enforced size limit + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun maxSizeBytes(): Optional = maxSizeBytes.getOptional("max_size_bytes") + + /** + * Returns the raw JSON value of [acceptedMimeTypes]. + * + * Unlike [acceptedMimeTypes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accepted_mime_types") + @ExcludeMissing + fun _acceptedMimeTypes(): JsonField> = acceptedMimeTypes + + /** + * Returns the raw JSON value of [maxSizeBytes]. + * + * Unlike [maxSizeBytes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("max_size_bytes") + @ExcludeMissing + fun _maxSizeBytes(): JsonField = maxSizeBytes + + @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 [UploadConstraints2]. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UploadConstraints2]. */ + class Builder internal constructor() { + + private var acceptedMimeTypes: JsonField>? = null + private var maxSizeBytes: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(uploadConstraints2: UploadConstraints2) = apply { + acceptedMimeTypes = uploadConstraints2.acceptedMimeTypes.map { it.toMutableList() } + maxSizeBytes = uploadConstraints2.maxSizeBytes + additionalProperties = uploadConstraints2.additionalProperties.toMutableMap() + } + + /** MIME types accepted for upload */ + fun acceptedMimeTypes(acceptedMimeTypes: List) = + acceptedMimeTypes(JsonField.of(acceptedMimeTypes)) + + /** + * Sets [Builder.acceptedMimeTypes] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptedMimeTypes] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acceptedMimeTypes(acceptedMimeTypes: JsonField>) = apply { + this.acceptedMimeTypes = acceptedMimeTypes.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [acceptedMimeTypes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAcceptedMimeType(acceptedMimeType: String) = apply { + acceptedMimeTypes = + (acceptedMimeTypes ?: JsonField.of(mutableListOf())).also { + checkKnown("acceptedMimeTypes", it).add(acceptedMimeType) + } + } + + /** Maximum file size in bytes. Null if there is no enforced size limit */ + fun maxSizeBytes(maxSizeBytes: Long?) = maxSizeBytes(JsonField.ofNullable(maxSizeBytes)) + + /** + * Alias for [Builder.maxSizeBytes]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun maxSizeBytes(maxSizeBytes: Long) = maxSizeBytes(maxSizeBytes as Long?) + + /** Alias for calling [Builder.maxSizeBytes] with `maxSizeBytes.orElse(null)`. */ + fun maxSizeBytes(maxSizeBytes: Optional) = maxSizeBytes(maxSizeBytes.getOrNull()) + + /** + * Sets [Builder.maxSizeBytes] to an arbitrary JSON value. + * + * You should usually call [Builder.maxSizeBytes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun maxSizeBytes(maxSizeBytes: JsonField) = apply { + this.maxSizeBytes = maxSizeBytes + } + + 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 [UploadConstraints2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UploadConstraints2 = + UploadConstraints2( + checkRequired("acceptedMimeTypes", acceptedMimeTypes).map { it.toImmutable() }, + checkRequired("maxSizeBytes", maxSizeBytes), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): UploadConstraints2 = apply { + if (validated) { + return@apply + } + + acceptedMimeTypes() + maxSizeBytes() + 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 = + (acceptedMimeTypes.asKnown().getOrNull()?.size ?: 0) + + (if (maxSizeBytes.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is UploadConstraints2 && + acceptedMimeTypes == other.acceptedMimeTypes && + maxSizeBytes == other.maxSizeBytes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(acceptedMimeTypes, maxSizeBytes, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UploadConstraints2{acceptedMimeTypes=$acceptedMimeTypes, maxSizeBytes=$maxSizeBytes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClaimDocumentAcceptedWebhookEvent && + token == other.token && + created == other.created && + downloadUrl == other.downloadUrl && + downloadUrlExpiresAt == other.downloadUrlExpiresAt && + eventType == other.eventType && + failureReason == other.failureReason && + name == other.name && + requirementId == other.requirementId && + status == other.status && + updated == other.updated && + uploadConstraints == other.uploadConstraints && + uploadUrl == other.uploadUrl && + uploadUrlExpiresAt == other.uploadUrlExpiresAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ClaimDocumentAcceptedWebhookEvent{token=$token, created=$created, downloadUrl=$downloadUrl, downloadUrlExpiresAt=$downloadUrlExpiresAt, eventType=$eventType, failureReason=$failureReason, name=$name, requirementId=$requirementId, status=$status, updated=$updated, uploadConstraints=$uploadConstraints, uploadUrl=$uploadUrl, uploadUrlExpiresAt=$uploadUrlExpiresAt, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEvent.kt new file mode 100644 index 000000000..bd0f02ed5 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEvent.kt @@ -0,0 +1,1442 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ClaimDocumentRejectedWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val created: JsonField, + private val downloadUrl: JsonField, + private val downloadUrlExpiresAt: JsonField, + private val eventType: JsonField, + private val failureReason: JsonField, + private val name: JsonField, + private val requirementId: JsonField, + private val status: JsonField, + private val updated: JsonField, + private val uploadConstraints: JsonField, + private val uploadUrl: JsonField, + private val uploadUrlExpiresAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("download_url") + @ExcludeMissing + downloadUrl: JsonField = JsonMissing.of(), + @JsonProperty("download_url_expires_at") + @ExcludeMissing + downloadUrlExpiresAt: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + @JsonProperty("failure_reason") + @ExcludeMissing + failureReason: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("requirement_id") + @ExcludeMissing + requirementId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + @JsonProperty("upload_constraints") + @ExcludeMissing + uploadConstraints: JsonField = JsonMissing.of(), + @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(), + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + uploadUrlExpiresAt: JsonField = JsonMissing.of(), + ) : this( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + mutableMapOf(), + ) + + /** + * Unique identifier for the document, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * When the document was created + * + * @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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrl(): Optional = downloadUrl.getOptional("download_url") + + /** + * When the download URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrlExpiresAt(): Optional = + downloadUrlExpiresAt.getOptional("download_url_expires_at") + + /** + * The type of event that occurred. + * + * @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 eventType(): EventType = eventType.getRequired("event_type") + + /** + * Reason the document failed validation. Null unless `status` is `REJECTED` + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun failureReason(): Optional = failureReason.getOptional("failure_reason") + + /** + * Name provided when the upload intent was created + * + * @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 name(): String = name.getRequired("name") + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requirementId(): Optional = requirementId.getOptional("requirement_id") + + /** + * Current validation status of the document + * + * @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 status(): Status = status.getRequired("status") + + /** + * When the document was last updated + * + * @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 updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * Constraints that an uploaded file must satisfy. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadConstraints(): Optional = + uploadConstraints.getOptional("upload_constraints") + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires or + * after the document has been validated + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url") + + /** + * When the upload URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrlExpiresAt(): Optional = + uploadUrlExpiresAt.getOptional("upload_url_expires_at") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + + /** + * Returns the raw JSON value of [downloadUrl]. + * + * Unlike [downloadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("download_url") + @ExcludeMissing + fun _downloadUrl(): JsonField = downloadUrl + + /** + * Returns the raw JSON value of [downloadUrlExpiresAt]. + * + * Unlike [downloadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("download_url_expires_at") + @ExcludeMissing + fun _downloadUrlExpiresAt(): JsonField = downloadUrlExpiresAt + + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + + /** + * Returns the raw JSON value of [failureReason]. + * + * Unlike [failureReason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("failure_reason") + @ExcludeMissing + fun _failureReason(): JsonField = failureReason + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [requirementId]. + * + * Unlike [requirementId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requirement_id") + @ExcludeMissing + fun _requirementId(): JsonField = requirementId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [uploadConstraints]. + * + * Unlike [uploadConstraints], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_constraints") + @ExcludeMissing + fun _uploadConstraints(): JsonField = uploadConstraints + + /** + * Returns the raw JSON value of [uploadUrl]. + * + * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl + + /** + * Returns the raw JSON value of [uploadUrlExpiresAt]. + * + * Unlike [uploadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + fun _uploadUrlExpiresAt(): JsonField = uploadUrlExpiresAt + + @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 + * [ClaimDocumentRejectedWebhookEvent]. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ClaimDocumentRejectedWebhookEvent]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var created: JsonField? = null + private var downloadUrl: JsonField? = null + private var downloadUrlExpiresAt: JsonField? = null + private var eventType: JsonField? = null + private var failureReason: JsonField? = null + private var name: JsonField? = null + private var requirementId: JsonField? = null + private var status: JsonField? = null + private var updated: JsonField? = null + private var uploadConstraints: JsonField? = null + private var uploadUrl: JsonField? = null + private var uploadUrlExpiresAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(claimDocumentRejectedWebhookEvent: ClaimDocumentRejectedWebhookEvent) = + apply { + token = claimDocumentRejectedWebhookEvent.token + created = claimDocumentRejectedWebhookEvent.created + downloadUrl = claimDocumentRejectedWebhookEvent.downloadUrl + downloadUrlExpiresAt = claimDocumentRejectedWebhookEvent.downloadUrlExpiresAt + eventType = claimDocumentRejectedWebhookEvent.eventType + failureReason = claimDocumentRejectedWebhookEvent.failureReason + name = claimDocumentRejectedWebhookEvent.name + requirementId = claimDocumentRejectedWebhookEvent.requirementId + status = claimDocumentRejectedWebhookEvent.status + updated = claimDocumentRejectedWebhookEvent.updated + uploadConstraints = claimDocumentRejectedWebhookEvent.uploadConstraints + uploadUrl = claimDocumentRejectedWebhookEvent.uploadUrl + uploadUrlExpiresAt = claimDocumentRejectedWebhookEvent.uploadUrlExpiresAt + additionalProperties = + claimDocumentRejectedWebhookEvent.additionalProperties.toMutableMap() + } + + /** Unique identifier for the document, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + /** When the document was created */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) + + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun created(created: JsonField) = apply { this.created = created } + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + */ + fun downloadUrl(downloadUrl: String?) = downloadUrl(JsonField.ofNullable(downloadUrl)) + + /** Alias for calling [Builder.downloadUrl] with `downloadUrl.orElse(null)`. */ + fun downloadUrl(downloadUrl: Optional) = downloadUrl(downloadUrl.getOrNull()) + + /** + * Sets [Builder.downloadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun downloadUrl(downloadUrl: JsonField) = apply { this.downloadUrl = downloadUrl } + + /** When the download URL expires */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: OffsetDateTime?) = + downloadUrlExpiresAt(JsonField.ofNullable(downloadUrlExpiresAt)) + + /** + * Alias for calling [Builder.downloadUrlExpiresAt] with + * `downloadUrlExpiresAt.orElse(null)`. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: Optional) = + downloadUrlExpiresAt(downloadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.downloadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: JsonField) = apply { + this.downloadUrlExpiresAt = downloadUrlExpiresAt + } + + /** The type of event that occurred. */ + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + fun failureReason(failureReason: FailureReason?) = + failureReason(JsonField.ofNullable(failureReason)) + + /** Alias for calling [Builder.failureReason] with `failureReason.orElse(null)`. */ + fun failureReason(failureReason: Optional) = + failureReason(failureReason.getOrNull()) + + /** + * Sets [Builder.failureReason] to an arbitrary JSON value. + * + * You should usually call [Builder.failureReason] with a well-typed [FailureReason] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun failureReason(failureReason: JsonField) = apply { + this.failureReason = failureReason + } + + /** Name provided when the upload intent was created */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + */ + fun requirementId(requirementId: String?) = + requirementId(JsonField.ofNullable(requirementId)) + + /** Alias for calling [Builder.requirementId] with `requirementId.orElse(null)`. */ + fun requirementId(requirementId: Optional) = + requirementId(requirementId.getOrNull()) + + /** + * Sets [Builder.requirementId] to an arbitrary JSON value. + * + * You should usually call [Builder.requirementId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun requirementId(requirementId: JsonField) = apply { + this.requirementId = requirementId + } + + /** Current validation status of the document */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** When the document was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + /** Constraints that an uploaded file must satisfy. */ + fun uploadConstraints(uploadConstraints: UploadConstraints2?) = + uploadConstraints(JsonField.ofNullable(uploadConstraints)) + + /** Alias for calling [Builder.uploadConstraints] with `uploadConstraints.orElse(null)`. */ + fun uploadConstraints(uploadConstraints: Optional) = + uploadConstraints(uploadConstraints.getOrNull()) + + /** + * Sets [Builder.uploadConstraints] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadConstraints] with a well-typed + * [UploadConstraints2] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun uploadConstraints(uploadConstraints: JsonField) = apply { + this.uploadConstraints = uploadConstraints + } + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires + * or after the document has been validated + */ + fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl)) + + /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */ + fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull()) + + /** + * Sets [Builder.uploadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl } + + /** When the upload URL expires */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: OffsetDateTime?) = + uploadUrlExpiresAt(JsonField.ofNullable(uploadUrlExpiresAt)) + + /** + * Alias for calling [Builder.uploadUrlExpiresAt] with `uploadUrlExpiresAt.orElse(null)`. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: Optional) = + uploadUrlExpiresAt(uploadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.uploadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: JsonField) = apply { + this.uploadUrlExpiresAt = uploadUrlExpiresAt + } + + 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 [ClaimDocumentRejectedWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ClaimDocumentRejectedWebhookEvent = + ClaimDocumentRejectedWebhookEvent( + checkRequired("token", token), + checkRequired("created", created), + checkRequired("downloadUrl", downloadUrl), + checkRequired("downloadUrlExpiresAt", downloadUrlExpiresAt), + checkRequired("eventType", eventType), + checkRequired("failureReason", failureReason), + checkRequired("name", name), + checkRequired("requirementId", requirementId), + checkRequired("status", status), + checkRequired("updated", updated), + checkRequired("uploadConstraints", uploadConstraints), + checkRequired("uploadUrl", uploadUrl), + checkRequired("uploadUrlExpiresAt", uploadUrlExpiresAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ClaimDocumentRejectedWebhookEvent = apply { + if (validated) { + return@apply + } + + token() + created() + downloadUrl() + downloadUrlExpiresAt() + eventType().validate() + failureReason().ifPresent { it.validate() } + name() + requirementId() + status().validate() + updated() + uploadConstraints().ifPresent { it.validate() } + uploadUrl() + uploadUrlExpiresAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (downloadUrl.asKnown().isPresent) 1 else 0) + + (if (downloadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (failureReason.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (requirementId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (uploadConstraints.asKnown().getOrNull()?.validity() ?: 0) + + (if (uploadUrl.asKnown().isPresent) 1 else 0) + + (if (uploadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + /** The type of event that occurred. */ + class EventType @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 CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + CLAIM_DOCUMENT_REJECTED + } + + /** + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EventType] 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 { + CLAIM_DOCUMENT_REJECTED, + /** + * An enum member indicating that [EventType] 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) { + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + 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) { + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + else -> throw LithicInvalidDataException("Unknown EventType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EventType = 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 EventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + class FailureReason @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 INVALID_MIME_TYPE = of("INVALID_MIME_TYPE") + + @JvmField val FILE_TOO_LARGE = of("FILE_TOO_LARGE") + + @JvmField val FILE_EMPTY = of("FILE_EMPTY") + + @JvmField val CORRUPT_FILE = of("CORRUPT_FILE") + + @JvmField val OTHER = of("OTHER") + + @JvmStatic fun of(value: String) = FailureReason(JsonField.of(value)) + } + + /** An enum containing [FailureReason]'s known values. */ + enum class Known { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + } + + /** + * An enum containing [FailureReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FailureReason] 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 { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + /** + * An enum member indicating that [FailureReason] 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) { + INVALID_MIME_TYPE -> Value.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Value.FILE_TOO_LARGE + FILE_EMPTY -> Value.FILE_EMPTY + CORRUPT_FILE -> Value.CORRUPT_FILE + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INVALID_MIME_TYPE -> Known.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Known.FILE_TOO_LARGE + FILE_EMPTY -> Known.FILE_EMPTY + CORRUPT_FILE -> Known.CORRUPT_FILE + OTHER -> Known.OTHER + else -> throw LithicInvalidDataException("Unknown FailureReason: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FailureReason = 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 FailureReason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current validation status of the document */ + class Status @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 PENDING = of("PENDING") + + @JvmField val VALIDATING = of("VALIDATING") + + @JvmField val ACCEPTED = of("ACCEPTED") + + @JvmField val REJECTED = of("REJECTED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] 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 { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + /** An enum member indicating that [Status] 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) { + PENDING -> Value.PENDING + VALIDATING -> Value.VALIDATING + ACCEPTED -> Value.ACCEPTED + REJECTED -> Value.REJECTED + 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) { + PENDING -> Known.PENDING + VALIDATING -> Known.VALIDATING + ACCEPTED -> Known.ACCEPTED + REJECTED -> Known.REJECTED + else -> throw LithicInvalidDataException("Unknown Status: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = 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 Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Constraints that an uploaded file must satisfy. */ + class UploadConstraints2 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acceptedMimeTypes: JsonField>, + private val maxSizeBytes: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("accepted_mime_types") + @ExcludeMissing + acceptedMimeTypes: JsonField> = JsonMissing.of(), + @JsonProperty("max_size_bytes") + @ExcludeMissing + maxSizeBytes: JsonField = JsonMissing.of(), + ) : this(acceptedMimeTypes, maxSizeBytes, mutableMapOf()) + + /** + * MIME types accepted for upload + * + * @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 acceptedMimeTypes(): List = acceptedMimeTypes.getRequired("accepted_mime_types") + + /** + * Maximum file size in bytes. Null if there is no enforced size limit + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun maxSizeBytes(): Optional = maxSizeBytes.getOptional("max_size_bytes") + + /** + * Returns the raw JSON value of [acceptedMimeTypes]. + * + * Unlike [acceptedMimeTypes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accepted_mime_types") + @ExcludeMissing + fun _acceptedMimeTypes(): JsonField> = acceptedMimeTypes + + /** + * Returns the raw JSON value of [maxSizeBytes]. + * + * Unlike [maxSizeBytes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("max_size_bytes") + @ExcludeMissing + fun _maxSizeBytes(): JsonField = maxSizeBytes + + @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 [UploadConstraints2]. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UploadConstraints2]. */ + class Builder internal constructor() { + + private var acceptedMimeTypes: JsonField>? = null + private var maxSizeBytes: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(uploadConstraints2: UploadConstraints2) = apply { + acceptedMimeTypes = uploadConstraints2.acceptedMimeTypes.map { it.toMutableList() } + maxSizeBytes = uploadConstraints2.maxSizeBytes + additionalProperties = uploadConstraints2.additionalProperties.toMutableMap() + } + + /** MIME types accepted for upload */ + fun acceptedMimeTypes(acceptedMimeTypes: List) = + acceptedMimeTypes(JsonField.of(acceptedMimeTypes)) + + /** + * Sets [Builder.acceptedMimeTypes] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptedMimeTypes] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acceptedMimeTypes(acceptedMimeTypes: JsonField>) = apply { + this.acceptedMimeTypes = acceptedMimeTypes.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [acceptedMimeTypes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAcceptedMimeType(acceptedMimeType: String) = apply { + acceptedMimeTypes = + (acceptedMimeTypes ?: JsonField.of(mutableListOf())).also { + checkKnown("acceptedMimeTypes", it).add(acceptedMimeType) + } + } + + /** Maximum file size in bytes. Null if there is no enforced size limit */ + fun maxSizeBytes(maxSizeBytes: Long?) = maxSizeBytes(JsonField.ofNullable(maxSizeBytes)) + + /** + * Alias for [Builder.maxSizeBytes]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun maxSizeBytes(maxSizeBytes: Long) = maxSizeBytes(maxSizeBytes as Long?) + + /** Alias for calling [Builder.maxSizeBytes] with `maxSizeBytes.orElse(null)`. */ + fun maxSizeBytes(maxSizeBytes: Optional) = maxSizeBytes(maxSizeBytes.getOrNull()) + + /** + * Sets [Builder.maxSizeBytes] to an arbitrary JSON value. + * + * You should usually call [Builder.maxSizeBytes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun maxSizeBytes(maxSizeBytes: JsonField) = apply { + this.maxSizeBytes = maxSizeBytes + } + + 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 [UploadConstraints2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UploadConstraints2 = + UploadConstraints2( + checkRequired("acceptedMimeTypes", acceptedMimeTypes).map { it.toImmutable() }, + checkRequired("maxSizeBytes", maxSizeBytes), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): UploadConstraints2 = apply { + if (validated) { + return@apply + } + + acceptedMimeTypes() + maxSizeBytes() + 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 = + (acceptedMimeTypes.asKnown().getOrNull()?.size ?: 0) + + (if (maxSizeBytes.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is UploadConstraints2 && + acceptedMimeTypes == other.acceptedMimeTypes && + maxSizeBytes == other.maxSizeBytes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(acceptedMimeTypes, maxSizeBytes, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UploadConstraints2{acceptedMimeTypes=$acceptedMimeTypes, maxSizeBytes=$maxSizeBytes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClaimDocumentRejectedWebhookEvent && + token == other.token && + created == other.created && + downloadUrl == other.downloadUrl && + downloadUrlExpiresAt == other.downloadUrlExpiresAt && + eventType == other.eventType && + failureReason == other.failureReason && + name == other.name && + requirementId == other.requirementId && + status == other.status && + updated == other.updated && + uploadConstraints == other.uploadConstraints && + uploadUrl == other.uploadUrl && + uploadUrlExpiresAt == other.uploadUrlExpiresAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ClaimDocumentRejectedWebhookEvent{token=$token, created=$created, downloadUrl=$downloadUrl, downloadUrlExpiresAt=$downloadUrlExpiresAt, eventType=$eventType, failureReason=$failureReason, name=$name, requirementId=$requirementId, status=$status, updated=$updated, uploadConstraints=$uploadConstraints, uploadUrl=$uploadUrl, uploadUrlExpiresAt=$uploadUrlExpiresAt, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEvent.kt new file mode 100644 index 000000000..fa163c4e0 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEvent.kt @@ -0,0 +1,1442 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ClaimDocumentUploadedWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val created: JsonField, + private val downloadUrl: JsonField, + private val downloadUrlExpiresAt: JsonField, + private val eventType: JsonField, + private val failureReason: JsonField, + private val name: JsonField, + private val requirementId: JsonField, + private val status: JsonField, + private val updated: JsonField, + private val uploadConstraints: JsonField, + private val uploadUrl: JsonField, + private val uploadUrlExpiresAt: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("download_url") + @ExcludeMissing + downloadUrl: JsonField = JsonMissing.of(), + @JsonProperty("download_url_expires_at") + @ExcludeMissing + downloadUrlExpiresAt: JsonField = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + @JsonProperty("failure_reason") + @ExcludeMissing + failureReason: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("requirement_id") + @ExcludeMissing + requirementId: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + @JsonProperty("upload_constraints") + @ExcludeMissing + uploadConstraints: JsonField = JsonMissing.of(), + @JsonProperty("upload_url") @ExcludeMissing uploadUrl: JsonField = JsonMissing.of(), + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + uploadUrlExpiresAt: JsonField = JsonMissing.of(), + ) : this( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + mutableMapOf(), + ) + + /** + * Unique identifier for the document, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * When the document was created + * + * @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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrl(): Optional = downloadUrl.getOptional("download_url") + + /** + * When the download URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun downloadUrlExpiresAt(): Optional = + downloadUrlExpiresAt.getOptional("download_url_expires_at") + + /** + * The type of event that occurred. + * + * @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 eventType(): EventType = eventType.getRequired("event_type") + + /** + * Reason the document failed validation. Null unless `status` is `REJECTED` + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun failureReason(): Optional = failureReason.getOptional("failure_reason") + + /** + * Name provided when the upload intent was created + * + * @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 name(): String = name.getRequired("name") + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun requirementId(): Optional = requirementId.getOptional("requirement_id") + + /** + * Current validation status of the document + * + * @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 status(): Status = status.getRequired("status") + + /** + * When the document was last updated + * + * @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 updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * Constraints that an uploaded file must satisfy. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadConstraints(): Optional = + uploadConstraints.getOptional("upload_constraints") + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires or + * after the document has been validated + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrl(): Optional = uploadUrl.getOptional("upload_url") + + /** + * When the upload URL expires + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun uploadUrlExpiresAt(): Optional = + uploadUrlExpiresAt.getOptional("upload_url_expires_at") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + + /** + * Returns the raw JSON value of [downloadUrl]. + * + * Unlike [downloadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("download_url") + @ExcludeMissing + fun _downloadUrl(): JsonField = downloadUrl + + /** + * Returns the raw JSON value of [downloadUrlExpiresAt]. + * + * Unlike [downloadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("download_url_expires_at") + @ExcludeMissing + fun _downloadUrlExpiresAt(): JsonField = downloadUrlExpiresAt + + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + + /** + * Returns the raw JSON value of [failureReason]. + * + * Unlike [failureReason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("failure_reason") + @ExcludeMissing + fun _failureReason(): JsonField = failureReason + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + /** + * Returns the raw JSON value of [requirementId]. + * + * Unlike [requirementId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("requirement_id") + @ExcludeMissing + fun _requirementId(): JsonField = requirementId + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + /** + * Returns the raw JSON value of [uploadConstraints]. + * + * Unlike [uploadConstraints], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_constraints") + @ExcludeMissing + fun _uploadConstraints(): JsonField = uploadConstraints + + /** + * Returns the raw JSON value of [uploadUrl]. + * + * Unlike [uploadUrl], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("upload_url") @ExcludeMissing fun _uploadUrl(): JsonField = uploadUrl + + /** + * Returns the raw JSON value of [uploadUrlExpiresAt]. + * + * Unlike [uploadUrlExpiresAt], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("upload_url_expires_at") + @ExcludeMissing + fun _uploadUrlExpiresAt(): JsonField = uploadUrlExpiresAt + + @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 + * [ClaimDocumentUploadedWebhookEvent]. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ClaimDocumentUploadedWebhookEvent]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var created: JsonField? = null + private var downloadUrl: JsonField? = null + private var downloadUrlExpiresAt: JsonField? = null + private var eventType: JsonField? = null + private var failureReason: JsonField? = null + private var name: JsonField? = null + private var requirementId: JsonField? = null + private var status: JsonField? = null + private var updated: JsonField? = null + private var uploadConstraints: JsonField? = null + private var uploadUrl: JsonField? = null + private var uploadUrlExpiresAt: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(claimDocumentUploadedWebhookEvent: ClaimDocumentUploadedWebhookEvent) = + apply { + token = claimDocumentUploadedWebhookEvent.token + created = claimDocumentUploadedWebhookEvent.created + downloadUrl = claimDocumentUploadedWebhookEvent.downloadUrl + downloadUrlExpiresAt = claimDocumentUploadedWebhookEvent.downloadUrlExpiresAt + eventType = claimDocumentUploadedWebhookEvent.eventType + failureReason = claimDocumentUploadedWebhookEvent.failureReason + name = claimDocumentUploadedWebhookEvent.name + requirementId = claimDocumentUploadedWebhookEvent.requirementId + status = claimDocumentUploadedWebhookEvent.status + updated = claimDocumentUploadedWebhookEvent.updated + uploadConstraints = claimDocumentUploadedWebhookEvent.uploadConstraints + uploadUrl = claimDocumentUploadedWebhookEvent.uploadUrl + uploadUrlExpiresAt = claimDocumentUploadedWebhookEvent.uploadUrlExpiresAt + additionalProperties = + claimDocumentUploadedWebhookEvent.additionalProperties.toMutableMap() + } + + /** Unique identifier for the document, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + /** When the document was created */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) + + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun created(created: JsonField) = apply { this.created = created } + + /** + * Presigned URL for downloading the uploaded document. Available once the document is being + * validated or has been accepted (`VALIDATING` or `ACCEPTED`) + */ + fun downloadUrl(downloadUrl: String?) = downloadUrl(JsonField.ofNullable(downloadUrl)) + + /** Alias for calling [Builder.downloadUrl] with `downloadUrl.orElse(null)`. */ + fun downloadUrl(downloadUrl: Optional) = downloadUrl(downloadUrl.getOrNull()) + + /** + * Sets [Builder.downloadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun downloadUrl(downloadUrl: JsonField) = apply { this.downloadUrl = downloadUrl } + + /** When the download URL expires */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: OffsetDateTime?) = + downloadUrlExpiresAt(JsonField.ofNullable(downloadUrlExpiresAt)) + + /** + * Alias for calling [Builder.downloadUrlExpiresAt] with + * `downloadUrlExpiresAt.orElse(null)`. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: Optional) = + downloadUrlExpiresAt(downloadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.downloadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.downloadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun downloadUrlExpiresAt(downloadUrlExpiresAt: JsonField) = apply { + this.downloadUrlExpiresAt = downloadUrlExpiresAt + } + + /** The type of event that occurred. */ + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + fun failureReason(failureReason: FailureReason?) = + failureReason(JsonField.ofNullable(failureReason)) + + /** Alias for calling [Builder.failureReason] with `failureReason.orElse(null)`. */ + fun failureReason(failureReason: Optional) = + failureReason(failureReason.getOrNull()) + + /** + * Sets [Builder.failureReason] to an arbitrary JSON value. + * + * You should usually call [Builder.failureReason] with a well-typed [FailureReason] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun failureReason(failureReason: JsonField) = apply { + this.failureReason = failureReason + } + + /** Name provided when the upload intent was created */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun name(name: JsonField) = apply { this.name = name } + + /** + * Identifier of the document requirement this document satisfies. Null for supplemental + * documents not tied to a specific requirement + */ + fun requirementId(requirementId: String?) = + requirementId(JsonField.ofNullable(requirementId)) + + /** Alias for calling [Builder.requirementId] with `requirementId.orElse(null)`. */ + fun requirementId(requirementId: Optional) = + requirementId(requirementId.getOrNull()) + + /** + * Sets [Builder.requirementId] to an arbitrary JSON value. + * + * You should usually call [Builder.requirementId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun requirementId(requirementId: JsonField) = apply { + this.requirementId = requirementId + } + + /** Current validation status of the document */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** When the document was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + /** Constraints that an uploaded file must satisfy. */ + fun uploadConstraints(uploadConstraints: UploadConstraints2?) = + uploadConstraints(JsonField.ofNullable(uploadConstraints)) + + /** Alias for calling [Builder.uploadConstraints] with `uploadConstraints.orElse(null)`. */ + fun uploadConstraints(uploadConstraints: Optional) = + uploadConstraints(uploadConstraints.getOrNull()) + + /** + * Sets [Builder.uploadConstraints] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadConstraints] with a well-typed + * [UploadConstraints2] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun uploadConstraints(uploadConstraints: JsonField) = apply { + this.uploadConstraints = uploadConstraints + } + + /** + * Presigned URL for uploading the file via HTTP PUT. Null after the upload window expires + * or after the document has been validated + */ + fun uploadUrl(uploadUrl: String?) = uploadUrl(JsonField.ofNullable(uploadUrl)) + + /** Alias for calling [Builder.uploadUrl] with `uploadUrl.orElse(null)`. */ + fun uploadUrl(uploadUrl: Optional) = uploadUrl(uploadUrl.getOrNull()) + + /** + * Sets [Builder.uploadUrl] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrl] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun uploadUrl(uploadUrl: JsonField) = apply { this.uploadUrl = uploadUrl } + + /** When the upload URL expires */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: OffsetDateTime?) = + uploadUrlExpiresAt(JsonField.ofNullable(uploadUrlExpiresAt)) + + /** + * Alias for calling [Builder.uploadUrlExpiresAt] with `uploadUrlExpiresAt.orElse(null)`. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: Optional) = + uploadUrlExpiresAt(uploadUrlExpiresAt.getOrNull()) + + /** + * Sets [Builder.uploadUrlExpiresAt] to an arbitrary JSON value. + * + * You should usually call [Builder.uploadUrlExpiresAt] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun uploadUrlExpiresAt(uploadUrlExpiresAt: JsonField) = apply { + this.uploadUrlExpiresAt = uploadUrlExpiresAt + } + + 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 [ClaimDocumentUploadedWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .downloadUrl() + * .downloadUrlExpiresAt() + * .eventType() + * .failureReason() + * .name() + * .requirementId() + * .status() + * .updated() + * .uploadConstraints() + * .uploadUrl() + * .uploadUrlExpiresAt() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ClaimDocumentUploadedWebhookEvent = + ClaimDocumentUploadedWebhookEvent( + checkRequired("token", token), + checkRequired("created", created), + checkRequired("downloadUrl", downloadUrl), + checkRequired("downloadUrlExpiresAt", downloadUrlExpiresAt), + checkRequired("eventType", eventType), + checkRequired("failureReason", failureReason), + checkRequired("name", name), + checkRequired("requirementId", requirementId), + checkRequired("status", status), + checkRequired("updated", updated), + checkRequired("uploadConstraints", uploadConstraints), + checkRequired("uploadUrl", uploadUrl), + checkRequired("uploadUrlExpiresAt", uploadUrlExpiresAt), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ClaimDocumentUploadedWebhookEvent = apply { + if (validated) { + return@apply + } + + token() + created() + downloadUrl() + downloadUrlExpiresAt() + eventType().validate() + failureReason().ifPresent { it.validate() } + name() + requirementId() + status().validate() + updated() + uploadConstraints().ifPresent { it.validate() } + uploadUrl() + uploadUrlExpiresAt() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (downloadUrl.asKnown().isPresent) 1 else 0) + + (if (downloadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (failureReason.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (requirementId.asKnown().isPresent) 1 else 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + (uploadConstraints.asKnown().getOrNull()?.validity() ?: 0) + + (if (uploadUrl.asKnown().isPresent) 1 else 0) + + (if (uploadUrlExpiresAt.asKnown().isPresent) 1 else 0) + + /** The type of event that occurred. */ + class EventType @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 CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + CLAIM_DOCUMENT_UPLOADED + } + + /** + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EventType] 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 { + CLAIM_DOCUMENT_UPLOADED, + /** + * An enum member indicating that [EventType] 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) { + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + 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) { + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + else -> throw LithicInvalidDataException("Unknown EventType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EventType = 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 EventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason the document failed validation. Null unless `status` is `REJECTED` */ + class FailureReason @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 INVALID_MIME_TYPE = of("INVALID_MIME_TYPE") + + @JvmField val FILE_TOO_LARGE = of("FILE_TOO_LARGE") + + @JvmField val FILE_EMPTY = of("FILE_EMPTY") + + @JvmField val CORRUPT_FILE = of("CORRUPT_FILE") + + @JvmField val OTHER = of("OTHER") + + @JvmStatic fun of(value: String) = FailureReason(JsonField.of(value)) + } + + /** An enum containing [FailureReason]'s known values. */ + enum class Known { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + } + + /** + * An enum containing [FailureReason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FailureReason] 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 { + INVALID_MIME_TYPE, + FILE_TOO_LARGE, + FILE_EMPTY, + CORRUPT_FILE, + OTHER, + /** + * An enum member indicating that [FailureReason] 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) { + INVALID_MIME_TYPE -> Value.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Value.FILE_TOO_LARGE + FILE_EMPTY -> Value.FILE_EMPTY + CORRUPT_FILE -> Value.CORRUPT_FILE + OTHER -> Value.OTHER + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't + * want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known + * member. + */ + fun known(): Known = + when (this) { + INVALID_MIME_TYPE -> Known.INVALID_MIME_TYPE + FILE_TOO_LARGE -> Known.FILE_TOO_LARGE + FILE_EMPTY -> Known.FILE_EMPTY + CORRUPT_FILE -> Known.CORRUPT_FILE + OTHER -> Known.OTHER + else -> throw LithicInvalidDataException("Unknown FailureReason: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): FailureReason = 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 FailureReason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current validation status of the document */ + class Status @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 PENDING = of("PENDING") + + @JvmField val VALIDATING = of("VALIDATING") + + @JvmField val ACCEPTED = of("ACCEPTED") + + @JvmField val REJECTED = of("REJECTED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] 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 { + PENDING, + VALIDATING, + ACCEPTED, + REJECTED, + /** An enum member indicating that [Status] 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) { + PENDING -> Value.PENDING + VALIDATING -> Value.VALIDATING + ACCEPTED -> Value.ACCEPTED + REJECTED -> Value.REJECTED + 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) { + PENDING -> Known.PENDING + VALIDATING -> Known.VALIDATING + ACCEPTED -> Known.ACCEPTED + REJECTED -> Known.REJECTED + else -> throw LithicInvalidDataException("Unknown Status: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = 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 Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Constraints that an uploaded file must satisfy. */ + class UploadConstraints2 + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val acceptedMimeTypes: JsonField>, + private val maxSizeBytes: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("accepted_mime_types") + @ExcludeMissing + acceptedMimeTypes: JsonField> = JsonMissing.of(), + @JsonProperty("max_size_bytes") + @ExcludeMissing + maxSizeBytes: JsonField = JsonMissing.of(), + ) : this(acceptedMimeTypes, maxSizeBytes, mutableMapOf()) + + /** + * MIME types accepted for upload + * + * @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 acceptedMimeTypes(): List = acceptedMimeTypes.getRequired("accepted_mime_types") + + /** + * Maximum file size in bytes. Null if there is no enforced size limit + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun maxSizeBytes(): Optional = maxSizeBytes.getOptional("max_size_bytes") + + /** + * Returns the raw JSON value of [acceptedMimeTypes]. + * + * Unlike [acceptedMimeTypes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("accepted_mime_types") + @ExcludeMissing + fun _acceptedMimeTypes(): JsonField> = acceptedMimeTypes + + /** + * Returns the raw JSON value of [maxSizeBytes]. + * + * Unlike [maxSizeBytes], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("max_size_bytes") + @ExcludeMissing + fun _maxSizeBytes(): JsonField = maxSizeBytes + + @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 [UploadConstraints2]. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [UploadConstraints2]. */ + class Builder internal constructor() { + + private var acceptedMimeTypes: JsonField>? = null + private var maxSizeBytes: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(uploadConstraints2: UploadConstraints2) = apply { + acceptedMimeTypes = uploadConstraints2.acceptedMimeTypes.map { it.toMutableList() } + maxSizeBytes = uploadConstraints2.maxSizeBytes + additionalProperties = uploadConstraints2.additionalProperties.toMutableMap() + } + + /** MIME types accepted for upload */ + fun acceptedMimeTypes(acceptedMimeTypes: List) = + acceptedMimeTypes(JsonField.of(acceptedMimeTypes)) + + /** + * Sets [Builder.acceptedMimeTypes] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptedMimeTypes] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun acceptedMimeTypes(acceptedMimeTypes: JsonField>) = apply { + this.acceptedMimeTypes = acceptedMimeTypes.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [acceptedMimeTypes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addAcceptedMimeType(acceptedMimeType: String) = apply { + acceptedMimeTypes = + (acceptedMimeTypes ?: JsonField.of(mutableListOf())).also { + checkKnown("acceptedMimeTypes", it).add(acceptedMimeType) + } + } + + /** Maximum file size in bytes. Null if there is no enforced size limit */ + fun maxSizeBytes(maxSizeBytes: Long?) = maxSizeBytes(JsonField.ofNullable(maxSizeBytes)) + + /** + * Alias for [Builder.maxSizeBytes]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun maxSizeBytes(maxSizeBytes: Long) = maxSizeBytes(maxSizeBytes as Long?) + + /** Alias for calling [Builder.maxSizeBytes] with `maxSizeBytes.orElse(null)`. */ + fun maxSizeBytes(maxSizeBytes: Optional) = maxSizeBytes(maxSizeBytes.getOrNull()) + + /** + * Sets [Builder.maxSizeBytes] to an arbitrary JSON value. + * + * You should usually call [Builder.maxSizeBytes] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun maxSizeBytes(maxSizeBytes: JsonField) = apply { + this.maxSizeBytes = maxSizeBytes + } + + 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 [UploadConstraints2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptedMimeTypes() + * .maxSizeBytes() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): UploadConstraints2 = + UploadConstraints2( + checkRequired("acceptedMimeTypes", acceptedMimeTypes).map { it.toImmutable() }, + checkRequired("maxSizeBytes", maxSizeBytes), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): UploadConstraints2 = apply { + if (validated) { + return@apply + } + + acceptedMimeTypes() + maxSizeBytes() + 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 = + (acceptedMimeTypes.asKnown().getOrNull()?.size ?: 0) + + (if (maxSizeBytes.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is UploadConstraints2 && + acceptedMimeTypes == other.acceptedMimeTypes && + maxSizeBytes == other.maxSizeBytes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(acceptedMimeTypes, maxSizeBytes, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "UploadConstraints2{acceptedMimeTypes=$acceptedMimeTypes, maxSizeBytes=$maxSizeBytes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClaimDocumentUploadedWebhookEvent && + token == other.token && + created == other.created && + downloadUrl == other.downloadUrl && + downloadUrlExpiresAt == other.downloadUrlExpiresAt && + eventType == other.eventType && + failureReason == other.failureReason && + name == other.name && + requirementId == other.requirementId && + status == other.status && + updated == other.updated && + uploadConstraints == other.uploadConstraints && + uploadUrl == other.uploadUrl && + uploadUrlExpiresAt == other.uploadUrlExpiresAt && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + created, + downloadUrl, + downloadUrlExpiresAt, + eventType, + failureReason, + name, + requirementId, + status, + updated, + uploadConstraints, + uploadUrl, + uploadUrlExpiresAt, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ClaimDocumentUploadedWebhookEvent{token=$token, created=$created, downloadUrl=$downloadUrl, downloadUrlExpiresAt=$downloadUrlExpiresAt, eventType=$eventType, failureReason=$failureReason, name=$name, requirementId=$requirementId, status=$status, updated=$updated, uploadConstraints=$uploadConstraints, uploadUrl=$uploadUrl, uploadUrlExpiresAt=$uploadUrlExpiresAt, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEvent.kt new file mode 100644 index 000000000..bc8eb3e79 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEvent.kt @@ -0,0 +1,1639 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ClaimUpdatedWebhookEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val accountHolderToken: JsonField, + private val accountToken: JsonField, + private val cardTokens: JsonField>, + private val created: JsonField, + private val disputedTransactions: JsonField>, + private val eventType: JsonField, + private val outstandingRequirements: JsonField>, + private val reason: JsonField, + private val status: JsonField, + private val submitted: JsonField, + private val updated: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("account_holder_token") + @ExcludeMissing + accountHolderToken: JsonField = JsonMissing.of(), + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("card_tokens") + @ExcludeMissing + cardTokens: JsonField> = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("disputed_transactions") + @ExcludeMissing + disputedTransactions: JsonField> = JsonMissing.of(), + @JsonProperty("event_type") + @ExcludeMissing + eventType: JsonField = JsonMissing.of(), + @JsonProperty("outstanding_requirements") + @ExcludeMissing + outstandingRequirements: JsonField> = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("submitted") + @ExcludeMissing + submitted: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + ) : this( + token, + accountHolderToken, + accountToken, + cardTokens, + created, + disputedTransactions, + eventType, + outstandingRequirements, + reason, + status, + submitted, + updated, + mutableMapOf(), + ) + + /** + * Unique identifier for the claim, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * Token for the account holder that filed the claim + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accountHolderToken(): Optional = + accountHolderToken.getOptional("account_holder_token") + + /** + * Token for the account associated with the claim + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun accountToken(): Optional = accountToken.getOptional("account_token") + + /** + * Tokens for the cards associated with the disputed transactions + * + * @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 cardTokens(): List = cardTokens.getRequired("card_tokens") + + /** + * When the claim was created + * + * @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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Transactions included in this claim + * + * @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 disputedTransactions(): List = + disputedTransactions.getRequired("disputed_transactions") + + /** + * The type of event that occurred. + * + * @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 eventType(): EventType = eventType.getRequired("event_type") + + /** + * Requirements that must be fulfilled before the claim can be submitted + * + * @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 outstandingRequirements(): List = + outstandingRequirements.getRequired("outstanding_requirements") + + /** + * Dispute reason code provided when creating the claim + * + * @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 reason(): Reason = reason.getRequired("reason") + + /** + * Current lifecycle status of the claim + * + * @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 status(): Status = status.getRequired("status") + + /** + * When the claim was submitted. Null until the claim reaches `SUBMITTED` status + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun submitted(): Optional = submitted.getOptional("submitted") + + /** + * When the claim was last updated + * + * @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 updated(): OffsetDateTime = updated.getRequired("updated") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [accountHolderToken]. + * + * Unlike [accountHolderToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("account_holder_token") + @ExcludeMissing + fun _accountHolderToken(): JsonField = accountHolderToken + + /** + * Returns the raw JSON value of [accountToken]. + * + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("account_token") + @ExcludeMissing + fun _accountToken(): JsonField = accountToken + + /** + * Returns the raw JSON value of [cardTokens]. + * + * Unlike [cardTokens], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("card_tokens") + @ExcludeMissing + fun _cardTokens(): JsonField> = cardTokens + + /** + * Returns the raw JSON value of [created]. + * + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + + /** + * Returns the raw JSON value of [disputedTransactions]. + * + * Unlike [disputedTransactions], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("disputed_transactions") + @ExcludeMissing + fun _disputedTransactions(): JsonField> = disputedTransactions + + /** + * Returns the raw JSON value of [eventType]. + * + * Unlike [eventType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_type") @ExcludeMissing fun _eventType(): JsonField = eventType + + /** + * Returns the raw JSON value of [outstandingRequirements]. + * + * Unlike [outstandingRequirements], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("outstanding_requirements") + @ExcludeMissing + fun _outstandingRequirements(): JsonField> = + outstandingRequirements + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + /** + * Returns the raw JSON value of [status]. + * + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + + /** + * Returns the raw JSON value of [submitted]. + * + * Unlike [submitted], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("submitted") + @ExcludeMissing + fun _submitted(): JsonField = submitted + + /** + * Returns the raw JSON value of [updated]. + * + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + + @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 [ClaimUpdatedWebhookEvent]. + * + * The following fields are required: + * ```java + * .token() + * .accountHolderToken() + * .accountToken() + * .cardTokens() + * .created() + * .disputedTransactions() + * .eventType() + * .outstandingRequirements() + * .reason() + * .status() + * .submitted() + * .updated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ClaimUpdatedWebhookEvent]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var accountHolderToken: JsonField? = null + private var accountToken: JsonField? = null + private var cardTokens: JsonField>? = null + private var created: JsonField? = null + private var disputedTransactions: JsonField>? = null + private var eventType: JsonField? = null + private var outstandingRequirements: JsonField>? = null + private var reason: JsonField? = null + private var status: JsonField? = null + private var submitted: JsonField? = null + private var updated: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(claimUpdatedWebhookEvent: ClaimUpdatedWebhookEvent) = apply { + token = claimUpdatedWebhookEvent.token + accountHolderToken = claimUpdatedWebhookEvent.accountHolderToken + accountToken = claimUpdatedWebhookEvent.accountToken + cardTokens = claimUpdatedWebhookEvent.cardTokens.map { it.toMutableList() } + created = claimUpdatedWebhookEvent.created + disputedTransactions = + claimUpdatedWebhookEvent.disputedTransactions.map { it.toMutableList() } + eventType = claimUpdatedWebhookEvent.eventType + outstandingRequirements = + claimUpdatedWebhookEvent.outstandingRequirements.map { it.toMutableList() } + reason = claimUpdatedWebhookEvent.reason + status = claimUpdatedWebhookEvent.status + submitted = claimUpdatedWebhookEvent.submitted + updated = claimUpdatedWebhookEvent.updated + additionalProperties = claimUpdatedWebhookEvent.additionalProperties.toMutableMap() + } + + /** Unique identifier for the claim, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + /** Token for the account holder that filed the claim */ + fun accountHolderToken(accountHolderToken: String?) = + accountHolderToken(JsonField.ofNullable(accountHolderToken)) + + /** + * Alias for calling [Builder.accountHolderToken] with `accountHolderToken.orElse(null)`. + */ + fun accountHolderToken(accountHolderToken: Optional) = + accountHolderToken(accountHolderToken.getOrNull()) + + /** + * Sets [Builder.accountHolderToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accountHolderToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun accountHolderToken(accountHolderToken: JsonField) = apply { + this.accountHolderToken = accountHolderToken + } + + /** Token for the account associated with the claim */ + fun accountToken(accountToken: String?) = accountToken(JsonField.ofNullable(accountToken)) + + /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */ + fun accountToken(accountToken: Optional) = accountToken(accountToken.getOrNull()) + + /** + * Sets [Builder.accountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.accountToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun accountToken(accountToken: JsonField) = apply { + this.accountToken = accountToken + } + + /** Tokens for the cards associated with the disputed transactions */ + fun cardTokens(cardTokens: List) = cardTokens(JsonField.of(cardTokens)) + + /** + * Sets [Builder.cardTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.cardTokens] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun cardTokens(cardTokens: JsonField>) = apply { + this.cardTokens = cardTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [cardTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCardToken(cardToken: String) = apply { + cardTokens = + (cardTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("cardTokens", it).add(cardToken) + } + } + + /** When the claim was created */ + fun created(created: OffsetDateTime) = created(JsonField.of(created)) + + /** + * Sets [Builder.created] to an arbitrary JSON value. + * + * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun created(created: JsonField) = apply { this.created = created } + + /** Transactions included in this claim */ + fun disputedTransactions(disputedTransactions: List) = + disputedTransactions(JsonField.of(disputedTransactions)) + + /** + * Sets [Builder.disputedTransactions] to an arbitrary JSON value. + * + * You should usually call [Builder.disputedTransactions] with a well-typed + * `List` value instead. This method is primarily for setting the field + * to an undocumented or not yet supported value. + */ + fun disputedTransactions(disputedTransactions: JsonField>) = + apply { + this.disputedTransactions = disputedTransactions.map { it.toMutableList() } + } + + /** + * Adds a single [DisputedTransaction] to [disputedTransactions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDisputedTransaction(disputedTransaction: DisputedTransaction) = apply { + disputedTransactions = + (disputedTransactions ?: JsonField.of(mutableListOf())).also { + checkKnown("disputedTransactions", it).add(disputedTransaction) + } + } + + /** The type of event that occurred. */ + fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) + + /** + * Sets [Builder.eventType] to an arbitrary JSON value. + * + * You should usually call [Builder.eventType] with a well-typed [EventType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun eventType(eventType: JsonField) = apply { this.eventType = eventType } + + /** Requirements that must be fulfilled before the claim can be submitted */ + fun outstandingRequirements(outstandingRequirements: List) = + outstandingRequirements(JsonField.of(outstandingRequirements)) + + /** + * Sets [Builder.outstandingRequirements] to an arbitrary JSON value. + * + * You should usually call [Builder.outstandingRequirements] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun outstandingRequirements( + outstandingRequirements: JsonField> + ) = apply { + this.outstandingRequirements = outstandingRequirements.map { it.toMutableList() } + } + + /** + * Adds a single [OutstandingRequirement] to [outstandingRequirements]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addOutstandingRequirement(outstandingRequirement: OutstandingRequirement) = apply { + outstandingRequirements = + (outstandingRequirements ?: JsonField.of(mutableListOf())).also { + checkKnown("outstandingRequirements", it).add(outstandingRequirement) + } + } + + /** Dispute reason code provided when creating the claim */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + /** Current lifecycle status of the claim */ + fun status(status: Status) = status(JsonField.of(status)) + + /** + * Sets [Builder.status] to an arbitrary JSON value. + * + * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun status(status: JsonField) = apply { this.status = status } + + /** When the claim was submitted. Null until the claim reaches `SUBMITTED` status */ + fun submitted(submitted: OffsetDateTime?) = submitted(JsonField.ofNullable(submitted)) + + /** Alias for calling [Builder.submitted] with `submitted.orElse(null)`. */ + fun submitted(submitted: Optional) = submitted(submitted.getOrNull()) + + /** + * Sets [Builder.submitted] to an arbitrary JSON value. + * + * You should usually call [Builder.submitted] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun submitted(submitted: JsonField) = apply { this.submitted = submitted } + + /** When the claim was last updated */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + + /** + * Sets [Builder.updated] to an arbitrary JSON value. + * + * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun updated(updated: JsonField) = apply { this.updated = updated } + + 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 [ClaimUpdatedWebhookEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .accountHolderToken() + * .accountToken() + * .cardTokens() + * .created() + * .disputedTransactions() + * .eventType() + * .outstandingRequirements() + * .reason() + * .status() + * .submitted() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ClaimUpdatedWebhookEvent = + ClaimUpdatedWebhookEvent( + checkRequired("token", token), + checkRequired("accountHolderToken", accountHolderToken), + checkRequired("accountToken", accountToken), + checkRequired("cardTokens", cardTokens).map { it.toImmutable() }, + checkRequired("created", created), + checkRequired("disputedTransactions", disputedTransactions).map { + it.toImmutable() + }, + checkRequired("eventType", eventType), + checkRequired("outstandingRequirements", outstandingRequirements).map { + it.toImmutable() + }, + checkRequired("reason", reason), + checkRequired("status", status), + checkRequired("submitted", submitted), + checkRequired("updated", updated), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): ClaimUpdatedWebhookEvent = apply { + if (validated) { + return@apply + } + + token() + accountHolderToken() + accountToken() + cardTokens() + created() + disputedTransactions().forEach { it.validate() } + eventType().validate() + outstandingRequirements().forEach { it.validate() } + reason().validate() + status().validate() + submitted() + updated() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (accountHolderToken.asKnown().isPresent) 1 else 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (cardTokens.asKnown().getOrNull()?.size ?: 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (disputedTransactions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (outstandingRequirements.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (if (submitted.asKnown().isPresent) 1 else 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + /** A transaction included in a claim, along with the specific events being disputed. */ + class DisputedTransaction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val eventTokens: JsonField>, + private val transactionToken: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("event_tokens") + @ExcludeMissing + eventTokens: JsonField> = JsonMissing.of(), + @JsonProperty("transaction_token") + @ExcludeMissing + transactionToken: JsonField = JsonMissing.of(), + ) : this(eventTokens, transactionToken, mutableMapOf()) + + /** + * Tokens for the specific events within the transaction being disputed. Lithic creates one + * dispute per event token + * + * @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 eventTokens(): List = eventTokens.getRequired("event_tokens") + + /** + * Token for the transaction being disputed, in UUID format + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun transactionToken(): String = transactionToken.getRequired("transaction_token") + + /** + * Returns the raw JSON value of [eventTokens]. + * + * Unlike [eventTokens], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("event_tokens") + @ExcludeMissing + fun _eventTokens(): JsonField> = eventTokens + + /** + * Returns the raw JSON value of [transactionToken]. + * + * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_token") + @ExcludeMissing + fun _transactionToken(): JsonField = transactionToken + + @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 [DisputedTransaction]. + * + * The following fields are required: + * ```java + * .eventTokens() + * .transactionToken() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputedTransaction]. */ + class Builder internal constructor() { + + private var eventTokens: JsonField>? = null + private var transactionToken: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(disputedTransaction: DisputedTransaction) = apply { + eventTokens = disputedTransaction.eventTokens.map { it.toMutableList() } + transactionToken = disputedTransaction.transactionToken + additionalProperties = disputedTransaction.additionalProperties.toMutableMap() + } + + /** + * Tokens for the specific events within the transaction being disputed. Lithic creates + * one dispute per event token + */ + fun eventTokens(eventTokens: List) = eventTokens(JsonField.of(eventTokens)) + + /** + * Sets [Builder.eventTokens] to an arbitrary JSON value. + * + * You should usually call [Builder.eventTokens] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun eventTokens(eventTokens: JsonField>) = apply { + this.eventTokens = eventTokens.map { it.toMutableList() } + } + + /** + * Adds a single [String] to [eventTokens]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEventToken(eventToken: String) = apply { + eventTokens = + (eventTokens ?: JsonField.of(mutableListOf())).also { + checkKnown("eventTokens", it).add(eventToken) + } + } + + /** Token for the transaction being disputed, in UUID format */ + fun transactionToken(transactionToken: String) = + transactionToken(JsonField.of(transactionToken)) + + /** + * Sets [Builder.transactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionToken(transactionToken: JsonField) = apply { + this.transactionToken = transactionToken + } + + 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 [DisputedTransaction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .eventTokens() + * .transactionToken() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputedTransaction = + DisputedTransaction( + checkRequired("eventTokens", eventTokens).map { it.toImmutable() }, + checkRequired("transactionToken", transactionToken), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): DisputedTransaction = apply { + if (validated) { + return@apply + } + + eventTokens() + transactionToken() + 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 = + (eventTokens.asKnown().getOrNull()?.size ?: 0) + + (if (transactionToken.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputedTransaction && + eventTokens == other.eventTokens && + transactionToken == other.transactionToken && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(eventTokens, transactionToken, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DisputedTransaction{eventTokens=$eventTokens, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" + } + + /** The type of event that occurred. */ + class EventType @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 CLAIM_UPDATED = of("claim.updated") + + @JvmStatic fun of(value: String) = EventType(JsonField.of(value)) + } + + /** An enum containing [EventType]'s known values. */ + enum class Known { + CLAIM_UPDATED + } + + /** + * An enum containing [EventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [EventType] 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 { + CLAIM_UPDATED, + /** + * An enum member indicating that [EventType] 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) { + CLAIM_UPDATED -> Value.CLAIM_UPDATED + 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) { + CLAIM_UPDATED -> Known.CLAIM_UPDATED + else -> throw LithicInvalidDataException("Unknown EventType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): EventType = 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 EventType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class OutstandingRequirement + @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 QUESTIONNAIRE = of("QUESTIONNAIRE") + + @JvmField val DOCUMENTS = of("DOCUMENTS") + + @JvmStatic fun of(value: String) = OutstandingRequirement(JsonField.of(value)) + } + + /** An enum containing [OutstandingRequirement]'s known values. */ + enum class Known { + QUESTIONNAIRE, + DOCUMENTS, + } + + /** + * An enum containing [OutstandingRequirement]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [OutstandingRequirement] 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 { + QUESTIONNAIRE, + DOCUMENTS, + /** + * An enum member indicating that [OutstandingRequirement] 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) { + QUESTIONNAIRE -> Value.QUESTIONNAIRE + DOCUMENTS -> Value.DOCUMENTS + 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) { + QUESTIONNAIRE -> Known.QUESTIONNAIRE + DOCUMENTS -> Known.DOCUMENTS + else -> throw LithicInvalidDataException("Unknown OutstandingRequirement: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): OutstandingRequirement = 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 OutstandingRequirement && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Dispute reason code provided when creating the claim */ + class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is on an + * older version than the API, then the API may respond with new members that the SDK is + * unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val CARD_NOT_PRESENT = of("CARD_NOT_PRESENT") + + @JvmField val CARD_LOST = of("CARD_LOST") + + @JvmField val CARD_STOLEN = of("CARD_STOLEN") + + @JvmField val CARD_NEVER_RECEIVED = of("CARD_NEVER_RECEIVED") + + @JvmField val COUNTERFEIT = of("COUNTERFEIT") + + @JvmField val ACCOUNT_TAKEOVER = of("ACCOUNT_TAKEOVER") + + @JvmField val PRODUCT_NOT_RECEIVED = of("PRODUCT_NOT_RECEIVED") + + @JvmField val NOT_AS_DESCRIBED = of("NOT_AS_DESCRIBED") + + @JvmField val CREDIT_NOT_PROCESSED = of("CREDIT_NOT_PROCESSED") + + @JvmField val CANCELLED_RECURRING = of("CANCELLED_RECURRING") + + @JvmField val PAID_BY_OTHER_MEANS = of("PAID_BY_OTHER_MEANS") + + @JvmField val DUPLICATE_CHARGE = of("DUPLICATE_CHARGE") + + @JvmField val LATE_PRESENTMENT = of("LATE_PRESENTMENT") + + @JvmField val INCORRECT_TRANSACTION_CODE = of("INCORRECT_TRANSACTION_CODE") + + @JvmField val NO_AUTHORIZATION = of("NO_AUTHORIZATION") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") + + @JvmField val ATM_CASH_NOT_DISPENSED = of("ATM_CASH_NOT_DISPENSED") + + @JvmField val ATM_DEPOSIT_WRONG_AMOUNT = of("ATM_DEPOSIT_WRONG_AMOUNT") + + @JvmField val ATM_DEPOSIT_MISSING = of("ATM_DEPOSIT_MISSING") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + CARD_NOT_PRESENT, + CARD_LOST, + CARD_STOLEN, + CARD_NEVER_RECEIVED, + COUNTERFEIT, + ACCOUNT_TAKEOVER, + PRODUCT_NOT_RECEIVED, + NOT_AS_DESCRIBED, + CREDIT_NOT_PROCESSED, + CANCELLED_RECURRING, + PAID_BY_OTHER_MEANS, + DUPLICATE_CHARGE, + LATE_PRESENTMENT, + INCORRECT_TRANSACTION_CODE, + NO_AUTHORIZATION, + DECLINED, + INCORRECT_AMOUNT, + ATM_CASH_NOT_DISPENSED, + ATM_DEPOSIT_WRONG_AMOUNT, + ATM_DEPOSIT_MISSING, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the + * SDK is on an older version than the API, then the API may respond with new members that + * the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + CARD_NOT_PRESENT, + CARD_LOST, + CARD_STOLEN, + CARD_NEVER_RECEIVED, + COUNTERFEIT, + ACCOUNT_TAKEOVER, + PRODUCT_NOT_RECEIVED, + NOT_AS_DESCRIBED, + CREDIT_NOT_PROCESSED, + CANCELLED_RECURRING, + PAID_BY_OTHER_MEANS, + DUPLICATE_CHARGE, + LATE_PRESENTMENT, + INCORRECT_TRANSACTION_CODE, + NO_AUTHORIZATION, + DECLINED, + INCORRECT_AMOUNT, + ATM_CASH_NOT_DISPENSED, + ATM_DEPOSIT_WRONG_AMOUNT, + ATM_DEPOSIT_MISSING, + /** An enum member indicating that [Reason] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] + * if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want + * to throw for the unknown case. + */ + fun value(): Value = + when (this) { + CARD_NOT_PRESENT -> Value.CARD_NOT_PRESENT + CARD_LOST -> Value.CARD_LOST + CARD_STOLEN -> Value.CARD_STOLEN + CARD_NEVER_RECEIVED -> Value.CARD_NEVER_RECEIVED + COUNTERFEIT -> Value.COUNTERFEIT + ACCOUNT_TAKEOVER -> Value.ACCOUNT_TAKEOVER + PRODUCT_NOT_RECEIVED -> Value.PRODUCT_NOT_RECEIVED + NOT_AS_DESCRIBED -> Value.NOT_AS_DESCRIBED + CREDIT_NOT_PROCESSED -> Value.CREDIT_NOT_PROCESSED + CANCELLED_RECURRING -> Value.CANCELLED_RECURRING + PAID_BY_OTHER_MEANS -> Value.PAID_BY_OTHER_MEANS + DUPLICATE_CHARGE -> Value.DUPLICATE_CHARGE + LATE_PRESENTMENT -> Value.LATE_PRESENTMENT + INCORRECT_TRANSACTION_CODE -> Value.INCORRECT_TRANSACTION_CODE + NO_AUTHORIZATION -> Value.NO_AUTHORIZATION + DECLINED -> Value.DECLINED + INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT + ATM_CASH_NOT_DISPENSED -> Value.ATM_CASH_NOT_DISPENSED + ATM_DEPOSIT_WRONG_AMOUNT -> Value.ATM_DEPOSIT_WRONG_AMOUNT + ATM_DEPOSIT_MISSING -> Value.ATM_DEPOSIT_MISSING + 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) { + CARD_NOT_PRESENT -> Known.CARD_NOT_PRESENT + CARD_LOST -> Known.CARD_LOST + CARD_STOLEN -> Known.CARD_STOLEN + CARD_NEVER_RECEIVED -> Known.CARD_NEVER_RECEIVED + COUNTERFEIT -> Known.COUNTERFEIT + ACCOUNT_TAKEOVER -> Known.ACCOUNT_TAKEOVER + PRODUCT_NOT_RECEIVED -> Known.PRODUCT_NOT_RECEIVED + NOT_AS_DESCRIBED -> Known.NOT_AS_DESCRIBED + CREDIT_NOT_PROCESSED -> Known.CREDIT_NOT_PROCESSED + CANCELLED_RECURRING -> Known.CANCELLED_RECURRING + PAID_BY_OTHER_MEANS -> Known.PAID_BY_OTHER_MEANS + DUPLICATE_CHARGE -> Known.DUPLICATE_CHARGE + LATE_PRESENTMENT -> Known.LATE_PRESENTMENT + INCORRECT_TRANSACTION_CODE -> Known.INCORRECT_TRANSACTION_CODE + NO_AUTHORIZATION -> Known.NO_AUTHORIZATION + DECLINED -> Known.DECLINED + INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT + ATM_CASH_NOT_DISPENSED -> Known.ATM_CASH_NOT_DISPENSED + ATM_DEPOSIT_WRONG_AMOUNT -> Known.ATM_DEPOSIT_WRONG_AMOUNT + ATM_DEPOSIT_MISSING -> Known.ATM_DEPOSIT_MISSING + else -> throw LithicInvalidDataException("Unknown Reason: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Reason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current lifecycle status of the claim */ + class Status @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 INITIALIZING = of("INITIALIZING") + + @JvmField val AWAITING_INFO = of("AWAITING_INFO") + + @JvmField val SUBMITTED = of("SUBMITTED") + + @JvmField val RESOLVED = of("RESOLVED") + + @JvmField val ABANDONED = of("ABANDONED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + INITIALIZING, + AWAITING_INFO, + SUBMITTED, + RESOLVED, + ABANDONED, + } + + /** + * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Status] 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 { + INITIALIZING, + AWAITING_INFO, + SUBMITTED, + RESOLVED, + ABANDONED, + /** An enum member indicating that [Status] 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) { + INITIALIZING -> Value.INITIALIZING + AWAITING_INFO -> Value.AWAITING_INFO + SUBMITTED -> Value.SUBMITTED + RESOLVED -> Value.RESOLVED + ABANDONED -> Value.ABANDONED + 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) { + INITIALIZING -> Known.INITIALIZING + AWAITING_INFO -> Known.AWAITING_INFO + SUBMITTED -> Known.SUBMITTED + RESOLVED -> Known.RESOLVED + ABANDONED -> Known.ABANDONED + else -> throw LithicInvalidDataException("Unknown Status: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Status = 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 Status && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ClaimUpdatedWebhookEvent && + token == other.token && + accountHolderToken == other.accountHolderToken && + accountToken == other.accountToken && + cardTokens == other.cardTokens && + created == other.created && + disputedTransactions == other.disputedTransactions && + eventType == other.eventType && + outstandingRequirements == other.outstandingRequirements && + reason == other.reason && + status == other.status && + submitted == other.submitted && + updated == other.updated && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + accountHolderToken, + accountToken, + cardTokens, + created, + disputedTransactions, + eventType, + outstandingRequirements, + reason, + status, + submitted, + updated, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ClaimUpdatedWebhookEvent{token=$token, accountHolderToken=$accountHolderToken, accountToken=$accountToken, cardTokens=$cardTokens, created=$created, disputedTransactions=$disputedTransactions, eventType=$eventType, outstandingRequirements=$outstandingRequirements, reason=$reason, status=$status, submitted=$submitted, updated=$updated, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt index 3d0b5c0bc..9aed3f5d2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt @@ -89,6 +89,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -291,6 +297,14 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is + * accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins + * validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change + * or a change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or * failed. * @@ -490,6 +504,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -611,6 +631,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -716,6 +746,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -782,6 +817,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -853,6 +893,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -927,6 +972,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt index 9e70e7cbe..e4bed4337 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt @@ -347,6 +347,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -468,6 +474,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -573,6 +589,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -639,6 +660,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -710,6 +736,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -784,6 +815,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt index d216dd7da..d71b5c602 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt @@ -357,6 +357,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -478,6 +484,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -583,6 +599,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -649,6 +670,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -720,6 +746,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -794,6 +825,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt index 17cd3fba7..2d6c6594a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt @@ -680,6 +680,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -801,6 +807,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -906,6 +922,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -972,6 +993,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -1043,6 +1069,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -1117,6 +1148,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt index 4556099af..91b9d23b7 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt @@ -479,6 +479,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -584,6 +594,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -650,6 +665,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -721,6 +741,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -795,6 +820,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt index 589d50361..cef49defd 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt @@ -703,6 +703,12 @@ private constructor( * - card.renewed: Occurs when a card is renewed. * - card.shipped: Occurs when a card is shipped. * - card.updated: Occurs when a card is updated. + * - claim_document.accepted: Occurs when a claim document passes validation and is accepted. + * - claim_document.rejected: Occurs when a claim document fails validation and is rejected. + * - claim_document.uploaded: Occurs when a claim document is uploaded and begins validation. + * - claim.created: Occurs when a dispute intake claim is created. + * - claim.updated: Occurs when a dispute intake claim is updated, such as a status change or a + * change to its outstanding requirements. * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. * * This event will be deprecated in the future. We recommend using `tokenization.result` @@ -824,6 +830,16 @@ private constructor( @JvmField val CARD_UPDATED = of("card.updated") + @JvmField val CLAIM_DOCUMENT_ACCEPTED = of("claim_document.accepted") + + @JvmField val CLAIM_DOCUMENT_REJECTED = of("claim_document.rejected") + + @JvmField val CLAIM_DOCUMENT_UPLOADED = of("claim_document.uploaded") + + @JvmField val CLAIM_CREATED = of("claim.created") + + @JvmField val CLAIM_UPDATED = of("claim.updated") + @JvmField val DIGITAL_WALLET_TOKENIZATION_RESULT = of("digital_wallet.tokenization_result") @@ -929,6 +945,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -995,6 +1016,11 @@ private constructor( CARD_RENEWED, CARD_SHIPPED, CARD_UPDATED, + CLAIM_DOCUMENT_ACCEPTED, + CLAIM_DOCUMENT_REJECTED, + CLAIM_DOCUMENT_UPLOADED, + CLAIM_CREATED, + CLAIM_UPDATED, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, @@ -1066,6 +1092,11 @@ private constructor( CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED CARD_UPDATED -> Value.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Value.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Value.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Value.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Value.CLAIM_CREATED + CLAIM_UPDATED -> Value.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE @@ -1140,6 +1171,11 @@ private constructor( CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED CARD_UPDATED -> Known.CARD_UPDATED + CLAIM_DOCUMENT_ACCEPTED -> Known.CLAIM_DOCUMENT_ACCEPTED + CLAIM_DOCUMENT_REJECTED -> Known.CLAIM_DOCUMENT_REJECTED + CLAIM_DOCUMENT_UPLOADED -> Known.CLAIM_DOCUMENT_UPLOADED + CLAIM_CREATED -> Known.CLAIM_CREATED + CLAIM_UPDATED -> Known.CLAIM_UPDATED DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt index 120baf35c..b052da680 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ParsedWebhookEvent.kt @@ -66,6 +66,11 @@ private constructor( private val cardTransactionEnhancedDataUpdated: CardTransactionEnhancedDataUpdatedWebhookEvent? = null, + private val claimCreated: ClaimCreatedWebhookEvent? = null, + private val claimUpdated: ClaimUpdatedWebhookEvent? = null, + private val claimDocumentUploaded: ClaimDocumentUploadedWebhookEvent? = null, + private val claimDocumentAccepted: ClaimDocumentAcceptedWebhookEvent? = null, + private val claimDocumentRejected: ClaimDocumentRejectedWebhookEvent? = null, private val digitalWalletTokenizationApprovalRequest: DigitalWalletTokenizationApprovalRequestWebhookEvent? = null, @@ -185,6 +190,19 @@ private constructor( Optional = Optional.ofNullable(cardTransactionEnhancedDataUpdated) + fun claimCreated(): Optional = Optional.ofNullable(claimCreated) + + fun claimUpdated(): Optional = Optional.ofNullable(claimUpdated) + + fun claimDocumentUploaded(): Optional = + Optional.ofNullable(claimDocumentUploaded) + + fun claimDocumentAccepted(): Optional = + Optional.ofNullable(claimDocumentAccepted) + + fun claimDocumentRejected(): Optional = + Optional.ofNullable(claimDocumentRejected) + /** * Payload for digital wallet tokenization approval requests. Used for both the decisioning * responder request (sent to the customer's endpoint for a real-time decision) and the @@ -361,6 +379,16 @@ private constructor( fun isCardTransactionEnhancedDataUpdated(): Boolean = cardTransactionEnhancedDataUpdated != null + fun isClaimCreated(): Boolean = claimCreated != null + + fun isClaimUpdated(): Boolean = claimUpdated != null + + fun isClaimDocumentUploaded(): Boolean = claimDocumentUploaded != null + + fun isClaimDocumentAccepted(): Boolean = claimDocumentAccepted != null + + fun isClaimDocumentRejected(): Boolean = claimDocumentRejected != null + fun isDigitalWalletTokenizationApprovalRequest(): Boolean = digitalWalletTokenizationApprovalRequest != null @@ -503,6 +531,19 @@ private constructor( fun asCardTransactionEnhancedDataUpdated(): CardTransactionEnhancedDataUpdatedWebhookEvent = cardTransactionEnhancedDataUpdated.getOrThrow("cardTransactionEnhancedDataUpdated") + fun asClaimCreated(): ClaimCreatedWebhookEvent = claimCreated.getOrThrow("claimCreated") + + fun asClaimUpdated(): ClaimUpdatedWebhookEvent = claimUpdated.getOrThrow("claimUpdated") + + fun asClaimDocumentUploaded(): ClaimDocumentUploadedWebhookEvent = + claimDocumentUploaded.getOrThrow("claimDocumentUploaded") + + fun asClaimDocumentAccepted(): ClaimDocumentAcceptedWebhookEvent = + claimDocumentAccepted.getOrThrow("claimDocumentAccepted") + + fun asClaimDocumentRejected(): ClaimDocumentRejectedWebhookEvent = + claimDocumentRejected.getOrThrow("claimDocumentRejected") + /** * Payload for digital wallet tokenization approval requests. Used for both the decisioning * responder request (sent to the customer's endpoint for a real-time decision) and the @@ -710,6 +751,14 @@ private constructor( visitor.visitCardTransactionEnhancedDataCreated(cardTransactionEnhancedDataCreated) cardTransactionEnhancedDataUpdated != null -> visitor.visitCardTransactionEnhancedDataUpdated(cardTransactionEnhancedDataUpdated) + claimCreated != null -> visitor.visitClaimCreated(claimCreated) + claimUpdated != null -> visitor.visitClaimUpdated(claimUpdated) + claimDocumentUploaded != null -> + visitor.visitClaimDocumentUploaded(claimDocumentUploaded) + claimDocumentAccepted != null -> + visitor.visitClaimDocumentAccepted(claimDocumentAccepted) + claimDocumentRejected != null -> + visitor.visitClaimDocumentRejected(claimDocumentRejected) digitalWalletTokenizationApprovalRequest != null -> visitor.visitDigitalWalletTokenizationApprovalRequest( digitalWalletTokenizationApprovalRequest @@ -922,6 +971,32 @@ private constructor( cardTransactionEnhancedDataUpdated.validate() } + override fun visitClaimCreated(claimCreated: ClaimCreatedWebhookEvent) { + claimCreated.validate() + } + + override fun visitClaimUpdated(claimUpdated: ClaimUpdatedWebhookEvent) { + claimUpdated.validate() + } + + override fun visitClaimDocumentUploaded( + claimDocumentUploaded: ClaimDocumentUploadedWebhookEvent + ) { + claimDocumentUploaded.validate() + } + + override fun visitClaimDocumentAccepted( + claimDocumentAccepted: ClaimDocumentAcceptedWebhookEvent + ) { + claimDocumentAccepted.validate() + } + + override fun visitClaimDocumentRejected( + claimDocumentRejected: ClaimDocumentRejectedWebhookEvent + ) { + claimDocumentRejected.validate() + } + override fun visitDigitalWalletTokenizationApprovalRequest( digitalWalletTokenizationApprovalRequest: DigitalWalletTokenizationApprovalRequestWebhookEvent @@ -1244,6 +1319,24 @@ private constructor( CardTransactionEnhancedDataUpdatedWebhookEvent ) = cardTransactionEnhancedDataUpdated.validity() + override fun visitClaimCreated(claimCreated: ClaimCreatedWebhookEvent) = + claimCreated.validity() + + override fun visitClaimUpdated(claimUpdated: ClaimUpdatedWebhookEvent) = + claimUpdated.validity() + + override fun visitClaimDocumentUploaded( + claimDocumentUploaded: ClaimDocumentUploadedWebhookEvent + ) = claimDocumentUploaded.validity() + + override fun visitClaimDocumentAccepted( + claimDocumentAccepted: ClaimDocumentAcceptedWebhookEvent + ) = claimDocumentAccepted.validity() + + override fun visitClaimDocumentRejected( + claimDocumentRejected: ClaimDocumentRejectedWebhookEvent + ) = claimDocumentRejected.validity() + override fun visitDigitalWalletTokenizationApprovalRequest( digitalWalletTokenizationApprovalRequest: DigitalWalletTokenizationApprovalRequestWebhookEvent @@ -1427,6 +1520,11 @@ private constructor( cardTransactionUpdated == other.cardTransactionUpdated && cardTransactionEnhancedDataCreated == other.cardTransactionEnhancedDataCreated && cardTransactionEnhancedDataUpdated == other.cardTransactionEnhancedDataUpdated && + claimCreated == other.claimCreated && + claimUpdated == other.claimUpdated && + claimDocumentUploaded == other.claimDocumentUploaded && + claimDocumentAccepted == other.claimDocumentAccepted && + claimDocumentRejected == other.claimDocumentRejected && digitalWalletTokenizationApprovalRequest == other.digitalWalletTokenizationApprovalRequest && digitalWalletTokenizationResult == other.digitalWalletTokenizationResult && @@ -1495,6 +1593,11 @@ private constructor( cardTransactionUpdated, cardTransactionEnhancedDataCreated, cardTransactionEnhancedDataUpdated, + claimCreated, + claimUpdated, + claimDocumentUploaded, + claimDocumentAccepted, + claimDocumentRejected, digitalWalletTokenizationApprovalRequest, digitalWalletTokenizationResult, digitalWalletTokenizationTwoFactorAuthenticationCode, @@ -1570,6 +1673,14 @@ private constructor( "ParsedWebhookEvent{cardTransactionEnhancedDataCreated=$cardTransactionEnhancedDataCreated}" cardTransactionEnhancedDataUpdated != null -> "ParsedWebhookEvent{cardTransactionEnhancedDataUpdated=$cardTransactionEnhancedDataUpdated}" + claimCreated != null -> "ParsedWebhookEvent{claimCreated=$claimCreated}" + claimUpdated != null -> "ParsedWebhookEvent{claimUpdated=$claimUpdated}" + claimDocumentUploaded != null -> + "ParsedWebhookEvent{claimDocumentUploaded=$claimDocumentUploaded}" + claimDocumentAccepted != null -> + "ParsedWebhookEvent{claimDocumentAccepted=$claimDocumentAccepted}" + claimDocumentRejected != null -> + "ParsedWebhookEvent{claimDocumentRejected=$claimDocumentRejected}" digitalWalletTokenizationApprovalRequest != null -> "ParsedWebhookEvent{digitalWalletTokenizationApprovalRequest=$digitalWalletTokenizationApprovalRequest}" digitalWalletTokenizationResult != null -> @@ -1757,6 +1868,26 @@ private constructor( cardTransactionEnhancedDataUpdated = cardTransactionEnhancedDataUpdated ) + @JvmStatic + fun ofClaimCreated(claimCreated: ClaimCreatedWebhookEvent) = + ParsedWebhookEvent(claimCreated = claimCreated) + + @JvmStatic + fun ofClaimUpdated(claimUpdated: ClaimUpdatedWebhookEvent) = + ParsedWebhookEvent(claimUpdated = claimUpdated) + + @JvmStatic + fun ofClaimDocumentUploaded(claimDocumentUploaded: ClaimDocumentUploadedWebhookEvent) = + ParsedWebhookEvent(claimDocumentUploaded = claimDocumentUploaded) + + @JvmStatic + fun ofClaimDocumentAccepted(claimDocumentAccepted: ClaimDocumentAcceptedWebhookEvent) = + ParsedWebhookEvent(claimDocumentAccepted = claimDocumentAccepted) + + @JvmStatic + fun ofClaimDocumentRejected(claimDocumentRejected: ClaimDocumentRejectedWebhookEvent) = + ParsedWebhookEvent(claimDocumentRejected = claimDocumentRejected) + /** * Payload for digital wallet tokenization approval requests. Used for both the decisioning * responder request (sent to the customer's endpoint for a real-time decision) and the @@ -2053,6 +2184,16 @@ private constructor( cardTransactionEnhancedDataUpdated: CardTransactionEnhancedDataUpdatedWebhookEvent ): T + fun visitClaimCreated(claimCreated: ClaimCreatedWebhookEvent): T + + fun visitClaimUpdated(claimUpdated: ClaimUpdatedWebhookEvent): T + + fun visitClaimDocumentUploaded(claimDocumentUploaded: ClaimDocumentUploadedWebhookEvent): T + + fun visitClaimDocumentAccepted(claimDocumentAccepted: ClaimDocumentAcceptedWebhookEvent): T + + fun visitClaimDocumentRejected(claimDocumentRejected: ClaimDocumentRejectedWebhookEvent): T + /** * Payload for digital wallet tokenization approval requests. Used for both the decisioning * responder request (sent to the customer's endpoint for a real-time decision) and the @@ -2352,6 +2493,18 @@ private constructor( _json = json, ) }, + tryDeserialize(node, jacksonTypeRef())?.let { + ParsedWebhookEvent(claimCreated = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + ParsedWebhookEvent(claimUpdated = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { ParsedWebhookEvent(claimDocumentUploaded = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { ParsedWebhookEvent(claimDocumentAccepted = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { ParsedWebhookEvent(claimDocumentRejected = it, _json = json) }, tryDeserialize( node, jacksonTypeRef< @@ -2646,6 +2799,14 @@ private constructor( generator.writeObject(value.cardTransactionEnhancedDataCreated) value.cardTransactionEnhancedDataUpdated != null -> generator.writeObject(value.cardTransactionEnhancedDataUpdated) + value.claimCreated != null -> generator.writeObject(value.claimCreated) + value.claimUpdated != null -> generator.writeObject(value.claimUpdated) + value.claimDocumentUploaded != null -> + generator.writeObject(value.claimDocumentUploaded) + value.claimDocumentAccepted != null -> + generator.writeObject(value.claimDocumentAccepted) + value.claimDocumentRejected != null -> + generator.writeObject(value.claimDocumentRejected) value.digitalWalletTokenizationApprovalRequest != null -> generator.writeObject(value.digitalWalletTokenizationApprovalRequest) value.digitalWalletTokenizationResult != null -> diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt index 07671c010..0bc999c79 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/RuleFeature.kt @@ -21,8 +21,10 @@ import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue import com.lithic.api.core.allMaxBy +import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects @@ -45,6 +47,8 @@ import kotlin.jvm.optionals.getOrNull * CARD_TRANSACTION_UPDATE event stream rules. * - `ACH_PAYMENT`: The ACH payment being evaluated. Only available for ACH_PAYMENT_UPDATE event * stream rules. + * - `EXTERNAL_BANK_ACCOUNT`: The external bank account tied to the ACH payment being evaluated. + * Only available for ACH_PAYMENT_UPDATE event stream rules. * - `CARD`: The card associated with the event. Available for AUTHORIZATION, * THREE_DS_AUTHENTICATION, and CARD_TRANSACTION_UPDATE event stream rules. * - `ACCOUNT_HOLDER`: The account holder associated with the event. Available for AUTHORIZATION, @@ -52,8 +56,16 @@ import kotlin.jvm.optionals.getOrNull * - `IP_METADATA`: IP address metadata for the request. Available for THREE_DS_AUTHENTICATION event * stream rules. * - `SPEND_VELOCITY`: Spend velocity data for the card or account. Requires `scope`, `period`, and - * optionally `filters` to configure the velocity calculation. Available for AUTHORIZATION event - * stream rules. + * optionally `filters` to configure the velocity calculation. Available for AUTHORIZATION and + * CARD_TRANSACTION_UPDATE event stream rules. + * - `PAYMENT_VELOCITY`: ACH payment velocity data, aggregated over the given scope. Requires + * `scope`, `period`, and optionally `filters` to configure the velocity calculation. Available + * for ACH_PAYMENT_UPDATE event stream rules. + * - `CONSECUTIVE_DECLINES`: The number of consecutive declined transactions since the last approval + * for the card or account. Requires `scope`. Available for AUTHORIZATION and + * CARD_TRANSACTION_UPDATE event stream rules. + * - `ACH_PAYMENT_HISTORY`: Windowed settled-amount statistics derived from the financial account's + * ACH payment history. Requires `scope`. Available for ACH_PAYMENT_UPDATE event stream rules. * - `TRANSACTION_HISTORY_SIGNALS`: Behavioral feature state derived from the entity's transaction * history. Requires `scope` to specify whether to load card, account, or business account * history. Available for AUTHORIZATION and CARD_TRANSACTION_UPDATE event stream rules. @@ -68,11 +80,15 @@ private constructor( private val achReceipt: AchReceiptFeature? = null, private val cardTransaction: CardTransactionFeature? = null, private val achPayment: AchPaymentFeature? = null, + private val externalBankAccount: ExternalBankAccountFeature? = null, private val card: CardFeature? = null, private val accountHolder: AccountHolderFeature? = null, private val ipMetadata: IpMetadataFeature? = null, private val spendVelocity: SpendVelocityFeature? = null, + private val paymentVelocity: PaymentVelocityFeature? = null, private val transactionHistorySignals: TransactionHistorySignalsFeature? = null, + private val consecutiveDeclines: ConsecutiveDeclinesFeature? = null, + private val achPaymentHistory: AchPaymentHistoryFeature? = null, private val _json: JsonValue? = null, ) { @@ -88,6 +104,9 @@ private constructor( fun achPayment(): Optional = Optional.ofNullable(achPayment) + fun externalBankAccount(): Optional = + Optional.ofNullable(externalBankAccount) + fun card(): Optional = Optional.ofNullable(card) fun accountHolder(): Optional = Optional.ofNullable(accountHolder) @@ -96,9 +115,17 @@ private constructor( fun spendVelocity(): Optional = Optional.ofNullable(spendVelocity) + fun paymentVelocity(): Optional = Optional.ofNullable(paymentVelocity) + fun transactionHistorySignals(): Optional = Optional.ofNullable(transactionHistorySignals) + fun consecutiveDeclines(): Optional = + Optional.ofNullable(consecutiveDeclines) + + fun achPaymentHistory(): Optional = + Optional.ofNullable(achPaymentHistory) + fun isAuthorization(): Boolean = authorization != null fun isAuthentication(): Boolean = authentication != null @@ -111,6 +138,8 @@ private constructor( fun isAchPayment(): Boolean = achPayment != null + fun isExternalBankAccount(): Boolean = externalBankAccount != null + fun isCard(): Boolean = card != null fun isAccountHolder(): Boolean = accountHolder != null @@ -119,8 +148,14 @@ private constructor( fun isSpendVelocity(): Boolean = spendVelocity != null + fun isPaymentVelocity(): Boolean = paymentVelocity != null + fun isTransactionHistorySignals(): Boolean = transactionHistorySignals != null + fun isConsecutiveDeclines(): Boolean = consecutiveDeclines != null + + fun isAchPaymentHistory(): Boolean = achPaymentHistory != null + fun asAuthorization(): AuthorizationFeature = authorization.getOrThrow("authorization") fun asAuthentication(): AuthenticationFeature = authentication.getOrThrow("authentication") @@ -133,6 +168,9 @@ private constructor( fun asAchPayment(): AchPaymentFeature = achPayment.getOrThrow("achPayment") + fun asExternalBankAccount(): ExternalBankAccountFeature = + externalBankAccount.getOrThrow("externalBankAccount") + fun asCard(): CardFeature = card.getOrThrow("card") fun asAccountHolder(): AccountHolderFeature = accountHolder.getOrThrow("accountHolder") @@ -141,9 +179,17 @@ private constructor( fun asSpendVelocity(): SpendVelocityFeature = spendVelocity.getOrThrow("spendVelocity") + fun asPaymentVelocity(): PaymentVelocityFeature = paymentVelocity.getOrThrow("paymentVelocity") + fun asTransactionHistorySignals(): TransactionHistorySignalsFeature = transactionHistorySignals.getOrThrow("transactionHistorySignals") + fun asConsecutiveDeclines(): ConsecutiveDeclinesFeature = + consecutiveDeclines.getOrThrow("consecutiveDeclines") + + fun asAchPaymentHistory(): AchPaymentHistoryFeature = + achPaymentHistory.getOrThrow("achPaymentHistory") + fun _json(): Optional = Optional.ofNullable(_json) /** @@ -183,12 +229,16 @@ private constructor( achReceipt != null -> visitor.visitAchReceipt(achReceipt) cardTransaction != null -> visitor.visitCardTransaction(cardTransaction) achPayment != null -> visitor.visitAchPayment(achPayment) + externalBankAccount != null -> visitor.visitExternalBankAccount(externalBankAccount) card != null -> visitor.visitCard(card) accountHolder != null -> visitor.visitAccountHolder(accountHolder) ipMetadata != null -> visitor.visitIpMetadata(ipMetadata) spendVelocity != null -> visitor.visitSpendVelocity(spendVelocity) + paymentVelocity != null -> visitor.visitPaymentVelocity(paymentVelocity) transactionHistorySignals != null -> visitor.visitTransactionHistorySignals(transactionHistorySignals) + consecutiveDeclines != null -> visitor.visitConsecutiveDeclines(consecutiveDeclines) + achPaymentHistory != null -> visitor.visitAchPaymentHistory(achPaymentHistory) else -> visitor.unknown(_json) } @@ -233,6 +283,12 @@ private constructor( achPayment.validate() } + override fun visitExternalBankAccount( + externalBankAccount: ExternalBankAccountFeature + ) { + externalBankAccount.validate() + } + override fun visitCard(card: CardFeature) { card.validate() } @@ -249,11 +305,25 @@ private constructor( spendVelocity.validate() } + override fun visitPaymentVelocity(paymentVelocity: PaymentVelocityFeature) { + paymentVelocity.validate() + } + override fun visitTransactionHistorySignals( transactionHistorySignals: TransactionHistorySignalsFeature ) { transactionHistorySignals.validate() } + + override fun visitConsecutiveDeclines( + consecutiveDeclines: ConsecutiveDeclinesFeature + ) { + consecutiveDeclines.validate() + } + + override fun visitAchPaymentHistory(achPaymentHistory: AchPaymentHistoryFeature) { + achPaymentHistory.validate() + } } ) validated = true @@ -292,6 +362,10 @@ private constructor( override fun visitAchPayment(achPayment: AchPaymentFeature) = achPayment.validity() + override fun visitExternalBankAccount( + externalBankAccount: ExternalBankAccountFeature + ) = externalBankAccount.validity() + override fun visitCard(card: CardFeature) = card.validity() override fun visitAccountHolder(accountHolder: AccountHolderFeature) = @@ -302,10 +376,20 @@ private constructor( override fun visitSpendVelocity(spendVelocity: SpendVelocityFeature) = spendVelocity.validity() + override fun visitPaymentVelocity(paymentVelocity: PaymentVelocityFeature) = + paymentVelocity.validity() + override fun visitTransactionHistorySignals( transactionHistorySignals: TransactionHistorySignalsFeature ) = transactionHistorySignals.validity() + override fun visitConsecutiveDeclines( + consecutiveDeclines: ConsecutiveDeclinesFeature + ) = consecutiveDeclines.validity() + + override fun visitAchPaymentHistory(achPaymentHistory: AchPaymentHistoryFeature) = + achPaymentHistory.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -322,11 +406,15 @@ private constructor( achReceipt == other.achReceipt && cardTransaction == other.cardTransaction && achPayment == other.achPayment && + externalBankAccount == other.externalBankAccount && card == other.card && accountHolder == other.accountHolder && ipMetadata == other.ipMetadata && spendVelocity == other.spendVelocity && - transactionHistorySignals == other.transactionHistorySignals + paymentVelocity == other.paymentVelocity && + transactionHistorySignals == other.transactionHistorySignals && + consecutiveDeclines == other.consecutiveDeclines && + achPaymentHistory == other.achPaymentHistory } override fun hashCode(): Int = @@ -337,11 +425,15 @@ private constructor( achReceipt, cardTransaction, achPayment, + externalBankAccount, card, accountHolder, ipMetadata, spendVelocity, + paymentVelocity, transactionHistorySignals, + consecutiveDeclines, + achPaymentHistory, ) override fun toString(): String = @@ -352,12 +444,16 @@ private constructor( achReceipt != null -> "RuleFeature{achReceipt=$achReceipt}" cardTransaction != null -> "RuleFeature{cardTransaction=$cardTransaction}" achPayment != null -> "RuleFeature{achPayment=$achPayment}" + externalBankAccount != null -> "RuleFeature{externalBankAccount=$externalBankAccount}" card != null -> "RuleFeature{card=$card}" accountHolder != null -> "RuleFeature{accountHolder=$accountHolder}" ipMetadata != null -> "RuleFeature{ipMetadata=$ipMetadata}" spendVelocity != null -> "RuleFeature{spendVelocity=$spendVelocity}" + paymentVelocity != null -> "RuleFeature{paymentVelocity=$paymentVelocity}" transactionHistorySignals != null -> "RuleFeature{transactionHistorySignals=$transactionHistorySignals}" + consecutiveDeclines != null -> "RuleFeature{consecutiveDeclines=$consecutiveDeclines}" + achPaymentHistory != null -> "RuleFeature{achPaymentHistory=$achPaymentHistory}" _json != null -> "RuleFeature{_unknown=$_json}" else -> throw IllegalStateException("Invalid RuleFeature") } @@ -386,6 +482,10 @@ private constructor( @JvmStatic fun ofAchPayment(achPayment: AchPaymentFeature) = RuleFeature(achPayment = achPayment) + @JvmStatic + fun ofExternalBankAccount(externalBankAccount: ExternalBankAccountFeature) = + RuleFeature(externalBankAccount = externalBankAccount) + @JvmStatic fun ofCard(card: CardFeature) = RuleFeature(card = card) @JvmStatic @@ -399,10 +499,22 @@ private constructor( fun ofSpendVelocity(spendVelocity: SpendVelocityFeature) = RuleFeature(spendVelocity = spendVelocity) + @JvmStatic + fun ofPaymentVelocity(paymentVelocity: PaymentVelocityFeature) = + RuleFeature(paymentVelocity = paymentVelocity) + @JvmStatic fun ofTransactionHistorySignals( transactionHistorySignals: TransactionHistorySignalsFeature ) = RuleFeature(transactionHistorySignals = transactionHistorySignals) + + @JvmStatic + fun ofConsecutiveDeclines(consecutiveDeclines: ConsecutiveDeclinesFeature) = + RuleFeature(consecutiveDeclines = consecutiveDeclines) + + @JvmStatic + fun ofAchPaymentHistory(achPaymentHistory: AchPaymentHistoryFeature) = + RuleFeature(achPaymentHistory = achPaymentHistory) } /** @@ -422,6 +534,8 @@ private constructor( fun visitAchPayment(achPayment: AchPaymentFeature): T + fun visitExternalBankAccount(externalBankAccount: ExternalBankAccountFeature): T + fun visitCard(card: CardFeature): T fun visitAccountHolder(accountHolder: AccountHolderFeature): T @@ -430,10 +544,16 @@ private constructor( fun visitSpendVelocity(spendVelocity: SpendVelocityFeature): T + fun visitPaymentVelocity(paymentVelocity: PaymentVelocityFeature): T + fun visitTransactionHistorySignals( transactionHistorySignals: TransactionHistorySignalsFeature ): T + fun visitConsecutiveDeclines(consecutiveDeclines: ConsecutiveDeclinesFeature): T + + fun visitAchPaymentHistory(achPaymentHistory: AchPaymentHistoryFeature): T + /** * Maps an unknown variant of [RuleFeature] to a value of type [T]. * @@ -473,6 +593,9 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { RuleFeature(achPayment = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(externalBankAccount = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef())?.let { RuleFeature(card = it, _json = json) }, @@ -485,8 +608,17 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { RuleFeature(spendVelocity = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(paymentVelocity = it, _json = json) + }, tryDeserialize(node, jacksonTypeRef()) ?.let { RuleFeature(transactionHistorySignals = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(consecutiveDeclines = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + RuleFeature(achPaymentHistory = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -517,12 +649,18 @@ private constructor( value.achReceipt != null -> generator.writeObject(value.achReceipt) value.cardTransaction != null -> generator.writeObject(value.cardTransaction) value.achPayment != null -> generator.writeObject(value.achPayment) + value.externalBankAccount != null -> + generator.writeObject(value.externalBankAccount) value.card != null -> generator.writeObject(value.card) value.accountHolder != null -> generator.writeObject(value.accountHolder) value.ipMetadata != null -> generator.writeObject(value.ipMetadata) value.spendVelocity != null -> generator.writeObject(value.spendVelocity) + value.paymentVelocity != null -> generator.writeObject(value.paymentVelocity) value.transactionHistorySignals != null -> generator.writeObject(value.transactionHistorySignals) + value.consecutiveDeclines != null -> + generator.writeObject(value.consecutiveDeclines) + value.achPaymentHistory != null -> generator.writeObject(value.achPaymentHistory) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid RuleFeature") } @@ -2521,7 +2659,7 @@ private constructor( "AchPaymentFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" } - class CardFeature + class ExternalBankAccountFeature @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -2578,7 +2716,8 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [CardFeature]. + * Returns a mutable builder for constructing an instance of + * [ExternalBankAccountFeature]. * * The following fields are required: * ```java @@ -2588,7 +2727,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [CardFeature]. */ + /** A builder for [ExternalBankAccountFeature]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -2596,10 +2735,11 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(cardFeature: CardFeature) = apply { - type = cardFeature.type - name = cardFeature.name - additionalProperties = cardFeature.additionalProperties.toMutableMap() + internal fun from(externalBankAccountFeature: ExternalBankAccountFeature) = apply { + type = externalBankAccountFeature.type + name = externalBankAccountFeature.name + additionalProperties = + externalBankAccountFeature.additionalProperties.toMutableMap() } fun type(type: Type) = type(JsonField.of(type)) @@ -2645,7 +2785,7 @@ private constructor( } /** - * Returns an immutable instance of [CardFeature]. + * Returns an immutable instance of [ExternalBankAccountFeature]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2656,8 +2796,12 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): CardFeature = - CardFeature(checkRequired("type", type), name, additionalProperties.toMutableMap()) + fun build(): ExternalBankAccountFeature = + ExternalBankAccountFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -2671,7 +2815,7 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): CardFeature = apply { + fun validate(): ExternalBankAccountFeature = apply { if (validated) { return@apply } @@ -2713,14 +2857,14 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") + @JvmField val EXTERNAL_BANK_ACCOUNT = of("EXTERNAL_BANK_ACCOUNT") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - CARD + EXTERNAL_BANK_ACCOUNT } /** @@ -2733,7 +2877,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CARD, + EXTERNAL_BANK_ACCOUNT, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -2747,7 +2891,7 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD + EXTERNAL_BANK_ACCOUNT -> Value.EXTERNAL_BANK_ACCOUNT else -> Value._UNKNOWN } @@ -2762,7 +2906,7 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD + EXTERNAL_BANK_ACCOUNT -> Known.EXTERNAL_BANK_ACCOUNT else -> throw LithicInvalidDataException("Unknown Type: $value") } @@ -2835,7 +2979,7 @@ private constructor( return true } - return other is CardFeature && + return other is ExternalBankAccountFeature && type == other.type && name == other.name && additionalProperties == other.additionalProperties @@ -2846,10 +2990,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + "ExternalBankAccountFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" } - class AccountHolderFeature + class CardFeature @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -2906,7 +3050,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [AccountHolderFeature]. + * Returns a mutable builder for constructing an instance of [CardFeature]. * * The following fields are required: * ```java @@ -2916,7 +3060,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [AccountHolderFeature]. */ + /** A builder for [CardFeature]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -2924,10 +3068,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(accountHolderFeature: AccountHolderFeature) = apply { - type = accountHolderFeature.type - name = accountHolderFeature.name - additionalProperties = accountHolderFeature.additionalProperties.toMutableMap() + internal fun from(cardFeature: CardFeature) = apply { + type = cardFeature.type + name = cardFeature.name + additionalProperties = cardFeature.additionalProperties.toMutableMap() } fun type(type: Type) = type(JsonField.of(type)) @@ -2973,7 +3117,7 @@ private constructor( } /** - * Returns an immutable instance of [AccountHolderFeature]. + * Returns an immutable instance of [CardFeature]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -2984,12 +3128,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): AccountHolderFeature = - AccountHolderFeature( - checkRequired("type", type), - name, - additionalProperties.toMutableMap(), - ) + fun build(): CardFeature = + CardFeature(checkRequired("type", type), name, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -3003,7 +3143,7 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): AccountHolderFeature = apply { + fun validate(): CardFeature = apply { if (validated) { return@apply } @@ -3045,14 +3185,14 @@ private constructor( companion object { - @JvmField val ACCOUNT_HOLDER = of("ACCOUNT_HOLDER") + @JvmField val CARD = of("CARD") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - ACCOUNT_HOLDER + CARD } /** @@ -3065,7 +3205,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - ACCOUNT_HOLDER, + CARD, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -3079,7 +3219,7 @@ private constructor( */ fun value(): Value = when (this) { - ACCOUNT_HOLDER -> Value.ACCOUNT_HOLDER + CARD -> Value.CARD else -> Value._UNKNOWN } @@ -3094,7 +3234,7 @@ private constructor( */ fun known(): Known = when (this) { - ACCOUNT_HOLDER -> Known.ACCOUNT_HOLDER + CARD -> Known.CARD else -> throw LithicInvalidDataException("Unknown Type: $value") } @@ -3167,7 +3307,7 @@ private constructor( return true } - return other is AccountHolderFeature && + return other is CardFeature && type == other.type && name == other.name && additionalProperties == other.additionalProperties @@ -3178,10 +3318,10 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AccountHolderFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + "CardFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" } - class IpMetadataFeature + class AccountHolderFeature @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val type: JsonField, @@ -3238,7 +3378,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [IpMetadataFeature]. + * Returns a mutable builder for constructing an instance of [AccountHolderFeature]. * * The following fields are required: * ```java @@ -3248,7 +3388,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [IpMetadataFeature]. */ + /** A builder for [AccountHolderFeature]. */ class Builder internal constructor() { private var type: JsonField? = null @@ -3256,10 +3396,10 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(ipMetadataFeature: IpMetadataFeature) = apply { - type = ipMetadataFeature.type - name = ipMetadataFeature.name - additionalProperties = ipMetadataFeature.additionalProperties.toMutableMap() + internal fun from(accountHolderFeature: AccountHolderFeature) = apply { + type = accountHolderFeature.type + name = accountHolderFeature.name + additionalProperties = accountHolderFeature.additionalProperties.toMutableMap() } fun type(type: Type) = type(JsonField.of(type)) @@ -3305,7 +3445,7 @@ private constructor( } /** - * Returns an immutable instance of [IpMetadataFeature]. + * Returns an immutable instance of [AccountHolderFeature]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -3316,8 +3456,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): IpMetadataFeature = - IpMetadataFeature( + fun build(): AccountHolderFeature = + AccountHolderFeature( checkRequired("type", type), name, additionalProperties.toMutableMap(), @@ -3335,7 +3475,7 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): IpMetadataFeature = apply { + fun validate(): AccountHolderFeature = apply { if (validated) { return@apply } @@ -3377,14 +3517,14 @@ private constructor( companion object { - @JvmField val IP_METADATA = of("IP_METADATA") + @JvmField val ACCOUNT_HOLDER = of("ACCOUNT_HOLDER") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - IP_METADATA + ACCOUNT_HOLDER } /** @@ -3397,7 +3537,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - IP_METADATA, + ACCOUNT_HOLDER, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -3411,7 +3551,7 @@ private constructor( */ fun value(): Value = when (this) { - IP_METADATA -> Value.IP_METADATA + ACCOUNT_HOLDER -> Value.ACCOUNT_HOLDER else -> Value._UNKNOWN } @@ -3426,7 +3566,7 @@ private constructor( */ fun known(): Known = when (this) { - IP_METADATA -> Known.IP_METADATA + ACCOUNT_HOLDER -> Known.ACCOUNT_HOLDER else -> throw LithicInvalidDataException("Unknown Type: $value") } @@ -3499,7 +3639,7 @@ private constructor( return true } - return other is IpMetadataFeature && + return other is AccountHolderFeature && type == other.type && name == other.name && additionalProperties == other.additionalProperties @@ -3510,50 +3650,22 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "IpMetadataFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + "AccountHolderFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" } - class SpendVelocityFeature + class IpMetadataFeature @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val period: JsonField, - private val scope: JsonField, private val type: JsonField, - private val filters: JsonField, private val name: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("period") - @ExcludeMissing - period: JsonField = JsonMissing.of(), - @JsonProperty("scope") - @ExcludeMissing - scope: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("filters") - @ExcludeMissing - filters: JsonField = JsonMissing.of(), @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - ) : this(period, scope, type, filters, name, mutableMapOf()) - - /** - * Velocity over the current day since 00:00 / 12 AM in Eastern Time - * - * @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 period(): VelocityLimitPeriod = period.getRequired("period") - - /** - * The scope the velocity is calculated for - * - * @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 scope(): VelocityScope = scope.getRequired("scope") + ) : this(type, name, mutableMapOf()) /** * @throws LithicInvalidDataException if the JSON field has an unexpected type or is @@ -3561,12 +3673,6 @@ private constructor( */ fun type(): Type = type.getRequired("type") - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun filters(): Optional = filters.getOptional("filters") - /** * The variable name for this feature in the rule function signature * @@ -3575,22 +3681,6 @@ private constructor( */ fun name(): Optional = name.getOptional("name") - /** - * Returns the raw JSON value of [period]. - * - * Unlike [period], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("period") - @ExcludeMissing - fun _period(): JsonField = period - - /** - * Returns the raw JSON value of [scope]. - * - * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope - /** * Returns the raw JSON value of [type]. * @@ -3598,15 +3688,6 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - /** - * Returns the raw JSON value of [filters]. - * - * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("filters") - @ExcludeMissing - fun _filters(): JsonField = filters - /** * Returns the raw JSON value of [name]. * @@ -3629,96 +3710,3479 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [SpendVelocityFeature]. + * Returns a mutable builder for constructing an instance of [IpMetadataFeature]. * * The following fields are required: * ```java - * .period() - * .scope() * .type() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [SpendVelocityFeature]. */ + /** A builder for [IpMetadataFeature]. */ class Builder internal constructor() { - private var period: JsonField? = null - private var scope: JsonField? = null private var type: JsonField? = null - private var filters: JsonField = JsonMissing.of() private var name: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(spendVelocityFeature: SpendVelocityFeature) = apply { - period = spendVelocityFeature.period - scope = spendVelocityFeature.scope - type = spendVelocityFeature.type - filters = spendVelocityFeature.filters - name = spendVelocityFeature.name - additionalProperties = spendVelocityFeature.additionalProperties.toMutableMap() + internal fun from(ipMetadataFeature: IpMetadataFeature) = apply { + type = ipMetadataFeature.type + name = ipMetadataFeature.name + additionalProperties = ipMetadataFeature.additionalProperties.toMutableMap() } - /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ - fun period(period: VelocityLimitPeriod) = period(JsonField.of(period)) + fun type(type: Type) = type(JsonField.of(type)) /** - * Sets [Builder.period] to an arbitrary JSON value. + * Sets [Builder.type] to an arbitrary JSON value. * - * You should usually call [Builder.period] with a well-typed [VelocityLimitPeriod] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun period(period: JsonField) = apply { this.period = period } + fun type(type: JsonField) = apply { this.type = type } - /** - * Alias for calling [period] with - * `VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)`. - */ - fun period(trailingWindowObject: VelocityLimitPeriod.TrailingWindowObject) = - period(VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)) + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) /** - * Alias for calling [period] with - * `VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)`. + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun period(fixedWindowDay: VelocityLimitPeriod.FixedWindowDay) = + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [IpMetadataFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): IpMetadataFeature = + IpMetadataFeature( + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): IpMetadataFeature = apply { + if (validated) { + return@apply + } + + type().validate() + name() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IP_METADATA = of("IP_METADATA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + IP_METADATA + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IP_METADATA, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + IP_METADATA -> Value.IP_METADATA + 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) { + IP_METADATA -> Known.IP_METADATA + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IpMetadataFeature && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "IpMetadataFeature{type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class SpendVelocityFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val period: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val filters: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("period") + @ExcludeMissing + period: JsonField = JsonMissing.of(), + @JsonProperty("scope") + @ExcludeMissing + scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("filters") + @ExcludeMissing + filters: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(period, scope, type, filters, name, mutableMapOf()) + + /** + * Velocity over the current day since 00:00 / 12 AM in Eastern Time + * + * @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 period(): VelocityLimitPeriod = period.getRequired("period") + + /** + * The scope the velocity is calculated for + * + * @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 scope(): VelocityScope = scope.getRequired("scope") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun filters(): Optional = filters.getOptional("filters") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [period]. + * + * Unlike [period], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("period") + @ExcludeMissing + fun _period(): JsonField = period + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [filters]. + * + * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("filters") + @ExcludeMissing + fun _filters(): JsonField = filters + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [SpendVelocityFeature]. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SpendVelocityFeature]. */ + class Builder internal constructor() { + + private var period: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var filters: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(spendVelocityFeature: SpendVelocityFeature) = apply { + period = spendVelocityFeature.period + scope = spendVelocityFeature.scope + type = spendVelocityFeature.type + filters = spendVelocityFeature.filters + name = spendVelocityFeature.name + additionalProperties = spendVelocityFeature.additionalProperties.toMutableMap() + } + + /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ + fun period(period: VelocityLimitPeriod) = period(JsonField.of(period)) + + /** + * Sets [Builder.period] to an arbitrary JSON value. + * + * You should usually call [Builder.period] with a well-typed [VelocityLimitPeriod] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun period(period: JsonField) = apply { this.period = period } + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)`. + */ + fun period(trailingWindowObject: VelocityLimitPeriod.TrailingWindowObject) = + period(VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)`. + */ + fun period(fixedWindowDay: VelocityLimitPeriod.FixedWindowDay) = + period(VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)`. + */ + fun period(fixedWindowWeek: VelocityLimitPeriod.FixedWindowWeek) = + period(VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)`. + */ + fun period(fixedWindowMonth: VelocityLimitPeriod.FixedWindowMonth) = + period(VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)`. + */ + fun period(fixedWindowYear: VelocityLimitPeriod.FixedWindowYear) = + period(VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)) + + /** The scope the velocity is calculated for */ + fun scope(scope: VelocityScope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [VelocityScope] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun filters(filters: VelocityLimitFilters) = filters(JsonField.of(filters)) + + /** + * Sets [Builder.filters] to an arbitrary JSON value. + * + * You should usually call [Builder.filters] with a well-typed [VelocityLimitFilters] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun filters(filters: JsonField) = apply { this.filters = filters } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [SpendVelocityFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SpendVelocityFeature = + SpendVelocityFeature( + checkRequired("period", period), + checkRequired("scope", scope), + checkRequired("type", type), + filters, + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): SpendVelocityFeature = apply { + if (validated) { + return@apply + } + + period().validate() + scope().validate() + type().validate() + filters().ifPresent { it.validate() } + name() + 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 = + (period.asKnown().getOrNull()?.validity() ?: 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (filters.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The scope the velocity is calculated for */ + class VelocityScope @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 CARD = of("CARD") + + @JvmField val ACCOUNT = of("ACCOUNT") + + @JvmStatic fun of(value: String) = VelocityScope(JsonField.of(value)) + } + + /** An enum containing [VelocityScope]'s known values. */ + enum class Known { + CARD, + ACCOUNT, + } + + /** + * An enum containing [VelocityScope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [VelocityScope] 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 { + CARD, + ACCOUNT, + /** + * An enum member indicating that [VelocityScope] 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) { + CARD -> Value.CARD + ACCOUNT -> Value.ACCOUNT + 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) { + CARD -> Known.CARD + ACCOUNT -> Known.ACCOUNT + else -> throw LithicInvalidDataException("Unknown VelocityScope: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): VelocityScope = 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 VelocityScope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val SPEND_VELOCITY = of("SPEND_VELOCITY") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + SPEND_VELOCITY + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + SPEND_VELOCITY, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + SPEND_VELOCITY -> Value.SPEND_VELOCITY + 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) { + SPEND_VELOCITY -> Known.SPEND_VELOCITY + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpendVelocityFeature && + period == other.period && + scope == other.scope && + type == other.type && + filters == other.filters && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(period, scope, type, filters, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SpendVelocityFeature{period=$period, scope=$scope, type=$type, filters=$filters, name=$name, additionalProperties=$additionalProperties}" + } + + class PaymentVelocityFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val period: JsonField, + private val scope: JsonField, + private val type: JsonField, + private val filters: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("period") + @ExcludeMissing + period: JsonField = JsonMissing.of(), + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("filters") + @ExcludeMissing + filters: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(period, scope, type, filters, name, mutableMapOf()) + + /** + * Velocity over the current day since 00:00 / 12 AM in Eastern Time + * + * @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 period(): VelocityLimitPeriod = period.getRequired("period") + + /** + * The scope over which the ACH payment velocity is aggregated. + * + * @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 scope(): Scope = scope.getRequired("scope") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Optional filters applied when aggregating ACH payment velocity. Payments not matching the + * provided filters are excluded from the calculated velocity. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun filters(): Optional = filters.getOptional("filters") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [period]. + * + * Unlike [period], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("period") + @ExcludeMissing + fun _period(): JsonField = period + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [filters]. + * + * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("filters") + @ExcludeMissing + fun _filters(): JsonField = filters + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PaymentVelocityFeature]. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PaymentVelocityFeature]. */ + class Builder internal constructor() { + + private var period: JsonField? = null + private var scope: JsonField? = null + private var type: JsonField? = null + private var filters: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentVelocityFeature: PaymentVelocityFeature) = apply { + period = paymentVelocityFeature.period + scope = paymentVelocityFeature.scope + type = paymentVelocityFeature.type + filters = paymentVelocityFeature.filters + name = paymentVelocityFeature.name + additionalProperties = paymentVelocityFeature.additionalProperties.toMutableMap() + } + + /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ + fun period(period: VelocityLimitPeriod) = period(JsonField.of(period)) + + /** + * Sets [Builder.period] to an arbitrary JSON value. + * + * You should usually call [Builder.period] with a well-typed [VelocityLimitPeriod] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun period(period: JsonField) = apply { this.period = period } + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)`. + */ + fun period(trailingWindowObject: VelocityLimitPeriod.TrailingWindowObject) = + period(VelocityLimitPeriod.ofTrailingWindowObject(trailingWindowObject)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)`. + */ + fun period(fixedWindowDay: VelocityLimitPeriod.FixedWindowDay) = period(VelocityLimitPeriod.ofFixedWindowDay(fixedWindowDay)) /** - * Alias for calling [period] with - * `VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)`. + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)`. + */ + fun period(fixedWindowWeek: VelocityLimitPeriod.FixedWindowWeek) = + period(VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)`. + */ + fun period(fixedWindowMonth: VelocityLimitPeriod.FixedWindowMonth) = + period(VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)) + + /** + * Alias for calling [period] with + * `VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)`. + */ + fun period(fixedWindowYear: VelocityLimitPeriod.FixedWindowYear) = + period(VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)) + + /** The scope over which the ACH payment velocity is aggregated. */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** + * Optional filters applied when aggregating ACH payment velocity. Payments not matching + * the provided filters are excluded from the calculated velocity. + */ + fun filters(filters: PaymentVelocityFilters) = filters(JsonField.of(filters)) + + /** + * Sets [Builder.filters] to an arbitrary JSON value. + * + * You should usually call [Builder.filters] with a well-typed [PaymentVelocityFilters] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun filters(filters: JsonField) = apply { + this.filters = filters + } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [PaymentVelocityFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .period() + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PaymentVelocityFeature = + PaymentVelocityFeature( + checkRequired("period", period), + checkRequired("scope", scope), + checkRequired("type", type), + filters, + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): PaymentVelocityFeature = apply { + if (validated) { + return@apply + } + + period().validate() + scope().validate() + type().validate() + filters().ifPresent { it.validate() } + name() + 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 = + (period.asKnown().getOrNull()?.validity() ?: 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (filters.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The scope over which the ACH payment velocity is aggregated. */ + class Scope @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 FINANCIAL_ACCOUNT = of("FINANCIAL_ACCOUNT") + + @JvmField val GLOBAL = of("GLOBAL") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + FINANCIAL_ACCOUNT, + GLOBAL, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] 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 { + FINANCIAL_ACCOUNT, + GLOBAL, + /** + * An enum member indicating that [Scope] 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) { + FINANCIAL_ACCOUNT -> Value.FINANCIAL_ACCOUNT + GLOBAL -> Value.GLOBAL + 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) { + FINANCIAL_ACCOUNT -> Known.FINANCIAL_ACCOUNT + GLOBAL -> Known.GLOBAL + else -> throw LithicInvalidDataException("Unknown Scope: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = 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 Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val PAYMENT_VELOCITY = of("PAYMENT_VELOCITY") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + PAYMENT_VELOCITY + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PAYMENT_VELOCITY, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PAYMENT_VELOCITY -> Value.PAYMENT_VELOCITY + 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) { + PAYMENT_VELOCITY -> Known.PAYMENT_VELOCITY + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** + * Optional filters applied when aggregating ACH payment velocity. Payments not matching the + * provided filters are excluded from the calculated velocity. + */ + class PaymentVelocityFilters + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val excludeTags: JsonField, + private val includePaymentTypes: JsonField>, + private val includePolarities: JsonField>, + private val includeStatuses: JsonField>, + private val includeTags: JsonField, + private val result: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("exclude_tags") + @ExcludeMissing + excludeTags: JsonField = JsonMissing.of(), + @JsonProperty("include_payment_types") + @ExcludeMissing + includePaymentTypes: JsonField> = JsonMissing.of(), + @JsonProperty("include_polarities") + @ExcludeMissing + includePolarities: JsonField> = JsonMissing.of(), + @JsonProperty("include_statuses") + @ExcludeMissing + includeStatuses: JsonField> = JsonMissing.of(), + @JsonProperty("include_tags") + @ExcludeMissing + includeTags: JsonField = JsonMissing.of(), + @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + ) : this( + excludeTags, + includePaymentTypes, + includePolarities, + includeStatuses, + includeTags, + result, + mutableMapOf(), + ) + + /** + * Exclude payments matching any of the provided tag key-value pairs. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun excludeTags(): Optional = excludeTags.getOptional("exclude_tags") + + /** + * Payment types to include in the velocity calculation. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun includePaymentTypes(): Optional> = + includePaymentTypes.getOptional("include_payment_types") + + /** + * Payment polarities to include in the velocity calculation. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun includePolarities(): Optional> = + includePolarities.getOptional("include_polarities") + + /** + * Payment statuses to include in the velocity calculation. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun includeStatuses(): Optional> = + includeStatuses.getOptional("include_statuses") + + /** + * Only include payments matching all of the provided tag key-value pairs. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun includeTags(): Optional = includeTags.getOptional("include_tags") + + /** + * Only include payments with the given result. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun result(): Optional = result.getOptional("result") + + /** + * Returns the raw JSON value of [excludeTags]. + * + * Unlike [excludeTags], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("exclude_tags") + @ExcludeMissing + fun _excludeTags(): JsonField = excludeTags + + /** + * Returns the raw JSON value of [includePaymentTypes]. + * + * Unlike [includePaymentTypes], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("include_payment_types") + @ExcludeMissing + fun _includePaymentTypes(): JsonField> = includePaymentTypes + + /** + * Returns the raw JSON value of [includePolarities]. + * + * Unlike [includePolarities], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("include_polarities") + @ExcludeMissing + fun _includePolarities(): JsonField> = includePolarities + + /** + * Returns the raw JSON value of [includeStatuses]. + * + * Unlike [includeStatuses], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("include_statuses") + @ExcludeMissing + fun _includeStatuses(): JsonField> = includeStatuses + + /** + * Returns the raw JSON value of [includeTags]. + * + * Unlike [includeTags], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("include_tags") + @ExcludeMissing + fun _includeTags(): JsonField = includeTags + + /** + * Returns the raw JSON value of [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + + @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 + * [PaymentVelocityFilters]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PaymentVelocityFilters]. */ + class Builder internal constructor() { + + private var excludeTags: JsonField = JsonMissing.of() + private var includePaymentTypes: JsonField>? = null + private var includePolarities: JsonField>? = null + private var includeStatuses: JsonField>? = null + private var includeTags: JsonField = JsonMissing.of() + private var result: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentVelocityFilters: PaymentVelocityFilters) = apply { + excludeTags = paymentVelocityFilters.excludeTags + includePaymentTypes = + paymentVelocityFilters.includePaymentTypes.map { it.toMutableList() } + includePolarities = + paymentVelocityFilters.includePolarities.map { it.toMutableList() } + includeStatuses = + paymentVelocityFilters.includeStatuses.map { it.toMutableList() } + includeTags = paymentVelocityFilters.includeTags + result = paymentVelocityFilters.result + additionalProperties = + paymentVelocityFilters.additionalProperties.toMutableMap() + } + + /** Exclude payments matching any of the provided tag key-value pairs. */ + fun excludeTags(excludeTags: ExcludeTags?) = + excludeTags(JsonField.ofNullable(excludeTags)) + + /** Alias for calling [Builder.excludeTags] with `excludeTags.orElse(null)`. */ + fun excludeTags(excludeTags: Optional) = + excludeTags(excludeTags.getOrNull()) + + /** + * Sets [Builder.excludeTags] to an arbitrary JSON value. + * + * You should usually call [Builder.excludeTags] with a well-typed [ExcludeTags] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun excludeTags(excludeTags: JsonField) = apply { + this.excludeTags = excludeTags + } + + /** Payment types to include in the velocity calculation. */ + fun includePaymentTypes(includePaymentTypes: List?) = + includePaymentTypes(JsonField.ofNullable(includePaymentTypes)) + + /** + * Alias for calling [Builder.includePaymentTypes] with + * `includePaymentTypes.orElse(null)`. + */ + fun includePaymentTypes(includePaymentTypes: Optional>) = + includePaymentTypes(includePaymentTypes.getOrNull()) + + /** + * Sets [Builder.includePaymentTypes] to an arbitrary JSON value. + * + * You should usually call [Builder.includePaymentTypes] with a well-typed + * `List` value instead. This method is primarily for setting + * the field to an undocumented or not yet supported value. + */ + fun includePaymentTypes(includePaymentTypes: JsonField>) = + apply { + this.includePaymentTypes = includePaymentTypes.map { it.toMutableList() } + } + + /** + * Adds a single [IncludePaymentType] to [includePaymentTypes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludePaymentType(includePaymentType: IncludePaymentType) = apply { + includePaymentTypes = + (includePaymentTypes ?: JsonField.of(mutableListOf())).also { + checkKnown("includePaymentTypes", it).add(includePaymentType) + } + } + + /** Payment polarities to include in the velocity calculation. */ + fun includePolarities(includePolarities: List?) = + includePolarities(JsonField.ofNullable(includePolarities)) + + /** + * Alias for calling [Builder.includePolarities] with + * `includePolarities.orElse(null)`. + */ + fun includePolarities(includePolarities: Optional>) = + includePolarities(includePolarities.getOrNull()) + + /** + * Sets [Builder.includePolarities] to an arbitrary JSON value. + * + * You should usually call [Builder.includePolarities] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun includePolarities(includePolarities: JsonField>) = apply { + this.includePolarities = includePolarities.map { it.toMutableList() } + } + + /** + * Adds a single [IncludePolarity] to [includePolarities]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludePolarity(includePolarity: IncludePolarity) = apply { + includePolarities = + (includePolarities ?: JsonField.of(mutableListOf())).also { + checkKnown("includePolarities", it).add(includePolarity) + } + } + + /** Payment statuses to include in the velocity calculation. */ + fun includeStatuses(includeStatuses: List?) = + includeStatuses(JsonField.ofNullable(includeStatuses)) + + /** + * Alias for calling [Builder.includeStatuses] with `includeStatuses.orElse(null)`. + */ + fun includeStatuses(includeStatuses: Optional>) = + includeStatuses(includeStatuses.getOrNull()) + + /** + * Sets [Builder.includeStatuses] to an arbitrary JSON value. + * + * You should usually call [Builder.includeStatuses] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun includeStatuses(includeStatuses: JsonField>) = apply { + this.includeStatuses = includeStatuses.map { it.toMutableList() } + } + + /** + * Adds a single [IncludeStatus] to [includeStatuses]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addIncludeStatus(includeStatus: IncludeStatus) = apply { + includeStatuses = + (includeStatuses ?: JsonField.of(mutableListOf())).also { + checkKnown("includeStatuses", it).add(includeStatus) + } + } + + /** Only include payments matching all of the provided tag key-value pairs. */ + fun includeTags(includeTags: IncludeTags?) = + includeTags(JsonField.ofNullable(includeTags)) + + /** Alias for calling [Builder.includeTags] with `includeTags.orElse(null)`. */ + fun includeTags(includeTags: Optional) = + includeTags(includeTags.getOrNull()) + + /** + * Sets [Builder.includeTags] to an arbitrary JSON value. + * + * You should usually call [Builder.includeTags] with a well-typed [IncludeTags] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun includeTags(includeTags: JsonField) = apply { + this.includeTags = includeTags + } + + /** Only include payments with the given result. */ + fun result(result: Result) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [Result] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun result(result: JsonField) = apply { this.result = result } + + 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 [PaymentVelocityFilters]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): PaymentVelocityFilters = + PaymentVelocityFilters( + excludeTags, + (includePaymentTypes ?: JsonMissing.of()).map { it.toImmutable() }, + (includePolarities ?: JsonMissing.of()).map { it.toImmutable() }, + (includeStatuses ?: JsonMissing.of()).map { it.toImmutable() }, + includeTags, + result, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): PaymentVelocityFilters = apply { + if (validated) { + return@apply + } + + excludeTags().ifPresent { it.validate() } + includePaymentTypes().ifPresent { it.forEach { it.validate() } } + includePolarities().ifPresent { it.forEach { it.validate() } } + includeStatuses().ifPresent { it.forEach { it.validate() } } + includeTags().ifPresent { it.validate() } + result().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 = + (excludeTags.asKnown().getOrNull()?.validity() ?: 0) + + (includePaymentTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (includePolarities.asKnown().getOrNull()?.sumOf { it.validity().toInt() } + ?: 0) + + (includeStatuses.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (includeTags.asKnown().getOrNull()?.validity() ?: 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) + + /** Exclude payments matching any of the provided tag key-value pairs. */ + class ExcludeTags + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [ExcludeTags]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExcludeTags]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(excludeTags: ExcludeTags) = apply { + additionalProperties = excludeTags.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ExcludeTags]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExcludeTags = ExcludeTags(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): ExcludeTags = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExcludeTags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "ExcludeTags{additionalProperties=$additionalProperties}" + } + + class IncludePaymentType + @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 ORIGINATION = of("ORIGINATION") + + @JvmField val RECEIPT = of("RECEIPT") + + @JvmStatic fun of(value: String) = IncludePaymentType(JsonField.of(value)) + } + + /** An enum containing [IncludePaymentType]'s known values. */ + enum class Known { + ORIGINATION, + RECEIPT, + } + + /** + * An enum containing [IncludePaymentType]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [IncludePaymentType] 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 { + ORIGINATION, + RECEIPT, + /** + * An enum member indicating that [IncludePaymentType] 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) { + ORIGINATION -> Value.ORIGINATION + RECEIPT -> Value.RECEIPT + 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) { + ORIGINATION -> Known.ORIGINATION + RECEIPT -> Known.RECEIPT + else -> + throw LithicInvalidDataException("Unknown IncludePaymentType: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): IncludePaymentType = 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 IncludePaymentType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class IncludePolarity + @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 CREDIT = of("CREDIT") + + @JvmField val DEBIT = of("DEBIT") + + @JvmStatic fun of(value: String) = IncludePolarity(JsonField.of(value)) + } + + /** An enum containing [IncludePolarity]'s known values. */ + enum class Known { + CREDIT, + DEBIT, + } + + /** + * An enum containing [IncludePolarity]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [IncludePolarity] 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 { + CREDIT, + DEBIT, + /** + * An enum member indicating that [IncludePolarity] 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) { + CREDIT -> Value.CREDIT + DEBIT -> Value.DEBIT + 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) { + CREDIT -> Known.CREDIT + DEBIT -> Known.DEBIT + else -> throw LithicInvalidDataException("Unknown IncludePolarity: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): IncludePolarity = 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 IncludePolarity && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class IncludeStatus + @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 PENDING = of("PENDING") + + @JvmField val SETTLED = of("SETTLED") + + @JvmField val DECLINED = of("DECLINED") + + @JvmField val REVERSED = of("REVERSED") + + @JvmField val CANCELED = of("CANCELED") + + @JvmField val RETURNED = of("RETURNED") + + @JvmStatic fun of(value: String) = IncludeStatus(JsonField.of(value)) + } + + /** An enum containing [IncludeStatus]'s known values. */ + enum class Known { + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, + } + + /** + * An enum containing [IncludeStatus]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [IncludeStatus] 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 { + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, + /** + * An enum member indicating that [IncludeStatus] 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) { + PENDING -> Value.PENDING + SETTLED -> Value.SETTLED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED + 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) { + PENDING -> Known.PENDING + SETTLED -> Known.SETTLED + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED + else -> throw LithicInvalidDataException("Unknown IncludeStatus: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): IncludeStatus = 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 IncludeStatus && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Only include payments matching all of the provided tag key-value pairs. */ + class IncludeTags + @JsonCreator + private constructor( + @com.fasterxml.jackson.annotation.JsonValue + private val additionalProperties: Map + ) { + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = additionalProperties + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [IncludeTags]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [IncludeTags]. */ + class Builder internal constructor() { + + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(includeTags: IncludeTags) = apply { + additionalProperties = includeTags.additionalProperties.toMutableMap() + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [IncludeTags]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): IncludeTags = IncludeTags(additionalProperties.toImmutable()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): IncludeTags = apply { + if (validated) { + return@apply + } + + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + additionalProperties.count { (_, value) -> + !value.isNull() && !value.isMissing() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is IncludeTags && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = "IncludeTags{additionalProperties=$additionalProperties}" + } + + /** Only include payments with the given result. */ + class Result @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val APPROVED = of("APPROVED") + + @JvmField val DECLINED = of("DECLINED") + + @JvmStatic fun of(value: String) = Result(JsonField.of(value)) + } + + /** An enum containing [Result]'s known values. */ + enum class Known { + APPROVED, + DECLINED, + } + + /** + * An enum containing [Result]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Result] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + APPROVED, + DECLINED, + /** + * An enum member indicating that [Result] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + APPROVED -> Known.APPROVED + DECLINED -> Known.DECLINED + else -> throw LithicInvalidDataException("Unknown Result: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Result = 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 Result && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentVelocityFilters && + excludeTags == other.excludeTags && + includePaymentTypes == other.includePaymentTypes && + includePolarities == other.includePolarities && + includeStatuses == other.includeStatuses && + includeTags == other.includeTags && + result == other.result && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + excludeTags, + includePaymentTypes, + includePolarities, + includeStatuses, + includeTags, + result, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PaymentVelocityFilters{excludeTags=$excludeTags, includePaymentTypes=$includePaymentTypes, includePolarities=$includePolarities, includeStatuses=$includeStatuses, includeTags=$includeTags, result=$result, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentVelocityFeature && + period == other.period && + scope == other.scope && + type == other.type && + filters == other.filters && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(period, scope, type, filters, name, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PaymentVelocityFeature{period=$period, scope=$scope, type=$type, filters=$filters, name=$name, additionalProperties=$additionalProperties}" + } + + class TransactionHistorySignalsFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val scope: JsonField, + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(scope, type, name, mutableMapOf()) + + /** + * The entity scope to load transaction history signals for. + * + * @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 scope(): Scope = scope.getRequired("scope") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [TransactionHistorySignalsFeature]. + * + * The following fields are required: + * ```java + * .scope() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionHistorySignalsFeature]. */ + class Builder internal constructor() { + + private var scope: JsonField? = null + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionHistorySignalsFeature: TransactionHistorySignalsFeature) = + apply { + scope = transactionHistorySignalsFeature.scope + type = transactionHistorySignalsFeature.type + name = transactionHistorySignalsFeature.name + additionalProperties = + transactionHistorySignalsFeature.additionalProperties.toMutableMap() + } + + /** The entity scope to load transaction history signals for. */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) + + /** + * Sets [Builder.scope] to an arbitrary JSON value. + * + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun scope(scope: JsonField) = apply { this.scope = scope } + + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** The variable name for this feature in the rule function signature */ + fun name(name: String) = name(JsonField.of(name)) + + /** + * Sets [Builder.name] to an arbitrary JSON value. + * + * You should usually call [Builder.name] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun name(name: JsonField) = apply { this.name = name } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TransactionHistorySignalsFeature]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .scope() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionHistorySignalsFeature = + TransactionHistorySignalsFeature( + checkRequired("scope", scope), + checkRequired("type", type), + name, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): TransactionHistorySignalsFeature = apply { + if (validated) { + return@apply + } + + scope().validate() + type().validate() + name() + 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 = + (scope.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (name.asKnown().isPresent) 1 else 0) + + /** The entity scope to load transaction history signals for. */ + class Scope @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 CARD = of("CARD") + + @JvmField val ACCOUNT = of("ACCOUNT") + + @JvmField val BUSINESS_ACCOUNT = of("BUSINESS_ACCOUNT") + + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) + } + + /** An enum containing [Scope]'s known values. */ + enum class Known { + CARD, + ACCOUNT, + BUSINESS_ACCOUNT, + } + + /** + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Scope] 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 { + CARD, + ACCOUNT, + BUSINESS_ACCOUNT, + /** + * An enum member indicating that [Scope] 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) { + CARD -> Value.CARD + ACCOUNT -> Value.ACCOUNT + BUSINESS_ACCOUNT -> Value.BUSINESS_ACCOUNT + 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) { + CARD -> Known.CARD + ACCOUNT -> Known.ACCOUNT + BUSINESS_ACCOUNT -> Known.BUSINESS_ACCOUNT + else -> throw LithicInvalidDataException("Unknown Scope: $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 + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Scope = 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 Scope && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TRANSACTION_HISTORY_SIGNALS = of("TRANSACTION_HISTORY_SIGNALS") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + TRANSACTION_HISTORY_SIGNALS + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TRANSACTION_HISTORY_SIGNALS, + /** An enum member indicating that [Type] was instantiated with an unknown value. */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TRANSACTION_HISTORY_SIGNALS -> Value.TRANSACTION_HISTORY_SIGNALS + 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) { + TRANSACTION_HISTORY_SIGNALS -> Known.TRANSACTION_HISTORY_SIGNALS + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LithicInvalidDataException if any value type in this object doesn't match its + * expected type. + */ + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. */ - fun period(fixedWindowWeek: VelocityLimitPeriod.FixedWindowWeek) = - period(VelocityLimitPeriod.ofFixedWindowWeek(fixedWindowWeek)) + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - /** - * Alias for calling [period] with - * `VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)`. - */ - fun period(fixedWindowMonth: VelocityLimitPeriod.FixedWindowMonth) = - period(VelocityLimitPeriod.ofFixedWindowMonth(fixedWindowMonth)) + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TransactionHistorySignalsFeature && + scope == other.scope && + type == other.type && + name == other.name && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(scope, type, name, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionHistorySignalsFeature{scope=$scope, type=$type, name=$name, additionalProperties=$additionalProperties}" + } + + class ConsecutiveDeclinesFeature + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val scope: JsonField, + private val type: JsonField, + private val name: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("scope") @ExcludeMissing scope: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + ) : this(scope, type, name, mutableMapOf()) + + /** + * The entity scope to count consecutive declines for. + * + * @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 scope(): Scope = scope.getRequired("scope") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * The variable name for this feature in the rule function signature + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun name(): Optional = name.getOptional("name") + + /** + * Returns the raw JSON value of [scope]. + * + * Unlike [scope], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("scope") @ExcludeMissing fun _scope(): JsonField = scope + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [name]. + * + * Unlike [name], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { /** - * Alias for calling [period] with - * `VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)`. + * Returns a mutable builder for constructing an instance of + * [ConsecutiveDeclinesFeature]. + * + * The following fields are required: + * ```java + * .scope() + * .type() + * ``` */ - fun period(fixedWindowYear: VelocityLimitPeriod.FixedWindowYear) = - period(VelocityLimitPeriod.ofFixedWindowYear(fixedWindowYear)) + @JvmStatic fun builder() = Builder() + } - /** The scope the velocity is calculated for */ - fun scope(scope: VelocityScope) = scope(JsonField.of(scope)) + /** A builder for [ConsecutiveDeclinesFeature]. */ + class Builder internal constructor() { + + private var scope: JsonField? = null + private var type: JsonField? = null + private var name: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(consecutiveDeclinesFeature: ConsecutiveDeclinesFeature) = apply { + scope = consecutiveDeclinesFeature.scope + type = consecutiveDeclinesFeature.type + name = consecutiveDeclinesFeature.name + additionalProperties = + consecutiveDeclinesFeature.additionalProperties.toMutableMap() + } + + /** The entity scope to count consecutive declines for. */ + fun scope(scope: Scope) = scope(JsonField.of(scope)) /** * Sets [Builder.scope] to an arbitrary JSON value. * - * You should usually call [Builder.scope] with a well-typed [VelocityScope] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.scope] with a well-typed [Scope] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun scope(scope: JsonField) = apply { this.scope = scope } + fun scope(scope: JsonField) = apply { this.scope = scope } fun type(type: Type) = type(JsonField.of(type)) @@ -3731,17 +7195,6 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } - fun filters(filters: VelocityLimitFilters) = filters(JsonField.of(filters)) - - /** - * Sets [Builder.filters] to an arbitrary JSON value. - * - * You should usually call [Builder.filters] with a well-typed [VelocityLimitFilters] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun filters(filters: JsonField) = apply { this.filters = filters } - /** The variable name for this feature in the rule function signature */ fun name(name: String) = name(JsonField.of(name)) @@ -3774,25 +7227,22 @@ private constructor( } /** - * Returns an immutable instance of [SpendVelocityFeature]. + * Returns an immutable instance of [ConsecutiveDeclinesFeature]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .period() * .scope() * .type() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): SpendVelocityFeature = - SpendVelocityFeature( - checkRequired("period", period), + fun build(): ConsecutiveDeclinesFeature = + ConsecutiveDeclinesFeature( checkRequired("scope", scope), checkRequired("type", type), - filters, name, additionalProperties.toMutableMap(), ) @@ -3809,15 +7259,13 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): SpendVelocityFeature = apply { + fun validate(): ConsecutiveDeclinesFeature = apply { if (validated) { return@apply } - period().validate() scope().validate() type().validate() - filters().ifPresent { it.validate() } name() validated = true } @@ -3838,15 +7286,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (period.asKnown().getOrNull()?.validity() ?: 0) + - (scope.asKnown().getOrNull()?.validity() ?: 0) + + (scope.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + - (filters.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) - /** The scope the velocity is calculated for */ - class VelocityScope @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** The entity scope to count consecutive declines for. */ + class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -3864,19 +7309,19 @@ private constructor( @JvmField val ACCOUNT = of("ACCOUNT") - @JvmStatic fun of(value: String) = VelocityScope(JsonField.of(value)) + @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) } - /** An enum containing [VelocityScope]'s known values. */ + /** An enum containing [Scope]'s known values. */ enum class Known { CARD, ACCOUNT, } /** - * An enum containing [VelocityScope]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [VelocityScope] can contain an unknown value in a couple of cases: + * An instance of [Scope] 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. @@ -3886,8 +7331,7 @@ private constructor( CARD, ACCOUNT, /** - * An enum member indicating that [VelocityScope] was instantiated with an unknown - * value. + * An enum member indicating that [Scope] was instantiated with an unknown value. */ _UNKNOWN, } @@ -3919,7 +7363,7 @@ private constructor( when (this) { CARD -> Known.CARD ACCOUNT -> Known.ACCOUNT - else -> throw LithicInvalidDataException("Unknown VelocityScope: $value") + else -> throw LithicInvalidDataException("Unknown Scope: $value") } /** @@ -3948,7 +7392,7 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): VelocityScope = apply { + fun validate(): Scope = apply { if (validated) { return@apply } @@ -3978,7 +7422,7 @@ private constructor( return true } - return other is VelocityScope && value == other.value + return other is Scope && value == other.value } override fun hashCode() = value.hashCode() @@ -4000,14 +7444,14 @@ private constructor( companion object { - @JvmField val SPEND_VELOCITY = of("SPEND_VELOCITY") + @JvmField val CONSECUTIVE_DECLINES = of("CONSECUTIVE_DECLINES") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - SPEND_VELOCITY + CONSECUTIVE_DECLINES } /** @@ -4020,7 +7464,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - SPEND_VELOCITY, + CONSECUTIVE_DECLINES, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -4034,7 +7478,7 @@ private constructor( */ fun value(): Value = when (this) { - SPEND_VELOCITY -> Value.SPEND_VELOCITY + CONSECUTIVE_DECLINES -> Value.CONSECUTIVE_DECLINES else -> Value._UNKNOWN } @@ -4049,7 +7493,7 @@ private constructor( */ fun known(): Known = when (this) { - SPEND_VELOCITY -> Known.SPEND_VELOCITY + CONSECUTIVE_DECLINES -> Known.CONSECUTIVE_DECLINES else -> throw LithicInvalidDataException("Unknown Type: $value") } @@ -4122,26 +7566,22 @@ private constructor( return true } - return other is SpendVelocityFeature && - period == other.period && + return other is ConsecutiveDeclinesFeature && scope == other.scope && type == other.type && - filters == other.filters && name == other.name && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { - Objects.hash(period, scope, type, filters, name, additionalProperties) - } + private val hashCode: Int by lazy { Objects.hash(scope, type, name, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SpendVelocityFeature{period=$period, scope=$scope, type=$type, filters=$filters, name=$name, additionalProperties=$additionalProperties}" + "ConsecutiveDeclinesFeature{scope=$scope, type=$type, name=$name, additionalProperties=$additionalProperties}" } - class TransactionHistorySignalsFeature + class AchPaymentHistoryFeature @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val scope: JsonField, @@ -4158,7 +7598,7 @@ private constructor( ) : this(scope, type, name, mutableMapOf()) /** - * The entity scope to load transaction history signals for. + * The entity scope to load ACH payment history for. * * @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). @@ -4215,8 +7655,7 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [TransactionHistorySignalsFeature]. + * Returns a mutable builder for constructing an instance of [AchPaymentHistoryFeature]. * * The following fields are required: * ```java @@ -4227,7 +7666,7 @@ private constructor( @JvmStatic fun builder() = Builder() } - /** A builder for [TransactionHistorySignalsFeature]. */ + /** A builder for [AchPaymentHistoryFeature]. */ class Builder internal constructor() { private var scope: JsonField? = null @@ -4236,16 +7675,14 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(transactionHistorySignalsFeature: TransactionHistorySignalsFeature) = - apply { - scope = transactionHistorySignalsFeature.scope - type = transactionHistorySignalsFeature.type - name = transactionHistorySignalsFeature.name - additionalProperties = - transactionHistorySignalsFeature.additionalProperties.toMutableMap() - } + internal fun from(achPaymentHistoryFeature: AchPaymentHistoryFeature) = apply { + scope = achPaymentHistoryFeature.scope + type = achPaymentHistoryFeature.type + name = achPaymentHistoryFeature.name + additionalProperties = achPaymentHistoryFeature.additionalProperties.toMutableMap() + } - /** The entity scope to load transaction history signals for. */ + /** The entity scope to load ACH payment history for. */ fun scope(scope: Scope) = scope(JsonField.of(scope)) /** @@ -4300,7 +7737,7 @@ private constructor( } /** - * Returns an immutable instance of [TransactionHistorySignalsFeature]. + * Returns an immutable instance of [AchPaymentHistoryFeature]. * * Further updates to this [Builder] will not mutate the returned instance. * @@ -4312,8 +7749,8 @@ private constructor( * * @throws IllegalStateException if any required field is unset. */ - fun build(): TransactionHistorySignalsFeature = - TransactionHistorySignalsFeature( + fun build(): AchPaymentHistoryFeature = + AchPaymentHistoryFeature( checkRequired("scope", scope), checkRequired("type", type), name, @@ -4332,7 +7769,7 @@ private constructor( * @throws LithicInvalidDataException if any value type in this object doesn't match its * expected type. */ - fun validate(): TransactionHistorySignalsFeature = apply { + fun validate(): AchPaymentHistoryFeature = apply { if (validated) { return@apply } @@ -4363,7 +7800,7 @@ private constructor( (type.asKnown().getOrNull()?.validity() ?: 0) + (if (name.asKnown().isPresent) 1 else 0) - /** The entity scope to load transaction history signals for. */ + /** The entity scope to load ACH payment history for. */ class Scope @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -4378,20 +7815,14 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") - - @JvmField val ACCOUNT = of("ACCOUNT") - - @JvmField val BUSINESS_ACCOUNT = of("BUSINESS_ACCOUNT") + @JvmField val FINANCIAL_ACCOUNT = of("FINANCIAL_ACCOUNT") @JvmStatic fun of(value: String) = Scope(JsonField.of(value)) } /** An enum containing [Scope]'s known values. */ enum class Known { - CARD, - ACCOUNT, - BUSINESS_ACCOUNT, + FINANCIAL_ACCOUNT } /** @@ -4404,9 +7835,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - CARD, - ACCOUNT, - BUSINESS_ACCOUNT, + FINANCIAL_ACCOUNT, /** * An enum member indicating that [Scope] was instantiated with an unknown value. */ @@ -4422,9 +7851,7 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD - ACCOUNT -> Value.ACCOUNT - BUSINESS_ACCOUNT -> Value.BUSINESS_ACCOUNT + FINANCIAL_ACCOUNT -> Value.FINANCIAL_ACCOUNT else -> Value._UNKNOWN } @@ -4439,9 +7866,7 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD - ACCOUNT -> Known.ACCOUNT - BUSINESS_ACCOUNT -> Known.BUSINESS_ACCOUNT + FINANCIAL_ACCOUNT -> Known.FINANCIAL_ACCOUNT else -> throw LithicInvalidDataException("Unknown Scope: $value") } @@ -4523,14 +7948,14 @@ private constructor( companion object { - @JvmField val TRANSACTION_HISTORY_SIGNALS = of("TRANSACTION_HISTORY_SIGNALS") + @JvmField val ACH_PAYMENT_HISTORY = of("ACH_PAYMENT_HISTORY") @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - TRANSACTION_HISTORY_SIGNALS + ACH_PAYMENT_HISTORY } /** @@ -4543,7 +7968,7 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - TRANSACTION_HISTORY_SIGNALS, + ACH_PAYMENT_HISTORY, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -4557,7 +7982,7 @@ private constructor( */ fun value(): Value = when (this) { - TRANSACTION_HISTORY_SIGNALS -> Value.TRANSACTION_HISTORY_SIGNALS + ACH_PAYMENT_HISTORY -> Value.ACH_PAYMENT_HISTORY else -> Value._UNKNOWN } @@ -4572,7 +7997,7 @@ private constructor( */ fun known(): Known = when (this) { - TRANSACTION_HISTORY_SIGNALS -> Known.TRANSACTION_HISTORY_SIGNALS + ACH_PAYMENT_HISTORY -> Known.ACH_PAYMENT_HISTORY else -> throw LithicInvalidDataException("Unknown Type: $value") } @@ -4645,7 +8070,7 @@ private constructor( return true } - return other is TransactionHistorySignalsFeature && + return other is AchPaymentHistoryFeature && scope == other.scope && type == other.type && name == other.name && @@ -4657,6 +8082,6 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "TransactionHistorySignalsFeature{scope=$scope, type=$type, name=$name, additionalProperties=$additionalProperties}" + "AchPaymentHistoryFeature{scope=$scope, type=$type, name=$name, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt index 55da6b551..5ecd8813c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/TypescriptCodeParameters.kt @@ -174,6 +174,13 @@ private constructor( fun addFeature(achPayment: RuleFeature.AchPaymentFeature) = addFeature(RuleFeature.ofAchPayment(achPayment)) + /** + * Alias for calling [addFeature] with + * `RuleFeature.ofExternalBankAccount(externalBankAccount)`. + */ + fun addFeature(externalBankAccount: RuleFeature.ExternalBankAccountFeature) = + addFeature(RuleFeature.ofExternalBankAccount(externalBankAccount)) + /** Alias for calling [addFeature] with `RuleFeature.ofCard(card)`. */ fun addFeature(card: RuleFeature.CardFeature) = addFeature(RuleFeature.ofCard(card)) @@ -189,6 +196,10 @@ private constructor( fun addFeature(spendVelocity: RuleFeature.SpendVelocityFeature) = addFeature(RuleFeature.ofSpendVelocity(spendVelocity)) + /** Alias for calling [addFeature] with `RuleFeature.ofPaymentVelocity(paymentVelocity)`. */ + fun addFeature(paymentVelocity: RuleFeature.PaymentVelocityFeature) = + addFeature(RuleFeature.ofPaymentVelocity(paymentVelocity)) + /** * Alias for calling [addFeature] with * `RuleFeature.ofTransactionHistorySignals(transactionHistorySignals)`. @@ -196,6 +207,19 @@ private constructor( fun addFeature(transactionHistorySignals: RuleFeature.TransactionHistorySignalsFeature) = addFeature(RuleFeature.ofTransactionHistorySignals(transactionHistorySignals)) + /** + * Alias for calling [addFeature] with + * `RuleFeature.ofConsecutiveDeclines(consecutiveDeclines)`. + */ + fun addFeature(consecutiveDeclines: RuleFeature.ConsecutiveDeclinesFeature) = + addFeature(RuleFeature.ofConsecutiveDeclines(consecutiveDeclines)) + + /** + * Alias for calling [addFeature] with `RuleFeature.ofAchPaymentHistory(achPaymentHistory)`. + */ + fun addFeature(achPaymentHistory: RuleFeature.AchPaymentHistoryFeature) = + addFeature(RuleFeature.ofAchPaymentHistory(achPaymentHistory)) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimCreatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimCreatedWebhookEventTest.kt new file mode 100644 index 000000000..d4e0d6c7a --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimCreatedWebhookEventTest.kt @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ClaimCreatedWebhookEventTest { + + @Test + fun create() { + val claimCreatedWebhookEvent = + ClaimCreatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimCreatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimCreatedWebhookEvent.EventType.CLAIM_CREATED) + .addOutstandingRequirement( + ClaimCreatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimCreatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimCreatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(claimCreatedWebhookEvent.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimCreatedWebhookEvent.accountHolderToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimCreatedWebhookEvent.accountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimCreatedWebhookEvent.cardTokens()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimCreatedWebhookEvent.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimCreatedWebhookEvent.disputedTransactions()) + .containsExactly( + ClaimCreatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + assertThat(claimCreatedWebhookEvent.eventType()) + .isEqualTo(ClaimCreatedWebhookEvent.EventType.CLAIM_CREATED) + assertThat(claimCreatedWebhookEvent.outstandingRequirements()) + .containsExactly(ClaimCreatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE) + assertThat(claimCreatedWebhookEvent.reason()) + .isEqualTo(ClaimCreatedWebhookEvent.Reason.CARD_NOT_PRESENT) + assertThat(claimCreatedWebhookEvent.status()) + .isEqualTo(ClaimCreatedWebhookEvent.Status.INITIALIZING) + assertThat(claimCreatedWebhookEvent.submitted()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimCreatedWebhookEvent.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val claimCreatedWebhookEvent = + ClaimCreatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimCreatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimCreatedWebhookEvent.EventType.CLAIM_CREATED) + .addOutstandingRequirement( + ClaimCreatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimCreatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimCreatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedClaimCreatedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(claimCreatedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedClaimCreatedWebhookEvent).isEqualTo(claimCreatedWebhookEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEventTest.kt new file mode 100644 index 000000000..ac094c170 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentAcceptedWebhookEventTest.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ClaimDocumentAcceptedWebhookEventTest { + + @Test + fun create() { + val claimDocumentAcceptedWebhookEvent = + ClaimDocumentAcceptedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentAcceptedWebhookEvent.EventType.CLAIM_DOCUMENT_ACCEPTED) + .failureReason(ClaimDocumentAcceptedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentAcceptedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentAcceptedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(claimDocumentAcceptedWebhookEvent.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimDocumentAcceptedWebhookEvent.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentAcceptedWebhookEvent.downloadUrl()).contains("download_url") + assertThat(claimDocumentAcceptedWebhookEvent.downloadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentAcceptedWebhookEvent.eventType()) + .isEqualTo(ClaimDocumentAcceptedWebhookEvent.EventType.CLAIM_DOCUMENT_ACCEPTED) + assertThat(claimDocumentAcceptedWebhookEvent.failureReason()) + .contains(ClaimDocumentAcceptedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + assertThat(claimDocumentAcceptedWebhookEvent.name()).isEqualTo("name") + assertThat(claimDocumentAcceptedWebhookEvent.requirementId()).contains("requirement_id") + assertThat(claimDocumentAcceptedWebhookEvent.status()) + .isEqualTo(ClaimDocumentAcceptedWebhookEvent.Status.PENDING) + assertThat(claimDocumentAcceptedWebhookEvent.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentAcceptedWebhookEvent.uploadConstraints()) + .contains( + ClaimDocumentAcceptedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + assertThat(claimDocumentAcceptedWebhookEvent.uploadUrl()).contains("upload_url") + assertThat(claimDocumentAcceptedWebhookEvent.uploadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val claimDocumentAcceptedWebhookEvent = + ClaimDocumentAcceptedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentAcceptedWebhookEvent.EventType.CLAIM_DOCUMENT_ACCEPTED) + .failureReason(ClaimDocumentAcceptedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentAcceptedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentAcceptedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedClaimDocumentAcceptedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(claimDocumentAcceptedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedClaimDocumentAcceptedWebhookEvent) + .isEqualTo(claimDocumentAcceptedWebhookEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEventTest.kt new file mode 100644 index 000000000..98d250d81 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentRejectedWebhookEventTest.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ClaimDocumentRejectedWebhookEventTest { + + @Test + fun create() { + val claimDocumentRejectedWebhookEvent = + ClaimDocumentRejectedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentRejectedWebhookEvent.EventType.CLAIM_DOCUMENT_REJECTED) + .failureReason(ClaimDocumentRejectedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentRejectedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentRejectedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(claimDocumentRejectedWebhookEvent.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimDocumentRejectedWebhookEvent.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentRejectedWebhookEvent.downloadUrl()).contains("download_url") + assertThat(claimDocumentRejectedWebhookEvent.downloadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentRejectedWebhookEvent.eventType()) + .isEqualTo(ClaimDocumentRejectedWebhookEvent.EventType.CLAIM_DOCUMENT_REJECTED) + assertThat(claimDocumentRejectedWebhookEvent.failureReason()) + .contains(ClaimDocumentRejectedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + assertThat(claimDocumentRejectedWebhookEvent.name()).isEqualTo("name") + assertThat(claimDocumentRejectedWebhookEvent.requirementId()).contains("requirement_id") + assertThat(claimDocumentRejectedWebhookEvent.status()) + .isEqualTo(ClaimDocumentRejectedWebhookEvent.Status.PENDING) + assertThat(claimDocumentRejectedWebhookEvent.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentRejectedWebhookEvent.uploadConstraints()) + .contains( + ClaimDocumentRejectedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + assertThat(claimDocumentRejectedWebhookEvent.uploadUrl()).contains("upload_url") + assertThat(claimDocumentRejectedWebhookEvent.uploadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val claimDocumentRejectedWebhookEvent = + ClaimDocumentRejectedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentRejectedWebhookEvent.EventType.CLAIM_DOCUMENT_REJECTED) + .failureReason(ClaimDocumentRejectedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentRejectedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentRejectedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedClaimDocumentRejectedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(claimDocumentRejectedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedClaimDocumentRejectedWebhookEvent) + .isEqualTo(claimDocumentRejectedWebhookEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEventTest.kt new file mode 100644 index 000000000..f6ca58b9b --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimDocumentUploadedWebhookEventTest.kt @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ClaimDocumentUploadedWebhookEventTest { + + @Test + fun create() { + val claimDocumentUploadedWebhookEvent = + ClaimDocumentUploadedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentUploadedWebhookEvent.EventType.CLAIM_DOCUMENT_UPLOADED) + .failureReason(ClaimDocumentUploadedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentUploadedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentUploadedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(claimDocumentUploadedWebhookEvent.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimDocumentUploadedWebhookEvent.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentUploadedWebhookEvent.downloadUrl()).contains("download_url") + assertThat(claimDocumentUploadedWebhookEvent.downloadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentUploadedWebhookEvent.eventType()) + .isEqualTo(ClaimDocumentUploadedWebhookEvent.EventType.CLAIM_DOCUMENT_UPLOADED) + assertThat(claimDocumentUploadedWebhookEvent.failureReason()) + .contains(ClaimDocumentUploadedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + assertThat(claimDocumentUploadedWebhookEvent.name()).isEqualTo("name") + assertThat(claimDocumentUploadedWebhookEvent.requirementId()).contains("requirement_id") + assertThat(claimDocumentUploadedWebhookEvent.status()) + .isEqualTo(ClaimDocumentUploadedWebhookEvent.Status.PENDING) + assertThat(claimDocumentUploadedWebhookEvent.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimDocumentUploadedWebhookEvent.uploadConstraints()) + .contains( + ClaimDocumentUploadedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + assertThat(claimDocumentUploadedWebhookEvent.uploadUrl()).contains("upload_url") + assertThat(claimDocumentUploadedWebhookEvent.uploadUrlExpiresAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val claimDocumentUploadedWebhookEvent = + ClaimDocumentUploadedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentUploadedWebhookEvent.EventType.CLAIM_DOCUMENT_UPLOADED) + .failureReason(ClaimDocumentUploadedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentUploadedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentUploadedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedClaimDocumentUploadedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(claimDocumentUploadedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedClaimDocumentUploadedWebhookEvent) + .isEqualTo(claimDocumentUploadedWebhookEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEventTest.kt new file mode 100644 index 000000000..f55389f4a --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ClaimUpdatedWebhookEventTest.kt @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ClaimUpdatedWebhookEventTest { + + @Test + fun create() { + val claimUpdatedWebhookEvent = + ClaimUpdatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimUpdatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimUpdatedWebhookEvent.EventType.CLAIM_UPDATED) + .addOutstandingRequirement( + ClaimUpdatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimUpdatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimUpdatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(claimUpdatedWebhookEvent.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimUpdatedWebhookEvent.accountHolderToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimUpdatedWebhookEvent.accountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimUpdatedWebhookEvent.cardTokens()) + .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(claimUpdatedWebhookEvent.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimUpdatedWebhookEvent.disputedTransactions()) + .containsExactly( + ClaimUpdatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + assertThat(claimUpdatedWebhookEvent.eventType()) + .isEqualTo(ClaimUpdatedWebhookEvent.EventType.CLAIM_UPDATED) + assertThat(claimUpdatedWebhookEvent.outstandingRequirements()) + .containsExactly(ClaimUpdatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE) + assertThat(claimUpdatedWebhookEvent.reason()) + .isEqualTo(ClaimUpdatedWebhookEvent.Reason.CARD_NOT_PRESENT) + assertThat(claimUpdatedWebhookEvent.status()) + .isEqualTo(ClaimUpdatedWebhookEvent.Status.INITIALIZING) + assertThat(claimUpdatedWebhookEvent.submitted()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(claimUpdatedWebhookEvent.updated()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val claimUpdatedWebhookEvent = + ClaimUpdatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimUpdatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimUpdatedWebhookEvent.EventType.CLAIM_UPDATED) + .addOutstandingRequirement( + ClaimUpdatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimUpdatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimUpdatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedClaimUpdatedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(claimUpdatedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedClaimUpdatedWebhookEvent).isEqualTo(claimUpdatedWebhookEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt index 1102f5eba..4a4e76790 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ParsedWebhookEventTest.kt @@ -59,6 +59,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -232,6 +237,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -424,6 +434,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -552,6 +567,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -661,6 +681,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -789,6 +814,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -1118,6 +1148,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -1662,6 +1697,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2015,6 +2055,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2166,6 +2211,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2325,6 +2375,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2480,6 +2535,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2669,6 +2729,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2810,6 +2875,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -2904,6 +2974,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -3001,6 +3076,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -3098,6 +3178,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -3196,6 +3281,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -3296,6 +3386,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -3618,6 +3713,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).contains(cardTransactionUpdated) assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -4009,6 +4109,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()) .contains(cardTransactionEnhancedDataCreated) assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -4215,6 +4320,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()) .contains(cardTransactionEnhancedDataUpdated) + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -4331,6 +4441,666 @@ internal class ParsedWebhookEventTest { assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) } + @Test + fun ofClaimCreated() { + val claimCreated = + ClaimCreatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimCreatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimCreatedWebhookEvent.EventType.CLAIM_CREATED) + .addOutstandingRequirement( + ClaimCreatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimCreatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimCreatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val parsedWebhookEvent = ParsedWebhookEvent.ofClaimCreated(claimCreated) + + assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty + assertThat(parsedWebhookEvent.kybPayload()).isEmpty + assertThat(parsedWebhookEvent.kycPayload()).isEmpty + assertThat(parsedWebhookEvent.legacyPayload()).isEmpty + assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty + assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallenge()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallengeResponse()).isEmpty + assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty + assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardCreated()).isEmpty + assertThat(parsedWebhookEvent.cardConverted()).isEmpty + assertThat(parsedWebhookEvent.cardRenewed()).isEmpty + assertThat(parsedWebhookEvent.cardReissued()).isEmpty + assertThat(parsedWebhookEvent.cardShipped()).isEmpty + assertThat(parsedWebhookEvent.cardUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).contains(claimCreated) + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty + assertThat(parsedWebhookEvent.statementsCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty + assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty + assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty + } + + @Test + fun ofClaimCreatedRoundtrip() { + val jsonMapper = jsonMapper() + val parsedWebhookEvent = + ParsedWebhookEvent.ofClaimCreated( + ClaimCreatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimCreatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimCreatedWebhookEvent.EventType.CLAIM_CREATED) + .addOutstandingRequirement( + ClaimCreatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimCreatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimCreatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val roundtrippedParsedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(parsedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) + } + + @Test + fun ofClaimUpdated() { + val claimUpdated = + ClaimUpdatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimUpdatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimUpdatedWebhookEvent.EventType.CLAIM_UPDATED) + .addOutstandingRequirement( + ClaimUpdatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimUpdatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimUpdatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val parsedWebhookEvent = ParsedWebhookEvent.ofClaimUpdated(claimUpdated) + + assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty + assertThat(parsedWebhookEvent.kybPayload()).isEmpty + assertThat(parsedWebhookEvent.kycPayload()).isEmpty + assertThat(parsedWebhookEvent.legacyPayload()).isEmpty + assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty + assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallenge()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallengeResponse()).isEmpty + assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty + assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardCreated()).isEmpty + assertThat(parsedWebhookEvent.cardConverted()).isEmpty + assertThat(parsedWebhookEvent.cardRenewed()).isEmpty + assertThat(parsedWebhookEvent.cardReissued()).isEmpty + assertThat(parsedWebhookEvent.cardShipped()).isEmpty + assertThat(parsedWebhookEvent.cardUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).contains(claimUpdated) + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty + assertThat(parsedWebhookEvent.statementsCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty + assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty + assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty + } + + @Test + fun ofClaimUpdatedRoundtrip() { + val jsonMapper = jsonMapper() + val parsedWebhookEvent = + ParsedWebhookEvent.ofClaimUpdated( + ClaimUpdatedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .addDisputedTransaction( + ClaimUpdatedWebhookEvent.DisputedTransaction.builder() + .addEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + ) + .eventType(ClaimUpdatedWebhookEvent.EventType.CLAIM_UPDATED) + .addOutstandingRequirement( + ClaimUpdatedWebhookEvent.OutstandingRequirement.QUESTIONNAIRE + ) + .reason(ClaimUpdatedWebhookEvent.Reason.CARD_NOT_PRESENT) + .status(ClaimUpdatedWebhookEvent.Status.INITIALIZING) + .submitted(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val roundtrippedParsedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(parsedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) + } + + @Test + fun ofClaimDocumentUploaded() { + val claimDocumentUploaded = + ClaimDocumentUploadedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentUploadedWebhookEvent.EventType.CLAIM_DOCUMENT_UPLOADED) + .failureReason(ClaimDocumentUploadedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentUploadedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentUploadedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val parsedWebhookEvent = ParsedWebhookEvent.ofClaimDocumentUploaded(claimDocumentUploaded) + + assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty + assertThat(parsedWebhookEvent.kybPayload()).isEmpty + assertThat(parsedWebhookEvent.kycPayload()).isEmpty + assertThat(parsedWebhookEvent.legacyPayload()).isEmpty + assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty + assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallenge()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallengeResponse()).isEmpty + assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty + assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardCreated()).isEmpty + assertThat(parsedWebhookEvent.cardConverted()).isEmpty + assertThat(parsedWebhookEvent.cardRenewed()).isEmpty + assertThat(parsedWebhookEvent.cardReissued()).isEmpty + assertThat(parsedWebhookEvent.cardShipped()).isEmpty + assertThat(parsedWebhookEvent.cardUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).contains(claimDocumentUploaded) + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty + assertThat(parsedWebhookEvent.statementsCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty + assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty + assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty + } + + @Test + fun ofClaimDocumentUploadedRoundtrip() { + val jsonMapper = jsonMapper() + val parsedWebhookEvent = + ParsedWebhookEvent.ofClaimDocumentUploaded( + ClaimDocumentUploadedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentUploadedWebhookEvent.EventType.CLAIM_DOCUMENT_UPLOADED) + .failureReason( + ClaimDocumentUploadedWebhookEvent.FailureReason.INVALID_MIME_TYPE + ) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentUploadedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentUploadedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val roundtrippedParsedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(parsedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) + } + + @Test + fun ofClaimDocumentAccepted() { + val claimDocumentAccepted = + ClaimDocumentAcceptedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentAcceptedWebhookEvent.EventType.CLAIM_DOCUMENT_ACCEPTED) + .failureReason(ClaimDocumentAcceptedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentAcceptedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentAcceptedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val parsedWebhookEvent = ParsedWebhookEvent.ofClaimDocumentAccepted(claimDocumentAccepted) + + assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty + assertThat(parsedWebhookEvent.kybPayload()).isEmpty + assertThat(parsedWebhookEvent.kycPayload()).isEmpty + assertThat(parsedWebhookEvent.legacyPayload()).isEmpty + assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty + assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallenge()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallengeResponse()).isEmpty + assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty + assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardCreated()).isEmpty + assertThat(parsedWebhookEvent.cardConverted()).isEmpty + assertThat(parsedWebhookEvent.cardRenewed()).isEmpty + assertThat(parsedWebhookEvent.cardReissued()).isEmpty + assertThat(parsedWebhookEvent.cardShipped()).isEmpty + assertThat(parsedWebhookEvent.cardUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).contains(claimDocumentAccepted) + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty + assertThat(parsedWebhookEvent.statementsCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty + assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty + assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty + } + + @Test + fun ofClaimDocumentAcceptedRoundtrip() { + val jsonMapper = jsonMapper() + val parsedWebhookEvent = + ParsedWebhookEvent.ofClaimDocumentAccepted( + ClaimDocumentAcceptedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentAcceptedWebhookEvent.EventType.CLAIM_DOCUMENT_ACCEPTED) + .failureReason( + ClaimDocumentAcceptedWebhookEvent.FailureReason.INVALID_MIME_TYPE + ) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentAcceptedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentAcceptedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val roundtrippedParsedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(parsedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) + } + + @Test + fun ofClaimDocumentRejected() { + val claimDocumentRejected = + ClaimDocumentRejectedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentRejectedWebhookEvent.EventType.CLAIM_DOCUMENT_REJECTED) + .failureReason(ClaimDocumentRejectedWebhookEvent.FailureReason.INVALID_MIME_TYPE) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentRejectedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentRejectedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val parsedWebhookEvent = ParsedWebhookEvent.ofClaimDocumentRejected(claimDocumentRejected) + + assertThat(parsedWebhookEvent.accountHolderCreated()).isEmpty + assertThat(parsedWebhookEvent.kybPayload()).isEmpty + assertThat(parsedWebhookEvent.kycPayload()).isEmpty + assertThat(parsedWebhookEvent.legacyPayload()).isEmpty + assertThat(parsedWebhookEvent.accountHolderVerification()).isEmpty + assertThat(parsedWebhookEvent.accountHolderDocumentUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallenge()).isEmpty + assertThat(parsedWebhookEvent.cardAuthorizationChallengeResponse()).isEmpty + assertThat(parsedWebhookEvent.authRulesBacktestReportCreated()).isEmpty + assertThat(parsedWebhookEvent.balanceUpdated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.bookTransferTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardCreated()).isEmpty + assertThat(parsedWebhookEvent.cardConverted()).isEmpty + assertThat(parsedWebhookEvent.cardRenewed()).isEmpty + assertThat(parsedWebhookEvent.cardReissued()).isEmpty + assertThat(parsedWebhookEvent.cardShipped()).isEmpty + assertThat(parsedWebhookEvent.cardUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty + assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).contains(claimDocumentRejected) + assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCodeSent()) + .isEmpty + assertThat(parsedWebhookEvent.digitalWalletTokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeUpdated()).isEmpty + assertThat(parsedWebhookEvent.disputeEvidenceUploadFailed()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.externalBankAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentCreated()).isEmpty + assertThat(parsedWebhookEvent.externalPaymentUpdated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountCreated()).isEmpty + assertThat(parsedWebhookEvent.financialAccountUpdated()).isEmpty + assertThat(parsedWebhookEvent.fundingEventCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeCreated()).isEmpty + assertThat(parsedWebhookEvent.loanTapeUpdated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationCreated()).isEmpty + assertThat(parsedWebhookEvent.managementOperationUpdated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.internalTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalCreated()).isEmpty + assertThat(parsedWebhookEvent.networkTotalUpdated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.paymentTransactionUpdated()).isEmpty + assertThat(parsedWebhookEvent.settlementReportUpdated()).isEmpty + assertThat(parsedWebhookEvent.statementsCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationCreated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationChallenge()).isEmpty + assertThat(parsedWebhookEvent.tokenizationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.tokenizationResult()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCode()).isEmpty + assertThat(parsedWebhookEvent.tokenizationTwoFactorAuthenticationCodeSent()).isEmpty + assertThat(parsedWebhookEvent.tokenizationUpdated()).isEmpty + assertThat(parsedWebhookEvent.threeDSAuthenticationApprovalRequest()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionCreated()).isEmpty + assertThat(parsedWebhookEvent.disputeTransactionUpdated()).isEmpty + } + + @Test + fun ofClaimDocumentRejectedRoundtrip() { + val jsonMapper = jsonMapper() + val parsedWebhookEvent = + ParsedWebhookEvent.ofClaimDocumentRejected( + ClaimDocumentRejectedWebhookEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .downloadUrl("download_url") + .downloadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .eventType(ClaimDocumentRejectedWebhookEvent.EventType.CLAIM_DOCUMENT_REJECTED) + .failureReason( + ClaimDocumentRejectedWebhookEvent.FailureReason.INVALID_MIME_TYPE + ) + .name("name") + .requirementId("requirement_id") + .status(ClaimDocumentRejectedWebhookEvent.Status.PENDING) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .uploadConstraints( + ClaimDocumentRejectedWebhookEvent.UploadConstraints2.builder() + .addAcceptedMimeType("string") + .maxSizeBytes(0L) + .build() + ) + .uploadUrl("upload_url") + .uploadUrlExpiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + + val roundtrippedParsedWebhookEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(parsedWebhookEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedParsedWebhookEvent).isEqualTo(parsedWebhookEvent) + } + @Test fun ofDigitalWalletTokenizationApprovalRequest() { val digitalWalletTokenizationApprovalRequest = @@ -4445,6 +5215,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()) .contains(digitalWalletTokenizationApprovalRequest) assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty @@ -4654,6 +5429,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()) .contains(digitalWalletTokenizationResult) @@ -4807,6 +5587,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -4942,6 +5727,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5102,6 +5892,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5260,6 +6055,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5379,6 +6179,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5515,6 +6320,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5675,6 +6485,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5831,6 +6646,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -5984,6 +6804,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -6135,6 +6960,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -6283,6 +7113,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -6416,6 +7251,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -6683,6 +7523,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -7118,6 +7963,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -7444,6 +8294,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -7647,6 +8502,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -7820,6 +8680,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -7963,6 +8828,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -8101,6 +8971,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -8230,6 +9105,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -8408,6 +9288,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -8635,6 +9520,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -8817,6 +9707,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -9059,6 +9954,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -9415,6 +10315,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -9790,6 +10695,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -10194,6 +11104,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -10528,6 +11443,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -10723,6 +11643,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -10866,6 +11791,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -10998,6 +11928,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -11153,6 +12088,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -11429,6 +12369,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -11723,6 +12668,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) @@ -11930,6 +12880,11 @@ internal class ParsedWebhookEventTest { assertThat(parsedWebhookEvent.cardTransactionUpdated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataCreated()).isEmpty assertThat(parsedWebhookEvent.cardTransactionEnhancedDataUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimCreated()).isEmpty + assertThat(parsedWebhookEvent.claimUpdated()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentUploaded()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentAccepted()).isEmpty + assertThat(parsedWebhookEvent.claimDocumentRejected()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationApprovalRequest()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationResult()).isEmpty assertThat(parsedWebhookEvent.digitalWalletTokenizationTwoFactorAuthenticationCode()) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt index fcca38021..b943e2933 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/RuleFeatureTest.kt @@ -30,11 +30,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -73,11 +77,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -116,11 +124,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -159,11 +171,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).contains(achReceipt) assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -202,11 +218,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).contains(cardTransaction) assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -245,11 +265,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).contains(achPayment) + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -272,6 +296,53 @@ internal class RuleFeatureTest { assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) } + @Test + fun ofExternalBankAccount() { + val externalBankAccount = + RuleFeature.ExternalBankAccountFeature.builder() + .type(RuleFeature.ExternalBankAccountFeature.Type.EXTERNAL_BANK_ACCOUNT) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofExternalBankAccount(externalBankAccount) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.cardTransaction()).isEmpty + assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).contains(externalBankAccount) + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty + assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty + } + + @Test + fun ofExternalBankAccountRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofExternalBankAccount( + RuleFeature.ExternalBankAccountFeature.builder() + .type(RuleFeature.ExternalBankAccountFeature.Type.EXTERNAL_BANK_ACCOUNT) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + @Test fun ofCard() { val card = @@ -288,11 +359,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).contains(card) assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -331,11 +406,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).contains(accountHolder) assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -374,11 +453,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).contains(ipMetadata) assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -433,11 +516,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).contains(spendVelocity) + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -478,6 +565,138 @@ internal class RuleFeatureTest { assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) } + @Test + fun ofPaymentVelocity() { + val paymentVelocity = + RuleFeature.PaymentVelocityFeature.builder() + .period( + VelocityLimitPeriod.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitPeriod.TrailingWindowObject.Type.CUSTOM) + .build() + ) + .scope(RuleFeature.PaymentVelocityFeature.Scope.FINANCIAL_ACCOUNT) + .type(RuleFeature.PaymentVelocityFeature.Type.PAYMENT_VELOCITY) + .filters( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.builder() + .excludeTags( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.ExcludeTags + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addIncludePaymentType( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludePaymentType + .ORIGINATION + ) + .addIncludePolarity( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludePolarity + .CREDIT + ) + .addIncludeStatus( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.IncludeStatus + .PENDING + ) + .includeTags( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.IncludeTags + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .result( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.Result + .APPROVED + ) + .build() + ) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofPaymentVelocity(paymentVelocity) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.cardTransaction()).isEmpty + assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).contains(paymentVelocity) + assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty + } + + @Test + fun ofPaymentVelocityRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofPaymentVelocity( + RuleFeature.PaymentVelocityFeature.builder() + .period( + VelocityLimitPeriod.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitPeriod.TrailingWindowObject.Type.CUSTOM) + .build() + ) + .scope(RuleFeature.PaymentVelocityFeature.Scope.FINANCIAL_ACCOUNT) + .type(RuleFeature.PaymentVelocityFeature.Type.PAYMENT_VELOCITY) + .filters( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.builder() + .excludeTags( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .ExcludeTags + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .addIncludePaymentType( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludePaymentType + .ORIGINATION + ) + .addIncludePolarity( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludePolarity + .CREDIT + ) + .addIncludeStatus( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludeStatus + .PENDING + ) + .includeTags( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters + .IncludeTags + .builder() + .putAdditionalProperty("foo", JsonValue.from("string")) + .build() + ) + .result( + RuleFeature.PaymentVelocityFeature.PaymentVelocityFilters.Result + .APPROVED + ) + .build() + ) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + @Test fun ofTransactionHistorySignals() { val transactionHistorySignals = @@ -495,11 +714,15 @@ internal class RuleFeatureTest { assertThat(ruleFeature.achReceipt()).isEmpty assertThat(ruleFeature.cardTransaction()).isEmpty assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty assertThat(ruleFeature.card()).isEmpty assertThat(ruleFeature.accountHolder()).isEmpty assertThat(ruleFeature.ipMetadata()).isEmpty assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty assertThat(ruleFeature.transactionHistorySignals()).contains(transactionHistorySignals) + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).isEmpty } @Test @@ -526,6 +749,104 @@ internal class RuleFeatureTest { assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) } + @Test + fun ofConsecutiveDeclines() { + val consecutiveDeclines = + RuleFeature.ConsecutiveDeclinesFeature.builder() + .scope(RuleFeature.ConsecutiveDeclinesFeature.Scope.CARD) + .type(RuleFeature.ConsecutiveDeclinesFeature.Type.CONSECUTIVE_DECLINES) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofConsecutiveDeclines(consecutiveDeclines) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.cardTransaction()).isEmpty + assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty + assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).contains(consecutiveDeclines) + assertThat(ruleFeature.achPaymentHistory()).isEmpty + } + + @Test + fun ofConsecutiveDeclinesRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofConsecutiveDeclines( + RuleFeature.ConsecutiveDeclinesFeature.builder() + .scope(RuleFeature.ConsecutiveDeclinesFeature.Scope.CARD) + .type(RuleFeature.ConsecutiveDeclinesFeature.Type.CONSECUTIVE_DECLINES) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + + @Test + fun ofAchPaymentHistory() { + val achPaymentHistory = + RuleFeature.AchPaymentHistoryFeature.builder() + .scope(RuleFeature.AchPaymentHistoryFeature.Scope.FINANCIAL_ACCOUNT) + .type(RuleFeature.AchPaymentHistoryFeature.Type.ACH_PAYMENT_HISTORY) + .name("name") + .build() + + val ruleFeature = RuleFeature.ofAchPaymentHistory(achPaymentHistory) + + assertThat(ruleFeature.authorization()).isEmpty + assertThat(ruleFeature.authentication()).isEmpty + assertThat(ruleFeature.tokenization()).isEmpty + assertThat(ruleFeature.achReceipt()).isEmpty + assertThat(ruleFeature.cardTransaction()).isEmpty + assertThat(ruleFeature.achPayment()).isEmpty + assertThat(ruleFeature.externalBankAccount()).isEmpty + assertThat(ruleFeature.card()).isEmpty + assertThat(ruleFeature.accountHolder()).isEmpty + assertThat(ruleFeature.ipMetadata()).isEmpty + assertThat(ruleFeature.spendVelocity()).isEmpty + assertThat(ruleFeature.paymentVelocity()).isEmpty + assertThat(ruleFeature.transactionHistorySignals()).isEmpty + assertThat(ruleFeature.consecutiveDeclines()).isEmpty + assertThat(ruleFeature.achPaymentHistory()).contains(achPaymentHistory) + } + + @Test + fun ofAchPaymentHistoryRoundtrip() { + val jsonMapper = jsonMapper() + val ruleFeature = + RuleFeature.ofAchPaymentHistory( + RuleFeature.AchPaymentHistoryFeature.builder() + .scope(RuleFeature.AchPaymentHistoryFeature.Scope.FINANCIAL_ACCOUNT) + .type(RuleFeature.AchPaymentHistoryFeature.Type.ACH_PAYMENT_HISTORY) + .name("name") + .build() + ) + + val roundtrippedRuleFeature = + jsonMapper.readValue( + jsonMapper.writeValueAsString(ruleFeature), + jacksonTypeRef(), + ) + + assertThat(roundtrippedRuleFeature).isEqualTo(ruleFeature) + } + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { BOOLEAN(JsonValue.from(false)), STRING(JsonValue.from("invalid")),