diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2969a756f..820b5c1ae 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.111.0" + ".": "0.112.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index a080bc222..9462bec8d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 168 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c3f6c23018d70fd1b259b21cfd377b5d905872f0d3c5ce2cdb8013f4b6daa338.yml -openapi_spec_hash: b551344da9d29eb4c5374874ed84a9b0 -config_hash: 012f050e575d1bbfe8db56a9eeaa5fcd +configured_endpoints: 172 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-e1901db484e520cc1f6aa88c8b00d0fcda30c8f9e5ea562a12b9edfc3fb3b6d6.yml +openapi_spec_hash: 59c317749628f3ed4cc7911b68f6351f +config_hash: aab05d0cf41f1f6b9f4d5677273c1600 diff --git a/CHANGELOG.md b/CHANGELOG.md index bb9a97459..2e2469475 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## 0.112.0 (2025-11-17) + +Full Changelog: [v0.111.0...v0.112.0](https://github.com/lithic-com/lithic-java/compare/v0.111.0...v0.112.0) + +### Features + +* **api:** add disputes V2 endpoints ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **api:** add return payment method ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **api:** add Tokenization and ACH Rules ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **api:** add unpause external_bank_accounts API method ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **api:** extract some common schemas into models ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) + + +### Bug Fixes + +* **api:** add type guards to ConditionalValue deserializer ([dbd6653](https://github.com/lithic-com/lithic-java/commit/dbd665344d8cc3213a31c65b8bd22a2490085be4)) +* **api:** change allowed phone number length from 18 to 16 ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **api:** mark certain optional fields as nullable ([ff8ebce](https://github.com/lithic-com/lithic-java/commit/ff8ebce11768f9f6993d13140fdd906d725d8b44)) +* **format:** remove extraneous blank line in dispute service imports ([57ec41a](https://github.com/lithic-com/lithic-java/commit/57ec41a0bfbd4385ec76dbb4d4d6901c7b838ce0)) + ## 0.111.0 (2025-11-13) Full Changelog: [v0.110.0...v0.111.0](https://github.com/lithic-com/lithic-java/compare/v0.110.0...v0.111.0) diff --git a/README.md b/README.md index 286679aea..2e03962db 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.111.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.111.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.111.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.112.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.112.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.112.0) @@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc -The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.111.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.112.0). @@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic ### Gradle ```kotlin -implementation("com.lithic.api:lithic-java:0.111.0") +implementation("com.lithic.api:lithic-java:0.112.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.111.0") com.lithic.api lithic-java - 0.111.0 + 0.112.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index d50b65125..ebb49cb87 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.111.0" // x-release-please-version + version = "0.112.0" // x-release-please-version } subprojects { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt index 19d433991..4d7561aea 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt @@ -21,6 +21,7 @@ import com.lithic.api.services.blocking.CardService import com.lithic.api.services.blocking.CreditProductService import com.lithic.api.services.blocking.DigitalCardArtService import com.lithic.api.services.blocking.DisputeService +import com.lithic.api.services.blocking.DisputesV2Service import com.lithic.api.services.blocking.EventService import com.lithic.api.services.blocking.ExternalBankAccountService import com.lithic.api.services.blocking.ExternalPaymentService @@ -96,6 +97,8 @@ interface LithicClient { fun disputes(): DisputeService + fun disputesV2(): DisputesV2Service + fun events(): EventService fun transfers(): TransferService @@ -196,6 +199,8 @@ interface LithicClient { fun disputes(): DisputeService.WithRawResponse + fun disputesV2(): DisputesV2Service.WithRawResponse + fun events(): EventService.WithRawResponse fun transfers(): TransferService.WithRawResponse diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt index 63aa8975b..e8aa12038 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt @@ -20,6 +20,7 @@ import com.lithic.api.services.async.CardServiceAsync import com.lithic.api.services.async.CreditProductServiceAsync import com.lithic.api.services.async.DigitalCardArtServiceAsync import com.lithic.api.services.async.DisputeServiceAsync +import com.lithic.api.services.async.DisputesV2ServiceAsync import com.lithic.api.services.async.EventServiceAsync import com.lithic.api.services.async.ExternalBankAccountServiceAsync import com.lithic.api.services.async.ExternalPaymentServiceAsync @@ -96,6 +97,8 @@ interface LithicClientAsync { fun disputes(): DisputeServiceAsync + fun disputesV2(): DisputesV2ServiceAsync + fun events(): EventServiceAsync fun transfers(): TransferServiceAsync @@ -199,6 +202,8 @@ interface LithicClientAsync { fun disputes(): DisputeServiceAsync.WithRawResponse + fun disputesV2(): DisputesV2ServiceAsync.WithRawResponse + fun events(): EventServiceAsync.WithRawResponse fun transfers(): TransferServiceAsync.WithRawResponse diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt index d0a10d637..ec4117127 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt @@ -43,6 +43,8 @@ import com.lithic.api.services.async.DigitalCardArtServiceAsync import com.lithic.api.services.async.DigitalCardArtServiceAsyncImpl import com.lithic.api.services.async.DisputeServiceAsync import com.lithic.api.services.async.DisputeServiceAsyncImpl +import com.lithic.api.services.async.DisputesV2ServiceAsync +import com.lithic.api.services.async.DisputesV2ServiceAsyncImpl import com.lithic.api.services.async.EventServiceAsync import com.lithic.api.services.async.EventServiceAsyncImpl import com.lithic.api.services.async.ExternalBankAccountServiceAsync @@ -135,6 +137,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl DisputeServiceAsyncImpl(clientOptionsWithUserAgent) } + private val disputesV2: DisputesV2ServiceAsync by lazy { + DisputesV2ServiceAsyncImpl(clientOptionsWithUserAgent) + } + private val events: EventServiceAsync by lazy { EventServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -241,6 +247,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun disputes(): DisputeServiceAsync = disputes + override fun disputesV2(): DisputesV2ServiceAsync = disputesV2 + override fun events(): EventServiceAsync = events override fun transfers(): TransferServiceAsync = transfers @@ -337,6 +345,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl DisputeServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val disputesV2: DisputesV2ServiceAsync.WithRawResponse by lazy { + DisputesV2ServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val events: EventServiceAsync.WithRawResponse by lazy { EventServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -443,6 +455,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl override fun disputes(): DisputeServiceAsync.WithRawResponse = disputes + override fun disputesV2(): DisputesV2ServiceAsync.WithRawResponse = disputesV2 + override fun events(): EventServiceAsync.WithRawResponse = events override fun transfers(): TransferServiceAsync.WithRawResponse = transfers diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt index 7be47434e..f3e4589f0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt @@ -43,6 +43,8 @@ import com.lithic.api.services.blocking.DigitalCardArtService import com.lithic.api.services.blocking.DigitalCardArtServiceImpl import com.lithic.api.services.blocking.DisputeService import com.lithic.api.services.blocking.DisputeServiceImpl +import com.lithic.api.services.blocking.DisputesV2Service +import com.lithic.api.services.blocking.DisputesV2ServiceImpl import com.lithic.api.services.blocking.EventService import com.lithic.api.services.blocking.EventServiceImpl import com.lithic.api.services.blocking.ExternalBankAccountService @@ -128,6 +130,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient private val disputes: DisputeService by lazy { DisputeServiceImpl(clientOptionsWithUserAgent) } + private val disputesV2: DisputesV2Service by lazy { + DisputesV2ServiceImpl(clientOptionsWithUserAgent) + } + private val events: EventService by lazy { EventServiceImpl(clientOptionsWithUserAgent) } private val transfers: TransferService by lazy { @@ -223,6 +229,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun disputes(): DisputeService = disputes + override fun disputesV2(): DisputesV2Service = disputesV2 + override fun events(): EventService = events override fun transfers(): TransferService = transfers @@ -319,6 +327,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient DisputeServiceImpl.WithRawResponseImpl(clientOptions) } + private val disputesV2: DisputesV2Service.WithRawResponse by lazy { + DisputesV2ServiceImpl.WithRawResponseImpl(clientOptions) + } + private val events: EventService.WithRawResponse by lazy { EventServiceImpl.WithRawResponseImpl(clientOptions) } @@ -425,6 +437,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient override fun disputes(): DisputeService.WithRawResponse = disputes + override fun disputesV2(): DisputesV2Service.WithRawResponse = disputesV2 + override fun events(): EventService.WithRawResponse = events override fun transfers(): TransferService.WithRawResponse = transfers diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt index cb3b40b2d..a9f83fd75 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListResponse.kt @@ -1230,997 +1230,6 @@ private constructor( override fun toString() = value.toString() } - /** Financial Event */ - class FinancialEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(token, amount, created, result, type, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun token(): Optional = token.getOptional("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun created(): Optional = created.getOptional("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * 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 [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinancialEvent]. */ - class Builder internal constructor() { - - private var token: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() - private var created: JsonField = JsonMissing.of() - private var result: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(financialEvent: FinancialEvent) = apply { - token = financialEvent.token - amount = financialEvent.amount - created = financialEvent.created - result = financialEvent.result - type = financialEvent.type - additionalProperties = financialEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - 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 } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 type(type: FinancialEventType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [FinancialEventType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FinancialEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): FinancialEvent = - FinancialEvent( - token, - amount, - created, - result, - type, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FinancialEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().ifPresent { it.validate() } - type().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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 - - 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() - } - - class FinancialEventType - @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 ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_REJECTED = of("ACH_RETURN_REJECTED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmField val AUTHORIZATION = of("AUTHORIZATION") - - @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE") - - @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY") - - @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL") - - @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL") - - @JvmField val CLEARING = of("CLEARING") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") - - @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") - - @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION") - - @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED") - - @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED") - - @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED") - - @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED") - - @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED") - - @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED") - - @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED") - - @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED") - - @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED") - - @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED") - - @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED") - - @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED") - - @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED") - - @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED") - - @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED") - - @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED") - - @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED") - - @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED") - - @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED") - - @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED") - - @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION") - - @JvmField - val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL") - - @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val RETURN = of("RETURN") - - @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS") - - @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT") - - @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL") - - @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT") - - @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value)) - } - - /** An enum containing [FinancialEventType]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - } - - /** - * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialEventType] 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 { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - /** - * An enum member indicating that [FinancialEventType] 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) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - AUTHORIZATION -> Value.AUTHORIZATION - AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - BILLING_ERROR -> Value.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Value.CARD_TO_CARD - CASH_BACK -> Value.CASH_BACK - CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL - CLEARING -> Value.CLEARING - COLLECTION -> Value.COLLECTION - CORRECTION_CREDIT -> Value.CORRECTION_CREDIT - CORRECTION_DEBIT -> Value.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Value.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Value.INTEREST - INTEREST_REVERSAL -> Value.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Value.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Value.SERVICE - RETURN -> Value.RETURN - RETURN_REVERSAL -> Value.RETURN_REVERSAL - TRANSFER -> Value.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Value.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT - 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) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - AUTHORIZATION -> Known.AUTHORIZATION - AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - BILLING_ERROR -> Known.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Known.CARD_TO_CARD - CASH_BACK -> Known.CASH_BACK - CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL - CLEARING -> Known.CLEARING - COLLECTION -> Known.COLLECTION - CORRECTION_CREDIT -> Known.CORRECTION_CREDIT - CORRECTION_DEBIT -> Known.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Known.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Known.INTEREST - INTEREST_REVERSAL -> Known.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Known.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Known.SERVICE - RETURN -> Known.RETURN - RETURN_REVERSAL -> Known.RETURN_REVERSAL - TRANSFER -> Known.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Known.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT - else -> - throw LithicInvalidDataException("Unknown FinancialEventType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): FinancialEventType = 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 FinancialEventType && 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 FinancialEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, amount, created, result, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" - } - /** INTERNAL - Financial Transaction */ class Family @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2506,6 +1515,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -2516,6 +1527,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -2534,6 +1546,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an * unknown value. @@ -2555,6 +1568,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -2574,6 +1588,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } @@ -2695,7 +1710,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -2750,7 +1765,7 @@ private constructor( financialAccountToken: JsonField = JsonMissing.of(), @JsonProperty("merchant") @ExcludeMissing - merchant: JsonField = JsonMissing.of(), + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -2961,7 +1976,7 @@ private constructor( * @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 merchant(): Transaction.Merchant = merchant.getRequired("merchant") + fun merchant(): Merchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -3063,10 +2078,10 @@ private constructor( /** * CARD - Card Transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): Optional = family.getOptional("family") + fun family(): Family = family.getRequired("family") /** * Returns the raw JSON value of [token]. @@ -3192,9 +2207,7 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") - @ExcludeMissing - fun _merchant(): JsonField = merchant + @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -3360,6 +2373,7 @@ private constructor( * .status() * .tokenInfo() * .updated() + * .family() * ``` */ @JvmStatic fun builder() = Builder() @@ -3382,7 +2396,7 @@ private constructor( null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -3395,7 +2409,7 @@ private constructor( private var tokenInfo: JsonField? = null private var updated: JsonField? = null private var events: JsonField>? = null - private var family: JsonField = JsonMissing.of() + private var family: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3683,18 +2697,16 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) + fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.merchant] with a well-typed [Merchant] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun merchant(merchant: JsonField) = apply { - this.merchant = merchant - } + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -3999,6 +3011,7 @@ private constructor( * .status() * .tokenInfo() * .updated() + * .family() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4031,7 +3044,7 @@ private constructor( checkRequired("tokenInfo", tokenInfo), checkRequired("updated", updated), (events ?: JsonMissing.of()).map { it.toImmutable() }, - family, + checkRequired("family", family), additionalProperties.toMutableMap(), ) } @@ -4069,7 +3082,7 @@ private constructor( tokenInfo().ifPresent { it.validate() } updated() events().ifPresent { it.forEach { it.validate() } } - family().ifPresent { it.validate() } + family().validate() validated = true } @@ -4117,10 +3130,8 @@ private constructor( (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (family.asKnown().getOrNull()?.validity() ?: 0) - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** CARD - Card Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4134,47 +3145,29 @@ private constructor( 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 CARD = of("CARD") - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransactionStatus]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, + CARD } /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: + * An instance of [Family] 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, + CARD, /** - * An enum member indicating that [TransactionStatus] was instantiated with an - * unknown value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -4188,11 +3181,7 @@ private constructor( */ fun value(): Value = when (this) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED + CARD -> Value.CARD else -> Value._UNKNOWN } @@ -4207,12 +3196,8 @@ private constructor( */ fun known(): Known = when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") + CARD -> Known.CARD + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -4231,7 +3216,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransactionStatus = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -4261,7 +3246,7 @@ private constructor( return true } - return other is TransactionStatus && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -4269,8 +3254,10 @@ private constructor( override fun toString() = value.toString() } - /** CARD - Card Transaction */ - class Family @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The status of the transaction */ + class TransactionStatus + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4284,29 +3271,51 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") + @JvmField val PENDING = of("PENDING") - @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + @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) = TransactionStatus(JsonField.of(value)) } - /** An enum containing [Family]'s known values. */ + /** An enum containing [TransactionStatus]'s known values. */ enum class Known { - CARD + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, } /** - * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Family] can contain an unknown value in a couple of cases: + * An instance of [TransactionStatus] 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, + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, /** - * An enum member indicating that [Family] was instantiated with an unknown value. + * An enum member indicating that [TransactionStatus] was instantiated with an + * unknown value. */ _UNKNOWN, } @@ -4320,7 +3329,12 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD + PENDING -> Value.PENDING + SETTLED -> Value.SETTLED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -4335,8 +3349,13 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD - else -> throw LithicInvalidDataException("Unknown Family: $value") + PENDING -> Known.PENDING + SETTLED -> Known.SETTLED + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED + else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } /** @@ -4355,7 +3374,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Family = apply { + fun validate(): TransactionStatus = apply { if (validated) { return@apply } @@ -4385,7 +3404,7 @@ private constructor( return true } - return other is Family && value == other.value + return other is TransactionStatus && value == other.value } override fun hashCode() = value.hashCode() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt index 9535a0c5c..60c072c17 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponse.kt @@ -1252,997 +1252,6 @@ private constructor( override fun toString() = value.toString() } - /** Financial Event */ - class FinancialEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") - @ExcludeMissing - result: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(token, amount, created, result, type, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun token(): Optional = token.getOptional("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun created(): Optional = created.getOptional("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - * - * @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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * 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 [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinancialEvent]. */ - class Builder internal constructor() { - - private var token: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() - private var created: JsonField = JsonMissing.of() - private var result: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(financialEvent: FinancialEvent) = apply { - token = financialEvent.token - amount = financialEvent.amount - created = financialEvent.created - result = financialEvent.result - type = financialEvent.type - additionalProperties = financialEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** - * Amount of the financial event that has been settled in the currency's smallest - * unit (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - 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 } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 type(type: FinancialEventType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [FinancialEventType] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FinancialEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): FinancialEvent = - FinancialEvent( - token, - amount, - created, - result, - type, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FinancialEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().ifPresent { it.validate() } - type().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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 - - 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() - } - - class FinancialEventType - @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 ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_REJECTED = of("ACH_RETURN_REJECTED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmField val AUTHORIZATION = of("AUTHORIZATION") - - @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE") - - @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY") - - @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL") - - @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL") - - @JvmField val CLEARING = of("CLEARING") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") - - @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") - - @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION") - - @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED") - - @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED") - - @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED") - - @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED") - - @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED") - - @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED") - - @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED") - - @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED") - - @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED") - - @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED") - - @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED") - - @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED") - - @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED") - - @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED") - - @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED") - - @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED") - - @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED") - - @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED") - - @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED") - - @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED") - - @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION") - - @JvmField - val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL") - - @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val RETURN = of("RETURN") - - @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS") - - @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT") - - @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL") - - @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT") - - @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value)) - } - - /** An enum containing [FinancialEventType]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - } - - /** - * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialEventType] 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 { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - /** - * An enum member indicating that [FinancialEventType] 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) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - AUTHORIZATION -> Value.AUTHORIZATION - AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - BILLING_ERROR -> Value.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Value.CARD_TO_CARD - CASH_BACK -> Value.CASH_BACK - CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL - CLEARING -> Value.CLEARING - COLLECTION -> Value.COLLECTION - CORRECTION_CREDIT -> Value.CORRECTION_CREDIT - CORRECTION_DEBIT -> Value.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Value.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Value.INTEREST - INTEREST_REVERSAL -> Value.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Value.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Value.SERVICE - RETURN -> Value.RETURN - RETURN_REVERSAL -> Value.RETURN_REVERSAL - TRANSFER -> Value.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Value.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT - 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) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - AUTHORIZATION -> Known.AUTHORIZATION - AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - BILLING_ERROR -> Known.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Known.CARD_TO_CARD - CASH_BACK -> Known.CASH_BACK - CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL - CLEARING -> Known.CLEARING - COLLECTION -> Known.COLLECTION - CORRECTION_CREDIT -> Known.CORRECTION_CREDIT - CORRECTION_DEBIT -> Known.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Known.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Known.INTEREST - INTEREST_REVERSAL -> Known.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Known.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Known.SERVICE - RETURN -> Known.RETURN - RETURN_REVERSAL -> Known.RETURN_REVERSAL - TRANSFER -> Known.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Known.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT - else -> - throw LithicInvalidDataException("Unknown FinancialEventType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): FinancialEventType = 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 FinancialEventType && 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 FinancialEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, amount, created, result, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" - } - /** INTERNAL - Financial Transaction */ class Family @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2528,6 +1537,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -2538,6 +1549,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -2556,6 +1568,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an * unknown value. @@ -2577,6 +1590,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -2596,6 +1610,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } @@ -2717,7 +1732,7 @@ private constructor( private val cardholderAuthentication: JsonField, private val created: JsonField, private val financialAccountToken: JsonField, - private val merchant: JsonField, + private val merchant: JsonField, private val merchantAmount: JsonField, private val merchantAuthorizationAmount: JsonField, private val merchantCurrency: JsonField, @@ -2772,7 +1787,7 @@ private constructor( financialAccountToken: JsonField = JsonMissing.of(), @JsonProperty("merchant") @ExcludeMissing - merchant: JsonField = JsonMissing.of(), + merchant: JsonField = JsonMissing.of(), @JsonProperty("merchant_amount") @ExcludeMissing merchantAmount: JsonField = JsonMissing.of(), @@ -2983,7 +1998,7 @@ private constructor( * @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 merchant(): Transaction.Merchant = merchant.getRequired("merchant") + fun merchant(): Merchant = merchant.getRequired("merchant") /** * Analogous to the 'amount', but in the merchant currency. @@ -3085,10 +2100,10 @@ private constructor( /** * CARD - Card Transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun family(): Optional = family.getOptional("family") + fun family(): Family = family.getRequired("family") /** * Returns the raw JSON value of [token]. @@ -3214,9 +2229,7 @@ private constructor( * * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") - @ExcludeMissing - fun _merchant(): JsonField = merchant + @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant /** * Returns the raw JSON value of [merchantAmount]. @@ -3382,6 +2395,7 @@ private constructor( * .status() * .tokenInfo() * .updated() + * .family() * ``` */ @JvmStatic fun builder() = Builder() @@ -3404,7 +2418,7 @@ private constructor( null private var created: JsonField? = null private var financialAccountToken: JsonField? = null - private var merchant: JsonField? = null + private var merchant: JsonField? = null private var merchantAmount: JsonField? = null private var merchantAuthorizationAmount: JsonField? = null private var merchantCurrency: JsonField? = null @@ -3417,7 +2431,7 @@ private constructor( private var tokenInfo: JsonField? = null private var updated: JsonField? = null private var events: JsonField>? = null - private var family: JsonField = JsonMissing.of() + private var family: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -3705,18 +2719,16 @@ private constructor( this.financialAccountToken = financialAccountToken } - fun merchant(merchant: Transaction.Merchant) = merchant(JsonField.of(merchant)) + fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) /** * Sets [Builder.merchant] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Transaction.Merchant] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.merchant] with a well-typed [Merchant] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun merchant(merchant: JsonField) = apply { - this.merchant = merchant - } + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } /** Analogous to the 'amount', but in the merchant currency. */ @Deprecated("deprecated") @@ -4021,6 +3033,7 @@ private constructor( * .status() * .tokenInfo() * .updated() + * .family() * ``` * * @throws IllegalStateException if any required field is unset. @@ -4053,7 +3066,7 @@ private constructor( checkRequired("tokenInfo", tokenInfo), checkRequired("updated", updated), (events ?: JsonMissing.of()).map { it.toImmutable() }, - family, + checkRequired("family", family), additionalProperties.toMutableMap(), ) } @@ -4091,7 +3104,7 @@ private constructor( tokenInfo().ifPresent { it.validate() } updated() events().ifPresent { it.forEach { it.validate() } } - family().ifPresent { it.validate() } + family().validate() validated = true } @@ -4139,10 +3152,8 @@ private constructor( (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (family.asKnown().getOrNull()?.validity() ?: 0) - /** The status of the transaction */ - class TransactionStatus - @JsonCreator - private constructor(private val value: JsonField) : Enum { + /** CARD - Card Transaction */ + class Family @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4156,47 +3167,29 @@ private constructor( 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 CARD = of("CARD") - @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) + @JvmStatic fun of(value: String) = Family(JsonField.of(value)) } - /** An enum containing [TransactionStatus]'s known values. */ + /** An enum containing [Family]'s known values. */ enum class Known { - PENDING, - SETTLED, - DECLINED, - REVERSED, - CANCELED, + CARD } /** - * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] - * member. + * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [TransactionStatus] can contain an unknown value in a couple of cases: + * An instance of [Family] 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, + CARD, /** - * An enum member indicating that [TransactionStatus] was instantiated with an - * unknown value. + * An enum member indicating that [Family] was instantiated with an unknown value. */ _UNKNOWN, } @@ -4210,11 +3203,7 @@ private constructor( */ fun value(): Value = when (this) { - PENDING -> Value.PENDING - SETTLED -> Value.SETTLED - DECLINED -> Value.DECLINED - REVERSED -> Value.REVERSED - CANCELED -> Value.CANCELED + CARD -> Value.CARD else -> Value._UNKNOWN } @@ -4229,12 +3218,8 @@ private constructor( */ fun known(): Known = when (this) { - PENDING -> Known.PENDING - SETTLED -> Known.SETTLED - DECLINED -> Known.DECLINED - REVERSED -> Known.REVERSED - CANCELED -> Known.CANCELED - else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") + CARD -> Known.CARD + else -> throw LithicInvalidDataException("Unknown Family: $value") } /** @@ -4253,7 +3238,7 @@ private constructor( private var validated: Boolean = false - fun validate(): TransactionStatus = apply { + fun validate(): Family = apply { if (validated) { return@apply } @@ -4283,7 +3268,7 @@ private constructor( return true } - return other is TransactionStatus && value == other.value + return other is Family && value == other.value } override fun hashCode() = value.hashCode() @@ -4291,8 +3276,10 @@ private constructor( override fun toString() = value.toString() } - /** CARD - Card Transaction */ - class Family @JsonCreator private constructor(private val value: JsonField) : Enum { + /** The status of the transaction */ + class TransactionStatus + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -4306,29 +3293,51 @@ private constructor( companion object { - @JvmField val CARD = of("CARD") + @JvmField val PENDING = of("PENDING") - @JvmStatic fun of(value: String) = Family(JsonField.of(value)) + @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) = TransactionStatus(JsonField.of(value)) } - /** An enum containing [Family]'s known values. */ + /** An enum containing [TransactionStatus]'s known values. */ enum class Known { - CARD + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, } /** - * An enum containing [Family]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Family] can contain an unknown value in a couple of cases: + * An instance of [TransactionStatus] 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, + PENDING, + SETTLED, + DECLINED, + REVERSED, + CANCELED, + RETURNED, /** - * An enum member indicating that [Family] was instantiated with an unknown value. + * An enum member indicating that [TransactionStatus] was instantiated with an + * unknown value. */ _UNKNOWN, } @@ -4342,7 +3351,12 @@ private constructor( */ fun value(): Value = when (this) { - CARD -> Value.CARD + PENDING -> Value.PENDING + SETTLED -> Value.SETTLED + DECLINED -> Value.DECLINED + REVERSED -> Value.REVERSED + CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -4357,8 +3371,13 @@ private constructor( */ fun known(): Known = when (this) { - CARD -> Known.CARD - else -> throw LithicInvalidDataException("Unknown Family: $value") + PENDING -> Known.PENDING + SETTLED -> Known.SETTLED + DECLINED -> Known.DECLINED + REVERSED -> Known.REVERSED + CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED + else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } /** @@ -4377,7 +3396,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Family = apply { + fun validate(): TransactionStatus = apply { if (validated) { return@apply } @@ -4407,7 +3426,7 @@ private constructor( return true } - return other is Family && value == other.value + return other is TransactionStatus && value == other.value } override fun hashCode() = value.hashCode() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt index 5bcc304e5..ae1e77a4e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt @@ -6,35 +6,22 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.lithic.api.core.BaseDeserializer -import com.lithic.api.core.BaseSerializer -import com.lithic.api.core.Enum import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy -import com.lithic.api.core.getOrThrow -import com.lithic.api.core.toImmutable +import com.lithic.api.core.checkRequired import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull class AuthRuleCondition @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val attribute: JsonField, - private val operation: JsonField, - private val value: JsonField, + private val operation: JsonField, + private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -45,8 +32,8 @@ private constructor( attribute: JsonField = JsonMissing.of(), @JsonProperty("operation") @ExcludeMissing - operation: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + operation: JsonField = JsonMissing.of(), + @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), ) : this(attribute, operation, value, mutableMapOf()) /** @@ -92,26 +79,26 @@ private constructor( * cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun attribute(): Optional = attribute.getOptional("attribute") + fun attribute(): ConditionalAttribute = attribute.getRequired("attribute") /** * The operation to apply to the attribute * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 operation(): Optional = operation.getOptional("operation") + fun operation(): ConditionalOperation = operation.getRequired("operation") /** * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 value(): Optional = value.getOptional("value") + fun value(): ConditionalValue = value.getRequired("value") /** * Returns the raw JSON value of [attribute]. @@ -127,14 +114,16 @@ private constructor( * * Unlike [operation], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("operation") @ExcludeMissing fun _operation(): JsonField = operation + @JsonProperty("operation") + @ExcludeMissing + fun _operation(): JsonField = operation /** * Returns the raw JSON value of [value]. * * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -150,16 +139,25 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [AuthRuleCondition]. */ + /** + * Returns a mutable builder for constructing an instance of [AuthRuleCondition]. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [AuthRuleCondition]. */ class Builder internal constructor() { - private var attribute: JsonField = JsonMissing.of() - private var operation: JsonField = JsonMissing.of() - private var value: JsonField = JsonMissing.of() + private var attribute: JsonField? = null + private var operation: JsonField? = null + private var value: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -231,37 +229,40 @@ private constructor( } /** The operation to apply to the attribute */ - fun operation(operation: Operation) = operation(JsonField.of(operation)) + fun operation(operation: ConditionalOperation) = operation(JsonField.of(operation)) /** * Sets [Builder.operation] to an arbitrary JSON value. * - * You should usually call [Builder.operation] with a well-typed [Operation] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.operation] with a well-typed [ConditionalOperation] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun operation(operation: JsonField) = apply { this.operation = operation } + fun operation(operation: JsonField) = apply { + this.operation = operation + } /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun value(value: Value) = value(JsonField.of(value)) + fun value(value: ConditionalValue) = value(JsonField.of(value)) /** * Sets [Builder.value] to an arbitrary JSON value. * - * You should usually call [Builder.value] with a well-typed [Value] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.value] with a well-typed [ConditionalValue] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun value(value: JsonField) = apply { this.value = value } + fun value(value: JsonField) = apply { this.value = value } - /** Alias for calling [value] with `Value.ofRegex(regex)`. */ - fun value(regex: String) = value(Value.ofRegex(regex)) + /** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */ + fun value(regex: String) = value(ConditionalValue.ofRegex(regex)) - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun value(number: Long) = value(Value.ofNumber(number)) + /** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */ + fun value(number: Long) = value(ConditionalValue.ofNumber(number)) - /** Alias for calling [value] with `Value.ofListOfStrings(listOfStrings)`. */ + /** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */ fun valueOfListOfStrings(listOfStrings: List) = - value(Value.ofListOfStrings(listOfStrings)) + value(ConditionalValue.ofListOfStrings(listOfStrings)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -286,9 +287,23 @@ private constructor( * Returns an immutable instance of [AuthRuleCondition]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): AuthRuleCondition = - AuthRuleCondition(attribute, operation, value, additionalProperties.toMutableMap()) + AuthRuleCondition( + checkRequired("attribute", attribute), + checkRequired("operation", operation), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -298,9 +313,9 @@ private constructor( return@apply } - attribute().ifPresent { it.validate() } - operation().ifPresent { it.validate() } - value().ifPresent { it.validate() } + attribute().validate() + operation().validate() + value().validate() validated = true } @@ -323,401 +338,6 @@ private constructor( (operation.asKnown().getOrNull()?.validity() ?: 0) + (value.asKnown().getOrNull()?.validity() ?: 0) - /** The operation to apply to the attribute */ - class Operation @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val IS_ONE_OF = of("IS_ONE_OF") - - @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") - - @JvmField val MATCHES = of("MATCHES") - - @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") - - @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") - - @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") - - @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") - - @JvmField val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") - - @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") - - @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") - - @JvmStatic fun of(value: String) = Operation(JsonField.of(value)) - } - - /** An enum containing [Operation]'s known values. */ - enum class Known { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - } - - /** - * An enum containing [Operation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Operation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - /** - * An enum member indicating that [Operation] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - IS_ONE_OF -> Value.IS_ONE_OF - IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF - MATCHES -> Value.MATCHES - DOES_NOT_MATCH -> Value.DOES_NOT_MATCH - IS_EQUAL_TO -> Value.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Value.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Value.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - IS_ONE_OF -> Known.IS_ONE_OF - IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF - MATCHES -> Known.MATCHES - DOES_NOT_MATCH -> Known.DOES_NOT_MATCH - IS_EQUAL_TO -> Known.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Known.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Known.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO - else -> throw LithicInvalidDataException("Unknown Operation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Operation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Operation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val regex: String? = null, - private val number: Long? = null, - private val listOfStrings: List? = null, - private val _json: JsonValue? = null, - ) { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun regex(): Optional = Optional.ofNullable(regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun number(): Optional = Optional.ofNullable(number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun listOfStrings(): Optional> = Optional.ofNullable(listOfStrings) - - fun isRegex(): Boolean = regex != null - - fun isNumber(): Boolean = number != null - - fun isListOfStrings(): Boolean = listOfStrings != null - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun asRegex(): String = regex.getOrThrow("regex") - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun asNumber(): Long = number.getOrThrow("number") - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun asListOfStrings(): List = listOfStrings.getOrThrow("listOfStrings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - regex != null -> visitor.visitRegex(regex) - number != null -> visitor.visitNumber(number) - listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Value = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitRegex(regex: String) {} - - override fun visitNumber(number: Long) {} - - override fun visitListOfStrings(listOfStrings: List) {} - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitRegex(regex: String) = 1 - - override fun visitNumber(number: Long) = 1 - - override fun visitListOfStrings(listOfStrings: List) = - listOfStrings.size - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - regex == other.regex && - number == other.number && - listOfStrings == other.listOfStrings - } - - override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) - - override fun toString(): String = - when { - regex != null -> "Value{regex=$regex}" - number != null -> "Value{number=$number}" - listOfStrings != null -> "Value{listOfStrings=$listOfStrings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - - companion object { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JvmStatic fun ofRegex(regex: String) = Value(regex = regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - @JvmStatic fun ofNumber(number: Long) = Value(number = number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - @JvmStatic - fun ofListOfStrings(listOfStrings: List) = - Value(listOfStrings = listOfStrings.toImmutable()) - } - - /** An interface that defines how to map each variant of [Value] to a value of type [T]. */ - interface Visitor { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun visitRegex(regex: String): T - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun visitNumber(number: Long): T - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun visitListOfStrings(listOfStrings: List): T - - /** - * Maps an unknown variant of [Value] to a value of type [T]. - * - * An instance of [Value] can contain an unknown variant if it was deserialized from - * data that doesn't match any known variant. For example, if the SDK is on an older - * version than the API, then the API may respond with new variants that the SDK is - * unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Value: $json") - } - } - - internal class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Value(regex = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Value(number = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef>())?.let { - Value(listOfStrings = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible with - // all the possible variants (e.g. deserializing from object). - 0 -> Value(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the first - // completely valid match, or simply the first match if none are completely - // valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.regex != null -> generator.writeObject(value.regex) - value.number != null -> generator.writeObject(value.number) - value.listOfStrings != null -> generator.writeObject(value.listOfStrings) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Value") - } - } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt index 727366e24..df34a0018 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt @@ -476,7 +476,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -673,6 +674,24 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The type of Auth Rule. For certain rule types, this determines the event stream * during which it will be evaluated. For rules that can be applied to one of @@ -681,7 +700,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -875,6 +895,10 @@ private constructor( private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: + ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -894,6 +918,13 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): + Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -905,6 +936,11 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = + conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -920,6 +956,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -934,6 +976,12 @@ private constructor( visitor.visitConditionalAuthorizationAction( conditionalAuthorizationAction ) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction( + conditionalTokenizationAction + ) else -> visitor.unknown(_json) } @@ -974,6 +1022,19 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1017,6 +1078,15 @@ private constructor( ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1031,7 +1101,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1041,6 +1113,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1053,6 +1127,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1080,6 +1158,16 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1102,6 +1190,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1154,6 +1250,25 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalAchAction = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef< + ConditionalTokenizationActionParameters + >(), + ) + ?.let { + Parameters( + conditionalTokenizationAction = it, + _json = json, + ) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1189,6 +1304,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1203,7 +1322,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -1371,6 +1491,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1378,6 +1504,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1392,6 +1521,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown * value. @@ -1410,6 +1542,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1426,6 +1561,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -1569,7 +1707,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -1762,6 +1901,24 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The type of Auth Rule. For certain rule types, this determines the event stream * during which it will be evaluated. For rules that can be applied to one of @@ -1770,7 +1927,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -1908,6 +2066,10 @@ private constructor( private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: + ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1927,6 +2089,13 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): + Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1938,6 +2107,11 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = + conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1953,6 +2127,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1967,6 +2147,12 @@ private constructor( visitor.visitConditionalAuthorizationAction( conditionalAuthorizationAction ) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction( + conditionalTokenizationAction + ) else -> visitor.unknown(_json) } @@ -2007,6 +2193,19 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -2050,6 +2249,15 @@ private constructor( ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -2064,7 +2272,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -2074,6 +2284,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -2086,6 +2298,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -2113,6 +2329,16 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -2135,6 +2361,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -2187,6 +2421,25 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalAchAction = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef< + ConditionalTokenizationActionParameters + >(), + ) + ?.let { + Parameters( + conditionalTokenizationAction = it, + _json = json, + ) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -2222,6 +2475,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -2236,7 +2493,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -2404,6 +2662,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -2411,6 +2675,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -2425,6 +2692,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown * value. @@ -2443,6 +2713,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -2459,6 +2732,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2605,7 +2881,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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 @@ -2794,6 +3071,24 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** Whether the Auth Rule applies to all authorizations on the card program. */ fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel)) @@ -2816,7 +3111,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -2984,6 +3280,10 @@ private constructor( private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: + ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -3003,6 +3303,13 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): + Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -3014,6 +3321,11 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = + conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -3029,6 +3341,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -3043,6 +3361,12 @@ private constructor( visitor.visitConditionalAuthorizationAction( conditionalAuthorizationAction ) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction( + conditionalTokenizationAction + ) else -> visitor.unknown(_json) } @@ -3083,6 +3407,19 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -3126,6 +3463,15 @@ private constructor( ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: + ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -3140,7 +3486,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -3150,6 +3498,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -3162,6 +3512,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -3189,6 +3543,16 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -3211,6 +3575,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -3263,6 +3635,25 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalAchAction = it, _json = json) + }, + tryDeserialize( + node, + jacksonTypeRef< + ConditionalTokenizationActionParameters + >(), + ) + ?.let { + Parameters( + conditionalTokenizationAction = it, + _json = json, + ) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -3298,6 +3689,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -3312,7 +3707,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator @@ -3480,6 +3876,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -3487,6 +3889,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -3501,6 +3906,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown * value. @@ -3519,6 +3927,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -3535,6 +3946,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt index da480f2e7..641c141a0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt @@ -162,6 +162,23 @@ private constructor( body.parameters(conditionalAuthorizationAction) } + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = apply { + body.parameters(conditionalAchAction) + } + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + apply { + body.parameters(conditionalTokenizationAction) + } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -419,6 +436,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -503,6 +536,8 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = null, private val _json: JsonValue? = null, ) { @@ -520,6 +555,12 @@ private constructor( fun conditionalAuthorizationAction(): Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -530,6 +571,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -544,6 +589,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -555,6 +606,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -594,6 +649,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -636,6 +703,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -650,7 +725,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -660,6 +737,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -672,6 +751,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -698,6 +781,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -717,6 +809,12 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -756,6 +854,15 @@ private constructor( ?.let { Parameters(conditionalAuthorizationAction = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef()) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -789,6 +896,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt index fd29f1ce5..56b4c09b8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt @@ -325,6 +325,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -332,6 +338,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -346,6 +355,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -363,6 +375,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -379,6 +394,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt index 799e4c552..5dcbcb5b1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthenticationRetrieveResponse.kt @@ -1615,8 +1615,8 @@ private constructor( fun name(): Optional = name.getOptional("name") /** - * Home phone number provided by the cardholder. Maps to EMV 3DS fields `homePhone.cc` and - * `homePhone.subscriber`. + * Home phone number in E.164 format provided by the cardholder. Maps to EMV 3DS fields + * `homePhone.cc` and `homePhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1624,8 +1624,8 @@ private constructor( fun phoneNumberHome(): Optional = phoneNumberHome.getOptional("phone_number_home") /** - * Mobile/cell phone number provided by the cardholder. Maps to EMV 3DS fields - * `mobilePhone.cc` and `mobilePhone.subscriber`. + * Mobile/cell phone number in E.164 format provided by the cardholder. Maps to EMV 3DS + * fields `mobilePhone.cc` and `mobilePhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1634,8 +1634,8 @@ private constructor( phoneNumberMobile.getOptional("phone_number_mobile") /** - * Work phone number provided by the cardholder. Maps to EMV 3DS fields `workPhone.cc` and - * `workPhone.subscriber`. + * Work phone number in E.164 format provided by the cardholder. Maps to EMV 3DS fields + * `workPhone.cc` and `workPhone.subscriber`. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1881,8 +1881,8 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** - * Home phone number provided by the cardholder. Maps to EMV 3DS fields `homePhone.cc` - * and `homePhone.subscriber`. + * Home phone number in E.164 format provided by the cardholder. Maps to EMV 3DS fields + * `homePhone.cc` and `homePhone.subscriber`. */ fun phoneNumberHome(phoneNumberHome: String?) = phoneNumberHome(JsonField.ofNullable(phoneNumberHome)) @@ -1903,8 +1903,8 @@ private constructor( } /** - * Mobile/cell phone number provided by the cardholder. Maps to EMV 3DS fields - * `mobilePhone.cc` and `mobilePhone.subscriber`. + * Mobile/cell phone number in E.164 format provided by the cardholder. Maps to EMV 3DS + * fields `mobilePhone.cc` and `mobilePhone.subscriber`. */ fun phoneNumberMobile(phoneNumberMobile: String?) = phoneNumberMobile(JsonField.ofNullable(phoneNumberMobile)) @@ -1927,8 +1927,8 @@ private constructor( } /** - * Work phone number provided by the cardholder. Maps to EMV 3DS fields `workPhone.cc` - * and `workPhone.subscriber`. + * Work phone number in E.164 format provided by the cardholder. Maps to EMV 3DS fields + * `workPhone.cc` and `workPhone.subscriber`. */ fun phoneNumberWork(phoneNumberWork: String?) = phoneNumberWork(JsonField.ofNullable(phoneNumberWork)) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt index e3b8e21b5..b5aaffabe 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferResponse.kt @@ -2342,6 +2342,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -2352,6 +2354,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -2369,6 +2372,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -2390,6 +2394,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -2409,6 +2414,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryBalances.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryBalances.kt new file mode 100644 index 000000000..906e45055 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryBalances.kt @@ -0,0 +1,240 @@ +// 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.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects + +class CategoryBalances +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val fees: JsonField, + private val interest: JsonField, + private val principal: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), + @JsonProperty("interest") @ExcludeMissing interest: JsonField = JsonMissing.of(), + @JsonProperty("principal") @ExcludeMissing principal: JsonField = JsonMissing.of(), + ) : this(fees, interest, principal, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun fees(): Long = fees.getRequired("fees") + + /** + * @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 interest(): Long = interest.getRequired("interest") + + /** + * @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 principal(): Long = principal.getRequired("principal") + + /** + * Returns the raw JSON value of [fees]. + * + * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees + + /** + * Returns the raw JSON value of [interest]. + * + * Unlike [interest], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest + + /** + * Returns the raw JSON value of [principal]. + * + * Unlike [principal], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("principal") @ExcludeMissing fun _principal(): JsonField = principal + + @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 [CategoryBalances]. + * + * The following fields are required: + * ```java + * .fees() + * .interest() + * .principal() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CategoryBalances]. */ + class Builder internal constructor() { + + private var fees: JsonField? = null + private var interest: JsonField? = null + private var principal: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(categoryBalances: CategoryBalances) = apply { + fees = categoryBalances.fees + interest = categoryBalances.interest + principal = categoryBalances.principal + additionalProperties = categoryBalances.additionalProperties.toMutableMap() + } + + fun fees(fees: Long) = fees(JsonField.of(fees)) + + /** + * Sets [Builder.fees] to an arbitrary JSON value. + * + * You should usually call [Builder.fees] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun fees(fees: JsonField) = apply { this.fees = fees } + + fun interest(interest: Long) = interest(JsonField.of(interest)) + + /** + * Sets [Builder.interest] to an arbitrary JSON value. + * + * You should usually call [Builder.interest] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun interest(interest: JsonField) = apply { this.interest = interest } + + fun principal(principal: Long) = principal(JsonField.of(principal)) + + /** + * Sets [Builder.principal] to an arbitrary JSON value. + * + * You should usually call [Builder.principal] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun principal(principal: JsonField) = apply { this.principal = principal } + + 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 [CategoryBalances]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .fees() + * .interest() + * .principal() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CategoryBalances = + CategoryBalances( + checkRequired("fees", fees), + checkRequired("interest", interest), + checkRequired("principal", principal), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CategoryBalances = apply { + if (validated) { + return@apply + } + + fees() + interest() + principal() + 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 (fees.asKnown().isPresent) 1 else 0) + + (if (interest.asKnown().isPresent) 1 else 0) + + (if (principal.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CategoryBalances && + fees == other.fees && + interest == other.interest && + principal == other.principal && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(fees, interest, principal, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CategoryBalances{fees=$fees, interest=$interest, principal=$principal, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryDetails.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryDetails.kt new file mode 100644 index 000000000..2f5118ce9 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CategoryDetails.kt @@ -0,0 +1,257 @@ +// 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.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects + +class CategoryDetails +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val balanceTransfers: JsonField, + private val cashAdvances: JsonField, + private val purchases: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("balance_transfers") + @ExcludeMissing + balanceTransfers: JsonField = JsonMissing.of(), + @JsonProperty("cash_advances") + @ExcludeMissing + cashAdvances: JsonField = JsonMissing.of(), + @JsonProperty("purchases") @ExcludeMissing purchases: JsonField = JsonMissing.of(), + ) : this(balanceTransfers, cashAdvances, purchases, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun balanceTransfers(): String = balanceTransfers.getRequired("balance_transfers") + + /** + * @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 cashAdvances(): String = cashAdvances.getRequired("cash_advances") + + /** + * @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 purchases(): String = purchases.getRequired("purchases") + + /** + * Returns the raw JSON value of [balanceTransfers]. + * + * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("balance_transfers") + @ExcludeMissing + fun _balanceTransfers(): JsonField = balanceTransfers + + /** + * Returns the raw JSON value of [cashAdvances]. + * + * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("cash_advances") + @ExcludeMissing + fun _cashAdvances(): JsonField = cashAdvances + + /** + * Returns the raw JSON value of [purchases]. + * + * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("purchases") @ExcludeMissing fun _purchases(): JsonField = purchases + + @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 [CategoryDetails]. + * + * The following fields are required: + * ```java + * .balanceTransfers() + * .cashAdvances() + * .purchases() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CategoryDetails]. */ + class Builder internal constructor() { + + private var balanceTransfers: JsonField? = null + private var cashAdvances: JsonField? = null + private var purchases: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(categoryDetails: CategoryDetails) = apply { + balanceTransfers = categoryDetails.balanceTransfers + cashAdvances = categoryDetails.cashAdvances + purchases = categoryDetails.purchases + additionalProperties = categoryDetails.additionalProperties.toMutableMap() + } + + fun balanceTransfers(balanceTransfers: String) = + balanceTransfers(JsonField.of(balanceTransfers)) + + /** + * Sets [Builder.balanceTransfers] to an arbitrary JSON value. + * + * You should usually call [Builder.balanceTransfers] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balanceTransfers(balanceTransfers: JsonField) = apply { + this.balanceTransfers = balanceTransfers + } + + fun cashAdvances(cashAdvances: String) = cashAdvances(JsonField.of(cashAdvances)) + + /** + * Sets [Builder.cashAdvances] to an arbitrary JSON value. + * + * You should usually call [Builder.cashAdvances] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun cashAdvances(cashAdvances: JsonField) = apply { + this.cashAdvances = cashAdvances + } + + fun purchases(purchases: String) = purchases(JsonField.of(purchases)) + + /** + * Sets [Builder.purchases] to an arbitrary JSON value. + * + * You should usually call [Builder.purchases] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun purchases(purchases: JsonField) = apply { this.purchases = purchases } + + 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 [CategoryDetails]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .balanceTransfers() + * .cashAdvances() + * .purchases() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CategoryDetails = + CategoryDetails( + checkRequired("balanceTransfers", balanceTransfers), + checkRequired("cashAdvances", cashAdvances), + checkRequired("purchases", purchases), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CategoryDetails = apply { + if (validated) { + return@apply + } + + balanceTransfers() + cashAdvances() + purchases() + 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 (balanceTransfers.asKnown().isPresent) 1 else 0) + + (if (cashAdvances.asKnown().isPresent) 1 else 0) + + (if (purchases.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CategoryDetails && + balanceTransfers == other.balanceTransfers && + cashAdvances == other.cashAdvances && + purchases == other.purchases && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(balanceTransfers, cashAdvances, purchases, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CategoryDetails{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, purchases=$purchases, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt index ae6561d19..2c6d3e330 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Conditional3dsActionParameters.kt @@ -6,29 +6,17 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.lithic.api.core.BaseDeserializer -import com.lithic.api.core.BaseSerializer import com.lithic.api.core.Enum import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired -import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull class Conditional3dsActionParameters @@ -355,8 +343,8 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val attribute: JsonField, - private val operation: JsonField, - private val value: JsonField, + private val operation: JsonField, + private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -367,8 +355,10 @@ private constructor( attribute: JsonField = JsonMissing.of(), @JsonProperty("operation") @ExcludeMissing - operation: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + operation: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), ) : this(attribute, operation, value, mutableMapOf()) /** @@ -394,26 +384,26 @@ private constructor( * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun attribute(): Optional = attribute.getOptional("attribute") + fun attribute(): Attribute = attribute.getRequired("attribute") /** * The operation to apply to the attribute * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 operation(): Optional = operation.getOptional("operation") + fun operation(): ConditionalOperation = operation.getRequired("operation") /** * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 value(): Optional = value.getOptional("value") + fun value(): ConditionalValue = value.getRequired("value") /** * Returns the raw JSON value of [attribute]. @@ -431,14 +421,14 @@ private constructor( */ @JsonProperty("operation") @ExcludeMissing - fun _operation(): JsonField = operation + fun _operation(): JsonField = operation /** * Returns the raw JSON value of [value]. * * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -454,16 +444,25 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Condition]. */ + /** + * Returns a mutable builder for constructing an instance of [Condition]. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [Condition]. */ class Builder internal constructor() { - private var attribute: JsonField = JsonMissing.of() - private var operation: JsonField = JsonMissing.of() - private var value: JsonField = JsonMissing.of() + private var attribute: JsonField? = null + private var operation: JsonField? = null + private var value: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -511,38 +510,40 @@ private constructor( fun attribute(attribute: JsonField) = apply { this.attribute = attribute } /** The operation to apply to the attribute */ - fun operation(operation: Operation) = operation(JsonField.of(operation)) + fun operation(operation: ConditionalOperation) = operation(JsonField.of(operation)) /** * Sets [Builder.operation] to an arbitrary JSON value. * - * You should usually call [Builder.operation] with a well-typed [Operation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.operation] with a well-typed [ConditionalOperation] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun operation(operation: JsonField) = apply { this.operation = operation } + fun operation(operation: JsonField) = apply { + this.operation = operation + } /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun value(value: Value) = value(JsonField.of(value)) + fun value(value: ConditionalValue) = value(JsonField.of(value)) /** * Sets [Builder.value] to an arbitrary JSON value. * - * You should usually call [Builder.value] with a well-typed [Value] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.value] with a well-typed [ConditionalValue] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun value(value: JsonField) = apply { this.value = value } + fun value(value: JsonField) = apply { this.value = value } - /** Alias for calling [value] with `Value.ofRegex(regex)`. */ - fun value(regex: String) = value(Value.ofRegex(regex)) + /** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */ + fun value(regex: String) = value(ConditionalValue.ofRegex(regex)) - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun value(number: Long) = value(Value.ofNumber(number)) + /** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */ + fun value(number: Long) = value(ConditionalValue.ofNumber(number)) - /** Alias for calling [value] with `Value.ofListOfStrings(listOfStrings)`. */ + /** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */ fun valueOfListOfStrings(listOfStrings: List) = - value(Value.ofListOfStrings(listOfStrings)) + value(ConditionalValue.ofListOfStrings(listOfStrings)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -567,9 +568,23 @@ private constructor( * Returns an immutable instance of [Condition]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): Condition = - Condition(attribute, operation, value, additionalProperties.toMutableMap()) + Condition( + checkRequired("attribute", attribute), + checkRequired("operation", operation), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -579,9 +594,9 @@ private constructor( return@apply } - attribute().ifPresent { it.validate() } - operation().ifPresent { it.validate() } - value().ifPresent { it.validate() } + attribute().validate() + operation().validate() + value().validate() validated = true } @@ -801,407 +816,6 @@ private constructor( override fun toString() = value.toString() } - /** The operation to apply to the attribute */ - class Operation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val IS_ONE_OF = of("IS_ONE_OF") - - @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") - - @JvmField val MATCHES = of("MATCHES") - - @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") - - @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") - - @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") - - @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") - - @JvmField val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") - - @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") - - @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") - - @JvmStatic fun of(value: String) = Operation(JsonField.of(value)) - } - - /** An enum containing [Operation]'s known values. */ - enum class Known { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - } - - /** - * An enum containing [Operation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Operation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - /** - * An enum member indicating that [Operation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - IS_ONE_OF -> Value.IS_ONE_OF - IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF - MATCHES -> Value.MATCHES - DOES_NOT_MATCH -> Value.DOES_NOT_MATCH - IS_EQUAL_TO -> Value.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Value.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Value.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - IS_ONE_OF -> Known.IS_ONE_OF - IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF - MATCHES -> Known.MATCHES - DOES_NOT_MATCH -> Known.DOES_NOT_MATCH - IS_EQUAL_TO -> Known.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Known.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Known.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO - else -> throw LithicInvalidDataException("Unknown Operation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Operation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Operation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val regex: String? = null, - private val number: Long? = null, - private val listOfStrings: List? = null, - private val _json: JsonValue? = null, - ) { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun regex(): Optional = Optional.ofNullable(regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun number(): Optional = Optional.ofNullable(number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun listOfStrings(): Optional> = Optional.ofNullable(listOfStrings) - - fun isRegex(): Boolean = regex != null - - fun isNumber(): Boolean = number != null - - fun isListOfStrings(): Boolean = listOfStrings != null - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun asRegex(): String = regex.getOrThrow("regex") - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun asNumber(): Long = number.getOrThrow("number") - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun asListOfStrings(): List = listOfStrings.getOrThrow("listOfStrings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - regex != null -> visitor.visitRegex(regex) - number != null -> visitor.visitNumber(number) - listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Value = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitRegex(regex: String) {} - - override fun visitNumber(number: Long) {} - - override fun visitListOfStrings(listOfStrings: List) {} - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitRegex(regex: String) = 1 - - override fun visitNumber(number: Long) = 1 - - override fun visitListOfStrings(listOfStrings: List) = - listOfStrings.size - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - regex == other.regex && - number == other.number && - listOfStrings == other.listOfStrings - } - - override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) - - override fun toString(): String = - when { - regex != null -> "Value{regex=$regex}" - number != null -> "Value{number=$number}" - listOfStrings != null -> "Value{listOfStrings=$listOfStrings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - - companion object { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JvmStatic fun ofRegex(regex: String) = Value(regex = regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - @JvmStatic fun ofNumber(number: Long) = Value(number = number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - @JvmStatic - fun ofListOfStrings(listOfStrings: List) = - Value(listOfStrings = listOfStrings.toImmutable()) - } - - /** - * An interface that defines how to map each variant of [Value] to a value of type [T]. - */ - interface Visitor { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun visitRegex(regex: String): T - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun visitNumber(number: Long): T - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun visitListOfStrings(listOfStrings: List): T - - /** - * Maps an unknown variant of [Value] to a value of type [T]. - * - * An instance of [Value] can contain an unknown variant if it was deserialized from - * data that doesn't match any known variant. For example, if the SDK is on an older - * version than the API, then the API may respond with new variants that the SDK is - * unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Value: $json") - } - } - - internal class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Value(regex = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Value(number = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef>())?.let { - Value(listOfStrings = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible - // with all the possible variants (e.g. deserializing from object). - 0 -> Value(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the - // first completely valid match, or simply the first match if none are - // completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.regex != null -> generator.writeObject(value.regex) - value.number != null -> generator.writeObject(value.number) - value.listOfStrings != null -> generator.writeObject(value.listOfStrings) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Value") - } - } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt new file mode 100644 index 000000000..4e76f408e --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAchActionParameters.kt @@ -0,0 +1,2040 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ConditionalAchActionParameters +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val action: JsonField, + private val conditions: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("action") @ExcludeMissing action: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + ) : this(action, conditions, mutableMapOf()) + + /** + * The action to take if the conditions are met + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun action(): Action = action.getRequired("action") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun conditions(): List = conditions.getRequired("conditions") + + /** + * Returns the raw JSON value of [action]. + * + * Unlike [action], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ConditionalAchActionParameters]. + * + * The following fields are required: + * ```java + * .action() + * .conditions() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ConditionalAchActionParameters]. */ + class Builder internal constructor() { + + private var action: JsonField? = null + private var conditions: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(conditionalAchActionParameters: ConditionalAchActionParameters) = apply { + action = conditionalAchActionParameters.action + conditions = conditionalAchActionParameters.conditions.map { it.toMutableList() } + additionalProperties = + conditionalAchActionParameters.additionalProperties.toMutableMap() + } + + /** The action to take if the conditions are met */ + fun action(action: Action) = action(JsonField.of(action)) + + /** + * Sets [Builder.action] to an arbitrary JSON value. + * + * You should usually call [Builder.action] with a well-typed [Action] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun action(action: JsonField) = apply { this.action = action } + + /** Alias for calling [action] with `Action.ofApprove(approve)`. */ + fun action(approve: Action.ApproveAction) = action(Action.ofApprove(approve)) + + /** Alias for calling [action] with `Action.ofReturnAction(returnAction)`. */ + fun action(returnAction: Action.ReturnAction) = action(Action.ofReturnAction(returnAction)) + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ConditionalAchActionParameters]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .action() + * .conditions() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ConditionalAchActionParameters = + ConditionalAchActionParameters( + checkRequired("action", action), + checkRequired("conditions", conditions).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ConditionalAchActionParameters = apply { + if (validated) { + return@apply + } + + action().validate() + conditions().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (action.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** The action to take if the conditions are met */ + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) + class Action + private constructor( + private val approve: ApproveAction? = null, + private val returnAction: ReturnAction? = null, + private val _json: JsonValue? = null, + ) { + + fun approve(): Optional = Optional.ofNullable(approve) + + fun returnAction(): Optional = Optional.ofNullable(returnAction) + + fun isApprove(): Boolean = approve != null + + fun isReturnAction(): Boolean = returnAction != null + + fun asApprove(): ApproveAction = approve.getOrThrow("approve") + + fun asReturnAction(): ReturnAction = returnAction.getOrThrow("returnAction") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + approve != null -> visitor.visitApprove(approve) + returnAction != null -> visitor.visitReturnAction(returnAction) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitApprove(approve: ApproveAction) { + approve.validate() + } + + override fun visitReturnAction(returnAction: ReturnAction) { + returnAction.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitApprove(approve: ApproveAction) = approve.validity() + + override fun visitReturnAction(returnAction: ReturnAction) = + returnAction.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && approve == other.approve && returnAction == other.returnAction + } + + override fun hashCode(): Int = Objects.hash(approve, returnAction) + + override fun toString(): String = + when { + approve != null -> "Action{approve=$approve}" + returnAction != null -> "Action{returnAction=$returnAction}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") + } + + companion object { + + @JvmStatic fun ofApprove(approve: ApproveAction) = Action(approve = approve) + + @JvmStatic + fun ofReturnAction(returnAction: ReturnAction) = Action(returnAction = returnAction) + } + + /** An interface that defines how to map each variant of [Action] to a value of type [T]. */ + interface Visitor { + + fun visitApprove(approve: ApproveAction): T + + fun visitReturnAction(returnAction: ReturnAction): T + + /** + * Maps an unknown variant of [Action] to a value of type [T]. + * + * An instance of [Action] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Action(approve = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(returnAction = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> Action(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.approve != null -> generator.writeObject(value.approve) + value.returnAction != null -> generator.writeObject(value.returnAction) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class ApproveAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of() + ) : this(type, mutableMapOf()) + + /** + * Approve the ACH transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ApproveAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ApproveAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(approveAction: ApproveAction) = apply { + type = approveAction.type + additionalProperties = approveAction.additionalProperties.toMutableMap() + } + + /** Approve the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ApproveAction]. + * + * 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(): ApproveAction = + ApproveAction(checkRequired("type", type), additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): ApproveAction = apply { + if (validated) { + return@apply + } + + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Approve the ACH transaction */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val APPROVE = of("APPROVE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + APPROVE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + APPROVE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + APPROVE -> Value.APPROVE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + APPROVE -> Known.APPROVE + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ApproveAction && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ApproveAction{type=$type, additionalProperties=$additionalProperties}" + } + + class ReturnAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(code, type, mutableMapOf()) + + /** + * NACHA return code to use when returning the transaction. Note that the list of + * available return codes is subject to an allowlist configured at the program level + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun code(): Code = code.getRequired("code") + + /** + * Return the ACH transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ReturnAction]. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ReturnAction]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(returnAction: ReturnAction) = apply { + code = returnAction.code + type = returnAction.type + additionalProperties = returnAction.additionalProperties.toMutableMap() + } + + /** + * NACHA return code to use when returning the transaction. Note that the list of + * available return codes is subject to an allowlist configured at the program level + */ + fun code(code: Code) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [Code] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + /** Return the ACH transaction */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ReturnAction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .code() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ReturnAction = + ReturnAction( + checkRequired("code", code), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ReturnAction = apply { + if (validated) { + return@apply + } + + code().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (code.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * NACHA return code to use when returning the transaction. Note that the list of + * available return codes is subject to an allowlist configured at the program level + */ + class Code @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val R01 = of("R01") + + @JvmField val R02 = of("R02") + + @JvmField val R03 = of("R03") + + @JvmField val R04 = of("R04") + + @JvmField val R05 = of("R05") + + @JvmField val R06 = of("R06") + + @JvmField val R07 = of("R07") + + @JvmField val R08 = of("R08") + + @JvmField val R09 = of("R09") + + @JvmField val R10 = of("R10") + + @JvmField val R11 = of("R11") + + @JvmField val R12 = of("R12") + + @JvmField val R13 = of("R13") + + @JvmField val R14 = of("R14") + + @JvmField val R15 = of("R15") + + @JvmField val R16 = of("R16") + + @JvmField val R17 = of("R17") + + @JvmField val R18 = of("R18") + + @JvmField val R19 = of("R19") + + @JvmField val R20 = of("R20") + + @JvmField val R21 = of("R21") + + @JvmField val R22 = of("R22") + + @JvmField val R23 = of("R23") + + @JvmField val R24 = of("R24") + + @JvmField val R25 = of("R25") + + @JvmField val R26 = of("R26") + + @JvmField val R27 = of("R27") + + @JvmField val R28 = of("R28") + + @JvmField val R29 = of("R29") + + @JvmField val R30 = of("R30") + + @JvmField val R31 = of("R31") + + @JvmField val R32 = of("R32") + + @JvmField val R33 = of("R33") + + @JvmField val R34 = of("R34") + + @JvmField val R35 = of("R35") + + @JvmField val R36 = of("R36") + + @JvmField val R37 = of("R37") + + @JvmField val R38 = of("R38") + + @JvmField val R39 = of("R39") + + @JvmField val R40 = of("R40") + + @JvmField val R41 = of("R41") + + @JvmField val R42 = of("R42") + + @JvmField val R43 = of("R43") + + @JvmField val R44 = of("R44") + + @JvmField val R45 = of("R45") + + @JvmField val R46 = of("R46") + + @JvmField val R47 = of("R47") + + @JvmField val R50 = of("R50") + + @JvmField val R51 = of("R51") + + @JvmField val R52 = of("R52") + + @JvmField val R53 = of("R53") + + @JvmField val R61 = of("R61") + + @JvmField val R62 = of("R62") + + @JvmField val R67 = of("R67") + + @JvmField val R68 = of("R68") + + @JvmField val R69 = of("R69") + + @JvmField val R70 = of("R70") + + @JvmField val R71 = of("R71") + + @JvmField val R72 = of("R72") + + @JvmField val R73 = of("R73") + + @JvmField val R74 = of("R74") + + @JvmField val R75 = of("R75") + + @JvmField val R76 = of("R76") + + @JvmField val R77 = of("R77") + + @JvmField val R80 = of("R80") + + @JvmField val R81 = of("R81") + + @JvmField val R82 = of("R82") + + @JvmField val R83 = of("R83") + + @JvmField val R84 = of("R84") + + @JvmField val R85 = of("R85") + + @JvmStatic fun of(value: String) = Code(JsonField.of(value)) + } + + /** An enum containing [Code]'s known values. */ + enum class Known { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + } + + /** + * An enum containing [Code]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Code] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + R01, + R02, + R03, + R04, + R05, + R06, + R07, + R08, + R09, + R10, + R11, + R12, + R13, + R14, + R15, + R16, + R17, + R18, + R19, + R20, + R21, + R22, + R23, + R24, + R25, + R26, + R27, + R28, + R29, + R30, + R31, + R32, + R33, + R34, + R35, + R36, + R37, + R38, + R39, + R40, + R41, + R42, + R43, + R44, + R45, + R46, + R47, + R50, + R51, + R52, + R53, + R61, + R62, + R67, + R68, + R69, + R70, + R71, + R72, + R73, + R74, + R75, + R76, + R77, + R80, + R81, + R82, + R83, + R84, + R85, + /** + * An enum member indicating that [Code] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + R01 -> Value.R01 + R02 -> Value.R02 + R03 -> Value.R03 + R04 -> Value.R04 + R05 -> Value.R05 + R06 -> Value.R06 + R07 -> Value.R07 + R08 -> Value.R08 + R09 -> Value.R09 + R10 -> Value.R10 + R11 -> Value.R11 + R12 -> Value.R12 + R13 -> Value.R13 + R14 -> Value.R14 + R15 -> Value.R15 + R16 -> Value.R16 + R17 -> Value.R17 + R18 -> Value.R18 + R19 -> Value.R19 + R20 -> Value.R20 + R21 -> Value.R21 + R22 -> Value.R22 + R23 -> Value.R23 + R24 -> Value.R24 + R25 -> Value.R25 + R26 -> Value.R26 + R27 -> Value.R27 + R28 -> Value.R28 + R29 -> Value.R29 + R30 -> Value.R30 + R31 -> Value.R31 + R32 -> Value.R32 + R33 -> Value.R33 + R34 -> Value.R34 + R35 -> Value.R35 + R36 -> Value.R36 + R37 -> Value.R37 + R38 -> Value.R38 + R39 -> Value.R39 + R40 -> Value.R40 + R41 -> Value.R41 + R42 -> Value.R42 + R43 -> Value.R43 + R44 -> Value.R44 + R45 -> Value.R45 + R46 -> Value.R46 + R47 -> Value.R47 + R50 -> Value.R50 + R51 -> Value.R51 + R52 -> Value.R52 + R53 -> Value.R53 + R61 -> Value.R61 + R62 -> Value.R62 + R67 -> Value.R67 + R68 -> Value.R68 + R69 -> Value.R69 + R70 -> Value.R70 + R71 -> Value.R71 + R72 -> Value.R72 + R73 -> Value.R73 + R74 -> Value.R74 + R75 -> Value.R75 + R76 -> Value.R76 + R77 -> Value.R77 + R80 -> Value.R80 + R81 -> Value.R81 + R82 -> Value.R82 + R83 -> Value.R83 + R84 -> Value.R84 + R85 -> Value.R85 + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + R01 -> Known.R01 + R02 -> Known.R02 + R03 -> Known.R03 + R04 -> Known.R04 + R05 -> Known.R05 + R06 -> Known.R06 + R07 -> Known.R07 + R08 -> Known.R08 + R09 -> Known.R09 + R10 -> Known.R10 + R11 -> Known.R11 + R12 -> Known.R12 + R13 -> Known.R13 + R14 -> Known.R14 + R15 -> Known.R15 + R16 -> Known.R16 + R17 -> Known.R17 + R18 -> Known.R18 + R19 -> Known.R19 + R20 -> Known.R20 + R21 -> Known.R21 + R22 -> Known.R22 + R23 -> Known.R23 + R24 -> Known.R24 + R25 -> Known.R25 + R26 -> Known.R26 + R27 -> Known.R27 + R28 -> Known.R28 + R29 -> Known.R29 + R30 -> Known.R30 + R31 -> Known.R31 + R32 -> Known.R32 + R33 -> Known.R33 + R34 -> Known.R34 + R35 -> Known.R35 + R36 -> Known.R36 + R37 -> Known.R37 + R38 -> Known.R38 + R39 -> Known.R39 + R40 -> Known.R40 + R41 -> Known.R41 + R42 -> Known.R42 + R43 -> Known.R43 + R44 -> Known.R44 + R45 -> Known.R45 + R46 -> Known.R46 + R47 -> Known.R47 + R50 -> Known.R50 + R51 -> Known.R51 + R52 -> Known.R52 + R53 -> Known.R53 + R61 -> Known.R61 + R62 -> Known.R62 + R67 -> Known.R67 + R68 -> Known.R68 + R69 -> Known.R69 + R70 -> Known.R70 + R71 -> Known.R71 + R72 -> Known.R72 + R73 -> Known.R73 + R74 -> Known.R74 + R75 -> Known.R75 + R76 -> Known.R76 + R77 -> Known.R77 + R80 -> Known.R80 + R81 -> Known.R81 + R82 -> Known.R82 + R83 -> Known.R83 + R84 -> Known.R84 + R85 -> Known.R85 + else -> throw LithicInvalidDataException("Unknown Code: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Code = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Code && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Return the ACH transaction */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val RETURN = of("RETURN") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + RETURN + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + RETURN, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + RETURN -> Value.RETURN + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + RETURN -> Known.RETURN + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ReturnAction && + code == other.code && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(code, type, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ReturnAction{code=$code, type=$type, additionalProperties=$additionalProperties}" + } + } + + class Condition + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val attribute: JsonField, + private val operation: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("attribute") + @ExcludeMissing + attribute: JsonField = JsonMissing.of(), + @JsonProperty("operation") + @ExcludeMissing + operation: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(attribute, operation, value, mutableMapOf()) + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `COMPANY_NAME`: The name of the company initiating the ACH transaction. + * * `COMPANY_ID`: The company ID (also known as Standard Entry Class (SEC) Company ID) of + * the entity initiating the ACH transaction. + * * `TIMESTAMP`: The timestamp of the ACH transaction in ISO 8601 format. + * * `TRANSACTION_AMOUNT`: The amount of the ACH transaction in minor units (cents). + * * `SEC_CODE`: Standard Entry Class code indicating the type of ACH transaction. Valid + * values include PPD (Prearranged Payment and Deposit Entry), CCD (Corporate Credit or + * Debit Entry), WEB (Internet-Initiated/Mobile Entry), TEL (Telephone-Initiated Entry), + * and others. + * * `MEMO`: Optional memo or description field included with the ACH transaction. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun attribute(): Attribute = attribute.getRequired("attribute") + + /** + * The operation to apply to the attribute + * + * @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 operation(): ConditionalOperation = operation.getRequired("operation") + + /** + * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` + * + * @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 value(): ConditionalValue = value.getRequired("value") + + /** + * Returns the raw JSON value of [attribute]. + * + * Unlike [attribute], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attribute") + @ExcludeMissing + fun _attribute(): JsonField = attribute + + /** + * Returns the raw JSON value of [operation]. + * + * Unlike [operation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operation") + @ExcludeMissing + fun _operation(): JsonField = operation + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Condition]. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var attribute: JsonField? = null + private var operation: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + attribute = condition.attribute + operation = condition.operation + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `COMPANY_NAME`: The name of the company initiating the ACH transaction. + * * `COMPANY_ID`: The company ID (also known as Standard Entry Class (SEC) Company ID) + * of the entity initiating the ACH transaction. + * * `TIMESTAMP`: The timestamp of the ACH transaction in ISO 8601 format. + * * `TRANSACTION_AMOUNT`: The amount of the ACH transaction in minor units (cents). + * * `SEC_CODE`: Standard Entry Class code indicating the type of ACH transaction. Valid + * values include PPD (Prearranged Payment and Deposit Entry), CCD (Corporate Credit + * or Debit Entry), WEB (Internet-Initiated/Mobile Entry), TEL (Telephone-Initiated + * Entry), and others. + * * `MEMO`: Optional memo or description field included with the ACH transaction. + */ + fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) + + /** + * Sets [Builder.attribute] to an arbitrary JSON value. + * + * You should usually call [Builder.attribute] with a well-typed [Attribute] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attribute(attribute: JsonField) = apply { this.attribute = attribute } + + /** The operation to apply to the attribute */ + fun operation(operation: ConditionalOperation) = operation(JsonField.of(operation)) + + /** + * Sets [Builder.operation] to an arbitrary JSON value. + * + * You should usually call [Builder.operation] with a well-typed [ConditionalOperation] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun operation(operation: JsonField) = apply { + this.operation = operation + } + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + fun value(value: ConditionalValue) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [ConditionalValue] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */ + fun value(regex: String) = value(ConditionalValue.ofRegex(regex)) + + /** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */ + fun value(number: Long) = value(ConditionalValue.ofNumber(number)) + + /** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */ + fun valueOfListOfStrings(listOfStrings: List) = + value(ConditionalValue.ofListOfStrings(listOfStrings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Condition = + Condition( + checkRequired("attribute", attribute), + checkRequired("operation", operation), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + attribute().validate() + operation().validate() + value().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (attribute.asKnown().getOrNull()?.validity() ?: 0) + + (operation.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `COMPANY_NAME`: The name of the company initiating the ACH transaction. + * * `COMPANY_ID`: The company ID (also known as Standard Entry Class (SEC) Company ID) of + * the entity initiating the ACH transaction. + * * `TIMESTAMP`: The timestamp of the ACH transaction in ISO 8601 format. + * * `TRANSACTION_AMOUNT`: The amount of the ACH transaction in minor units (cents). + * * `SEC_CODE`: Standard Entry Class code indicating the type of ACH transaction. Valid + * values include PPD (Prearranged Payment and Deposit Entry), CCD (Corporate Credit or + * Debit Entry), WEB (Internet-Initiated/Mobile Entry), TEL (Telephone-Initiated Entry), + * and others. + * * `MEMO`: Optional memo or description field included with the ACH transaction. + */ + class Attribute @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val COMPANY_NAME = of("COMPANY_NAME") + + @JvmField val COMPANY_ID = of("COMPANY_ID") + + @JvmField val TIMESTAMP = of("TIMESTAMP") + + @JvmField val TRANSACTION_AMOUNT = of("TRANSACTION_AMOUNT") + + @JvmField val SEC_CODE = of("SEC_CODE") + + @JvmField val MEMO = of("MEMO") + + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) + } + + /** An enum containing [Attribute]'s known values. */ + enum class Known { + COMPANY_NAME, + COMPANY_ID, + TIMESTAMP, + TRANSACTION_AMOUNT, + SEC_CODE, + MEMO, + } + + /** + * An enum containing [Attribute]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Attribute] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + COMPANY_NAME, + COMPANY_ID, + TIMESTAMP, + TRANSACTION_AMOUNT, + SEC_CODE, + MEMO, + /** + * An enum member indicating that [Attribute] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + COMPANY_NAME -> Value.COMPANY_NAME + COMPANY_ID -> Value.COMPANY_ID + TIMESTAMP -> Value.TIMESTAMP + TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT + SEC_CODE -> Value.SEC_CODE + MEMO -> Value.MEMO + 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) { + COMPANY_NAME -> Known.COMPANY_NAME + COMPANY_ID -> Known.COMPANY_ID + TIMESTAMP -> Known.TIMESTAMP + TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT + SEC_CODE -> Known.SEC_CODE + MEMO -> Known.MEMO + else -> throw LithicInvalidDataException("Unknown Attribute: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Attribute = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Attribute && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Condition && + attribute == other.attribute && + operation == other.operation && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(attribute, operation, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConditionalAchActionParameters && + action == other.action && + conditions == other.conditions && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(action, conditions, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ConditionalAchActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt index 9a928f258..bd315b394 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParameters.kt @@ -6,29 +6,17 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.lithic.api.core.BaseDeserializer -import com.lithic.api.core.BaseSerializer import com.lithic.api.core.Enum import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired -import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects -import java.util.Optional import kotlin.jvm.optionals.getOrNull class ConditionalAuthorizationActionParameters @@ -358,8 +346,8 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val attribute: JsonField, - private val operation: JsonField, - private val value: JsonField, + private val operation: JsonField, + private val value: JsonField, private val additionalProperties: MutableMap, ) { @@ -370,8 +358,10 @@ private constructor( attribute: JsonField = JsonMissing.of(), @JsonProperty("operation") @ExcludeMissing - operation: JsonField = JsonMissing.of(), - @JsonProperty("value") @ExcludeMissing value: JsonField = JsonMissing.of(), + operation: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), ) : this(attribute, operation, value, mutableMapOf()) /** @@ -425,26 +415,26 @@ private constructor( * the cardholder KYC data if it exists. Valid values are `MATCH`, `MATCH_ADDRESS_ONLY`, * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun attribute(): Optional = attribute.getOptional("attribute") + fun attribute(): Attribute = attribute.getRequired("attribute") /** * The operation to apply to the attribute * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 operation(): Optional = operation.getOptional("operation") + fun operation(): ConditionalOperation = operation.getRequired("operation") /** * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * @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 value(): Optional = value.getOptional("value") + fun value(): ConditionalValue = value.getRequired("value") /** * Returns the raw JSON value of [attribute]. @@ -462,14 +452,14 @@ private constructor( */ @JsonProperty("operation") @ExcludeMissing - fun _operation(): JsonField = operation + fun _operation(): JsonField = operation /** * Returns the raw JSON value of [value]. * * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -485,16 +475,25 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [Condition]. */ + /** + * Returns a mutable builder for constructing an instance of [Condition]. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [Condition]. */ class Builder internal constructor() { - private var attribute: JsonField = JsonMissing.of() - private var operation: JsonField = JsonMissing.of() - private var value: JsonField = JsonMissing.of() + private var attribute: JsonField? = null + private var operation: JsonField? = null + private var value: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -571,38 +570,40 @@ private constructor( fun attribute(attribute: JsonField) = apply { this.attribute = attribute } /** The operation to apply to the attribute */ - fun operation(operation: Operation) = operation(JsonField.of(operation)) + fun operation(operation: ConditionalOperation) = operation(JsonField.of(operation)) /** * Sets [Builder.operation] to an arbitrary JSON value. * - * You should usually call [Builder.operation] with a well-typed [Operation] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.operation] with a well-typed [ConditionalOperation] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. */ - fun operation(operation: JsonField) = apply { this.operation = operation } + fun operation(operation: JsonField) = apply { + this.operation = operation + } /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun value(value: Value) = value(JsonField.of(value)) + fun value(value: ConditionalValue) = value(JsonField.of(value)) /** * Sets [Builder.value] to an arbitrary JSON value. * - * You should usually call [Builder.value] with a well-typed [Value] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.value] with a well-typed [ConditionalValue] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun value(value: JsonField) = apply { this.value = value } + fun value(value: JsonField) = apply { this.value = value } - /** Alias for calling [value] with `Value.ofRegex(regex)`. */ - fun value(regex: String) = value(Value.ofRegex(regex)) + /** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */ + fun value(regex: String) = value(ConditionalValue.ofRegex(regex)) - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun value(number: Long) = value(Value.ofNumber(number)) + /** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */ + fun value(number: Long) = value(ConditionalValue.ofNumber(number)) - /** Alias for calling [value] with `Value.ofListOfStrings(listOfStrings)`. */ + /** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */ fun valueOfListOfStrings(listOfStrings: List) = - value(Value.ofListOfStrings(listOfStrings)) + value(ConditionalValue.ofListOfStrings(listOfStrings)) fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -627,9 +628,23 @@ private constructor( * Returns an immutable instance of [Condition]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): Condition = - Condition(attribute, operation, value, additionalProperties.toMutableMap()) + Condition( + checkRequired("attribute", attribute), + checkRequired("operation", operation), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -639,9 +654,9 @@ private constructor( return@apply } - attribute().ifPresent { it.validate() } - operation().ifPresent { it.validate() } - value().ifPresent { it.validate() } + attribute().validate() + operation().validate() + value().validate() validated = true } @@ -949,407 +964,6 @@ private constructor( override fun toString() = value.toString() } - /** The operation to apply to the attribute */ - class Operation @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val IS_ONE_OF = of("IS_ONE_OF") - - @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") - - @JvmField val MATCHES = of("MATCHES") - - @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") - - @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") - - @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") - - @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") - - @JvmField val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") - - @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") - - @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") - - @JvmStatic fun of(value: String) = Operation(JsonField.of(value)) - } - - /** An enum containing [Operation]'s known values. */ - enum class Known { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - } - - /** - * An enum containing [Operation]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Operation] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - /** - * An enum member indicating that [Operation] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - IS_ONE_OF -> Value.IS_ONE_OF - IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF - MATCHES -> Value.MATCHES - DOES_NOT_MATCH -> Value.DOES_NOT_MATCH - IS_EQUAL_TO -> Value.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Value.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Value.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - IS_ONE_OF -> Known.IS_ONE_OF - IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF - MATCHES -> Known.MATCHES - DOES_NOT_MATCH -> Known.DOES_NOT_MATCH - IS_EQUAL_TO -> Known.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Known.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Known.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO - else -> throw LithicInvalidDataException("Unknown Operation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Operation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Operation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val regex: String? = null, - private val number: Long? = null, - private val listOfStrings: List? = null, - private val _json: JsonValue? = null, - ) { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun regex(): Optional = Optional.ofNullable(regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun number(): Optional = Optional.ofNullable(number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun listOfStrings(): Optional> = Optional.ofNullable(listOfStrings) - - fun isRegex(): Boolean = regex != null - - fun isNumber(): Boolean = number != null - - fun isListOfStrings(): Boolean = listOfStrings != null - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun asRegex(): String = regex.getOrThrow("regex") - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun asNumber(): Long = number.getOrThrow("number") - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun asListOfStrings(): List = listOfStrings.getOrThrow("listOfStrings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - regex != null -> visitor.visitRegex(regex) - number != null -> visitor.visitNumber(number) - listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Value = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitRegex(regex: String) {} - - override fun visitNumber(number: Long) {} - - override fun visitListOfStrings(listOfStrings: List) {} - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitRegex(regex: String) = 1 - - override fun visitNumber(number: Long) = 1 - - override fun visitListOfStrings(listOfStrings: List) = - listOfStrings.size - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - regex == other.regex && - number == other.number && - listOfStrings == other.listOfStrings - } - - override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) - - override fun toString(): String = - when { - regex != null -> "Value{regex=$regex}" - number != null -> "Value{number=$number}" - listOfStrings != null -> "Value{listOfStrings=$listOfStrings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - - companion object { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JvmStatic fun ofRegex(regex: String) = Value(regex = regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - @JvmStatic fun ofNumber(number: Long) = Value(number = number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - @JvmStatic - fun ofListOfStrings(listOfStrings: List) = - Value(listOfStrings = listOfStrings.toImmutable()) - } - - /** - * An interface that defines how to map each variant of [Value] to a value of type [T]. - */ - interface Visitor { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun visitRegex(regex: String): T - - /** - * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, - * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun visitNumber(number: Long): T - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun visitListOfStrings(listOfStrings: List): T - - /** - * Maps an unknown variant of [Value] to a value of type [T]. - * - * An instance of [Value] can contain an unknown variant if it was deserialized from - * data that doesn't match any known variant. For example, if the SDK is on an older - * version than the API, then the API may respond with new variants that the SDK is - * unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Value: $json") - } - } - - internal class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Value(regex = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Value(number = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef>())?.let { - Value(listOfStrings = it, _json = json) - }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible - // with all the possible variants (e.g. deserializing from object). - 0 -> Value(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the - // first completely valid match, or simply the first match if none are - // completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.regex != null -> generator.writeObject(value.regex) - value.number != null -> generator.writeObject(value.number) - value.listOfStrings != null -> generator.writeObject(value.listOfStrings) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Value") - } - } - } - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalOperation.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalOperation.kt new file mode 100644 index 000000000..9f9139f14 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalOperation.kt @@ -0,0 +1,183 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonCreator +import com.lithic.api.core.Enum +import com.lithic.api.core.JsonField +import com.lithic.api.errors.LithicInvalidDataException + +/** The operation to apply to the attribute */ +class ConditionalOperation @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't match + * any known member, and you want to know that value. For example, if the SDK is on an older + * version than the API, then the API may respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val IS_ONE_OF = of("IS_ONE_OF") + + @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") + + @JvmField val MATCHES = of("MATCHES") + + @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") + + @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") + + @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") + + @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") + + @JvmField val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") + + @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") + + @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") + + @JvmStatic fun of(value: String) = ConditionalOperation(JsonField.of(value)) + } + + /** An enum containing [ConditionalOperation]'s known values. */ + enum class Known { + IS_ONE_OF, + IS_NOT_ONE_OF, + MATCHES, + DOES_NOT_MATCH, + IS_EQUAL_TO, + IS_NOT_EQUAL_TO, + IS_GREATER_THAN, + IS_GREATER_THAN_OR_EQUAL_TO, + IS_LESS_THAN, + IS_LESS_THAN_OR_EQUAL_TO, + } + + /** + * An enum containing [ConditionalOperation]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [ConditionalOperation] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if the SDK + * is on an older version than the API, then the API may respond with new members that the SDK + * is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + IS_ONE_OF, + IS_NOT_ONE_OF, + MATCHES, + DOES_NOT_MATCH, + IS_EQUAL_TO, + IS_NOT_EQUAL_TO, + IS_GREATER_THAN, + IS_GREATER_THAN_OR_EQUAL_TO, + IS_LESS_THAN, + IS_LESS_THAN_OR_EQUAL_TO, + /** + * An enum member indicating that [ConditionalOperation] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] if + * the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you want to + * throw for the unknown case. + */ + fun value(): Value = + when (this) { + IS_ONE_OF -> Value.IS_ONE_OF + IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF + MATCHES -> Value.MATCHES + DOES_NOT_MATCH -> Value.DOES_NOT_MATCH + IS_EQUAL_TO -> Value.IS_EQUAL_TO + IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO + IS_GREATER_THAN -> Value.IS_GREATER_THAN + IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO + IS_LESS_THAN -> Value.IS_LESS_THAN + IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and don't want + * to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a known member. + */ + fun known(): Known = + when (this) { + IS_ONE_OF -> Known.IS_ONE_OF + IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF + MATCHES -> Known.MATCHES + DOES_NOT_MATCH -> Known.DOES_NOT_MATCH + IS_EQUAL_TO -> Known.IS_EQUAL_TO + IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO + IS_GREATER_THAN -> Known.IS_GREATER_THAN + IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO + IS_LESS_THAN -> Known.IS_LESS_THAN + IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO + else -> throw LithicInvalidDataException("Unknown ConditionalOperation: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging and + * generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the expected + * primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): ConditionalOperation = 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 ConditionalOperation && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt new file mode 100644 index 000000000..b8d764a66 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalTokenizationActionParameters.kt @@ -0,0 +1,1986 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ConditionalTokenizationActionParameters +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val action: JsonField, + private val conditions: JsonField>, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("action") @ExcludeMissing action: JsonField = JsonMissing.of(), + @JsonProperty("conditions") + @ExcludeMissing + conditions: JsonField> = JsonMissing.of(), + ) : this(action, conditions, mutableMapOf()) + + /** + * The action to take if the conditions are met + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun action(): Action = action.getRequired("action") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun conditions(): List = conditions.getRequired("conditions") + + /** + * Returns the raw JSON value of [action]. + * + * Unlike [action], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action + + /** + * Returns the raw JSON value of [conditions]. + * + * Unlike [conditions], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("conditions") + @ExcludeMissing + fun _conditions(): JsonField> = conditions + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ConditionalTokenizationActionParameters]. + * + * The following fields are required: + * ```java + * .action() + * .conditions() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ConditionalTokenizationActionParameters]. */ + class Builder internal constructor() { + + private var action: JsonField? = null + private var conditions: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from( + conditionalTokenizationActionParameters: ConditionalTokenizationActionParameters + ) = apply { + action = conditionalTokenizationActionParameters.action + conditions = + conditionalTokenizationActionParameters.conditions.map { it.toMutableList() } + additionalProperties = + conditionalTokenizationActionParameters.additionalProperties.toMutableMap() + } + + /** The action to take if the conditions are met */ + fun action(action: Action) = action(JsonField.of(action)) + + /** + * Sets [Builder.action] to an arbitrary JSON value. + * + * You should usually call [Builder.action] with a well-typed [Action] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun action(action: JsonField) = apply { this.action = action } + + /** Alias for calling [action] with `Action.ofDecline(decline)`. */ + fun action(decline: Action.DeclineAction) = action(Action.ofDecline(decline)) + + /** Alias for calling [action] with `Action.ofRequireTfa(requireTfa)`. */ + fun action(requireTfa: Action.RequireTfaAction) = action(Action.ofRequireTfa(requireTfa)) + + fun conditions(conditions: List) = conditions(JsonField.of(conditions)) + + /** + * Sets [Builder.conditions] to an arbitrary JSON value. + * + * You should usually call [Builder.conditions] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun conditions(conditions: JsonField>) = apply { + this.conditions = conditions.map { it.toMutableList() } + } + + /** + * Adds a single [Condition] to [conditions]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addCondition(condition: Condition) = apply { + conditions = + (conditions ?: JsonField.of(mutableListOf())).also { + checkKnown("conditions", it).add(condition) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ConditionalTokenizationActionParameters]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .action() + * .conditions() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ConditionalTokenizationActionParameters = + ConditionalTokenizationActionParameters( + checkRequired("action", action), + checkRequired("conditions", conditions).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ConditionalTokenizationActionParameters = apply { + if (validated) { + return@apply + } + + action().validate() + conditions().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (action.asKnown().getOrNull()?.validity() ?: 0) + + (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** The action to take if the conditions are met */ + @JsonDeserialize(using = Action.Deserializer::class) + @JsonSerialize(using = Action.Serializer::class) + class Action + private constructor( + private val decline: DeclineAction? = null, + private val requireTfa: RequireTfaAction? = null, + private val _json: JsonValue? = null, + ) { + + fun decline(): Optional = Optional.ofNullable(decline) + + fun requireTfa(): Optional = Optional.ofNullable(requireTfa) + + fun isDecline(): Boolean = decline != null + + fun isRequireTfa(): Boolean = requireTfa != null + + fun asDecline(): DeclineAction = decline.getOrThrow("decline") + + fun asRequireTfa(): RequireTfaAction = requireTfa.getOrThrow("requireTfa") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + decline != null -> visitor.visitDecline(decline) + requireTfa != null -> visitor.visitRequireTfa(requireTfa) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitDecline(decline: DeclineAction) { + decline.validate() + } + + override fun visitRequireTfa(requireTfa: RequireTfaAction) { + requireTfa.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitDecline(decline: DeclineAction) = decline.validity() + + override fun visitRequireTfa(requireTfa: RequireTfaAction) = + requireTfa.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && decline == other.decline && requireTfa == other.requireTfa + } + + override fun hashCode(): Int = Objects.hash(decline, requireTfa) + + override fun toString(): String = + when { + decline != null -> "Action{decline=$decline}" + requireTfa != null -> "Action{requireTfa=$requireTfa}" + _json != null -> "Action{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Action") + } + + companion object { + + @JvmStatic fun ofDecline(decline: DeclineAction) = Action(decline = decline) + + @JvmStatic + fun ofRequireTfa(requireTfa: RequireTfaAction) = Action(requireTfa = requireTfa) + } + + /** An interface that defines how to map each variant of [Action] to a value of type [T]. */ + interface Visitor { + + fun visitDecline(decline: DeclineAction): T + + fun visitRequireTfa(requireTfa: RequireTfaAction): T + + /** + * Maps an unknown variant of [Action] to a value of type [T]. + * + * An instance of [Action] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown Action: $json") + } + } + + internal class Deserializer : BaseDeserializer(Action::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Action { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + tryDeserialize(node, jacksonTypeRef())?.let { + Action(decline = it, _json = json) + }, + tryDeserialize(node, jacksonTypeRef())?.let { + Action(requireTfa = it, _json = json) + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with + // all the possible variants (e.g. deserializing from boolean). + 0 -> Action(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely + // valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(Action::class) { + + override fun serialize( + value: Action, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.decline != null -> generator.writeObject(value.decline) + value.requireTfa != null -> generator.writeObject(value.requireTfa) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Action") + } + } + } + + class DeclineAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Decline the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Reason code for declining the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DeclineAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DeclineAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(declineAction: DeclineAction) = apply { + type = declineAction.type + reason = declineAction.reason + additionalProperties = declineAction.additionalProperties.toMutableMap() + } + + /** Decline the tokenization request */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Reason code for declining the tokenization request */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [DeclineAction]. + * + * 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(): DeclineAction = + DeclineAction( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DeclineAction = apply { + if (validated) { + return@apply + } + + type().validate() + reason().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Decline the tokenization request */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val DECLINE = of("DECLINE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DECLINE + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + DECLINE, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + DECLINE -> Value.DECLINE + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + DECLINE -> Known.DECLINE + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason code for declining the tokenization request */ + class Reason @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val ACCOUNT_SCORE_1 = of("ACCOUNT_SCORE_1") + + @JvmField val DEVICE_SCORE_1 = of("DEVICE_SCORE_1") + + @JvmField + val ALL_WALLET_DECLINE_REASONS_PRESENT = + of("ALL_WALLET_DECLINE_REASONS_PRESENT") + + @JvmField + val WALLET_RECOMMENDED_DECISION_RED = of("WALLET_RECOMMENDED_DECISION_RED") + + @JvmField val CVC_MISMATCH = of("CVC_MISMATCH") + + @JvmField val CARD_EXPIRY_MONTH_MISMATCH = of("CARD_EXPIRY_MONTH_MISMATCH") + + @JvmField val CARD_EXPIRY_YEAR_MISMATCH = of("CARD_EXPIRY_YEAR_MISMATCH") + + @JvmField val CARD_INVALID_STATE = of("CARD_INVALID_STATE") + + @JvmField val CUSTOMER_RED_PATH = of("CUSTOMER_RED_PATH") + + @JvmField val INVALID_CUSTOMER_RESPONSE = of("INVALID_CUSTOMER_RESPONSE") + + @JvmField val NETWORK_FAILURE = of("NETWORK_FAILURE") + + @JvmField val GENERIC_DECLINE = of("GENERIC_DECLINE") + + @JvmField val DIGITAL_CARD_ART_REQUIRED = of("DIGITAL_CARD_ART_REQUIRED") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + ACCOUNT_SCORE_1, + DEVICE_SCORE_1, + ALL_WALLET_DECLINE_REASONS_PRESENT, + WALLET_RECOMMENDED_DECISION_RED, + CVC_MISMATCH, + CARD_EXPIRY_MONTH_MISMATCH, + CARD_EXPIRY_YEAR_MISMATCH, + CARD_INVALID_STATE, + CUSTOMER_RED_PATH, + INVALID_CUSTOMER_RESPONSE, + NETWORK_FAILURE, + GENERIC_DECLINE, + DIGITAL_CARD_ART_REQUIRED, + /** + * An enum member indicating that [Reason] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ACCOUNT_SCORE_1 -> Value.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Value.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Value.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> Value.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Value.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Value.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Value.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Value.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Value.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Value.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Value.NETWORK_FAILURE + GENERIC_DECLINE -> Value.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Value.DIGITAL_CARD_ART_REQUIRED + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + ACCOUNT_SCORE_1 -> Known.ACCOUNT_SCORE_1 + DEVICE_SCORE_1 -> Known.DEVICE_SCORE_1 + ALL_WALLET_DECLINE_REASONS_PRESENT -> + Known.ALL_WALLET_DECLINE_REASONS_PRESENT + WALLET_RECOMMENDED_DECISION_RED -> Known.WALLET_RECOMMENDED_DECISION_RED + CVC_MISMATCH -> Known.CVC_MISMATCH + CARD_EXPIRY_MONTH_MISMATCH -> Known.CARD_EXPIRY_MONTH_MISMATCH + CARD_EXPIRY_YEAR_MISMATCH -> Known.CARD_EXPIRY_YEAR_MISMATCH + CARD_INVALID_STATE -> Known.CARD_INVALID_STATE + CUSTOMER_RED_PATH -> Known.CUSTOMER_RED_PATH + INVALID_CUSTOMER_RESPONSE -> Known.INVALID_CUSTOMER_RESPONSE + NETWORK_FAILURE -> Known.NETWORK_FAILURE + GENERIC_DECLINE -> Known.GENERIC_DECLINE + DIGITAL_CARD_ART_REQUIRED -> Known.DIGITAL_CARD_ART_REQUIRED + else -> throw LithicInvalidDataException("Unknown Reason: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Reason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DeclineAction && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, reason, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DeclineAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + + class RequireTfaAction + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val type: JsonField, + private val reason: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + ) : this(type, reason, mutableMapOf()) + + /** + * Require two-factor authentication for the tokenization request + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Reason code for requiring two-factor authentication + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + /** + * Returns the raw JSON value of [reason]. + * + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [RequireTfaAction]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [RequireTfaAction]. */ + class Builder internal constructor() { + + private var type: JsonField? = null + private var reason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(requireTfaAction: RequireTfaAction) = apply { + type = requireTfaAction.type + reason = requireTfaAction.reason + additionalProperties = requireTfaAction.additionalProperties.toMutableMap() + } + + /** Require two-factor authentication for the tokenization request */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + /** Reason code for requiring two-factor authentication */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [Reason] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun reason(reason: JsonField) = apply { this.reason = reason } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [RequireTfaAction]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): RequireTfaAction = + RequireTfaAction( + checkRequired("type", type), + reason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): RequireTfaAction = apply { + if (validated) { + return@apply + } + + type().validate() + reason().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (type.asKnown().getOrNull()?.validity() ?: 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + /** Require two-factor authentication for the tokenization request */ + class Type @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val REQUIRE_TFA = of("REQUIRE_TFA") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + REQUIRE_TFA + } + + /** + * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Type] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + REQUIRE_TFA, + /** + * An enum member indicating that [Type] was instantiated with an unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + REQUIRE_TFA -> Value.REQUIRE_TFA + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + REQUIRE_TFA -> Known.REQUIRE_TFA + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Reason code for requiring two-factor authentication */ + class Reason @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val WALLET_RECOMMENDED_TFA = of("WALLET_RECOMMENDED_TFA") + + @JvmField val SUSPICIOUS_ACTIVITY = of("SUSPICIOUS_ACTIVITY") + + @JvmField val DEVICE_RECENTLY_LOST = of("DEVICE_RECENTLY_LOST") + + @JvmField val TOO_MANY_RECENT_ATTEMPTS = of("TOO_MANY_RECENT_ATTEMPTS") + + @JvmField val TOO_MANY_RECENT_TOKENS = of("TOO_MANY_RECENT_TOKENS") + + @JvmField + val TOO_MANY_DIFFERENT_CARDHOLDERS = of("TOO_MANY_DIFFERENT_CARDHOLDERS") + + @JvmField val OUTSIDE_HOME_TERRITORY = of("OUTSIDE_HOME_TERRITORY") + + @JvmField val HAS_SUSPENDED_TOKENS = of("HAS_SUSPENDED_TOKENS") + + @JvmField val HIGH_RISK = of("HIGH_RISK") + + @JvmField val ACCOUNT_SCORE_LOW = of("ACCOUNT_SCORE_LOW") + + @JvmField val DEVICE_SCORE_LOW = of("DEVICE_SCORE_LOW") + + @JvmField val CARD_STATE_TFA = of("CARD_STATE_TFA") + + @JvmField val HARDCODED_TFA = of("HARDCODED_TFA") + + @JvmField val CUSTOMER_RULE_TFA = of("CUSTOMER_RULE_TFA") + + @JvmField val DEVICE_HOST_CARD_EMULATION = of("DEVICE_HOST_CARD_EMULATION") + + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + } + + /** An enum containing [Reason]'s known values. */ + enum class Known { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + } + + /** + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Reason] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + WALLET_RECOMMENDED_TFA, + SUSPICIOUS_ACTIVITY, + DEVICE_RECENTLY_LOST, + TOO_MANY_RECENT_ATTEMPTS, + TOO_MANY_RECENT_TOKENS, + TOO_MANY_DIFFERENT_CARDHOLDERS, + OUTSIDE_HOME_TERRITORY, + HAS_SUSPENDED_TOKENS, + HIGH_RISK, + ACCOUNT_SCORE_LOW, + DEVICE_SCORE_LOW, + CARD_STATE_TFA, + HARDCODED_TFA, + CUSTOMER_RULE_TFA, + DEVICE_HOST_CARD_EMULATION, + /** + * An enum member indicating that [Reason] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if + * you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + WALLET_RECOMMENDED_TFA -> Value.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Value.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Value.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Value.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Value.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> Value.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Value.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Value.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Value.HIGH_RISK + ACCOUNT_SCORE_LOW -> Value.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Value.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Value.CARD_STATE_TFA + HARDCODED_TFA -> Value.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Value.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Value.DEVICE_HOST_CARD_EMULATION + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always known and + * don't want to throw for the unknown case. + * + * @throws LithicInvalidDataException if this class instance's value is a not a + * known member. + */ + fun known(): Known = + when (this) { + WALLET_RECOMMENDED_TFA -> Known.WALLET_RECOMMENDED_TFA + SUSPICIOUS_ACTIVITY -> Known.SUSPICIOUS_ACTIVITY + DEVICE_RECENTLY_LOST -> Known.DEVICE_RECENTLY_LOST + TOO_MANY_RECENT_ATTEMPTS -> Known.TOO_MANY_RECENT_ATTEMPTS + TOO_MANY_RECENT_TOKENS -> Known.TOO_MANY_RECENT_TOKENS + TOO_MANY_DIFFERENT_CARDHOLDERS -> Known.TOO_MANY_DIFFERENT_CARDHOLDERS + OUTSIDE_HOME_TERRITORY -> Known.OUTSIDE_HOME_TERRITORY + HAS_SUSPENDED_TOKENS -> Known.HAS_SUSPENDED_TOKENS + HIGH_RISK -> Known.HIGH_RISK + ACCOUNT_SCORE_LOW -> Known.ACCOUNT_SCORE_LOW + DEVICE_SCORE_LOW -> Known.DEVICE_SCORE_LOW + CARD_STATE_TFA -> Known.CARD_STATE_TFA + HARDCODED_TFA -> Known.HARDCODED_TFA + CUSTOMER_RULE_TFA -> Known.CUSTOMER_RULE_TFA + DEVICE_HOST_CARD_EMULATION -> Known.DEVICE_HOST_CARD_EMULATION + else -> throw LithicInvalidDataException("Unknown Reason: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have + * the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Reason = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Reason && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is RequireTfaAction && + type == other.type && + reason == other.reason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(type, reason, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "RequireTfaAction{type=$type, reason=$reason, additionalProperties=$additionalProperties}" + } + } + + class Condition + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val attribute: JsonField, + private val operation: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("attribute") + @ExcludeMissing + attribute: JsonField = JsonMissing.of(), + @JsonProperty("operation") + @ExcludeMissing + operation: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(attribute, operation, value, mutableMapOf()) + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `TIMESTAMP`: The timestamp of the tokenization request in ISO 8601 format. + * * `TOKENIZATION_CHANNEL`: The channel through which the tokenization request was + * initiated (e.g., DIGITAL_WALLET, ECOMMERCE). + * * `TOKENIZATION_SOURCE`: The source of the tokenization request. + * * `TOKEN_REQUESTOR_NAME`: The name of the entity requesting the token. Valid values are + * `ALT_ID`, `AMAZON_ONE`, `AMERICAN_EXPRESS_TOKEN_SERVICE`, `ANDROID_PAY`, `APPLE_PAY`, + * `FACEBOOK`, `FITBIT_PAY`, `GARMIN_PAY`, `GOOGLE_PAY`, `GOOGLE_VCN`, `ISSUER_HCE`, + * `MICROSOFT_PAY`, `NETFLIX`, `SAMSUNG_PAY`, `UNKNOWN`, `VISA_CHECKOUT`. + * * `WALLET_ACCOUNT_SCORE`: Risk score for the account in the digital wallet. Numeric value + * where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium risk). + * * `WALLET_DEVICE_SCORE`: Risk score for the device in the digital wallet. Numeric value + * where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium risk). + * * `WALLET_RECOMMENDED_DECISION`: The decision recommended by the digital wallet provider. + * Valid values include APPROVE, DECLINE, REQUIRE_ADDITIONAL_AUTHENTICATION. + * * `TOKEN_REQUESTOR_ID`: Unique identifier for the entity requesting the token. + * * `WALLET_TOKEN_STATUS`: The current status of the wallet 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 attribute(): Attribute = attribute.getRequired("attribute") + + /** + * The operation to apply to the attribute + * + * @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 operation(): ConditionalOperation = operation.getRequired("operation") + + /** + * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` + * + * @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 value(): ConditionalValue = value.getRequired("value") + + /** + * Returns the raw JSON value of [attribute]. + * + * Unlike [attribute], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("attribute") + @ExcludeMissing + fun _attribute(): JsonField = attribute + + /** + * Returns the raw JSON value of [operation]. + * + * Unlike [operation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("operation") + @ExcludeMissing + fun _operation(): JsonField = operation + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Condition]. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Condition]. */ + class Builder internal constructor() { + + private var attribute: JsonField? = null + private var operation: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(condition: Condition) = apply { + attribute = condition.attribute + operation = condition.operation + value = condition.value + additionalProperties = condition.additionalProperties.toMutableMap() + } + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `TIMESTAMP`: The timestamp of the tokenization request in ISO 8601 format. + * * `TOKENIZATION_CHANNEL`: The channel through which the tokenization request was + * initiated (e.g., DIGITAL_WALLET, ECOMMERCE). + * * `TOKENIZATION_SOURCE`: The source of the tokenization request. + * * `TOKEN_REQUESTOR_NAME`: The name of the entity requesting the token. Valid values + * are `ALT_ID`, `AMAZON_ONE`, `AMERICAN_EXPRESS_TOKEN_SERVICE`, `ANDROID_PAY`, + * `APPLE_PAY`, `FACEBOOK`, `FITBIT_PAY`, `GARMIN_PAY`, `GOOGLE_PAY`, `GOOGLE_VCN`, + * `ISSUER_HCE`, `MICROSOFT_PAY`, `NETFLIX`, `SAMSUNG_PAY`, `UNKNOWN`, + * `VISA_CHECKOUT`. + * * `WALLET_ACCOUNT_SCORE`: Risk score for the account in the digital wallet. Numeric + * value where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium + * risk). + * * `WALLET_DEVICE_SCORE`: Risk score for the device in the digital wallet. Numeric + * value where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium + * risk). + * * `WALLET_RECOMMENDED_DECISION`: The decision recommended by the digital wallet + * provider. Valid values include APPROVE, DECLINE, REQUIRE_ADDITIONAL_AUTHENTICATION. + * * `TOKEN_REQUESTOR_ID`: Unique identifier for the entity requesting the token. + * * `WALLET_TOKEN_STATUS`: The current status of the wallet token. + */ + fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) + + /** + * Sets [Builder.attribute] to an arbitrary JSON value. + * + * You should usually call [Builder.attribute] with a well-typed [Attribute] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun attribute(attribute: JsonField) = apply { this.attribute = attribute } + + /** The operation to apply to the attribute */ + fun operation(operation: ConditionalOperation) = operation(JsonField.of(operation)) + + /** + * Sets [Builder.operation] to an arbitrary JSON value. + * + * You should usually call [Builder.operation] with a well-typed [ConditionalOperation] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun operation(operation: JsonField) = apply { + this.operation = operation + } + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + fun value(value: ConditionalValue) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [ConditionalValue] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + /** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */ + fun value(regex: String) = value(ConditionalValue.ofRegex(regex)) + + /** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */ + fun value(number: Long) = value(ConditionalValue.ofNumber(number)) + + /** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */ + fun valueOfListOfStrings(listOfStrings: List) = + value(ConditionalValue.ofListOfStrings(listOfStrings)) + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Condition]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .attribute() + * .operation() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Condition = + Condition( + checkRequired("attribute", attribute), + checkRequired("operation", operation), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Condition = apply { + if (validated) { + return@apply + } + + attribute().validate() + operation().validate() + value().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (attribute.asKnown().getOrNull()?.validity() ?: 0) + + (operation.asKnown().getOrNull()?.validity() ?: 0) + + (value.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The attribute to target. + * + * The following attributes may be targeted: + * * `TIMESTAMP`: The timestamp of the tokenization request in ISO 8601 format. + * * `TOKENIZATION_CHANNEL`: The channel through which the tokenization request was + * initiated (e.g., DIGITAL_WALLET, ECOMMERCE). + * * `TOKENIZATION_SOURCE`: The source of the tokenization request. + * * `TOKEN_REQUESTOR_NAME`: The name of the entity requesting the token. Valid values are + * `ALT_ID`, `AMAZON_ONE`, `AMERICAN_EXPRESS_TOKEN_SERVICE`, `ANDROID_PAY`, `APPLE_PAY`, + * `FACEBOOK`, `FITBIT_PAY`, `GARMIN_PAY`, `GOOGLE_PAY`, `GOOGLE_VCN`, `ISSUER_HCE`, + * `MICROSOFT_PAY`, `NETFLIX`, `SAMSUNG_PAY`, `UNKNOWN`, `VISA_CHECKOUT`. + * * `WALLET_ACCOUNT_SCORE`: Risk score for the account in the digital wallet. Numeric value + * where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium risk). + * * `WALLET_DEVICE_SCORE`: Risk score for the device in the digital wallet. Numeric value + * where lower numbers indicate higher risk (e.g., 1 = high risk, 2 = medium risk). + * * `WALLET_RECOMMENDED_DECISION`: The decision recommended by the digital wallet provider. + * Valid values include APPROVE, DECLINE, REQUIRE_ADDITIONAL_AUTHENTICATION. + * * `TOKEN_REQUESTOR_ID`: Unique identifier for the entity requesting the token. + * * `WALLET_TOKEN_STATUS`: The current status of the wallet token. + */ + class Attribute @JsonCreator private constructor(private val value: JsonField) : + Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that doesn't + * match any known member, and you want to know that value. For example, if the SDK is + * on an older version than the API, then the API may respond with new members that the + * SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + + companion object { + + @JvmField val TIMESTAMP = of("TIMESTAMP") + + @JvmField val TOKENIZATION_CHANNEL = of("TOKENIZATION_CHANNEL") + + @JvmField val TOKENIZATION_SOURCE = of("TOKENIZATION_SOURCE") + + @JvmField val TOKEN_REQUESTOR_NAME = of("TOKEN_REQUESTOR_NAME") + + @JvmField val WALLET_ACCOUNT_SCORE = of("WALLET_ACCOUNT_SCORE") + + @JvmField val WALLET_DEVICE_SCORE = of("WALLET_DEVICE_SCORE") + + @JvmField val WALLET_RECOMMENDED_DECISION = of("WALLET_RECOMMENDED_DECISION") + + @JvmField val TOKEN_REQUESTOR_ID = of("TOKEN_REQUESTOR_ID") + + @JvmField val WALLET_TOKEN_STATUS = of("WALLET_TOKEN_STATUS") + + @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) + } + + /** An enum containing [Attribute]'s known values. */ + enum class Known { + TIMESTAMP, + TOKENIZATION_CHANNEL, + TOKENIZATION_SOURCE, + TOKEN_REQUESTOR_NAME, + WALLET_ACCOUNT_SCORE, + WALLET_DEVICE_SCORE, + WALLET_RECOMMENDED_DECISION, + TOKEN_REQUESTOR_ID, + WALLET_TOKEN_STATUS, + } + + /** + * An enum containing [Attribute]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Attribute] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For example, if + * the SDK is on an older version than the API, then the API may respond with new + * members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + TIMESTAMP, + TOKENIZATION_CHANNEL, + TOKENIZATION_SOURCE, + TOKEN_REQUESTOR_NAME, + WALLET_ACCOUNT_SCORE, + WALLET_DEVICE_SCORE, + WALLET_RECOMMENDED_DECISION, + TOKEN_REQUESTOR_ID, + WALLET_TOKEN_STATUS, + /** + * An enum member indicating that [Attribute] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or if you + * want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + TIMESTAMP -> Value.TIMESTAMP + TOKENIZATION_CHANNEL -> Value.TOKENIZATION_CHANNEL + TOKENIZATION_SOURCE -> Value.TOKENIZATION_SOURCE + TOKEN_REQUESTOR_NAME -> Value.TOKEN_REQUESTOR_NAME + WALLET_ACCOUNT_SCORE -> Value.WALLET_ACCOUNT_SCORE + WALLET_DEVICE_SCORE -> Value.WALLET_DEVICE_SCORE + WALLET_RECOMMENDED_DECISION -> Value.WALLET_RECOMMENDED_DECISION + TOKEN_REQUESTOR_ID -> Value.TOKEN_REQUESTOR_ID + WALLET_TOKEN_STATUS -> Value.WALLET_TOKEN_STATUS + 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) { + TIMESTAMP -> Known.TIMESTAMP + TOKENIZATION_CHANNEL -> Known.TOKENIZATION_CHANNEL + TOKENIZATION_SOURCE -> Known.TOKENIZATION_SOURCE + TOKEN_REQUESTOR_NAME -> Known.TOKEN_REQUESTOR_NAME + WALLET_ACCOUNT_SCORE -> Known.WALLET_ACCOUNT_SCORE + WALLET_DEVICE_SCORE -> Known.WALLET_DEVICE_SCORE + WALLET_RECOMMENDED_DECISION -> Known.WALLET_RECOMMENDED_DECISION + TOKEN_REQUESTOR_ID -> Known.TOKEN_REQUESTOR_ID + WALLET_TOKEN_STATUS -> Known.WALLET_TOKEN_STATUS + else -> throw LithicInvalidDataException("Unknown Attribute: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Attribute = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Attribute && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Condition && + attribute == other.attribute && + operation == other.operation && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(attribute, operation, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConditionalTokenizationActionParameters && + action == other.action && + conditions == other.conditions && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(action, conditions, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ConditionalTokenizationActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalValue.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalValue.kt new file mode 100644 index 000000000..1b8c652d6 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ConditionalValue.kt @@ -0,0 +1,251 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer +import com.lithic.api.core.JsonValue +import com.lithic.api.core.allMaxBy +import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Objects +import java.util.Optional + +/** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ +@JsonDeserialize(using = ConditionalValue.Deserializer::class) +@JsonSerialize(using = ConditionalValue.Serializer::class) +class ConditionalValue +private constructor( + private val regex: String? = null, + private val number: Long? = null, + private val listOfStrings: List? = null, + private val _json: JsonValue? = null, +) { + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + fun regex(): Optional = Optional.ofNullable(regex) + + /** + * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, + * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` + */ + fun number(): Optional = Optional.ofNullable(number) + + /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ + fun listOfStrings(): Optional> = Optional.ofNullable(listOfStrings) + + fun isRegex(): Boolean = regex != null + + fun isNumber(): Boolean = number != null + + fun isListOfStrings(): Boolean = listOfStrings != null + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + fun asRegex(): String = regex.getOrThrow("regex") + + /** + * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, + * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` + */ + fun asNumber(): Long = number.getOrThrow("number") + + /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ + fun asListOfStrings(): List = listOfStrings.getOrThrow("listOfStrings") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + regex != null -> visitor.visitRegex(regex) + number != null -> visitor.visitNumber(number) + listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): ConditionalValue = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitRegex(regex: String) {} + + override fun visitNumber(number: Long) {} + + override fun visitListOfStrings(listOfStrings: List) {} + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitRegex(regex: String) = 1 + + override fun visitNumber(number: Long) = 1 + + override fun visitListOfStrings(listOfStrings: List) = listOfStrings.size + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConditionalValue && + regex == other.regex && + number == other.number && + listOfStrings == other.listOfStrings + } + + override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) + + override fun toString(): String = + when { + regex != null -> "ConditionalValue{regex=$regex}" + number != null -> "ConditionalValue{number=$number}" + listOfStrings != null -> "ConditionalValue{listOfStrings=$listOfStrings}" + _json != null -> "ConditionalValue{_unknown=$_json}" + else -> throw IllegalStateException("Invalid ConditionalValue") + } + + companion object { + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + @JvmStatic fun ofRegex(regex: String) = ConditionalValue(regex = regex) + + /** + * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, + * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` + */ + @JvmStatic fun ofNumber(number: Long) = ConditionalValue(number = number) + + /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ + @JvmStatic + fun ofListOfStrings(listOfStrings: List) = + ConditionalValue(listOfStrings = listOfStrings.toImmutable()) + } + + /** + * An interface that defines how to map each variant of [ConditionalValue] to a value of type + * [T]. + */ + interface Visitor { + + /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ + fun visitRegex(regex: String): T + + /** + * A number, to be used with `IS_GREATER_THAN`, `IS_GREATER_THAN_OR_EQUAL_TO`, + * `IS_LESS_THAN`, `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` + */ + fun visitNumber(number: Long): T + + /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ + fun visitListOfStrings(listOfStrings: List): T + + /** + * Maps an unknown variant of [ConditionalValue] to a value of type [T]. + * + * An instance of [ConditionalValue] can contain an unknown variant if it was deserialized + * from data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is unaware + * of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown ConditionalValue: $json") + } + } + + internal class Deserializer : BaseDeserializer(ConditionalValue::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): ConditionalValue { + val json = JsonValue.fromJsonNode(node) + + val bestMatches = + sequenceOf( + if (node.isTextual) { + tryDeserialize(node, jacksonTypeRef())?.let { + ConditionalValue(regex = it, _json = json) + } + } else { + null + }, + if (node.isNumber) { + tryDeserialize(node, jacksonTypeRef())?.let { + ConditionalValue(number = it, _json = json) + } + } else { + null + }, + if (node.isArray) { + tryDeserialize(node, jacksonTypeRef>())?.let { + ConditionalValue(listOfStrings = it, _json = json) + } + } else { + null + }, + ) + .filterNotNull() + .allMaxBy { it.validity() } + .toList() + return when (bestMatches.size) { + // This can happen if what we're deserializing is completely incompatible with all + // the possible variants (e.g. deserializing from object). + 0 -> ConditionalValue(_json = json) + 1 -> bestMatches.single() + // If there's more than one match with the highest validity, then use the first + // completely valid match, or simply the first match if none are completely valid. + else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() + } + } + } + + internal class Serializer : BaseSerializer(ConditionalValue::class) { + + override fun serialize( + value: ConditionalValue, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.regex != null -> generator.writeObject(value.regex) + value.number != null -> generator.writeObject(value.number) + value.listOfStrings != null -> generator.writeObject(value.listOfStrings) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid ConditionalValue") + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Dispute.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Dispute.kt index e331a51d3..d98b38266 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Dispute.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Dispute.kt @@ -6,24 +6,13 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.core.ObjectCodec -import com.fasterxml.jackson.databind.JsonNode -import com.fasterxml.jackson.databind.SerializerProvider -import com.fasterxml.jackson.databind.annotation.JsonDeserialize -import com.fasterxml.jackson.databind.annotation.JsonSerialize -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.lithic.api.core.BaseDeserializer -import com.lithic.api.core.BaseSerializer import com.lithic.api.core.Enum import com.lithic.api.core.ExcludeMissing import com.lithic.api.core.JsonField import com.lithic.api.core.JsonMissing import com.lithic.api.core.JsonValue -import com.lithic.api.core.allMaxBy import com.lithic.api.core.checkKnown import com.lithic.api.core.checkRequired -import com.lithic.api.core.getOrThrow import com.lithic.api.core.toImmutable import com.lithic.api.errors.LithicInvalidDataException import java.time.OffsetDateTime @@ -32,75 +21,103 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** The Dispute object tracks the progression of a dispute throughout its lifecycle. */ +/** Dispute. */ class Dispute @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val accountToken: JsonField, - private val cardToken: JsonField, - private val caseId: JsonField, + private val amount: JsonField, + private val arbitrationDate: JsonField, private val created: JsonField, - private val currency: JsonField, - private val disposition: JsonField, - private val events: JsonField>, - private val liabilityAllocation: JsonField, - private val merchant: JsonField, - private val network: JsonField, + private val customerFiledDate: JsonField, + private val customerNote: JsonField, + private val networkClaimIds: JsonField>, + private val networkFiledDate: JsonField, + private val networkReasonCode: JsonField, + private val prearbitrationDate: JsonField, + private val primaryClaimId: JsonField, + private val reason: JsonField, + private val representmentDate: JsonField, + private val resolutionDate: JsonField, + private val resolutionNote: JsonField, + private val resolutionReason: JsonField, private val status: JsonField, - private val transactionSeries: JsonField, - private val updated: JsonField, + private val transactionToken: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("account_token") + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("arbitration_date") @ExcludeMissing - accountToken: JsonField = JsonMissing.of(), - @JsonProperty("card_token") @ExcludeMissing cardToken: JsonField = JsonMissing.of(), - @JsonProperty("case_id") @ExcludeMissing caseId: JsonField = JsonMissing.of(), + arbitrationDate: JsonField = JsonMissing.of(), @JsonProperty("created") @ExcludeMissing created: JsonField = JsonMissing.of(), - @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), - @JsonProperty("disposition") + @JsonProperty("customer_filed_date") @ExcludeMissing - disposition: JsonField = JsonMissing.of(), - @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), - @JsonProperty("liability_allocation") + customerFiledDate: JsonField = JsonMissing.of(), + @JsonProperty("customer_note") @ExcludeMissing - liabilityAllocation: JsonField = JsonMissing.of(), - @JsonProperty("merchant") @ExcludeMissing merchant: JsonField = JsonMissing.of(), - @JsonProperty("network") @ExcludeMissing network: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_series") + customerNote: JsonField = JsonMissing.of(), + @JsonProperty("network_claim_ids") + @ExcludeMissing + networkClaimIds: JsonField> = JsonMissing.of(), + @JsonProperty("network_filed_date") + @ExcludeMissing + networkFiledDate: JsonField = JsonMissing.of(), + @JsonProperty("network_reason_code") + @ExcludeMissing + networkReasonCode: JsonField = JsonMissing.of(), + @JsonProperty("prearbitration_date") + @ExcludeMissing + prearbitrationDate: JsonField = JsonMissing.of(), + @JsonProperty("primary_claim_id") + @ExcludeMissing + primaryClaimId: JsonField = JsonMissing.of(), + @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("representment_date") + @ExcludeMissing + representmentDate: JsonField = JsonMissing.of(), + @JsonProperty("resolution_date") + @ExcludeMissing + resolutionDate: JsonField = JsonMissing.of(), + @JsonProperty("resolution_note") @ExcludeMissing - transactionSeries: JsonField = JsonMissing.of(), - @JsonProperty("updated") + resolutionNote: JsonField = JsonMissing.of(), + @JsonProperty("resolution_reason") @ExcludeMissing - updated: JsonField = JsonMissing.of(), + resolutionReason: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("transaction_token") + @ExcludeMissing + transactionToken: JsonField = JsonMissing.of(), ) : this( token, - accountToken, - cardToken, - caseId, + amount, + arbitrationDate, created, - currency, - disposition, - events, - liabilityAllocation, - merchant, - network, + customerFiledDate, + customerNote, + networkClaimIds, + networkFiledDate, + networkReasonCode, + prearbitrationDate, + primaryClaimId, + reason, + representmentDate, + resolutionDate, + resolutionNote, + resolutionReason, status, - transactionSeries, - updated, + transactionToken, mutableMapOf(), ) /** - * Token assigned by Lithic for the dispute, in UUID format. + * Globally unique identifier. * * @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). @@ -108,109 +125,187 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Token for the account associated with the dispute, in UUID format. + * Amount under dispute. May be different from the original transaction amount. * * @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 accountToken(): String = accountToken.getRequired("account_token") + fun amount(): Long = amount.getRequired("amount") + + /** + * Date dispute entered arbitration. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun arbitrationDate(): Optional = + arbitrationDate.getOptional("arbitration_date") /** - * Token for the card used in the dispute, in UUID format. + * Timestamp of when first Dispute was reported. * * @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 cardToken(): String = cardToken.getRequired("card_token") + fun created(): OffsetDateTime = created.getRequired("created") /** - * Identifier assigned by the network for this dispute. + * Date that the dispute was filed by the customer making the dispute. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun caseId(): Optional = caseId.getOptional("case_id") + fun customerFiledDate(): Optional = + customerFiledDate.getOptional("customer_filed_date") /** - * When the dispute was created. + * End customer description of the reason for the dispute. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun created(): OffsetDateTime = created.getRequired("created") + fun customerNote(): Optional = customerNote.getOptional("customer_note") /** - * Three-letter ISO 4217 currency code. + * Unique identifiers for the dispute from the network. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun currency(): String = currency.getRequired("currency") + fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") /** - * Dispute resolution outcome + * Date that the dispute was submitted to the network. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun disposition(): Optional = disposition.getOptional("disposition") + fun networkFiledDate(): Optional = + networkFiledDate.getOptional("network_filed_date") /** - * Chronological list of events that have occurred in the dispute lifecycle + * Network reason code used to file the dispute. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun events(): List = events.getRequired("events") + fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") /** - * Current breakdown of how liability is allocated for the disputed amount + * Date dispute entered pre-arbitration. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun liabilityAllocation(): LiabilityAllocation = - liabilityAllocation.getRequired("liability_allocation") + fun prearbitrationDate(): Optional = + prearbitrationDate.getOptional("prearbitration_date") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Unique identifier for the dispute from the network. If there are multiple, this will be the + * first claim id set by the network + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun merchant(): Merchant = merchant.getRequired("merchant") + fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") /** - * Card network handling the dispute. + * Dispute reason: + * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + * * `CANCELLED`: Transaction was cancelled by the customer. + * * `DUPLICATED`: The transaction was a duplicate. + * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. + * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. + * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. + * * `MISSING_AUTH`: The transaction was missing authorization. + * * `OTHER`: Other reason. + * * `PROCESSING_ERROR`: Processing error. + * * `REFUND_NOT_PROCESSED`: The refund was not processed. + * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. * * @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 network(): Network = network.getRequired("network") + fun reason(): Reason = reason.getRequired("reason") + + /** + * Date the representment was received. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun representmentDate(): Optional = + representmentDate.getOptional("representment_date") + + /** + * Date that the dispute was resolved. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") /** - * Current status of the dispute. + * Note by Dispute team on the case resolution. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun status(): Optional = status.getOptional("status") + fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") /** - * Contains identifiers for the transaction and specific event within being disputed; null if no - * transaction can be identified + * Reason for the dispute resolution: + * * `CASE_LOST`: This case was lost at final arbitration. + * * `NETWORK_REJECTED`: Network rejected. + * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + * * `PAST_FILING_DATE`: Past filing date. + * * `PREARBITRATION_REJECTED`: Prearbitration rejected. + * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + * * `REFUNDED`: Refunded. + * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + * * `WITHDRAWN`: Withdrawn. + * * `WON_ARBITRATION`: Won arbitration. + * * `WON_FIRST_CHARGEBACK`: Won first chargeback. + * * `WON_PREARBITRATION`: Won prearbitration. * * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). */ - fun transactionSeries(): Optional = - transactionSeries.getOptional("transaction_series") + fun resolutionReason(): Optional = + resolutionReason.getOptional("resolution_reason") + + /** + * Status types: + * * `NEW` - New dispute case is opened. + * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. + * * `SUBMITTED` - Dispute is submitted to the card network. + * * `REPRESENTMENT` - Case has entered second presentment. + * * `PREARBITRATION` - Case has entered prearbitration. + * * `ARBITRATION` - Case has entered arbitration. + * * `CASE_WON` - Case was won and credit will be issued. + * * `CASE_CLOSED` - Case was lost or withdrawn. + * + * @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 dispute was last updated. + * The transaction that is being disputed. A transaction can only be disputed once but may have + * multiple dispute cases. * * @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") + fun transactionToken(): String = transactionToken.getRequired("transaction_token") /** * Returns the raw JSON value of [token]. @@ -220,105 +315,156 @@ private constructor( @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token /** - * Returns the raw JSON value of [accountToken]. + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [arbitrationDate]. * - * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("account_token") + @JsonProperty("arbitration_date") @ExcludeMissing - fun _accountToken(): JsonField = accountToken + fun _arbitrationDate(): JsonField = arbitrationDate /** - * Returns the raw JSON value of [cardToken]. + * Returns the raw JSON value of [created]. * - * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * Returns the raw JSON value of [caseId]. + * Returns the raw JSON value of [customerFiledDate]. * - * Unlike [caseId], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("case_id") @ExcludeMissing fun _caseId(): JsonField = caseId + @JsonProperty("customer_filed_date") + @ExcludeMissing + fun _customerFiledDate(): JsonField = customerFiledDate /** - * Returns the raw JSON value of [created]. + * Returns the raw JSON value of [customerNote]. * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + @JsonProperty("customer_note") + @ExcludeMissing + fun _customerNote(): JsonField = customerNote /** - * Returns the raw JSON value of [currency]. + * Returns the raw JSON value of [networkClaimIds]. * - * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + @JsonProperty("network_claim_ids") + @ExcludeMissing + fun _networkClaimIds(): JsonField> = networkClaimIds /** - * Returns the raw JSON value of [disposition]. + * Returns the raw JSON value of [networkFiledDate]. * - * Unlike [disposition], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("disposition") + @JsonProperty("network_filed_date") @ExcludeMissing - fun _disposition(): JsonField = disposition + fun _networkFiledDate(): JsonField = networkFiledDate /** - * Returns the raw JSON value of [events]. + * Returns the raw JSON value of [networkReasonCode]. * - * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events + @JsonProperty("network_reason_code") + @ExcludeMissing + fun _networkReasonCode(): JsonField = networkReasonCode /** - * Returns the raw JSON value of [liabilityAllocation]. + * Returns the raw JSON value of [prearbitrationDate]. * - * Unlike [liabilityAllocation], this method doesn't throw if the JSON field has an unexpected + * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("liability_allocation") + @JsonProperty("prearbitration_date") @ExcludeMissing - fun _liabilityAllocation(): JsonField = liabilityAllocation + fun _prearbitrationDate(): JsonField = prearbitrationDate /** - * Returns the raw JSON value of [merchant]. + * Returns the raw JSON value of [primaryClaimId]. * - * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + @JsonProperty("primary_claim_id") + @ExcludeMissing + fun _primaryClaimId(): JsonField = primaryClaimId /** - * Returns the raw JSON value of [network]. + * Returns the raw JSON value of [reason]. * - * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [reason], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network + @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason /** - * Returns the raw JSON value of [status]. + * Returns the raw JSON value of [representmentDate]. * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status + @JsonProperty("representment_date") + @ExcludeMissing + fun _representmentDate(): JsonField = representmentDate /** - * Returns the raw JSON value of [transactionSeries]. + * Returns the raw JSON value of [resolutionDate]. * - * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("resolution_date") + @ExcludeMissing + fun _resolutionDate(): JsonField = resolutionDate + + /** + * Returns the raw JSON value of [resolutionNote]. + * + * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("resolution_note") + @ExcludeMissing + fun _resolutionNote(): JsonField = resolutionNote + + /** + * Returns the raw JSON value of [resolutionReason]. + * + * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("transaction_series") + @JsonProperty("resolution_reason") @ExcludeMissing - fun _transactionSeries(): JsonField = transactionSeries + fun _resolutionReason(): JsonField = resolutionReason + + /** + * 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]. + * Returns the raw JSON value of [transactionToken]. * - * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated + @JsonProperty("transaction_token") + @ExcludeMissing + fun _transactionToken(): JsonField = transactionToken @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -340,19 +486,23 @@ private constructor( * The following fields are required: * ```java * .token() - * .accountToken() - * .cardToken() - * .caseId() + * .amount() + * .arbitrationDate() * .created() - * .currency() - * .disposition() - * .events() - * .liabilityAllocation() - * .merchant() - * .network() + * .customerFiledDate() + * .customerNote() + * .networkClaimIds() + * .networkFiledDate() + * .networkReasonCode() + * .prearbitrationDate() + * .primaryClaimId() + * .reason() + * .representmentDate() + * .resolutionDate() + * .resolutionNote() + * .resolutionReason() * .status() - * .transactionSeries() - * .updated() + * .transactionToken() * ``` */ @JvmStatic fun builder() = Builder() @@ -362,41 +512,49 @@ private constructor( class Builder internal constructor() { private var token: JsonField? = null - private var accountToken: JsonField? = null - private var cardToken: JsonField? = null - private var caseId: JsonField? = null + private var amount: JsonField? = null + private var arbitrationDate: JsonField? = null private var created: JsonField? = null - private var currency: JsonField? = null - private var disposition: JsonField? = null - private var events: JsonField>? = null - private var liabilityAllocation: JsonField? = null - private var merchant: JsonField? = null - private var network: JsonField? = null + private var customerFiledDate: JsonField? = null + private var customerNote: JsonField? = null + private var networkClaimIds: JsonField>? = null + private var networkFiledDate: JsonField? = null + private var networkReasonCode: JsonField? = null + private var prearbitrationDate: JsonField? = null + private var primaryClaimId: JsonField? = null + private var reason: JsonField? = null + private var representmentDate: JsonField? = null + private var resolutionDate: JsonField? = null + private var resolutionNote: JsonField? = null + private var resolutionReason: JsonField? = null private var status: JsonField? = null - private var transactionSeries: JsonField? = null - private var updated: JsonField? = null + private var transactionToken: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(dispute: Dispute) = apply { token = dispute.token - accountToken = dispute.accountToken - cardToken = dispute.cardToken - caseId = dispute.caseId + amount = dispute.amount + arbitrationDate = dispute.arbitrationDate created = dispute.created - currency = dispute.currency - disposition = dispute.disposition - events = dispute.events.map { it.toMutableList() } - liabilityAllocation = dispute.liabilityAllocation - merchant = dispute.merchant - network = dispute.network + customerFiledDate = dispute.customerFiledDate + customerNote = dispute.customerNote + networkClaimIds = dispute.networkClaimIds.map { it.toMutableList() } + networkFiledDate = dispute.networkFiledDate + networkReasonCode = dispute.networkReasonCode + prearbitrationDate = dispute.prearbitrationDate + primaryClaimId = dispute.primaryClaimId + reason = dispute.reason + representmentDate = dispute.representmentDate + resolutionDate = dispute.resolutionDate + resolutionNote = dispute.resolutionNote + resolutionReason = dispute.resolutionReason status = dispute.status - transactionSeries = dispute.transactionSeries - updated = dispute.updated + transactionToken = dispute.transactionToken additionalProperties = dispute.additionalProperties.toMutableMap() } - /** Token assigned by Lithic for the dispute, in UUID format. */ + /** Globally unique identifier. */ fun token(token: String) = token(JsonField.of(token)) /** @@ -407,47 +565,37 @@ private constructor( */ fun token(token: JsonField) = apply { this.token = token } - /** Token for the account associated with the dispute, in UUID format. */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) - - /** - * 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 - } - - /** Token for the card used in the dispute, in UUID format. */ - fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) + /** Amount under dispute. May be different from the original transaction amount. */ + fun amount(amount: Long) = amount(JsonField.of(amount)) /** - * Sets [Builder.cardToken] to an arbitrary JSON value. + * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.cardToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. */ - fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } + fun amount(amount: JsonField) = apply { this.amount = amount } - /** Identifier assigned by the network for this dispute. */ - fun caseId(caseId: String?) = caseId(JsonField.ofNullable(caseId)) + /** Date dispute entered arbitration. */ + fun arbitrationDate(arbitrationDate: OffsetDateTime?) = + arbitrationDate(JsonField.ofNullable(arbitrationDate)) - /** Alias for calling [Builder.caseId] with `caseId.orElse(null)`. */ - fun caseId(caseId: Optional) = caseId(caseId.getOrNull()) + /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ + fun arbitrationDate(arbitrationDate: Optional) = + arbitrationDate(arbitrationDate.getOrNull()) /** - * Sets [Builder.caseId] to an arbitrary JSON value. + * Sets [Builder.arbitrationDate] to an arbitrary JSON value. * - * You should usually call [Builder.caseId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun caseId(caseId: JsonField) = apply { this.caseId = caseId } + fun arbitrationDate(arbitrationDate: JsonField) = apply { + this.arbitrationDate = arbitrationDate + } - /** When the dispute was created. */ + /** Timestamp of when first Dispute was reported. */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -459,144 +607,315 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - /** Three-letter ISO 4217 currency code. */ - fun currency(currency: String) = currency(JsonField.of(currency)) + /** Date that the dispute was filed by the customer making the dispute. */ + fun customerFiledDate(customerFiledDate: OffsetDateTime?) = + customerFiledDate(JsonField.ofNullable(customerFiledDate)) + + /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ + fun customerFiledDate(customerFiledDate: Optional) = + customerFiledDate(customerFiledDate.getOrNull()) /** - * Sets [Builder.currency] to an arbitrary JSON value. + * Sets [Builder.customerFiledDate] to an arbitrary JSON value. * - * You should usually call [Builder.currency] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun currency(currency: JsonField) = apply { this.currency = currency } + fun customerFiledDate(customerFiledDate: JsonField) = apply { + this.customerFiledDate = customerFiledDate + } - /** Dispute resolution outcome */ - fun disposition(disposition: Disposition?) = disposition(JsonField.ofNullable(disposition)) + /** End customer description of the reason for the dispute. */ + fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - /** Alias for calling [Builder.disposition] with `disposition.orElse(null)`. */ - fun disposition(disposition: Optional) = disposition(disposition.getOrNull()) + /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ + fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) /** - * Sets [Builder.disposition] to an arbitrary JSON value. + * Sets [Builder.customerNote] to an arbitrary JSON value. * - * You should usually call [Builder.disposition] with a well-typed [Disposition] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. + * You should usually call [Builder.customerNote] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun disposition(disposition: JsonField) = apply { - this.disposition = disposition + fun customerNote(customerNote: JsonField) = apply { + this.customerNote = customerNote } - /** Chronological list of events that have occurred in the dispute lifecycle */ - fun events(events: List) = events(JsonField.of(events)) + /** Unique identifiers for the dispute from the network. */ + fun networkClaimIds(networkClaimIds: List?) = + networkClaimIds(JsonField.ofNullable(networkClaimIds)) + + /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ + fun networkClaimIds(networkClaimIds: Optional>) = + networkClaimIds(networkClaimIds.getOrNull()) /** - * Sets [Builder.events] to an arbitrary JSON value. + * Sets [Builder.networkClaimIds] to an arbitrary JSON value. * - * You should usually call [Builder.events] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.networkClaimIds] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun events(events: JsonField>) = apply { - this.events = events.map { it.toMutableList() } + fun networkClaimIds(networkClaimIds: JsonField>) = apply { + this.networkClaimIds = networkClaimIds.map { it.toMutableList() } } /** - * Adds a single [Event] to [events]. + * Adds a single [String] to [networkClaimIds]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addEvent(event: Event) = apply { - events = - (events ?: JsonField.of(mutableListOf())).also { - checkKnown("events", it).add(event) + fun addNetworkClaimId(networkClaimId: String) = apply { + networkClaimIds = + (networkClaimIds ?: JsonField.of(mutableListOf())).also { + checkKnown("networkClaimIds", it).add(networkClaimId) } } - /** Current breakdown of how liability is allocated for the disputed amount */ - fun liabilityAllocation(liabilityAllocation: LiabilityAllocation) = - liabilityAllocation(JsonField.of(liabilityAllocation)) + /** Date that the dispute was submitted to the network. */ + fun networkFiledDate(networkFiledDate: OffsetDateTime?) = + networkFiledDate(JsonField.ofNullable(networkFiledDate)) + + /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ + fun networkFiledDate(networkFiledDate: Optional) = + networkFiledDate(networkFiledDate.getOrNull()) /** - * Sets [Builder.liabilityAllocation] to an arbitrary JSON value. + * Sets [Builder.networkFiledDate] to an arbitrary JSON value. * - * You should usually call [Builder.liabilityAllocation] with a well-typed - * [LiabilityAllocation] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. + * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun liabilityAllocation(liabilityAllocation: JsonField) = apply { - this.liabilityAllocation = liabilityAllocation + fun networkFiledDate(networkFiledDate: JsonField) = apply { + this.networkFiledDate = networkFiledDate } - fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + /** Network reason code used to file the dispute. */ + fun networkReasonCode(networkReasonCode: String?) = + networkReasonCode(JsonField.ofNullable(networkReasonCode)) + + /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ + fun networkReasonCode(networkReasonCode: Optional) = + networkReasonCode(networkReasonCode.getOrNull()) /** - * Sets [Builder.merchant] to an arbitrary JSON value. + * Sets [Builder.networkReasonCode] to an arbitrary JSON value. * - * You should usually call [Builder.merchant] with a well-typed [Merchant] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. + * You should usually call [Builder.networkReasonCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + fun networkReasonCode(networkReasonCode: JsonField) = apply { + this.networkReasonCode = networkReasonCode + } + + /** Date dispute entered pre-arbitration. */ + fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = + prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - /** Card network handling the dispute. */ - fun network(network: Network) = network(JsonField.of(network)) + /** + * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. + */ + fun prearbitrationDate(prearbitrationDate: Optional) = + prearbitrationDate(prearbitrationDate.getOrNull()) /** - * Sets [Builder.network] to an arbitrary JSON value. + * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. * - * You should usually call [Builder.network] with a well-typed [Network] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. + * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun prearbitrationDate(prearbitrationDate: JsonField) = apply { + this.prearbitrationDate = prearbitrationDate + } + + /** + * Unique identifier for the dispute from the network. If there are multiple, this will be + * the first claim id set by the network */ - fun network(network: JsonField) = apply { this.network = network } + fun primaryClaimId(primaryClaimId: String?) = + primaryClaimId(JsonField.ofNullable(primaryClaimId)) + + /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ + fun primaryClaimId(primaryClaimId: Optional) = + primaryClaimId(primaryClaimId.getOrNull()) - /** Current status of the dispute. */ - fun status(status: Status?) = status(JsonField.ofNullable(status)) + /** + * Sets [Builder.primaryClaimId] to an arbitrary JSON value. + * + * You should usually call [Builder.primaryClaimId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun primaryClaimId(primaryClaimId: JsonField) = apply { + this.primaryClaimId = primaryClaimId + } - /** Alias for calling [Builder.status] with `status.orElse(null)`. */ - fun status(status: Optional) = status(status.getOrNull()) + /** + * Dispute reason: + * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + * * `CANCELLED`: Transaction was cancelled by the customer. + * * `DUPLICATED`: The transaction was a duplicate. + * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant + * activity. + * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. + * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. + * * `MISSING_AUTH`: The transaction was missing authorization. + * * `OTHER`: Other reason. + * * `PROCESSING_ERROR`: Processing error. + * * `REFUND_NOT_PROCESSED`: The refund was not processed. + * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. + */ + fun reason(reason: Reason) = reason(JsonField.of(reason)) /** - * Sets [Builder.status] to an arbitrary JSON value. + * Sets [Builder.reason] to an arbitrary JSON value. * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This + * 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 status(status: JsonField) = apply { this.status = status } + fun reason(reason: JsonField) = apply { this.reason = reason } + + /** Date the representment was received. */ + fun representmentDate(representmentDate: OffsetDateTime?) = + representmentDate(JsonField.ofNullable(representmentDate)) + + /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ + fun representmentDate(representmentDate: Optional) = + representmentDate(representmentDate.getOrNull()) + + /** + * Sets [Builder.representmentDate] to an arbitrary JSON value. + * + * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun representmentDate(representmentDate: JsonField) = apply { + this.representmentDate = representmentDate + } + + /** Date that the dispute was resolved. */ + fun resolutionDate(resolutionDate: OffsetDateTime?) = + resolutionDate(JsonField.ofNullable(resolutionDate)) + + /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ + fun resolutionDate(resolutionDate: Optional) = + resolutionDate(resolutionDate.getOrNull()) /** - * Contains identifiers for the transaction and specific event within being disputed; null - * if no transaction can be identified + * Sets [Builder.resolutionDate] to an arbitrary JSON value. + * + * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. */ - fun transactionSeries(transactionSeries: TransactionSeries?) = - transactionSeries(JsonField.ofNullable(transactionSeries)) + fun resolutionDate(resolutionDate: JsonField) = apply { + this.resolutionDate = resolutionDate + } - /** Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`. */ - fun transactionSeries(transactionSeries: Optional) = - transactionSeries(transactionSeries.getOrNull()) + /** Note by Dispute team on the case resolution. */ + fun resolutionNote(resolutionNote: String?) = + resolutionNote(JsonField.ofNullable(resolutionNote)) + + /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ + fun resolutionNote(resolutionNote: Optional) = + resolutionNote(resolutionNote.getOrNull()) /** - * Sets [Builder.transactionSeries] to an arbitrary JSON value. + * Sets [Builder.resolutionNote] to an arbitrary JSON value. * - * You should usually call [Builder.transactionSeries] with a well-typed [TransactionSeries] + * You should usually call [Builder.resolutionNote] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun resolutionNote(resolutionNote: JsonField) = apply { + this.resolutionNote = resolutionNote + } + + /** + * Reason for the dispute resolution: + * * `CASE_LOST`: This case was lost at final arbitration. + * * `NETWORK_REJECTED`: Network rejected. + * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + * * `PAST_FILING_DATE`: Past filing date. + * * `PREARBITRATION_REJECTED`: Prearbitration rejected. + * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + * * `REFUNDED`: Refunded. + * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + * * `WITHDRAWN`: Withdrawn. + * * `WON_ARBITRATION`: Won arbitration. + * * `WON_FIRST_CHARGEBACK`: Won first chargeback. + * * `WON_PREARBITRATION`: Won prearbitration. + */ + fun resolutionReason(resolutionReason: ResolutionReason?) = + resolutionReason(JsonField.ofNullable(resolutionReason)) + + /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ + fun resolutionReason(resolutionReason: Optional) = + resolutionReason(resolutionReason.getOrNull()) + + /** + * Sets [Builder.resolutionReason] to an arbitrary JSON value. + * + * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] * value instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun transactionSeries(transactionSeries: JsonField) = apply { - this.transactionSeries = transactionSeries + fun resolutionReason(resolutionReason: JsonField) = apply { + this.resolutionReason = resolutionReason } - /** When the dispute was last updated. */ - fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) + /** + * Status types: + * * `NEW` - New dispute case is opened. + * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. + * * `SUBMITTED` - Dispute is submitted to the card network. + * * `REPRESENTMENT` - Case has entered second presentment. + * * `PREARBITRATION` - Case has entered prearbitration. + * * `ARBITRATION` - Case has entered arbitration. + * * `CASE_WON` - Case was won and credit will be issued. + * * `CASE_CLOSED` - Case was lost or withdrawn. + */ + 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 } + + /** + * The transaction that is being disputed. A transaction can only be disputed once but may + * have multiple dispute cases. + */ + fun transactionToken(transactionToken: String) = + transactionToken(JsonField.of(transactionToken)) /** - * Sets [Builder.updated] to an arbitrary JSON value. + * Sets [Builder.transactionToken] to an arbitrary JSON value. * - * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] 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 updated(updated: JsonField) = apply { this.updated = updated } + fun transactionToken(transactionToken: JsonField) = apply { + this.transactionToken = transactionToken + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -625,19 +944,23 @@ private constructor( * The following fields are required: * ```java * .token() - * .accountToken() - * .cardToken() - * .caseId() + * .amount() + * .arbitrationDate() * .created() - * .currency() - * .disposition() - * .events() - * .liabilityAllocation() - * .merchant() - * .network() + * .customerFiledDate() + * .customerNote() + * .networkClaimIds() + * .networkFiledDate() + * .networkReasonCode() + * .prearbitrationDate() + * .primaryClaimId() + * .reason() + * .representmentDate() + * .resolutionDate() + * .resolutionNote() + * .resolutionReason() * .status() - * .transactionSeries() - * .updated() + * .transactionToken() * ``` * * @throws IllegalStateException if any required field is unset. @@ -645,19 +968,23 @@ private constructor( fun build(): Dispute = Dispute( checkRequired("token", token), - checkRequired("accountToken", accountToken), - checkRequired("cardToken", cardToken), - checkRequired("caseId", caseId), + checkRequired("amount", amount), + checkRequired("arbitrationDate", arbitrationDate), checkRequired("created", created), - checkRequired("currency", currency), - checkRequired("disposition", disposition), - checkRequired("events", events).map { it.toImmutable() }, - checkRequired("liabilityAllocation", liabilityAllocation), - checkRequired("merchant", merchant), - checkRequired("network", network), + checkRequired("customerFiledDate", customerFiledDate), + checkRequired("customerNote", customerNote), + checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, + checkRequired("networkFiledDate", networkFiledDate), + checkRequired("networkReasonCode", networkReasonCode), + checkRequired("prearbitrationDate", prearbitrationDate), + checkRequired("primaryClaimId", primaryClaimId), + checkRequired("reason", reason), + checkRequired("representmentDate", representmentDate), + checkRequired("resolutionDate", resolutionDate), + checkRequired("resolutionNote", resolutionNote), + checkRequired("resolutionReason", resolutionReason), checkRequired("status", status), - checkRequired("transactionSeries", transactionSeries), - checkRequired("updated", updated), + checkRequired("transactionToken", transactionToken), additionalProperties.toMutableMap(), ) } @@ -670,19 +997,23 @@ private constructor( } token() - accountToken() - cardToken() - caseId() + amount() + arbitrationDate() created() - currency() - disposition().ifPresent { it.validate() } - events().forEach { it.validate() } - liabilityAllocation().validate() - merchant().validate() - network().validate() - status().ifPresent { it.validate() } - transactionSeries().ifPresent { it.validate() } - updated() + customerFiledDate() + customerNote() + networkClaimIds() + networkFiledDate() + networkReasonCode() + prearbitrationDate() + primaryClaimId() + reason().validate() + representmentDate() + resolutionDate() + resolutionNote() + resolutionReason().ifPresent { it.validate() } + status().validate() + transactionToken() validated = true } @@ -702,23 +1033,42 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (token.asKnown().isPresent) 1 else 0) + - (if (accountToken.asKnown().isPresent) 1 else 0) + - (if (cardToken.asKnown().isPresent) 1 else 0) + - (if (caseId.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (arbitrationDate.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + - (if (currency.asKnown().isPresent) 1 else 0) + - (disposition.asKnown().getOrNull()?.validity() ?: 0) + - (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (liabilityAllocation.asKnown().getOrNull()?.validity() ?: 0) + - (merchant.asKnown().getOrNull()?.validity() ?: 0) + - (network.asKnown().getOrNull()?.validity() ?: 0) + + (if (customerFiledDate.asKnown().isPresent) 1 else 0) + + (if (customerNote.asKnown().isPresent) 1 else 0) + + (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + + (if (networkFiledDate.asKnown().isPresent) 1 else 0) + + (if (networkReasonCode.asKnown().isPresent) 1 else 0) + + (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + + (if (primaryClaimId.asKnown().isPresent) 1 else 0) + + (reason.asKnown().getOrNull()?.validity() ?: 0) + + (if (representmentDate.asKnown().isPresent) 1 else 0) + + (if (resolutionDate.asKnown().isPresent) 1 else 0) + + (if (resolutionNote.asKnown().isPresent) 1 else 0) + + (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + - (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) + - (if (updated.asKnown().isPresent) 1 else 0) + (if (transactionToken.asKnown().isPresent) 1 else 0) - /** Dispute resolution outcome */ - class Disposition @JsonCreator private constructor(private val value: JsonField) : - Enum { + /** + * Dispute reason: + * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. + * * `CANCELLED`: Transaction was cancelled by the customer. + * * `DUPLICATED`: The transaction was a duplicate. + * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. + * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. + * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. + * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. + * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. + * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. + * * `MISSING_AUTH`: The transaction was missing authorization. + * * `OTHER`: Other reason. + * * `PROCESSING_ERROR`: Processing error. + * * `REFUND_NOT_PROCESSED`: The refund was not processed. + * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. + */ + class Reason @JsonCreator private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -732,46 +1082,81 @@ private constructor( companion object { - @JvmField val WON = of("WON") + @JvmField val ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - @JvmField val LOST = of("LOST") + @JvmField val CANCELLED = of("CANCELLED") - @JvmField val PARTIALLY_WON = of("PARTIALLY_WON") + @JvmField val DUPLICATED = of("DUPLICATED") - @JvmField val WITHDRAWN = of("WITHDRAWN") + @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") + + @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") + + @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") + + @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") + + @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") + + @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") + + @JvmField val MISSING_AUTH = of("MISSING_AUTH") + + @JvmField val OTHER = of("OTHER") + + @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") + + @JvmField + val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - @JvmField val DENIED = of("DENIED") + @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - @JvmStatic fun of(value: String) = Disposition(JsonField.of(value)) + @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) } - /** An enum containing [Disposition]'s known values. */ + /** An enum containing [Reason]'s known values. */ enum class Known { - WON, - LOST, - PARTIALLY_WON, - WITHDRAWN, - DENIED, + ATM_CASH_MISDISPENSE, + CANCELLED, + DUPLICATED, + FRAUD_CARD_NOT_PRESENT, + FRAUD_CARD_PRESENT, + FRAUD_OTHER, + GOODS_SERVICES_NOT_AS_DESCRIBED, + GOODS_SERVICES_NOT_RECEIVED, + INCORRECT_AMOUNT, + MISSING_AUTH, + OTHER, + PROCESSING_ERROR, + RECURRING_TRANSACTION_NOT_CANCELLED, + REFUND_NOT_PROCESSED, } /** - * An enum containing [Disposition]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Disposition] can contain an unknown value in a couple of cases: + * 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 { - WON, - LOST, - PARTIALLY_WON, - WITHDRAWN, - DENIED, - /** - * An enum member indicating that [Disposition] was instantiated with an unknown value. - */ + ATM_CASH_MISDISPENSE, + CANCELLED, + DUPLICATED, + FRAUD_CARD_NOT_PRESENT, + FRAUD_CARD_PRESENT, + FRAUD_OTHER, + GOODS_SERVICES_NOT_AS_DESCRIBED, + GOODS_SERVICES_NOT_RECEIVED, + INCORRECT_AMOUNT, + MISSING_AUTH, + OTHER, + PROCESSING_ERROR, + RECURRING_TRANSACTION_NOT_CANCELLED, + REFUND_NOT_PROCESSED, + /** An enum member indicating that [Reason] was instantiated with an unknown value. */ _UNKNOWN, } @@ -784,11 +1169,20 @@ private constructor( */ fun value(): Value = when (this) { - WON -> Value.WON - LOST -> Value.LOST - PARTIALLY_WON -> Value.PARTIALLY_WON - WITHDRAWN -> Value.WITHDRAWN - DENIED -> Value.DENIED + ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE + CANCELLED -> Value.CANCELLED + DUPLICATED -> Value.DUPLICATED + FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT + FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT + FRAUD_OTHER -> Value.FRAUD_OTHER + GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED + GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED + INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT + MISSING_AUTH -> Value.MISSING_AUTH + OTHER -> Value.OTHER + PROCESSING_ERROR -> Value.PROCESSING_ERROR + RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED + REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED else -> Value._UNKNOWN } @@ -803,12 +1197,21 @@ private constructor( */ fun known(): Known = when (this) { - WON -> Known.WON - LOST -> Known.LOST - PARTIALLY_WON -> Known.PARTIALLY_WON - WITHDRAWN -> Known.WITHDRAWN - DENIED -> Known.DENIED - else -> throw LithicInvalidDataException("Unknown Disposition: $value") + ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE + CANCELLED -> Known.CANCELLED + DUPLICATED -> Known.DUPLICATED + FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT + FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT + FRAUD_OTHER -> Known.FRAUD_OTHER + GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED + GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED + INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT + MISSING_AUTH -> Known.MISSING_AUTH + OTHER -> Known.OTHER + PROCESSING_ERROR -> Known.PROCESSING_ERROR + RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED + REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED + else -> throw LithicInvalidDataException("Unknown Reason: $value") } /** @@ -825,7 +1228,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Disposition = apply { + fun validate(): Reason = apply { if (validated) { return@apply } @@ -855,7 +1258,7 @@ private constructor( return true } - return other is Disposition && value == other.value + return other is Reason && value == other.value } override fun hashCode() = value.hashCode() @@ -863,3227 +1266,132 @@ private constructor( override fun toString() = value.toString() } - /** Event that occurred in the dispute lifecycle */ - class Event - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val created: JsonField, - private val data: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(token, created, data, type, mutableMapOf()) + /** + * Reason for the dispute resolution: + * * `CASE_LOST`: This case was lost at final arbitration. + * * `NETWORK_REJECTED`: Network rejected. + * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. + * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. + * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. + * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. + * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. + * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. + * * `PAST_FILING_DATE`: Past filing date. + * * `PREARBITRATION_REJECTED`: Prearbitration rejected. + * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. + * * `REFUNDED`: Refunded. + * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. + * * `WITHDRAWN`: Withdrawn. + * * `WON_ARBITRATION`: Won arbitration. + * * `WON_FIRST_CHARGEBACK`: Won first chargeback. + * * `WON_PREARBITRATION`: Won prearbitration. + */ + class ResolutionReason @JsonCreator private constructor(private val value: JsonField) : + Enum { /** - * Unique identifier for the event, in UUID format + * Returns this class instance's raw value. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * 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. */ - fun token(): String = token.getRequired("token") + @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - /** - * When the event 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 created(): OffsetDateTime = created.getRequired("created") + companion object { - /** - * Details specific to the event type - * - * @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 data(): Data = data.getRequired("data") + @JvmField val CASE_LOST = of("CASE_LOST") - /** - * Type of event - * - * @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") + @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - /** - * 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 + @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - /** - * 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 + @JvmField + val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - /** - * Returns the raw JSON value of [data]. - * - * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - /** - * 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 + @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } + @JvmField + val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) + @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - fun toBuilder() = Builder().from(this) + @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - companion object { + @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - /** - * Returns a mutable builder for constructing an instance of [Event]. - * - * The following fields are required: - * ```java - * .token() - * .created() - * .data() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } + @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - /** A builder for [Event]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var created: JsonField? = null - private var data: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(event: Event) = apply { - token = event.token - created = event.created - data = event.data - type = event.type - additionalProperties = event.additionalProperties.toMutableMap() - } + @JvmField val REFUNDED = of("REFUNDED") - /** Unique identifier for the event, in UUID format */ - fun token(token: String) = token(JsonField.of(token)) + @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - /** - * 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 event occurred */ - 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 } - - /** Details specific to the event type */ - fun data(data: Data) = data(JsonField.of(data)) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed [Data] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun data(data: JsonField) = apply { this.data = data } - - /** Alias for calling [data] with `Data.ofWorkflowEvent(workflowEvent)`. */ - fun data(workflowEvent: Data.WorkflowEventData) = - data(Data.ofWorkflowEvent(workflowEvent)) - - /** Alias for calling [data] with `Data.ofFinancialEvent(financialEvent)`. */ - fun data(financialEvent: Data.FinancialEventData) = - data(Data.ofFinancialEvent(financialEvent)) - - /** - * Alias for calling [data] with - * `Data.ofCardholderLiabilityEvent(cardholderLiabilityEvent)`. - */ - fun data(cardholderLiabilityEvent: Data.CardholderLiabilityEventData) = - data(Data.ofCardholderLiabilityEvent(cardholderLiabilityEvent)) - - /** Type of event */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Event]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .created() - * .data() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Event = - Event( - checkRequired("token", token), - checkRequired("created", created), - checkRequired("data", data), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Event = apply { - if (validated) { - return@apply - } - - token() - created() - data().validate() - type().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (token.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (data.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** Details specific to the event type */ - @JsonDeserialize(using = Data.Deserializer::class) - @JsonSerialize(using = Data.Serializer::class) - class Data - private constructor( - private val workflowEvent: WorkflowEventData? = null, - private val financialEvent: FinancialEventData? = null, - private val cardholderLiabilityEvent: CardholderLiabilityEventData? = null, - private val _json: JsonValue? = null, - ) { - - /** Details specific to workflow events */ - fun workflowEvent(): Optional = Optional.ofNullable(workflowEvent) - - /** Details specific to financial events */ - fun financialEvent(): Optional = Optional.ofNullable(financialEvent) - - /** Details specific to cardholder liability events */ - fun cardholderLiabilityEvent(): Optional = - Optional.ofNullable(cardholderLiabilityEvent) - - fun isWorkflowEvent(): Boolean = workflowEvent != null - - fun isFinancialEvent(): Boolean = financialEvent != null - - fun isCardholderLiabilityEvent(): Boolean = cardholderLiabilityEvent != null - - /** Details specific to workflow events */ - fun asWorkflowEvent(): WorkflowEventData = workflowEvent.getOrThrow("workflowEvent") - - /** Details specific to financial events */ - fun asFinancialEvent(): FinancialEventData = financialEvent.getOrThrow("financialEvent") - - /** Details specific to cardholder liability events */ - fun asCardholderLiabilityEvent(): CardholderLiabilityEventData = - cardholderLiabilityEvent.getOrThrow("cardholderLiabilityEvent") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - workflowEvent != null -> visitor.visitWorkflowEvent(workflowEvent) - financialEvent != null -> visitor.visitFinancialEvent(financialEvent) - cardholderLiabilityEvent != null -> - visitor.visitCardholderLiabilityEvent(cardholderLiabilityEvent) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Data = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitWorkflowEvent(workflowEvent: WorkflowEventData) { - workflowEvent.validate() - } - - override fun visitFinancialEvent(financialEvent: FinancialEventData) { - financialEvent.validate() - } - - override fun visitCardholderLiabilityEvent( - cardholderLiabilityEvent: CardholderLiabilityEventData - ) { - cardholderLiabilityEvent.validate() - } - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitWorkflowEvent(workflowEvent: WorkflowEventData) = - workflowEvent.validity() - - override fun visitFinancialEvent(financialEvent: FinancialEventData) = - financialEvent.validity() - - override fun visitCardholderLiabilityEvent( - cardholderLiabilityEvent: CardholderLiabilityEventData - ) = cardholderLiabilityEvent.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Data && - workflowEvent == other.workflowEvent && - financialEvent == other.financialEvent && - cardholderLiabilityEvent == other.cardholderLiabilityEvent - } - - override fun hashCode(): Int = - Objects.hash(workflowEvent, financialEvent, cardholderLiabilityEvent) - - override fun toString(): String = - when { - workflowEvent != null -> "Data{workflowEvent=$workflowEvent}" - financialEvent != null -> "Data{financialEvent=$financialEvent}" - cardholderLiabilityEvent != null -> - "Data{cardholderLiabilityEvent=$cardholderLiabilityEvent}" - _json != null -> "Data{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Data") - } - - companion object { - - /** Details specific to workflow events */ - @JvmStatic - fun ofWorkflowEvent(workflowEvent: WorkflowEventData) = - Data(workflowEvent = workflowEvent) - - /** Details specific to financial events */ - @JvmStatic - fun ofFinancialEvent(financialEvent: FinancialEventData) = - Data(financialEvent = financialEvent) - - /** Details specific to cardholder liability events */ - @JvmStatic - fun ofCardholderLiabilityEvent( - cardholderLiabilityEvent: CardholderLiabilityEventData - ) = Data(cardholderLiabilityEvent = cardholderLiabilityEvent) - } - - /** - * An interface that defines how to map each variant of [Data] to a value of type [T]. - */ - interface Visitor { - - /** Details specific to workflow events */ - fun visitWorkflowEvent(workflowEvent: WorkflowEventData): T - - /** Details specific to financial events */ - fun visitFinancialEvent(financialEvent: FinancialEventData): T - - /** Details specific to cardholder liability events */ - fun visitCardholderLiabilityEvent( - cardholderLiabilityEvent: CardholderLiabilityEventData - ): T - - /** - * Maps an unknown variant of [Data] to a value of type [T]. - * - * An instance of [Data] can contain an unknown variant if it was deserialized from - * data that doesn't match any known variant. For example, if the SDK is on an older - * version than the API, then the API may respond with new variants that the SDK is - * unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Data: $json") - } - } - - internal class Deserializer : BaseDeserializer(Data::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Data { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Data(workflowEvent = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Data(financialEvent = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Data(cardholderLiabilityEvent = it, _json = json) }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely incompatible - // with all the possible variants (e.g. deserializing from boolean). - 0 -> Data(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, then use the - // first completely valid match, or simply the first match if none are - // completely valid. - else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Data::class) { - - override fun serialize( - value: Data, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.workflowEvent != null -> generator.writeObject(value.workflowEvent) - value.financialEvent != null -> generator.writeObject(value.financialEvent) - value.cardholderLiabilityEvent != null -> - generator.writeObject(value.cardholderLiabilityEvent) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Data") - } - } - } - - /** Details specific to workflow events */ - class WorkflowEventData - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val action: JsonField, - private val amount: JsonField, - private val disposition: JsonField, - private val reason: JsonField, - private val stage: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("action") - @ExcludeMissing - action: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("disposition") - @ExcludeMissing - disposition: JsonField = JsonMissing.of(), - @JsonProperty("reason") - @ExcludeMissing - reason: JsonField = JsonMissing.of(), - @JsonProperty("stage") - @ExcludeMissing - stage: JsonField = JsonMissing.of(), - ) : this(action, amount, disposition, reason, stage, mutableMapOf()) - - /** - * Action taken in this stage - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun action(): Action = action.getRequired("action") - - /** - * Amount in minor units - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Dispute resolution outcome - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun disposition(): Optional = disposition.getOptional("disposition") - - /** - * Reason for the action - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun reason(): Optional = reason.getOptional("reason") - - /** - * Current stage of the dispute workflow - * - * @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 stage(): Stage = stage.getRequired("stage") - - /** - * Returns the raw JSON value of [action]. - * - * Unlike [action], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [disposition]. - * - * Unlike [disposition], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("disposition") - @ExcludeMissing - fun _disposition(): JsonField = disposition - - /** - * 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 [stage]. - * - * Unlike [stage], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("stage") @ExcludeMissing fun _stage(): JsonField = stage - - @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 - * [WorkflowEventData]. - * - * The following fields are required: - * ```java - * .action() - * .amount() - * .disposition() - * .reason() - * .stage() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WorkflowEventData]. */ - class Builder internal constructor() { - - private var action: JsonField? = null - private var amount: JsonField? = null - private var disposition: JsonField? = null - private var reason: JsonField? = null - private var stage: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(workflowEventData: WorkflowEventData) = apply { - action = workflowEventData.action - amount = workflowEventData.amount - disposition = workflowEventData.disposition - reason = workflowEventData.reason - stage = workflowEventData.stage - additionalProperties = workflowEventData.additionalProperties.toMutableMap() - } - - /** Action taken in this stage */ - fun action(action: Action) = action(JsonField.of(action)) - - /** - * Sets [Builder.action] to an arbitrary JSON value. - * - * You should usually call [Builder.action] with a well-typed [Action] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun action(action: JsonField) = apply { this.action = action } - - /** Amount in minor units */ - fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - - /** - * Alias for [Builder.amount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun amount(amount: Long) = amount(amount as Long?) - - /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ - fun amount(amount: Optional) = amount(amount.getOrNull()) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Dispute resolution outcome */ - fun disposition(disposition: Disposition?) = - disposition(JsonField.ofNullable(disposition)) - - /** Alias for calling [Builder.disposition] with `disposition.orElse(null)`. */ - fun disposition(disposition: Optional) = - disposition(disposition.getOrNull()) - - /** - * Sets [Builder.disposition] to an arbitrary JSON value. - * - * You should usually call [Builder.disposition] with a well-typed [Disposition] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun disposition(disposition: JsonField) = apply { - this.disposition = disposition - } - - /** Reason for the action */ - fun reason(reason: String?) = reason(JsonField.ofNullable(reason)) - - /** Alias for calling [Builder.reason] with `reason.orElse(null)`. */ - fun reason(reason: Optional) = reason(reason.getOrNull()) - - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [String] 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 stage of the dispute workflow */ - fun stage(stage: Stage) = stage(JsonField.of(stage)) - - /** - * Sets [Builder.stage] to an arbitrary JSON value. - * - * You should usually call [Builder.stage] with a well-typed [Stage] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun stage(stage: JsonField) = apply { this.stage = stage } - - 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 [WorkflowEventData]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .action() - * .amount() - * .disposition() - * .reason() - * .stage() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): WorkflowEventData = - WorkflowEventData( - checkRequired("action", action), - checkRequired("amount", amount), - checkRequired("disposition", disposition), - checkRequired("reason", reason), - checkRequired("stage", stage), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): WorkflowEventData = apply { - if (validated) { - return@apply - } - - action().validate() - amount() - disposition().ifPresent { it.validate() } - reason() - stage().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (action.asKnown().getOrNull()?.validity() ?: 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (disposition.asKnown().getOrNull()?.validity() ?: 0) + - (if (reason.asKnown().isPresent) 1 else 0) + - (stage.asKnown().getOrNull()?.validity() ?: 0) - - /** Action taken in this stage */ - class Action - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val OPENED = of("OPENED") - - @JvmField val CLOSED = of("CLOSED") - - @JvmField val REOPENED = of("REOPENED") - - @JvmStatic fun of(value: String) = Action(JsonField.of(value)) - } - - /** An enum containing [Action]'s known values. */ - enum class Known { - OPENED, - CLOSED, - REOPENED, - } - - /** - * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Action] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - OPENED, - CLOSED, - REOPENED, - /** - * An enum member indicating that [Action] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - OPENED -> Value.OPENED - CLOSED -> Value.CLOSED - REOPENED -> Value.REOPENED - 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) { - OPENED -> Known.OPENED - CLOSED -> Known.CLOSED - REOPENED -> Known.REOPENED - else -> throw LithicInvalidDataException("Unknown Action: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Action = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Action && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Dispute resolution outcome */ - class Disposition - @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 WON = of("WON") - - @JvmField val LOST = of("LOST") - - @JvmField val PARTIALLY_WON = of("PARTIALLY_WON") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val DENIED = of("DENIED") - - @JvmStatic fun of(value: String) = Disposition(JsonField.of(value)) - } - - /** An enum containing [Disposition]'s known values. */ - enum class Known { - WON, - LOST, - PARTIALLY_WON, - WITHDRAWN, - DENIED, - } - - /** - * An enum containing [Disposition]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Disposition] 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 { - WON, - LOST, - PARTIALLY_WON, - WITHDRAWN, - DENIED, - /** - * An enum member indicating that [Disposition] 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) { - WON -> Value.WON - LOST -> Value.LOST - PARTIALLY_WON -> Value.PARTIALLY_WON - WITHDRAWN -> Value.WITHDRAWN - DENIED -> Value.DENIED - 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) { - WON -> Known.WON - LOST -> Known.LOST - PARTIALLY_WON -> Known.PARTIALLY_WON - WITHDRAWN -> Known.WITHDRAWN - DENIED -> Known.DENIED - else -> throw LithicInvalidDataException("Unknown Disposition: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Disposition = 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 Disposition && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Current stage of the dispute workflow */ - class Stage @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 = of("CLAIM") - - @JvmStatic fun of(value: String) = Stage(JsonField.of(value)) - } - - /** An enum containing [Stage]'s known values. */ - enum class Known { - CLAIM - } - - /** - * An enum containing [Stage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Stage] 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, - /** - * An enum member indicating that [Stage] 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 -> Value.CLAIM - 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 -> Known.CLAIM - else -> throw LithicInvalidDataException("Unknown Stage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Stage = 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 Stage && 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 WorkflowEventData && - action == other.action && - amount == other.amount && - disposition == other.disposition && - reason == other.reason && - stage == other.stage && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(action, amount, disposition, reason, stage, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WorkflowEventData{action=$action, amount=$amount, disposition=$disposition, reason=$reason, stage=$stage, additionalProperties=$additionalProperties}" - } - - /** Details specific to financial events */ - class FinancialEventData - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val amount: JsonField, - private val polarity: JsonField, - private val stage: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("polarity") - @ExcludeMissing - polarity: JsonField = JsonMissing.of(), - @JsonProperty("stage") - @ExcludeMissing - stage: JsonField = JsonMissing.of(), - ) : this(amount, polarity, stage, mutableMapOf()) - - /** - * Amount in minor units - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Direction of funds flow - * - * @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 polarity(): Polarity = polarity.getRequired("polarity") - - /** - * Stage at which the financial event 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 stage(): Stage = stage.getRequired("stage") - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [polarity]. - * - * Unlike [polarity], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("polarity") - @ExcludeMissing - fun _polarity(): JsonField = polarity - - /** - * Returns the raw JSON value of [stage]. - * - * Unlike [stage], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("stage") @ExcludeMissing fun _stage(): JsonField = stage - - @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 - * [FinancialEventData]. - * - * The following fields are required: - * ```java - * .amount() - * .polarity() - * .stage() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinancialEventData]. */ - class Builder internal constructor() { - - private var amount: JsonField? = null - private var polarity: JsonField? = null - private var stage: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(financialEventData: FinancialEventData) = apply { - amount = financialEventData.amount - polarity = financialEventData.polarity - stage = financialEventData.stage - additionalProperties = - financialEventData.additionalProperties.toMutableMap() - } - - /** Amount in minor units */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Direction of funds flow */ - fun polarity(polarity: Polarity) = polarity(JsonField.of(polarity)) - - /** - * Sets [Builder.polarity] to an arbitrary JSON value. - * - * You should usually call [Builder.polarity] with a well-typed [Polarity] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun polarity(polarity: JsonField) = apply { this.polarity = polarity } - - /** Stage at which the financial event occurred */ - fun stage(stage: Stage) = stage(JsonField.of(stage)) - - /** - * Sets [Builder.stage] to an arbitrary JSON value. - * - * You should usually call [Builder.stage] with a well-typed [Stage] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun stage(stage: JsonField) = apply { this.stage = stage } - - 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 [FinancialEventData]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .amount() - * .polarity() - * .stage() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): FinancialEventData = - FinancialEventData( - checkRequired("amount", amount), - checkRequired("polarity", polarity), - checkRequired("stage", stage), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FinancialEventData = apply { - if (validated) { - return@apply - } - - amount() - polarity().validate() - stage().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 = - (if (amount.asKnown().isPresent) 1 else 0) + - (polarity.asKnown().getOrNull()?.validity() ?: 0) + - (stage.asKnown().getOrNull()?.validity() ?: 0) - - /** Direction of funds flow */ - class Polarity - @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) = Polarity(JsonField.of(value)) - } - - /** An enum containing [Polarity]'s known values. */ - enum class Known { - CREDIT, - DEBIT, - } - - /** - * An enum containing [Polarity]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Polarity] 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 [Polarity] 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 Polarity: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Polarity = 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 Polarity && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Stage at which the financial event occurred */ - class Stage @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 CHARGEBACK = of("CHARGEBACK") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val ARBITRATION = of("ARBITRATION") - - @JvmField val COLLABORATION = of("COLLABORATION") - - @JvmStatic fun of(value: String) = Stage(JsonField.of(value)) - } - - /** An enum containing [Stage]'s known values. */ - enum class Known { - CHARGEBACK, - REPRESENTMENT, - PREARBITRATION, - ARBITRATION, - COLLABORATION, - } - - /** - * An enum containing [Stage]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Stage] 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 { - CHARGEBACK, - REPRESENTMENT, - PREARBITRATION, - ARBITRATION, - COLLABORATION, - /** - * An enum member indicating that [Stage] 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) { - CHARGEBACK -> Value.CHARGEBACK - REPRESENTMENT -> Value.REPRESENTMENT - PREARBITRATION -> Value.PREARBITRATION - ARBITRATION -> Value.ARBITRATION - COLLABORATION -> Value.COLLABORATION - 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) { - CHARGEBACK -> Known.CHARGEBACK - REPRESENTMENT -> Known.REPRESENTMENT - PREARBITRATION -> Known.PREARBITRATION - ARBITRATION -> Known.ARBITRATION - COLLABORATION -> Known.COLLABORATION - else -> throw LithicInvalidDataException("Unknown Stage: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Stage = 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 Stage && 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 FinancialEventData && - amount == other.amount && - polarity == other.polarity && - stage == other.stage && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(amount, polarity, stage, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FinancialEventData{amount=$amount, polarity=$polarity, stage=$stage, additionalProperties=$additionalProperties}" - } - - /** Details specific to cardholder liability events */ - class CardholderLiabilityEventData - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val action: JsonField, - private val amount: JsonField, - private val reason: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("action") - @ExcludeMissing - action: JsonField = JsonMissing.of(), - @JsonProperty("amount") - @ExcludeMissing - amount: JsonField = JsonMissing.of(), - @JsonProperty("reason") - @ExcludeMissing - reason: JsonField = JsonMissing.of(), - ) : this(action, amount, reason, mutableMapOf()) - - /** - * Action taken regarding cardholder liability - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun action(): Action = action.getRequired("action") - - /** - * Amount in minor units - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Reason for the action - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun reason(): String = reason.getRequired("reason") - - /** - * Returns the raw JSON value of [action]. - * - * Unlike [action], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [reason]. - * - * Unlike [reason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [CardholderLiabilityEventData]. - * - * The following fields are required: - * ```java - * .action() - * .amount() - * .reason() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardholderLiabilityEventData]. */ - class Builder internal constructor() { - - private var action: JsonField? = null - private var amount: JsonField? = null - private var reason: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardholderLiabilityEventData: CardholderLiabilityEventData) = - apply { - action = cardholderLiabilityEventData.action - amount = cardholderLiabilityEventData.amount - reason = cardholderLiabilityEventData.reason - additionalProperties = - cardholderLiabilityEventData.additionalProperties.toMutableMap() - } - - /** Action taken regarding cardholder liability */ - fun action(action: Action) = action(JsonField.of(action)) - - /** - * Sets [Builder.action] to an arbitrary JSON value. - * - * You should usually call [Builder.action] with a well-typed [Action] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun action(action: JsonField) = apply { this.action = action } - - /** Amount in minor units */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Reason for the action */ - fun reason(reason: String) = reason(JsonField.of(reason)) - - /** - * Sets [Builder.reason] to an arbitrary JSON value. - * - * You should usually call [Builder.reason] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun reason(reason: JsonField) = apply { this.reason = reason } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [CardholderLiabilityEventData]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .action() - * .amount() - * .reason() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardholderLiabilityEventData = - CardholderLiabilityEventData( - checkRequired("action", action), - checkRequired("amount", amount), - checkRequired("reason", reason), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardholderLiabilityEventData = apply { - if (validated) { - return@apply - } - - action().validate() - amount() - reason() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (action.asKnown().getOrNull()?.validity() ?: 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (reason.asKnown().isPresent) 1 else 0) - - /** Action taken regarding cardholder liability */ - class Action - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val PROVISIONAL_CREDIT_GRANTED = of("PROVISIONAL_CREDIT_GRANTED") - - @JvmField - val PROVISIONAL_CREDIT_REVERSED = of("PROVISIONAL_CREDIT_REVERSED") - - @JvmField val WRITTEN_OFF = of("WRITTEN_OFF") - - @JvmStatic fun of(value: String) = Action(JsonField.of(value)) - } - - /** An enum containing [Action]'s known values. */ - enum class Known { - PROVISIONAL_CREDIT_GRANTED, - PROVISIONAL_CREDIT_REVERSED, - WRITTEN_OFF, - } - - /** - * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Action] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - PROVISIONAL_CREDIT_GRANTED, - PROVISIONAL_CREDIT_REVERSED, - WRITTEN_OFF, - /** - * An enum member indicating that [Action] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PROVISIONAL_CREDIT_GRANTED -> Value.PROVISIONAL_CREDIT_GRANTED - PROVISIONAL_CREDIT_REVERSED -> Value.PROVISIONAL_CREDIT_REVERSED - WRITTEN_OFF -> Value.WRITTEN_OFF - 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) { - PROVISIONAL_CREDIT_GRANTED -> Known.PROVISIONAL_CREDIT_GRANTED - PROVISIONAL_CREDIT_REVERSED -> Known.PROVISIONAL_CREDIT_REVERSED - WRITTEN_OFF -> Known.WRITTEN_OFF - else -> throw LithicInvalidDataException("Unknown Action: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Action = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Action && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardholderLiabilityEventData && - action == other.action && - amount == other.amount && - reason == other.reason && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(action, amount, reason, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardholderLiabilityEventData{action=$action, amount=$amount, reason=$reason, additionalProperties=$additionalProperties}" - } - } - - /** Type of event */ - 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 WORKFLOW = of("WORKFLOW") - - @JvmField val FINANCIAL = of("FINANCIAL") - - @JvmField val CARDHOLDER_LIABILITY = of("CARDHOLDER_LIABILITY") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - WORKFLOW, - FINANCIAL, - CARDHOLDER_LIABILITY, - } - - /** - * 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 { - WORKFLOW, - FINANCIAL, - CARDHOLDER_LIABILITY, - /** 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) { - WORKFLOW -> Value.WORKFLOW - FINANCIAL -> Value.FINANCIAL - CARDHOLDER_LIABILITY -> Value.CARDHOLDER_LIABILITY - 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) { - WORKFLOW -> Known.WORKFLOW - FINANCIAL -> Known.FINANCIAL - CARDHOLDER_LIABILITY -> Known.CARDHOLDER_LIABILITY - else -> throw LithicInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Event && - token == other.token && - created == other.created && - data == other.data && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, created, data, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Event{token=$token, created=$created, data=$data, type=$type, additionalProperties=$additionalProperties}" - } - - /** Current breakdown of how liability is allocated for the disputed amount */ - class LiabilityAllocation - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val deniedAmount: JsonField, - private val originalAmount: JsonField, - private val recoveredAmount: JsonField, - private val remainingAmount: JsonField, - private val writtenOffAmount: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("denied_amount") - @ExcludeMissing - deniedAmount: JsonField = JsonMissing.of(), - @JsonProperty("original_amount") - @ExcludeMissing - originalAmount: JsonField = JsonMissing.of(), - @JsonProperty("recovered_amount") - @ExcludeMissing - recoveredAmount: JsonField = JsonMissing.of(), - @JsonProperty("remaining_amount") - @ExcludeMissing - remainingAmount: JsonField = JsonMissing.of(), - @JsonProperty("written_off_amount") - @ExcludeMissing - writtenOffAmount: JsonField = JsonMissing.of(), - ) : this( - deniedAmount, - originalAmount, - recoveredAmount, - remainingAmount, - writtenOffAmount, - mutableMapOf(), - ) - - /** - * The amount that has been denied to the cardholder - * - * @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 deniedAmount(): Long = deniedAmount.getRequired("denied_amount") - - /** - * The initial amount disputed - * - * @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 originalAmount(): Long = originalAmount.getRequired("original_amount") - - /** - * The amount that has been recovered from the merchant through the dispute process - * - * @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 recoveredAmount(): Long = recoveredAmount.getRequired("recovered_amount") - - /** - * Any disputed amount that is still outstanding, i.e. has not been recovered, written off, - * or denied - * - * @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 remainingAmount(): Long = remainingAmount.getRequired("remaining_amount") - - /** - * The amount the issuer has chosen to write off - * - * @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 writtenOffAmount(): Long = writtenOffAmount.getRequired("written_off_amount") - - /** - * Returns the raw JSON value of [deniedAmount]. - * - * Unlike [deniedAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("denied_amount") - @ExcludeMissing - fun _deniedAmount(): JsonField = deniedAmount - - /** - * Returns the raw JSON value of [originalAmount]. - * - * Unlike [originalAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("original_amount") - @ExcludeMissing - fun _originalAmount(): JsonField = originalAmount - - /** - * Returns the raw JSON value of [recoveredAmount]. - * - * Unlike [recoveredAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("recovered_amount") - @ExcludeMissing - fun _recoveredAmount(): JsonField = recoveredAmount - - /** - * Returns the raw JSON value of [remainingAmount]. - * - * Unlike [remainingAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("remaining_amount") - @ExcludeMissing - fun _remainingAmount(): JsonField = remainingAmount - - /** - * Returns the raw JSON value of [writtenOffAmount]. - * - * Unlike [writtenOffAmount], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("written_off_amount") - @ExcludeMissing - fun _writtenOffAmount(): JsonField = writtenOffAmount - - @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 [LiabilityAllocation]. - * - * The following fields are required: - * ```java - * .deniedAmount() - * .originalAmount() - * .recoveredAmount() - * .remainingAmount() - * .writtenOffAmount() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [LiabilityAllocation]. */ - class Builder internal constructor() { - - private var deniedAmount: JsonField? = null - private var originalAmount: JsonField? = null - private var recoveredAmount: JsonField? = null - private var remainingAmount: JsonField? = null - private var writtenOffAmount: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(liabilityAllocation: LiabilityAllocation) = apply { - deniedAmount = liabilityAllocation.deniedAmount - originalAmount = liabilityAllocation.originalAmount - recoveredAmount = liabilityAllocation.recoveredAmount - remainingAmount = liabilityAllocation.remainingAmount - writtenOffAmount = liabilityAllocation.writtenOffAmount - additionalProperties = liabilityAllocation.additionalProperties.toMutableMap() - } - - /** The amount that has been denied to the cardholder */ - fun deniedAmount(deniedAmount: Long) = deniedAmount(JsonField.of(deniedAmount)) - - /** - * Sets [Builder.deniedAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.deniedAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun deniedAmount(deniedAmount: JsonField) = apply { - this.deniedAmount = deniedAmount - } - - /** The initial amount disputed */ - fun originalAmount(originalAmount: Long) = originalAmount(JsonField.of(originalAmount)) - - /** - * Sets [Builder.originalAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.originalAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun originalAmount(originalAmount: JsonField) = apply { - this.originalAmount = originalAmount - } - - /** The amount that has been recovered from the merchant through the dispute process */ - fun recoveredAmount(recoveredAmount: Long) = - recoveredAmount(JsonField.of(recoveredAmount)) - - /** - * Sets [Builder.recoveredAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.recoveredAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun recoveredAmount(recoveredAmount: JsonField) = apply { - this.recoveredAmount = recoveredAmount - } - - /** - * Any disputed amount that is still outstanding, i.e. has not been recovered, written - * off, or denied - */ - fun remainingAmount(remainingAmount: Long) = - remainingAmount(JsonField.of(remainingAmount)) - - /** - * Sets [Builder.remainingAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.remainingAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun remainingAmount(remainingAmount: JsonField) = apply { - this.remainingAmount = remainingAmount - } - - /** The amount the issuer has chosen to write off */ - fun writtenOffAmount(writtenOffAmount: Long) = - writtenOffAmount(JsonField.of(writtenOffAmount)) - - /** - * Sets [Builder.writtenOffAmount] to an arbitrary JSON value. - * - * You should usually call [Builder.writtenOffAmount] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun writtenOffAmount(writtenOffAmount: JsonField) = apply { - this.writtenOffAmount = writtenOffAmount - } - - 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 [LiabilityAllocation]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .deniedAmount() - * .originalAmount() - * .recoveredAmount() - * .remainingAmount() - * .writtenOffAmount() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): LiabilityAllocation = - LiabilityAllocation( - checkRequired("deniedAmount", deniedAmount), - checkRequired("originalAmount", originalAmount), - checkRequired("recoveredAmount", recoveredAmount), - checkRequired("remainingAmount", remainingAmount), - checkRequired("writtenOffAmount", writtenOffAmount), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): LiabilityAllocation = apply { - if (validated) { - return@apply - } - - deniedAmount() - originalAmount() - recoveredAmount() - remainingAmount() - writtenOffAmount() - 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 (deniedAmount.asKnown().isPresent) 1 else 0) + - (if (originalAmount.asKnown().isPresent) 1 else 0) + - (if (recoveredAmount.asKnown().isPresent) 1 else 0) + - (if (remainingAmount.asKnown().isPresent) 1 else 0) + - (if (writtenOffAmount.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is LiabilityAllocation && - deniedAmount == other.deniedAmount && - originalAmount == other.originalAmount && - recoveredAmount == other.recoveredAmount && - remainingAmount == other.remainingAmount && - writtenOffAmount == other.writtenOffAmount && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - deniedAmount, - originalAmount, - recoveredAmount, - remainingAmount, - writtenOffAmount, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "LiabilityAllocation{deniedAmount=$deniedAmount, originalAmount=$originalAmount, recoveredAmount=$recoveredAmount, remainingAmount=$remainingAmount, writtenOffAmount=$writtenOffAmount, additionalProperties=$additionalProperties}" - } - - class Merchant - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val acceptorId: JsonField, - private val acquiringInstitutionId: JsonField, - private val city: JsonField, - private val country: JsonField, - private val descriptor: JsonField, - private val mcc: JsonField, - private val state: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("acceptor_id") - @ExcludeMissing - acceptorId: JsonField = JsonMissing.of(), - @JsonProperty("acquiring_institution_id") - @ExcludeMissing - acquiringInstitutionId: JsonField = JsonMissing.of(), - @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), - @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), - @JsonProperty("descriptor") - @ExcludeMissing - descriptor: JsonField = JsonMissing.of(), - @JsonProperty("mcc") @ExcludeMissing mcc: JsonField = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - ) : this( - acceptorId, - acquiringInstitutionId, - city, - country, - descriptor, - mcc, - state, - mutableMapOf(), - ) - - /** - * Unique alphanumeric identifier for the payment card acceptor (merchant). - * - * @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 acceptorId(): String = acceptorId.getRequired("acceptor_id") - - /** - * Unique numeric identifier of the acquiring institution. - * - * @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 acquiringInstitutionId(): String = - acquiringInstitutionId.getRequired("acquiring_institution_id") - - /** - * City of card acceptor. Note that in many cases, particularly in card-not-present - * transactions, merchants may send through a phone number or URL in this field. - * - * @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 city(): String = city.getRequired("city") - - /** - * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 - * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. - * - * @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 country(): String = country.getRequired("country") - - /** - * Short description of card acceptor. - * - * @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 descriptor(): String = descriptor.getRequired("descriptor") - - /** - * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to - * classify a business by the types of goods or services it provides. - * - * @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 mcc(): String = mcc.getRequired("mcc") - - /** - * Geographic state of card acceptor. - * - * @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 state(): String = state.getRequired("state") - - /** - * Returns the raw JSON value of [acceptorId]. - * - * Unlike [acceptorId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("acceptor_id") - @ExcludeMissing - fun _acceptorId(): JsonField = acceptorId - - /** - * Returns the raw JSON value of [acquiringInstitutionId]. - * - * Unlike [acquiringInstitutionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("acquiring_institution_id") - @ExcludeMissing - fun _acquiringInstitutionId(): JsonField = acquiringInstitutionId - - /** - * Returns the raw JSON value of [city]. - * - * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - - /** - * Returns the raw JSON value of [country]. - * - * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country - - /** - * Returns the raw JSON value of [descriptor]. - * - * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("descriptor") - @ExcludeMissing - fun _descriptor(): JsonField = descriptor - - /** - * Returns the raw JSON value of [mcc]. - * - * Unlike [mcc], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("mcc") @ExcludeMissing fun _mcc(): JsonField = mcc - - /** - * Returns the raw JSON value of [state]. - * - * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state - - @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 [Merchant]. - * - * The following fields are required: - * ```java - * .acceptorId() - * .acquiringInstitutionId() - * .city() - * .country() - * .descriptor() - * .mcc() - * .state() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Merchant]. */ - class Builder internal constructor() { - - private var acceptorId: JsonField? = null - private var acquiringInstitutionId: JsonField? = null - private var city: JsonField? = null - private var country: JsonField? = null - private var descriptor: JsonField? = null - private var mcc: JsonField? = null - private var state: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(merchant: Merchant) = apply { - acceptorId = merchant.acceptorId - acquiringInstitutionId = merchant.acquiringInstitutionId - city = merchant.city - country = merchant.country - descriptor = merchant.descriptor - mcc = merchant.mcc - state = merchant.state - additionalProperties = merchant.additionalProperties.toMutableMap() - } - - /** Unique alphanumeric identifier for the payment card acceptor (merchant). */ - fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId)) - - /** - * Sets [Builder.acceptorId] to an arbitrary JSON value. - * - * You should usually call [Builder.acceptorId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId } - - /** Unique numeric identifier of the acquiring institution. */ - fun acquiringInstitutionId(acquiringInstitutionId: String) = - acquiringInstitutionId(JsonField.of(acquiringInstitutionId)) - - /** - * Sets [Builder.acquiringInstitutionId] to an arbitrary JSON value. - * - * You should usually call [Builder.acquiringInstitutionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply { - this.acquiringInstitutionId = acquiringInstitutionId - } - - /** - * City of card acceptor. Note that in many cases, particularly in card-not-present - * transactions, merchants may send through a phone number or URL in this field. - */ - fun city(city: String) = city(JsonField.of(city)) - - /** - * Sets [Builder.city] to an arbitrary JSON value. - * - * You should usually call [Builder.city] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun city(city: JsonField) = apply { this.city = city } - - /** - * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 - * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. - */ - fun country(country: String) = country(JsonField.of(country)) - - /** - * Sets [Builder.country] to an arbitrary JSON value. - * - * You should usually call [Builder.country] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun country(country: JsonField) = apply { this.country = country } - - /** Short description of card acceptor. */ - fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) - - /** - * Sets [Builder.descriptor] to an arbitrary JSON value. - * - * You should usually call [Builder.descriptor] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } - - /** - * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used - * to classify a business by the types of goods or services it provides. - */ - fun mcc(mcc: String) = mcc(JsonField.of(mcc)) - - /** - * Sets [Builder.mcc] to an arbitrary JSON value. - * - * You should usually call [Builder.mcc] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun mcc(mcc: JsonField) = apply { this.mcc = mcc } - - /** Geographic state of card acceptor. */ - fun state(state: String) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun state(state: JsonField) = apply { this.state = state } - - 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 [Merchant]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .acceptorId() - * .acquiringInstitutionId() - * .city() - * .country() - * .descriptor() - * .mcc() - * .state() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Merchant = - Merchant( - checkRequired("acceptorId", acceptorId), - checkRequired("acquiringInstitutionId", acquiringInstitutionId), - checkRequired("city", city), - checkRequired("country", country), - checkRequired("descriptor", descriptor), - checkRequired("mcc", mcc), - checkRequired("state", state), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Merchant = apply { - if (validated) { - return@apply - } - - acceptorId() - acquiringInstitutionId() - city() - country() - descriptor() - mcc() - state() - 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 (acceptorId.asKnown().isPresent) 1 else 0) + - (if (acquiringInstitutionId.asKnown().isPresent) 1 else 0) + - (if (city.asKnown().isPresent) 1 else 0) + - (if (country.asKnown().isPresent) 1 else 0) + - (if (descriptor.asKnown().isPresent) 1 else 0) + - (if (mcc.asKnown().isPresent) 1 else 0) + - (if (state.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Merchant && - acceptorId == other.acceptorId && - acquiringInstitutionId == other.acquiringInstitutionId && - city == other.city && - country == other.country && - descriptor == other.descriptor && - mcc == other.mcc && - state == other.state && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - acceptorId, - acquiringInstitutionId, - city, - country, - descriptor, - mcc, - state, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Merchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, additionalProperties=$additionalProperties}" - } - - /** Card network handling the dispute. */ - class Network @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 + @JvmField val WITHDRAWN = of("WITHDRAWN") - companion object { + @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - @JvmField val VISA = of("VISA") + @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - @JvmField val MASTERCARD = of("MASTERCARD") + @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) } - /** An enum containing [Network]'s known values. */ + /** An enum containing [ResolutionReason]'s known values. */ enum class Known { - VISA, - MASTERCARD, + CASE_LOST, + NETWORK_REJECTED, + NO_DISPUTE_RIGHTS_3DS, + NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, + NO_DISPUTE_RIGHTS_CONTACTLESS, + NO_DISPUTE_RIGHTS_HYBRID, + NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, + NO_DISPUTE_RIGHTS_OTHER, + PAST_FILING_DATE, + PREARBITRATION_REJECTED, + PROCESSOR_REJECTED_OTHER, + REFUNDED, + REFUNDED_AFTER_CHARGEBACK, + WITHDRAWN, + WON_ARBITRATION, + WON_FIRST_CHARGEBACK, + WON_PREARBITRATION, } /** - * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Network] can contain an unknown value in a couple of cases: + * An instance of [ResolutionReason] 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 { - VISA, - MASTERCARD, - /** An enum member indicating that [Network] was instantiated with an unknown value. */ + CASE_LOST, + NETWORK_REJECTED, + NO_DISPUTE_RIGHTS_3DS, + NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, + NO_DISPUTE_RIGHTS_CONTACTLESS, + NO_DISPUTE_RIGHTS_HYBRID, + NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, + NO_DISPUTE_RIGHTS_OTHER, + PAST_FILING_DATE, + PREARBITRATION_REJECTED, + PROCESSOR_REJECTED_OTHER, + REFUNDED, + REFUNDED_AFTER_CHARGEBACK, + WITHDRAWN, + WON_ARBITRATION, + WON_FIRST_CHARGEBACK, + WON_PREARBITRATION, + /** + * An enum member indicating that [ResolutionReason] was instantiated with an unknown + * value. + */ _UNKNOWN, } @@ -4096,8 +1404,23 @@ private constructor( */ fun value(): Value = when (this) { - VISA -> Value.VISA - MASTERCARD -> Value.MASTERCARD + CASE_LOST -> Value.CASE_LOST + NETWORK_REJECTED -> Value.NETWORK_REJECTED + NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS + NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD + NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS + NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID + NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS + NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER + PAST_FILING_DATE -> Value.PAST_FILING_DATE + PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED + PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER + REFUNDED -> Value.REFUNDED + REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK + WITHDRAWN -> Value.WITHDRAWN + WON_ARBITRATION -> Value.WON_ARBITRATION + WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK + WON_PREARBITRATION -> Value.WON_PREARBITRATION else -> Value._UNKNOWN } @@ -4112,9 +1435,24 @@ private constructor( */ fun known(): Known = when (this) { - VISA -> Known.VISA - MASTERCARD -> Known.MASTERCARD - else -> throw LithicInvalidDataException("Unknown Network: $value") + CASE_LOST -> Known.CASE_LOST + NETWORK_REJECTED -> Known.NETWORK_REJECTED + NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS + NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD + NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS + NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID + NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS + NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER + PAST_FILING_DATE -> Known.PAST_FILING_DATE + PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED + PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER + REFUNDED -> Known.REFUNDED + REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK + WITHDRAWN -> Known.WITHDRAWN + WON_ARBITRATION -> Known.WON_ARBITRATION + WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK + WON_PREARBITRATION -> Known.WON_PREARBITRATION + else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") } /** @@ -4131,7 +1469,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Network = apply { + fun validate(): ResolutionReason = apply { if (validated) { return@apply } @@ -4161,7 +1499,7 @@ private constructor( return true } - return other is Network && value == other.value + return other is ResolutionReason && value == other.value } override fun hashCode() = value.hashCode() @@ -4169,7 +1507,17 @@ private constructor( override fun toString() = value.toString() } - /** Current status of the dispute. */ + /** + * Status types: + * * `NEW` - New dispute case is opened. + * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. + * * `SUBMITTED` - Dispute is submitted to the card network. + * * `REPRESENTMENT` - Case has entered second presentment. + * * `PREARBITRATION` - Case has entered prearbitration. + * * `ARBITRATION` - Case has entered arbitration. + * * `CASE_WON` - Case was won and credit will be issued. + * * `CASE_CLOSED` - Case was lost or withdrawn. + */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -4184,17 +1532,35 @@ private constructor( companion object { - @JvmField val OPEN = of("OPEN") + @JvmField val ARBITRATION = of("ARBITRATION") + + @JvmField val CASE_CLOSED = of("CASE_CLOSED") + + @JvmField val CASE_WON = of("CASE_WON") - @JvmField val CLOSED = of("CLOSED") + @JvmField val NEW = of("NEW") + + @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") + + @JvmField val PREARBITRATION = of("PREARBITRATION") + + @JvmField val REPRESENTMENT = of("REPRESENTMENT") + + @JvmField val SUBMITTED = of("SUBMITTED") @JvmStatic fun of(value: String) = Status(JsonField.of(value)) } /** An enum containing [Status]'s known values. */ enum class Known { - OPEN, - CLOSED, + ARBITRATION, + CASE_CLOSED, + CASE_WON, + NEW, + PENDING_CUSTOMER, + PREARBITRATION, + REPRESENTMENT, + SUBMITTED, } /** @@ -4207,8 +1573,14 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - OPEN, - CLOSED, + ARBITRATION, + CASE_CLOSED, + CASE_WON, + NEW, + PENDING_CUSTOMER, + PREARBITRATION, + REPRESENTMENT, + SUBMITTED, /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } @@ -4222,8 +1594,14 @@ private constructor( */ fun value(): Value = when (this) { - OPEN -> Value.OPEN - CLOSED -> Value.CLOSED + ARBITRATION -> Value.ARBITRATION + CASE_CLOSED -> Value.CASE_CLOSED + CASE_WON -> Value.CASE_WON + NEW -> Value.NEW + PENDING_CUSTOMER -> Value.PENDING_CUSTOMER + PREARBITRATION -> Value.PREARBITRATION + REPRESENTMENT -> Value.REPRESENTMENT + SUBMITTED -> Value.SUBMITTED else -> Value._UNKNOWN } @@ -4238,8 +1616,14 @@ private constructor( */ fun known(): Known = when (this) { - OPEN -> Known.OPEN - CLOSED -> Known.CLOSED + ARBITRATION -> Known.ARBITRATION + CASE_CLOSED -> Known.CASE_CLOSED + CASE_WON -> Known.CASE_WON + NEW -> Known.NEW + PENDING_CUSTOMER -> Known.PENDING_CUSTOMER + PREARBITRATION -> Known.PREARBITRATION + REPRESENTMENT -> Known.REPRESENTMENT + SUBMITTED -> Known.SUBMITTED else -> throw LithicInvalidDataException("Unknown Status: $value") } @@ -4295,411 +1679,6 @@ private constructor( override fun toString() = value.toString() } - /** - * Contains identifiers for the transaction and specific event within being disputed; null if no - * transaction can be identified - */ - class TransactionSeries - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val relatedTransactionEventToken: JsonField, - private val relatedTransactionToken: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - relatedTransactionEventToken: JsonField = JsonMissing.of(), - @JsonProperty("related_transaction_token") - @ExcludeMissing - relatedTransactionToken: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(relatedTransactionEventToken, relatedTransactionToken, type, mutableMapOf()) - - /** - * Token of the specific event in the original transaction being disputed, in UUID format; - * null if no event can be identified - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun relatedTransactionEventToken(): Optional = - relatedTransactionEventToken.getOptional("related_transaction_event_token") - - /** - * Token of the original 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 relatedTransactionToken(): String = - relatedTransactionToken.getRequired("related_transaction_token") - - /** - * The type of transaction series associating the dispute and the original transaction. - * Always set to DISPUTE - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun type(): Type = type.getRequired("type") - - /** - * Returns the raw JSON value of [relatedTransactionEventToken]. - * - * Unlike [relatedTransactionEventToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_transaction_event_token") - @ExcludeMissing - fun _relatedTransactionEventToken(): JsonField = relatedTransactionEventToken - - /** - * Returns the raw JSON value of [relatedTransactionToken]. - * - * Unlike [relatedTransactionToken], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("related_transaction_token") - @ExcludeMissing - fun _relatedTransactionToken(): JsonField = relatedTransactionToken - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [TransactionSeries]. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [TransactionSeries]. */ - class Builder internal constructor() { - - private var relatedTransactionEventToken: JsonField? = null - private var relatedTransactionToken: JsonField? = null - private var type: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(transactionSeries: TransactionSeries) = apply { - relatedTransactionEventToken = transactionSeries.relatedTransactionEventToken - relatedTransactionToken = transactionSeries.relatedTransactionToken - type = transactionSeries.type - additionalProperties = transactionSeries.additionalProperties.toMutableMap() - } - - /** - * Token of the specific event in the original transaction being disputed, in UUID - * format; null if no event can be identified - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: String?) = - relatedTransactionEventToken(JsonField.ofNullable(relatedTransactionEventToken)) - - /** - * Alias for calling [Builder.relatedTransactionEventToken] with - * `relatedTransactionEventToken.orElse(null)`. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: Optional) = - relatedTransactionEventToken(relatedTransactionEventToken.getOrNull()) - - /** - * Sets [Builder.relatedTransactionEventToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionEventToken] with a well-typed - * [String] value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun relatedTransactionEventToken(relatedTransactionEventToken: JsonField) = - apply { - this.relatedTransactionEventToken = relatedTransactionEventToken - } - - /** Token of the original transaction being disputed, in UUID format */ - fun relatedTransactionToken(relatedTransactionToken: String) = - relatedTransactionToken(JsonField.of(relatedTransactionToken)) - - /** - * Sets [Builder.relatedTransactionToken] to an arbitrary JSON value. - * - * You should usually call [Builder.relatedTransactionToken] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun relatedTransactionToken(relatedTransactionToken: JsonField) = apply { - this.relatedTransactionToken = relatedTransactionToken - } - - /** - * The type of transaction series associating the dispute and the original transaction. - * Always set to DISPUTE - */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [TransactionSeries]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .relatedTransactionEventToken() - * .relatedTransactionToken() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): TransactionSeries = - TransactionSeries( - checkRequired("relatedTransactionEventToken", relatedTransactionEventToken), - checkRequired("relatedTransactionToken", relatedTransactionToken), - checkRequired("type", type), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): TransactionSeries = apply { - if (validated) { - return@apply - } - - relatedTransactionEventToken() - relatedTransactionToken() - type().validate() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (relatedTransactionEventToken.asKnown().isPresent) 1 else 0) + - (if (relatedTransactionToken.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * The type of transaction series associating the dispute and the original transaction. - * Always set to DISPUTE - */ - 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 DISPUTE = of("DISPUTE") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - DISPUTE - } - - /** - * 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 { - DISPUTE, - /** 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) { - DISPUTE -> Value.DISPUTE - 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) { - DISPUTE -> Known.DISPUTE - else -> throw LithicInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TransactionSeries && - relatedTransactionEventToken == other.relatedTransactionEventToken && - relatedTransactionToken == other.relatedTransactionToken && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - relatedTransactionEventToken, - relatedTransactionToken, - type, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "TransactionSeries{relatedTransactionEventToken=$relatedTransactionEventToken, relatedTransactionToken=$relatedTransactionToken, type=$type, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -4707,38 +1686,46 @@ private constructor( return other is Dispute && token == other.token && - accountToken == other.accountToken && - cardToken == other.cardToken && - caseId == other.caseId && + amount == other.amount && + arbitrationDate == other.arbitrationDate && created == other.created && - currency == other.currency && - disposition == other.disposition && - events == other.events && - liabilityAllocation == other.liabilityAllocation && - merchant == other.merchant && - network == other.network && + customerFiledDate == other.customerFiledDate && + customerNote == other.customerNote && + networkClaimIds == other.networkClaimIds && + networkFiledDate == other.networkFiledDate && + networkReasonCode == other.networkReasonCode && + prearbitrationDate == other.prearbitrationDate && + primaryClaimId == other.primaryClaimId && + reason == other.reason && + representmentDate == other.representmentDate && + resolutionDate == other.resolutionDate && + resolutionNote == other.resolutionNote && + resolutionReason == other.resolutionReason && status == other.status && - transactionSeries == other.transactionSeries && - updated == other.updated && + transactionToken == other.transactionToken && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( token, - accountToken, - cardToken, - caseId, + amount, + arbitrationDate, created, - currency, - disposition, - events, - liabilityAllocation, - merchant, - network, + customerFiledDate, + customerNote, + networkClaimIds, + networkFiledDate, + networkReasonCode, + prearbitrationDate, + primaryClaimId, + reason, + representmentDate, + resolutionDate, + resolutionNote, + resolutionReason, status, - transactionSeries, - updated, + transactionToken, additionalProperties, ) } @@ -4746,5 +1733,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Dispute{token=$token, accountToken=$accountToken, cardToken=$cardToken, caseId=$caseId, created=$created, currency=$currency, disposition=$disposition, events=$events, liabilityAllocation=$liabilityAllocation, merchant=$merchant, network=$network, status=$status, transactionSeries=$transactionSeries, updated=$updated, additionalProperties=$additionalProperties}" + "Dispute{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateResponse.kt deleted file mode 100644 index f2a4c74ee..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateResponse.kt +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 - -/** Dispute. */ -class DisputeCreateResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, - private val created: JsonField, - private val customerFiledDate: JsonField, - private val customerNote: JsonField, - private val networkClaimIds: JsonField>, - private val networkFiledDate: JsonField, - private val networkReasonCode: JsonField, - private val prearbitrationDate: JsonField, - private val primaryClaimId: JsonField, - private val reason: JsonField, - private val representmentDate: JsonField, - private val resolutionDate: JsonField, - private val resolutionNote: JsonField, - private val resolutionReason: JsonField, - private val status: JsonField, - private val transactionToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("arbitration_date") - @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("customer_filed_date") - @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") - @ExcludeMissing - customerNote: JsonField = JsonMissing.of(), - @JsonProperty("network_claim_ids") - @ExcludeMissing - networkClaimIds: JsonField> = JsonMissing.of(), - @JsonProperty("network_filed_date") - @ExcludeMissing - networkFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("network_reason_code") - @ExcludeMissing - networkReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("prearbitration_date") - @ExcludeMissing - prearbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("primary_claim_id") - @ExcludeMissing - primaryClaimId: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - @JsonProperty("representment_date") - @ExcludeMissing - representmentDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_date") - @ExcludeMissing - resolutionDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_note") - @ExcludeMissing - resolutionNote: JsonField = JsonMissing.of(), - @JsonProperty("resolution_reason") - @ExcludeMissing - resolutionReason: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_token") - @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @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") - - /** - * Amount under dispute. May be different from the original transaction amount. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Date dispute entered arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun arbitrationDate(): Optional = - arbitrationDate.getOptional("arbitration_date") - - /** - * Timestamp of when first Dispute was reported. - * - * @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") - - /** - * Date that the dispute was filed by the customer making the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerFiledDate(): Optional = - customerFiledDate.getOptional("customer_filed_date") - - /** - * End customer description of the reason for the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerNote(): Optional = customerNote.getOptional("customer_note") - - /** - * Unique identifiers for the dispute from the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") - - /** - * Date that the dispute was submitted to the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") - - /** - * Network reason code used to file the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") - - /** - * Date dispute entered pre-arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun prearbitrationDate(): Optional = - prearbitrationDate.getOptional("prearbitration_date") - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - * - * @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") - - /** - * Date the representment was received. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") - - /** - * Date that the dispute was resolved. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") - - /** - * Note by Dispute team on the case resolution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionReason(): Optional = - resolutionReason.getOptional("resolution_reason") - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - * - * @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") - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. - * - * @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 [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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [arbitrationDate]. - * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("arbitration_date") - @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate - - /** - * 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 [customerFiledDate]. - * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate - - /** - * Returns the raw JSON value of [customerNote]. - * - * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote - - /** - * Returns the raw JSON value of [networkClaimIds]. - * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds - - /** - * Returns the raw JSON value of [networkFiledDate]. - * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_filed_date") - @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate - - /** - * Returns the raw JSON value of [networkReasonCode]. - * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode - - /** - * Returns the raw JSON value of [prearbitrationDate]. - * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("prearbitration_date") - @ExcludeMissing - fun _prearbitrationDate(): JsonField = prearbitrationDate - - /** - * Returns the raw JSON value of [primaryClaimId]. - * - * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("primary_claim_id") - @ExcludeMissing - fun _primaryClaimId(): JsonField = primaryClaimId - - /** - * 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 [representmentDate]. - * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate - - /** - * Returns the raw JSON value of [resolutionDate]. - * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate - - /** - * Returns the raw JSON value of [resolutionNote]. - * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote - - /** - * Returns the raw JSON value of [resolutionReason]. - * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("resolution_reason") - @ExcludeMissing - fun _resolutionReason(): JsonField = resolutionReason - - /** - * 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 [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 [DisputeCreateResponse]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DisputeCreateResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null - private var created: JsonField? = null - private var customerFiledDate: JsonField? = null - private var customerNote: JsonField? = null - private var networkClaimIds: JsonField>? = null - private var networkFiledDate: JsonField? = null - private var networkReasonCode: JsonField? = null - private var prearbitrationDate: JsonField? = null - private var primaryClaimId: JsonField? = null - private var reason: JsonField? = null - private var representmentDate: JsonField? = null - private var resolutionDate: JsonField? = null - private var resolutionNote: JsonField? = null - private var resolutionReason: JsonField? = null - private var status: JsonField? = null - private var transactionToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(disputeCreateResponse: DisputeCreateResponse) = apply { - token = disputeCreateResponse.token - amount = disputeCreateResponse.amount - arbitrationDate = disputeCreateResponse.arbitrationDate - created = disputeCreateResponse.created - customerFiledDate = disputeCreateResponse.customerFiledDate - customerNote = disputeCreateResponse.customerNote - networkClaimIds = disputeCreateResponse.networkClaimIds.map { it.toMutableList() } - networkFiledDate = disputeCreateResponse.networkFiledDate - networkReasonCode = disputeCreateResponse.networkReasonCode - prearbitrationDate = disputeCreateResponse.prearbitrationDate - primaryClaimId = disputeCreateResponse.primaryClaimId - reason = disputeCreateResponse.reason - representmentDate = disputeCreateResponse.representmentDate - resolutionDate = disputeCreateResponse.resolutionDate - resolutionNote = disputeCreateResponse.resolutionNote - resolutionReason = disputeCreateResponse.resolutionReason - status = disputeCreateResponse.status - transactionToken = disputeCreateResponse.transactionToken - additionalProperties = disputeCreateResponse.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** Amount under dispute. May be different from the original transaction amount. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) - - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) - - /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } - - /** Timestamp of when first Dispute was reported. */ - 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 } - - /** Date that the dispute was filed by the customer making the dispute. */ - fun customerFiledDate(customerFiledDate: OffsetDateTime?) = - customerFiledDate(JsonField.ofNullable(customerFiledDate)) - - /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ - fun customerFiledDate(customerFiledDate: Optional) = - customerFiledDate(customerFiledDate.getOrNull()) - - /** - * Sets [Builder.customerFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun customerFiledDate(customerFiledDate: JsonField) = apply { - this.customerFiledDate = customerFiledDate - } - - /** End customer description of the reason for the dispute. */ - fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - - /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ - fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) - - /** - * Sets [Builder.customerNote] to an arbitrary JSON value. - * - * You should usually call [Builder.customerNote] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } - - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) - - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) - - /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. - * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [networkClaimIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addNetworkClaimId(networkClaimId: String) = apply { - networkClaimIds = - (networkClaimIds ?: JsonField.of(mutableListOf())).also { - checkKnown("networkClaimIds", it).add(networkClaimId) - } - } - - /** Date that the dispute was submitted to the network. */ - fun networkFiledDate(networkFiledDate: OffsetDateTime?) = - networkFiledDate(JsonField.ofNullable(networkFiledDate)) - - /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ - fun networkFiledDate(networkFiledDate: Optional) = - networkFiledDate(networkFiledDate.getOrNull()) - - /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate - } - - /** Network reason code used to file the dispute. */ - fun networkReasonCode(networkReasonCode: String?) = - networkReasonCode(JsonField.ofNullable(networkReasonCode)) - - /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ - fun networkReasonCode(networkReasonCode: Optional) = - networkReasonCode(networkReasonCode.getOrNull()) - - /** - * Sets [Builder.networkReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.networkReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode - } - - /** Date dispute entered pre-arbitration. */ - fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = - prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - - /** - * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. - */ - fun prearbitrationDate(prearbitrationDate: Optional) = - prearbitrationDate(prearbitrationDate.getOrNull()) - - /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate - } - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be - * the first claim id set by the network - */ - fun primaryClaimId(primaryClaimId: String?) = - primaryClaimId(JsonField.ofNullable(primaryClaimId)) - - /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ - fun primaryClaimId(primaryClaimId: Optional) = - primaryClaimId(primaryClaimId.getOrNull()) - - /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryClaimId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant - * activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 } - - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) - - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) - - /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. - * - * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun representmentDate(representmentDate: JsonField) = apply { - this.representmentDate = representmentDate - } - - /** Date that the dispute was resolved. */ - fun resolutionDate(resolutionDate: OffsetDateTime?) = - resolutionDate(JsonField.ofNullable(resolutionDate)) - - /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ - fun resolutionDate(resolutionDate: Optional) = - resolutionDate(resolutionDate.getOrNull()) - - /** - * Sets [Builder.resolutionDate] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } - - /** Note by Dispute team on the case resolution. */ - fun resolutionNote(resolutionNote: String?) = - resolutionNote(JsonField.ofNullable(resolutionNote)) - - /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ - fun resolutionNote(resolutionNote: Optional) = - resolutionNote(resolutionNote.getOrNull()) - - /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionNote] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionNote(resolutionNote: JsonField) = apply { - this.resolutionNote = resolutionNote - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - fun resolutionReason(resolutionReason: ResolutionReason?) = - resolutionReason(JsonField.ofNullable(resolutionReason)) - - /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ - fun resolutionReason(resolutionReason: Optional) = - resolutionReason(resolutionReason.getOrNull()) - - /** - * Sets [Builder.resolutionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 } - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may - * have multiple dispute cases. - */ - 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 [DisputeCreateResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DisputeCreateResponse = - DisputeCreateResponse( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), - checkRequired("created", created), - checkRequired("customerFiledDate", customerFiledDate), - checkRequired("customerNote", customerNote), - checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, - checkRequired("networkFiledDate", networkFiledDate), - checkRequired("networkReasonCode", networkReasonCode), - checkRequired("prearbitrationDate", prearbitrationDate), - checkRequired("primaryClaimId", primaryClaimId), - checkRequired("reason", reason), - checkRequired("representmentDate", representmentDate), - checkRequired("resolutionDate", resolutionDate), - checkRequired("resolutionNote", resolutionNote), - checkRequired("resolutionReason", resolutionReason), - checkRequired("status", status), - checkRequired("transactionToken", transactionToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DisputeCreateResponse = apply { - if (validated) { - return@apply - } - - token() - amount() - arbitrationDate() - created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - 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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (arbitrationDate.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (customerFiledDate.asKnown().isPresent) 1 else 0) + - (if (customerNote.asKnown().isPresent) 1 else 0) + - (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + - (if (networkFiledDate.asKnown().isPresent) 1 else 0) + - (if (networkReasonCode.asKnown().isPresent) 1 else 0) + - (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + - (if (primaryClaimId.asKnown().isPresent) 1 else 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (representmentDate.asKnown().isPresent) 1 else 0) + - (if (resolutionDate.asKnown().isPresent) 1 else 0) + - (if (resolutionNote.asKnown().isPresent) 1 else 0) + - (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionToken.asKnown().isPresent) 1 else 0) - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") - - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") - - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") - - @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") - - @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") - - @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") - - @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") - - @JvmField val MISSING_AUTH = of("MISSING_AUTH") - - @JvmField val OTHER = of("OTHER") - - @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") - - @JvmField - val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - } - - /** - * 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 { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - /** 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) { - ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE - CANCELLED -> Value.CANCELLED - DUPLICATED -> Value.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Value.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT - MISSING_AUTH -> Value.MISSING_AUTH - OTHER -> Value.OTHER - PROCESSING_ERROR -> Value.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED - 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) { - ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE - CANCELLED -> Known.CANCELLED - DUPLICATED -> Known.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Known.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT - MISSING_AUTH -> Known.MISSING_AUTH - OTHER -> Known.OTHER - PROCESSING_ERROR -> Known.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED - else -> throw LithicInvalidDataException("Unknown Reason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Reason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Reason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - class ResolutionReason @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 CASE_LOST = of("CASE_LOST") - - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - - @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - - @JvmField - val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - - @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - - @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - - @JvmField - val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - - @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - - @JvmField val REFUNDED = of("REFUNDED") - - @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) - } - - /** An enum containing [ResolutionReason]'s known values. */ - enum class Known { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - } - - /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ResolutionReason] 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 { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - /** - * An enum member indicating that [ResolutionReason] 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) { - CASE_LOST -> Value.CASE_LOST - NETWORK_REJECTED -> Value.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Value.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER - REFUNDED -> Value.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Value.WITHDRAWN - WON_ARBITRATION -> Value.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Value.WON_PREARBITRATION - 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) { - CASE_LOST -> Known.CASE_LOST - NETWORK_REJECTED -> Known.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Known.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER - REFUNDED -> Known.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Known.WITHDRAWN - WON_ARBITRATION -> Known.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Known.WON_PREARBITRATION - else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ResolutionReason = 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 ResolutionReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") - - @JvmField val NEW = of("NEW") - - @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val SUBMITTED = of("SUBMITTED") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - } - - /** - * 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 { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - /** 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) { - ARBITRATION -> Value.ARBITRATION - CASE_CLOSED -> Value.CASE_CLOSED - CASE_WON -> Value.CASE_WON - NEW -> Value.NEW - PENDING_CUSTOMER -> Value.PENDING_CUSTOMER - PREARBITRATION -> Value.PREARBITRATION - REPRESENTMENT -> Value.REPRESENTMENT - SUBMITTED -> Value.SUBMITTED - 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) { - ARBITRATION -> Known.ARBITRATION - CASE_CLOSED -> Known.CASE_CLOSED - CASE_WON -> Known.CASE_WON - NEW -> Known.NEW - PENDING_CUSTOMER -> Known.PENDING_CUSTOMER - PREARBITRATION -> Known.PREARBITRATION - REPRESENTMENT -> Known.REPRESENTMENT - SUBMITTED -> Known.SUBMITTED - 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 - - 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 DisputeCreateResponse && - token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && - created == other.created && - customerFiledDate == other.customerFiledDate && - customerNote == other.customerNote && - networkClaimIds == other.networkClaimIds && - networkFiledDate == other.networkFiledDate && - networkReasonCode == other.networkReasonCode && - prearbitrationDate == other.prearbitrationDate && - primaryClaimId == other.primaryClaimId && - reason == other.reason && - representmentDate == other.representmentDate && - resolutionDate == other.resolutionDate && - resolutionNote == other.resolutionNote && - resolutionReason == other.resolutionReason && - status == other.status && - transactionToken == other.transactionToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DisputeCreateResponse{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteResponse.kt deleted file mode 100644 index e937fecf5..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteResponse.kt +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 - -/** Dispute. */ -class DisputeDeleteResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, - private val created: JsonField, - private val customerFiledDate: JsonField, - private val customerNote: JsonField, - private val networkClaimIds: JsonField>, - private val networkFiledDate: JsonField, - private val networkReasonCode: JsonField, - private val prearbitrationDate: JsonField, - private val primaryClaimId: JsonField, - private val reason: JsonField, - private val representmentDate: JsonField, - private val resolutionDate: JsonField, - private val resolutionNote: JsonField, - private val resolutionReason: JsonField, - private val status: JsonField, - private val transactionToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("arbitration_date") - @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("customer_filed_date") - @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") - @ExcludeMissing - customerNote: JsonField = JsonMissing.of(), - @JsonProperty("network_claim_ids") - @ExcludeMissing - networkClaimIds: JsonField> = JsonMissing.of(), - @JsonProperty("network_filed_date") - @ExcludeMissing - networkFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("network_reason_code") - @ExcludeMissing - networkReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("prearbitration_date") - @ExcludeMissing - prearbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("primary_claim_id") - @ExcludeMissing - primaryClaimId: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - @JsonProperty("representment_date") - @ExcludeMissing - representmentDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_date") - @ExcludeMissing - resolutionDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_note") - @ExcludeMissing - resolutionNote: JsonField = JsonMissing.of(), - @JsonProperty("resolution_reason") - @ExcludeMissing - resolutionReason: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_token") - @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @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") - - /** - * Amount under dispute. May be different from the original transaction amount. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Date dispute entered arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun arbitrationDate(): Optional = - arbitrationDate.getOptional("arbitration_date") - - /** - * Timestamp of when first Dispute was reported. - * - * @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") - - /** - * Date that the dispute was filed by the customer making the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerFiledDate(): Optional = - customerFiledDate.getOptional("customer_filed_date") - - /** - * End customer description of the reason for the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerNote(): Optional = customerNote.getOptional("customer_note") - - /** - * Unique identifiers for the dispute from the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") - - /** - * Date that the dispute was submitted to the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") - - /** - * Network reason code used to file the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") - - /** - * Date dispute entered pre-arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun prearbitrationDate(): Optional = - prearbitrationDate.getOptional("prearbitration_date") - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - * - * @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") - - /** - * Date the representment was received. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") - - /** - * Date that the dispute was resolved. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") - - /** - * Note by Dispute team on the case resolution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionReason(): Optional = - resolutionReason.getOptional("resolution_reason") - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - * - * @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") - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. - * - * @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 [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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [arbitrationDate]. - * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("arbitration_date") - @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate - - /** - * 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 [customerFiledDate]. - * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate - - /** - * Returns the raw JSON value of [customerNote]. - * - * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote - - /** - * Returns the raw JSON value of [networkClaimIds]. - * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds - - /** - * Returns the raw JSON value of [networkFiledDate]. - * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_filed_date") - @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate - - /** - * Returns the raw JSON value of [networkReasonCode]. - * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode - - /** - * Returns the raw JSON value of [prearbitrationDate]. - * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("prearbitration_date") - @ExcludeMissing - fun _prearbitrationDate(): JsonField = prearbitrationDate - - /** - * Returns the raw JSON value of [primaryClaimId]. - * - * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("primary_claim_id") - @ExcludeMissing - fun _primaryClaimId(): JsonField = primaryClaimId - - /** - * 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 [representmentDate]. - * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate - - /** - * Returns the raw JSON value of [resolutionDate]. - * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate - - /** - * Returns the raw JSON value of [resolutionNote]. - * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote - - /** - * Returns the raw JSON value of [resolutionReason]. - * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("resolution_reason") - @ExcludeMissing - fun _resolutionReason(): JsonField = resolutionReason - - /** - * 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 [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 [DisputeDeleteResponse]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DisputeDeleteResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null - private var created: JsonField? = null - private var customerFiledDate: JsonField? = null - private var customerNote: JsonField? = null - private var networkClaimIds: JsonField>? = null - private var networkFiledDate: JsonField? = null - private var networkReasonCode: JsonField? = null - private var prearbitrationDate: JsonField? = null - private var primaryClaimId: JsonField? = null - private var reason: JsonField? = null - private var representmentDate: JsonField? = null - private var resolutionDate: JsonField? = null - private var resolutionNote: JsonField? = null - private var resolutionReason: JsonField? = null - private var status: JsonField? = null - private var transactionToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(disputeDeleteResponse: DisputeDeleteResponse) = apply { - token = disputeDeleteResponse.token - amount = disputeDeleteResponse.amount - arbitrationDate = disputeDeleteResponse.arbitrationDate - created = disputeDeleteResponse.created - customerFiledDate = disputeDeleteResponse.customerFiledDate - customerNote = disputeDeleteResponse.customerNote - networkClaimIds = disputeDeleteResponse.networkClaimIds.map { it.toMutableList() } - networkFiledDate = disputeDeleteResponse.networkFiledDate - networkReasonCode = disputeDeleteResponse.networkReasonCode - prearbitrationDate = disputeDeleteResponse.prearbitrationDate - primaryClaimId = disputeDeleteResponse.primaryClaimId - reason = disputeDeleteResponse.reason - representmentDate = disputeDeleteResponse.representmentDate - resolutionDate = disputeDeleteResponse.resolutionDate - resolutionNote = disputeDeleteResponse.resolutionNote - resolutionReason = disputeDeleteResponse.resolutionReason - status = disputeDeleteResponse.status - transactionToken = disputeDeleteResponse.transactionToken - additionalProperties = disputeDeleteResponse.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** Amount under dispute. May be different from the original transaction amount. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) - - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) - - /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } - - /** Timestamp of when first Dispute was reported. */ - 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 } - - /** Date that the dispute was filed by the customer making the dispute. */ - fun customerFiledDate(customerFiledDate: OffsetDateTime?) = - customerFiledDate(JsonField.ofNullable(customerFiledDate)) - - /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ - fun customerFiledDate(customerFiledDate: Optional) = - customerFiledDate(customerFiledDate.getOrNull()) - - /** - * Sets [Builder.customerFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun customerFiledDate(customerFiledDate: JsonField) = apply { - this.customerFiledDate = customerFiledDate - } - - /** End customer description of the reason for the dispute. */ - fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - - /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ - fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) - - /** - * Sets [Builder.customerNote] to an arbitrary JSON value. - * - * You should usually call [Builder.customerNote] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } - - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) - - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) - - /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. - * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [networkClaimIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addNetworkClaimId(networkClaimId: String) = apply { - networkClaimIds = - (networkClaimIds ?: JsonField.of(mutableListOf())).also { - checkKnown("networkClaimIds", it).add(networkClaimId) - } - } - - /** Date that the dispute was submitted to the network. */ - fun networkFiledDate(networkFiledDate: OffsetDateTime?) = - networkFiledDate(JsonField.ofNullable(networkFiledDate)) - - /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ - fun networkFiledDate(networkFiledDate: Optional) = - networkFiledDate(networkFiledDate.getOrNull()) - - /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate - } - - /** Network reason code used to file the dispute. */ - fun networkReasonCode(networkReasonCode: String?) = - networkReasonCode(JsonField.ofNullable(networkReasonCode)) - - /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ - fun networkReasonCode(networkReasonCode: Optional) = - networkReasonCode(networkReasonCode.getOrNull()) - - /** - * Sets [Builder.networkReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.networkReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode - } - - /** Date dispute entered pre-arbitration. */ - fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = - prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - - /** - * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. - */ - fun prearbitrationDate(prearbitrationDate: Optional) = - prearbitrationDate(prearbitrationDate.getOrNull()) - - /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate - } - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be - * the first claim id set by the network - */ - fun primaryClaimId(primaryClaimId: String?) = - primaryClaimId(JsonField.ofNullable(primaryClaimId)) - - /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ - fun primaryClaimId(primaryClaimId: Optional) = - primaryClaimId(primaryClaimId.getOrNull()) - - /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryClaimId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant - * activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 } - - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) - - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) - - /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. - * - * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun representmentDate(representmentDate: JsonField) = apply { - this.representmentDate = representmentDate - } - - /** Date that the dispute was resolved. */ - fun resolutionDate(resolutionDate: OffsetDateTime?) = - resolutionDate(JsonField.ofNullable(resolutionDate)) - - /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ - fun resolutionDate(resolutionDate: Optional) = - resolutionDate(resolutionDate.getOrNull()) - - /** - * Sets [Builder.resolutionDate] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } - - /** Note by Dispute team on the case resolution. */ - fun resolutionNote(resolutionNote: String?) = - resolutionNote(JsonField.ofNullable(resolutionNote)) - - /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ - fun resolutionNote(resolutionNote: Optional) = - resolutionNote(resolutionNote.getOrNull()) - - /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionNote] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionNote(resolutionNote: JsonField) = apply { - this.resolutionNote = resolutionNote - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - fun resolutionReason(resolutionReason: ResolutionReason?) = - resolutionReason(JsonField.ofNullable(resolutionReason)) - - /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ - fun resolutionReason(resolutionReason: Optional) = - resolutionReason(resolutionReason.getOrNull()) - - /** - * Sets [Builder.resolutionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 } - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may - * have multiple dispute cases. - */ - 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 [DisputeDeleteResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DisputeDeleteResponse = - DisputeDeleteResponse( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), - checkRequired("created", created), - checkRequired("customerFiledDate", customerFiledDate), - checkRequired("customerNote", customerNote), - checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, - checkRequired("networkFiledDate", networkFiledDate), - checkRequired("networkReasonCode", networkReasonCode), - checkRequired("prearbitrationDate", prearbitrationDate), - checkRequired("primaryClaimId", primaryClaimId), - checkRequired("reason", reason), - checkRequired("representmentDate", representmentDate), - checkRequired("resolutionDate", resolutionDate), - checkRequired("resolutionNote", resolutionNote), - checkRequired("resolutionReason", resolutionReason), - checkRequired("status", status), - checkRequired("transactionToken", transactionToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DisputeDeleteResponse = apply { - if (validated) { - return@apply - } - - token() - amount() - arbitrationDate() - created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - 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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (arbitrationDate.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (customerFiledDate.asKnown().isPresent) 1 else 0) + - (if (customerNote.asKnown().isPresent) 1 else 0) + - (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + - (if (networkFiledDate.asKnown().isPresent) 1 else 0) + - (if (networkReasonCode.asKnown().isPresent) 1 else 0) + - (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + - (if (primaryClaimId.asKnown().isPresent) 1 else 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (representmentDate.asKnown().isPresent) 1 else 0) + - (if (resolutionDate.asKnown().isPresent) 1 else 0) + - (if (resolutionNote.asKnown().isPresent) 1 else 0) + - (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionToken.asKnown().isPresent) 1 else 0) - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") - - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") - - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") - - @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") - - @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") - - @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") - - @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") - - @JvmField val MISSING_AUTH = of("MISSING_AUTH") - - @JvmField val OTHER = of("OTHER") - - @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") - - @JvmField - val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - } - - /** - * 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 { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - /** 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) { - ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE - CANCELLED -> Value.CANCELLED - DUPLICATED -> Value.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Value.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT - MISSING_AUTH -> Value.MISSING_AUTH - OTHER -> Value.OTHER - PROCESSING_ERROR -> Value.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED - 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) { - ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE - CANCELLED -> Known.CANCELLED - DUPLICATED -> Known.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Known.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT - MISSING_AUTH -> Known.MISSING_AUTH - OTHER -> Known.OTHER - PROCESSING_ERROR -> Known.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED - else -> throw LithicInvalidDataException("Unknown Reason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Reason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Reason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - class ResolutionReason @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 CASE_LOST = of("CASE_LOST") - - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - - @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - - @JvmField - val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - - @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - - @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - - @JvmField - val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - - @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - - @JvmField val REFUNDED = of("REFUNDED") - - @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) - } - - /** An enum containing [ResolutionReason]'s known values. */ - enum class Known { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - } - - /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ResolutionReason] 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 { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - /** - * An enum member indicating that [ResolutionReason] 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) { - CASE_LOST -> Value.CASE_LOST - NETWORK_REJECTED -> Value.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Value.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER - REFUNDED -> Value.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Value.WITHDRAWN - WON_ARBITRATION -> Value.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Value.WON_PREARBITRATION - 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) { - CASE_LOST -> Known.CASE_LOST - NETWORK_REJECTED -> Known.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Known.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER - REFUNDED -> Known.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Known.WITHDRAWN - WON_ARBITRATION -> Known.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Known.WON_PREARBITRATION - else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ResolutionReason = 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 ResolutionReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") - - @JvmField val NEW = of("NEW") - - @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val SUBMITTED = of("SUBMITTED") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - } - - /** - * 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 { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - /** 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) { - ARBITRATION -> Value.ARBITRATION - CASE_CLOSED -> Value.CASE_CLOSED - CASE_WON -> Value.CASE_WON - NEW -> Value.NEW - PENDING_CUSTOMER -> Value.PENDING_CUSTOMER - PREARBITRATION -> Value.PREARBITRATION - REPRESENTMENT -> Value.REPRESENTMENT - SUBMITTED -> Value.SUBMITTED - 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) { - ARBITRATION -> Known.ARBITRATION - CASE_CLOSED -> Known.CASE_CLOSED - CASE_WON -> Known.CASE_WON - NEW -> Known.NEW - PENDING_CUSTOMER -> Known.PENDING_CUSTOMER - PREARBITRATION -> Known.PREARBITRATION - REPRESENTMENT -> Known.REPRESENTMENT - SUBMITTED -> Known.SUBMITTED - 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 - - 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 DisputeDeleteResponse && - token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && - created == other.created && - customerFiledDate == other.customerFiledDate && - customerNote == other.customerNote && - networkClaimIds == other.networkClaimIds && - networkFiledDate == other.networkFiledDate && - networkReasonCode == other.networkReasonCode && - prearbitrationDate == other.prearbitrationDate && - primaryClaimId == other.primaryClaimId && - reason == other.reason && - representmentDate == other.representmentDate && - resolutionDate == other.resolutionDate && - resolutionNote == other.resolutionNote && - resolutionReason == other.resolutionReason && - status == other.status && - transactionToken == other.transactionToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DisputeDeleteResponse{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPage.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPage.kt index 926073a37..4de6619a6 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPage.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPage.kt @@ -16,15 +16,14 @@ private constructor( private val service: DisputeService, private val params: DisputeListParams, private val response: DisputeListPageResponse, -) : Page { +) : Page { /** * Delegates to [DisputeListPageResponse], but gracefully handles missing data. * * @see DisputeListPageResponse.data */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() /** * Delegates to [DisputeListPageResponse], but gracefully handles missing data. @@ -33,7 +32,7 @@ private constructor( */ fun hasMore(): Optional = response._hasMore().getOptional("has_more") - override fun items(): List = data() + override fun items(): List = data() override fun hasNextPage(): Boolean = items().isNotEmpty() @@ -46,7 +45,7 @@ private constructor( override fun nextPage(): DisputeListPage = service.list(nextPageParams()) - fun autoPager(): AutoPager = AutoPager.from(this) + fun autoPager(): AutoPager = AutoPager.from(this) /** The parameters that were used to request this page. */ fun params(): DisputeListParams = params diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageAsync.kt index 2615283a1..b4ff65c7d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageAsync.kt @@ -19,15 +19,14 @@ private constructor( private val streamHandlerExecutor: Executor, private val params: DisputeListParams, private val response: DisputeListPageResponse, -) : PageAsync { +) : PageAsync { /** * Delegates to [DisputeListPageResponse], but gracefully handles missing data. * * @see DisputeListPageResponse.data */ - fun data(): List = - response._data().getOptional("data").getOrNull() ?: emptyList() + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() /** * Delegates to [DisputeListPageResponse], but gracefully handles missing data. @@ -36,7 +35,7 @@ private constructor( */ fun hasMore(): Optional = response._hasMore().getOptional("has_more") - override fun items(): List = data() + override fun items(): List = data() override fun hasNextPage(): Boolean = items().isNotEmpty() @@ -50,8 +49,7 @@ private constructor( override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - fun autoPager(): AutoPagerAsync = - AutoPagerAsync.from(this, streamHandlerExecutor) + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) /** The parameters that were used to request this page. */ fun params(): DisputeListParams = params diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageResponse.kt index 5f5a40873..0c62813b9 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListPageResponse.kt @@ -21,16 +21,14 @@ import kotlin.jvm.optionals.getOrNull class DisputeListPageResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val data: JsonField>, + private val data: JsonField>, private val hasMore: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("data") - @ExcludeMissing - data: JsonField> = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), @JsonProperty("has_more") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), ) : this(data, hasMore, mutableMapOf()) @@ -38,7 +36,7 @@ private constructor( * @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 data(): List = data.getRequired("data") + fun data(): List = data.getRequired("data") /** * More data exists. @@ -53,7 +51,7 @@ private constructor( * * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data /** * Returns the raw JSON value of [hasMore]. @@ -91,7 +89,7 @@ private constructor( /** A builder for [DisputeListPageResponse]. */ class Builder internal constructor() { - private var data: JsonField>? = null + private var data: JsonField>? = null private var hasMore: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -102,25 +100,25 @@ private constructor( additionalProperties = disputeListPageResponse.additionalProperties.toMutableMap() } - fun data(data: List) = data(JsonField.of(data)) + fun data(data: List) = data(JsonField.of(data)) /** * Sets [Builder.data] to an arbitrary JSON value. * - * You should usually call [Builder.data] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. + * You should usually call [Builder.data] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun data(data: JsonField>) = apply { + fun data(data: JsonField>) = apply { this.data = data.map { it.toMutableList() } } /** - * Adds a single [DisputeListResponse] to [Builder.data]. + * Adds a single [Dispute] to [Builder.data]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addData(data: DisputeListResponse) = apply { + fun addData(data: Dispute) = apply { this.data = (this.data ?: JsonField.of(mutableListOf())).also { checkKnown("data", it).add(data) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListResponse.kt deleted file mode 100644 index 5adb56ab5..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListResponse.kt +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 - -/** Dispute. */ -class DisputeListResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, - private val created: JsonField, - private val customerFiledDate: JsonField, - private val customerNote: JsonField, - private val networkClaimIds: JsonField>, - private val networkFiledDate: JsonField, - private val networkReasonCode: JsonField, - private val prearbitrationDate: JsonField, - private val primaryClaimId: JsonField, - private val reason: JsonField, - private val representmentDate: JsonField, - private val resolutionDate: JsonField, - private val resolutionNote: JsonField, - private val resolutionReason: JsonField, - private val status: JsonField, - private val transactionToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("arbitration_date") - @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("customer_filed_date") - @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") - @ExcludeMissing - customerNote: JsonField = JsonMissing.of(), - @JsonProperty("network_claim_ids") - @ExcludeMissing - networkClaimIds: JsonField> = JsonMissing.of(), - @JsonProperty("network_filed_date") - @ExcludeMissing - networkFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("network_reason_code") - @ExcludeMissing - networkReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("prearbitration_date") - @ExcludeMissing - prearbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("primary_claim_id") - @ExcludeMissing - primaryClaimId: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - @JsonProperty("representment_date") - @ExcludeMissing - representmentDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_date") - @ExcludeMissing - resolutionDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_note") - @ExcludeMissing - resolutionNote: JsonField = JsonMissing.of(), - @JsonProperty("resolution_reason") - @ExcludeMissing - resolutionReason: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_token") - @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @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") - - /** - * Amount under dispute. May be different from the original transaction amount. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Date dispute entered arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun arbitrationDate(): Optional = - arbitrationDate.getOptional("arbitration_date") - - /** - * Timestamp of when first Dispute was reported. - * - * @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") - - /** - * Date that the dispute was filed by the customer making the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerFiledDate(): Optional = - customerFiledDate.getOptional("customer_filed_date") - - /** - * End customer description of the reason for the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerNote(): Optional = customerNote.getOptional("customer_note") - - /** - * Unique identifiers for the dispute from the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") - - /** - * Date that the dispute was submitted to the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") - - /** - * Network reason code used to file the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") - - /** - * Date dispute entered pre-arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun prearbitrationDate(): Optional = - prearbitrationDate.getOptional("prearbitration_date") - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - * - * @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") - - /** - * Date the representment was received. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") - - /** - * Date that the dispute was resolved. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") - - /** - * Note by Dispute team on the case resolution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionReason(): Optional = - resolutionReason.getOptional("resolution_reason") - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - * - * @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") - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. - * - * @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 [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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [arbitrationDate]. - * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("arbitration_date") - @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate - - /** - * 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 [customerFiledDate]. - * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate - - /** - * Returns the raw JSON value of [customerNote]. - * - * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote - - /** - * Returns the raw JSON value of [networkClaimIds]. - * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds - - /** - * Returns the raw JSON value of [networkFiledDate]. - * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_filed_date") - @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate - - /** - * Returns the raw JSON value of [networkReasonCode]. - * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode - - /** - * Returns the raw JSON value of [prearbitrationDate]. - * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("prearbitration_date") - @ExcludeMissing - fun _prearbitrationDate(): JsonField = prearbitrationDate - - /** - * Returns the raw JSON value of [primaryClaimId]. - * - * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("primary_claim_id") - @ExcludeMissing - fun _primaryClaimId(): JsonField = primaryClaimId - - /** - * 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 [representmentDate]. - * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate - - /** - * Returns the raw JSON value of [resolutionDate]. - * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate - - /** - * Returns the raw JSON value of [resolutionNote]. - * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote - - /** - * Returns the raw JSON value of [resolutionReason]. - * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("resolution_reason") - @ExcludeMissing - fun _resolutionReason(): JsonField = resolutionReason - - /** - * 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 [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 [DisputeListResponse]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DisputeListResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null - private var created: JsonField? = null - private var customerFiledDate: JsonField? = null - private var customerNote: JsonField? = null - private var networkClaimIds: JsonField>? = null - private var networkFiledDate: JsonField? = null - private var networkReasonCode: JsonField? = null - private var prearbitrationDate: JsonField? = null - private var primaryClaimId: JsonField? = null - private var reason: JsonField? = null - private var representmentDate: JsonField? = null - private var resolutionDate: JsonField? = null - private var resolutionNote: JsonField? = null - private var resolutionReason: JsonField? = null - private var status: JsonField? = null - private var transactionToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(disputeListResponse: DisputeListResponse) = apply { - token = disputeListResponse.token - amount = disputeListResponse.amount - arbitrationDate = disputeListResponse.arbitrationDate - created = disputeListResponse.created - customerFiledDate = disputeListResponse.customerFiledDate - customerNote = disputeListResponse.customerNote - networkClaimIds = disputeListResponse.networkClaimIds.map { it.toMutableList() } - networkFiledDate = disputeListResponse.networkFiledDate - networkReasonCode = disputeListResponse.networkReasonCode - prearbitrationDate = disputeListResponse.prearbitrationDate - primaryClaimId = disputeListResponse.primaryClaimId - reason = disputeListResponse.reason - representmentDate = disputeListResponse.representmentDate - resolutionDate = disputeListResponse.resolutionDate - resolutionNote = disputeListResponse.resolutionNote - resolutionReason = disputeListResponse.resolutionReason - status = disputeListResponse.status - transactionToken = disputeListResponse.transactionToken - additionalProperties = disputeListResponse.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** Amount under dispute. May be different from the original transaction amount. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) - - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) - - /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } - - /** Timestamp of when first Dispute was reported. */ - 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 } - - /** Date that the dispute was filed by the customer making the dispute. */ - fun customerFiledDate(customerFiledDate: OffsetDateTime?) = - customerFiledDate(JsonField.ofNullable(customerFiledDate)) - - /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ - fun customerFiledDate(customerFiledDate: Optional) = - customerFiledDate(customerFiledDate.getOrNull()) - - /** - * Sets [Builder.customerFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun customerFiledDate(customerFiledDate: JsonField) = apply { - this.customerFiledDate = customerFiledDate - } - - /** End customer description of the reason for the dispute. */ - fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - - /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ - fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) - - /** - * Sets [Builder.customerNote] to an arbitrary JSON value. - * - * You should usually call [Builder.customerNote] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } - - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) - - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) - - /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. - * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [networkClaimIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addNetworkClaimId(networkClaimId: String) = apply { - networkClaimIds = - (networkClaimIds ?: JsonField.of(mutableListOf())).also { - checkKnown("networkClaimIds", it).add(networkClaimId) - } - } - - /** Date that the dispute was submitted to the network. */ - fun networkFiledDate(networkFiledDate: OffsetDateTime?) = - networkFiledDate(JsonField.ofNullable(networkFiledDate)) - - /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ - fun networkFiledDate(networkFiledDate: Optional) = - networkFiledDate(networkFiledDate.getOrNull()) - - /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate - } - - /** Network reason code used to file the dispute. */ - fun networkReasonCode(networkReasonCode: String?) = - networkReasonCode(JsonField.ofNullable(networkReasonCode)) - - /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ - fun networkReasonCode(networkReasonCode: Optional) = - networkReasonCode(networkReasonCode.getOrNull()) - - /** - * Sets [Builder.networkReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.networkReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode - } - - /** Date dispute entered pre-arbitration. */ - fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = - prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - - /** - * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. - */ - fun prearbitrationDate(prearbitrationDate: Optional) = - prearbitrationDate(prearbitrationDate.getOrNull()) - - /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate - } - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be - * the first claim id set by the network - */ - fun primaryClaimId(primaryClaimId: String?) = - primaryClaimId(JsonField.ofNullable(primaryClaimId)) - - /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ - fun primaryClaimId(primaryClaimId: Optional) = - primaryClaimId(primaryClaimId.getOrNull()) - - /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryClaimId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant - * activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 } - - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) - - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) - - /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. - * - * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun representmentDate(representmentDate: JsonField) = apply { - this.representmentDate = representmentDate - } - - /** Date that the dispute was resolved. */ - fun resolutionDate(resolutionDate: OffsetDateTime?) = - resolutionDate(JsonField.ofNullable(resolutionDate)) - - /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ - fun resolutionDate(resolutionDate: Optional) = - resolutionDate(resolutionDate.getOrNull()) - - /** - * Sets [Builder.resolutionDate] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } - - /** Note by Dispute team on the case resolution. */ - fun resolutionNote(resolutionNote: String?) = - resolutionNote(JsonField.ofNullable(resolutionNote)) - - /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ - fun resolutionNote(resolutionNote: Optional) = - resolutionNote(resolutionNote.getOrNull()) - - /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionNote] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionNote(resolutionNote: JsonField) = apply { - this.resolutionNote = resolutionNote - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - fun resolutionReason(resolutionReason: ResolutionReason?) = - resolutionReason(JsonField.ofNullable(resolutionReason)) - - /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ - fun resolutionReason(resolutionReason: Optional) = - resolutionReason(resolutionReason.getOrNull()) - - /** - * Sets [Builder.resolutionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 } - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may - * have multiple dispute cases. - */ - 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 [DisputeListResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DisputeListResponse = - DisputeListResponse( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), - checkRequired("created", created), - checkRequired("customerFiledDate", customerFiledDate), - checkRequired("customerNote", customerNote), - checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, - checkRequired("networkFiledDate", networkFiledDate), - checkRequired("networkReasonCode", networkReasonCode), - checkRequired("prearbitrationDate", prearbitrationDate), - checkRequired("primaryClaimId", primaryClaimId), - checkRequired("reason", reason), - checkRequired("representmentDate", representmentDate), - checkRequired("resolutionDate", resolutionDate), - checkRequired("resolutionNote", resolutionNote), - checkRequired("resolutionReason", resolutionReason), - checkRequired("status", status), - checkRequired("transactionToken", transactionToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DisputeListResponse = apply { - if (validated) { - return@apply - } - - token() - amount() - arbitrationDate() - created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - 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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (arbitrationDate.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (customerFiledDate.asKnown().isPresent) 1 else 0) + - (if (customerNote.asKnown().isPresent) 1 else 0) + - (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + - (if (networkFiledDate.asKnown().isPresent) 1 else 0) + - (if (networkReasonCode.asKnown().isPresent) 1 else 0) + - (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + - (if (primaryClaimId.asKnown().isPresent) 1 else 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (representmentDate.asKnown().isPresent) 1 else 0) + - (if (resolutionDate.asKnown().isPresent) 1 else 0) + - (if (resolutionNote.asKnown().isPresent) 1 else 0) + - (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionToken.asKnown().isPresent) 1 else 0) - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") - - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") - - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") - - @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") - - @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") - - @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") - - @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") - - @JvmField val MISSING_AUTH = of("MISSING_AUTH") - - @JvmField val OTHER = of("OTHER") - - @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") - - @JvmField - val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - } - - /** - * 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 { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - /** 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) { - ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE - CANCELLED -> Value.CANCELLED - DUPLICATED -> Value.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Value.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT - MISSING_AUTH -> Value.MISSING_AUTH - OTHER -> Value.OTHER - PROCESSING_ERROR -> Value.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED - 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) { - ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE - CANCELLED -> Known.CANCELLED - DUPLICATED -> Known.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Known.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT - MISSING_AUTH -> Known.MISSING_AUTH - OTHER -> Known.OTHER - PROCESSING_ERROR -> Known.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED - else -> throw LithicInvalidDataException("Unknown Reason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Reason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Reason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - class ResolutionReason @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 CASE_LOST = of("CASE_LOST") - - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - - @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - - @JvmField - val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - - @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - - @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - - @JvmField - val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - - @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - - @JvmField val REFUNDED = of("REFUNDED") - - @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) - } - - /** An enum containing [ResolutionReason]'s known values. */ - enum class Known { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - } - - /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ResolutionReason] 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 { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - /** - * An enum member indicating that [ResolutionReason] 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) { - CASE_LOST -> Value.CASE_LOST - NETWORK_REJECTED -> Value.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Value.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER - REFUNDED -> Value.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Value.WITHDRAWN - WON_ARBITRATION -> Value.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Value.WON_PREARBITRATION - 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) { - CASE_LOST -> Known.CASE_LOST - NETWORK_REJECTED -> Known.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Known.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER - REFUNDED -> Known.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Known.WITHDRAWN - WON_ARBITRATION -> Known.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Known.WON_PREARBITRATION - else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ResolutionReason = 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 ResolutionReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") - - @JvmField val NEW = of("NEW") - - @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val SUBMITTED = of("SUBMITTED") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - } - - /** - * 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 { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - /** 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) { - ARBITRATION -> Value.ARBITRATION - CASE_CLOSED -> Value.CASE_CLOSED - CASE_WON -> Value.CASE_WON - NEW -> Value.NEW - PENDING_CUSTOMER -> Value.PENDING_CUSTOMER - PREARBITRATION -> Value.PREARBITRATION - REPRESENTMENT -> Value.REPRESENTMENT - SUBMITTED -> Value.SUBMITTED - 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) { - ARBITRATION -> Known.ARBITRATION - CASE_CLOSED -> Known.CASE_CLOSED - CASE_WON -> Known.CASE_WON - NEW -> Known.NEW - PENDING_CUSTOMER -> Known.PENDING_CUSTOMER - PREARBITRATION -> Known.PREARBITRATION - REPRESENTMENT -> Known.REPRESENTMENT - SUBMITTED -> Known.SUBMITTED - 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 - - 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 DisputeListResponse && - token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && - created == other.created && - customerFiledDate == other.customerFiledDate && - customerNote == other.customerNote && - networkClaimIds == other.networkClaimIds && - networkFiledDate == other.networkFiledDate && - networkReasonCode == other.networkReasonCode && - prearbitrationDate == other.prearbitrationDate && - primaryClaimId == other.primaryClaimId && - reason == other.reason && - representmentDate == other.representmentDate && - resolutionDate == other.resolutionDate && - resolutionNote == other.resolutionNote && - resolutionReason == other.resolutionReason && - status == other.status && - transactionToken == other.transactionToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DisputeListResponse{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveResponse.kt deleted file mode 100644 index 632235abc..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveResponse.kt +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 - -/** Dispute. */ -class DisputeRetrieveResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, - private val created: JsonField, - private val customerFiledDate: JsonField, - private val customerNote: JsonField, - private val networkClaimIds: JsonField>, - private val networkFiledDate: JsonField, - private val networkReasonCode: JsonField, - private val prearbitrationDate: JsonField, - private val primaryClaimId: JsonField, - private val reason: JsonField, - private val representmentDate: JsonField, - private val resolutionDate: JsonField, - private val resolutionNote: JsonField, - private val resolutionReason: JsonField, - private val status: JsonField, - private val transactionToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("arbitration_date") - @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("customer_filed_date") - @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") - @ExcludeMissing - customerNote: JsonField = JsonMissing.of(), - @JsonProperty("network_claim_ids") - @ExcludeMissing - networkClaimIds: JsonField> = JsonMissing.of(), - @JsonProperty("network_filed_date") - @ExcludeMissing - networkFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("network_reason_code") - @ExcludeMissing - networkReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("prearbitration_date") - @ExcludeMissing - prearbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("primary_claim_id") - @ExcludeMissing - primaryClaimId: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - @JsonProperty("representment_date") - @ExcludeMissing - representmentDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_date") - @ExcludeMissing - resolutionDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_note") - @ExcludeMissing - resolutionNote: JsonField = JsonMissing.of(), - @JsonProperty("resolution_reason") - @ExcludeMissing - resolutionReason: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_token") - @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @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") - - /** - * Amount under dispute. May be different from the original transaction amount. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Date dispute entered arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun arbitrationDate(): Optional = - arbitrationDate.getOptional("arbitration_date") - - /** - * Timestamp of when first Dispute was reported. - * - * @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") - - /** - * Date that the dispute was filed by the customer making the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerFiledDate(): Optional = - customerFiledDate.getOptional("customer_filed_date") - - /** - * End customer description of the reason for the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerNote(): Optional = customerNote.getOptional("customer_note") - - /** - * Unique identifiers for the dispute from the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") - - /** - * Date that the dispute was submitted to the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") - - /** - * Network reason code used to file the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") - - /** - * Date dispute entered pre-arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun prearbitrationDate(): Optional = - prearbitrationDate.getOptional("prearbitration_date") - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - * - * @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") - - /** - * Date the representment was received. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") - - /** - * Date that the dispute was resolved. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") - - /** - * Note by Dispute team on the case resolution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionReason(): Optional = - resolutionReason.getOptional("resolution_reason") - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - * - * @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") - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. - * - * @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 [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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [arbitrationDate]. - * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("arbitration_date") - @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate - - /** - * 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 [customerFiledDate]. - * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate - - /** - * Returns the raw JSON value of [customerNote]. - * - * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote - - /** - * Returns the raw JSON value of [networkClaimIds]. - * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds - - /** - * Returns the raw JSON value of [networkFiledDate]. - * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_filed_date") - @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate - - /** - * Returns the raw JSON value of [networkReasonCode]. - * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode - - /** - * Returns the raw JSON value of [prearbitrationDate]. - * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("prearbitration_date") - @ExcludeMissing - fun _prearbitrationDate(): JsonField = prearbitrationDate - - /** - * Returns the raw JSON value of [primaryClaimId]. - * - * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("primary_claim_id") - @ExcludeMissing - fun _primaryClaimId(): JsonField = primaryClaimId - - /** - * 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 [representmentDate]. - * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate - - /** - * Returns the raw JSON value of [resolutionDate]. - * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate - - /** - * Returns the raw JSON value of [resolutionNote]. - * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote - - /** - * Returns the raw JSON value of [resolutionReason]. - * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("resolution_reason") - @ExcludeMissing - fun _resolutionReason(): JsonField = resolutionReason - - /** - * 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 [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 [DisputeRetrieveResponse]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DisputeRetrieveResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null - private var created: JsonField? = null - private var customerFiledDate: JsonField? = null - private var customerNote: JsonField? = null - private var networkClaimIds: JsonField>? = null - private var networkFiledDate: JsonField? = null - private var networkReasonCode: JsonField? = null - private var prearbitrationDate: JsonField? = null - private var primaryClaimId: JsonField? = null - private var reason: JsonField? = null - private var representmentDate: JsonField? = null - private var resolutionDate: JsonField? = null - private var resolutionNote: JsonField? = null - private var resolutionReason: JsonField? = null - private var status: JsonField? = null - private var transactionToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(disputeRetrieveResponse: DisputeRetrieveResponse) = apply { - token = disputeRetrieveResponse.token - amount = disputeRetrieveResponse.amount - arbitrationDate = disputeRetrieveResponse.arbitrationDate - created = disputeRetrieveResponse.created - customerFiledDate = disputeRetrieveResponse.customerFiledDate - customerNote = disputeRetrieveResponse.customerNote - networkClaimIds = disputeRetrieveResponse.networkClaimIds.map { it.toMutableList() } - networkFiledDate = disputeRetrieveResponse.networkFiledDate - networkReasonCode = disputeRetrieveResponse.networkReasonCode - prearbitrationDate = disputeRetrieveResponse.prearbitrationDate - primaryClaimId = disputeRetrieveResponse.primaryClaimId - reason = disputeRetrieveResponse.reason - representmentDate = disputeRetrieveResponse.representmentDate - resolutionDate = disputeRetrieveResponse.resolutionDate - resolutionNote = disputeRetrieveResponse.resolutionNote - resolutionReason = disputeRetrieveResponse.resolutionReason - status = disputeRetrieveResponse.status - transactionToken = disputeRetrieveResponse.transactionToken - additionalProperties = disputeRetrieveResponse.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** Amount under dispute. May be different from the original transaction amount. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) - - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) - - /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } - - /** Timestamp of when first Dispute was reported. */ - 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 } - - /** Date that the dispute was filed by the customer making the dispute. */ - fun customerFiledDate(customerFiledDate: OffsetDateTime?) = - customerFiledDate(JsonField.ofNullable(customerFiledDate)) - - /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ - fun customerFiledDate(customerFiledDate: Optional) = - customerFiledDate(customerFiledDate.getOrNull()) - - /** - * Sets [Builder.customerFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun customerFiledDate(customerFiledDate: JsonField) = apply { - this.customerFiledDate = customerFiledDate - } - - /** End customer description of the reason for the dispute. */ - fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - - /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ - fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) - - /** - * Sets [Builder.customerNote] to an arbitrary JSON value. - * - * You should usually call [Builder.customerNote] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } - - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) - - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) - - /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. - * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [networkClaimIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addNetworkClaimId(networkClaimId: String) = apply { - networkClaimIds = - (networkClaimIds ?: JsonField.of(mutableListOf())).also { - checkKnown("networkClaimIds", it).add(networkClaimId) - } - } - - /** Date that the dispute was submitted to the network. */ - fun networkFiledDate(networkFiledDate: OffsetDateTime?) = - networkFiledDate(JsonField.ofNullable(networkFiledDate)) - - /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ - fun networkFiledDate(networkFiledDate: Optional) = - networkFiledDate(networkFiledDate.getOrNull()) - - /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate - } - - /** Network reason code used to file the dispute. */ - fun networkReasonCode(networkReasonCode: String?) = - networkReasonCode(JsonField.ofNullable(networkReasonCode)) - - /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ - fun networkReasonCode(networkReasonCode: Optional) = - networkReasonCode(networkReasonCode.getOrNull()) - - /** - * Sets [Builder.networkReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.networkReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode - } - - /** Date dispute entered pre-arbitration. */ - fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = - prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - - /** - * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. - */ - fun prearbitrationDate(prearbitrationDate: Optional) = - prearbitrationDate(prearbitrationDate.getOrNull()) - - /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate - } - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be - * the first claim id set by the network - */ - fun primaryClaimId(primaryClaimId: String?) = - primaryClaimId(JsonField.ofNullable(primaryClaimId)) - - /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ - fun primaryClaimId(primaryClaimId: Optional) = - primaryClaimId(primaryClaimId.getOrNull()) - - /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryClaimId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant - * activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 } - - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) - - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) - - /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. - * - * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun representmentDate(representmentDate: JsonField) = apply { - this.representmentDate = representmentDate - } - - /** Date that the dispute was resolved. */ - fun resolutionDate(resolutionDate: OffsetDateTime?) = - resolutionDate(JsonField.ofNullable(resolutionDate)) - - /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ - fun resolutionDate(resolutionDate: Optional) = - resolutionDate(resolutionDate.getOrNull()) - - /** - * Sets [Builder.resolutionDate] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } - - /** Note by Dispute team on the case resolution. */ - fun resolutionNote(resolutionNote: String?) = - resolutionNote(JsonField.ofNullable(resolutionNote)) - - /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ - fun resolutionNote(resolutionNote: Optional) = - resolutionNote(resolutionNote.getOrNull()) - - /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionNote] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionNote(resolutionNote: JsonField) = apply { - this.resolutionNote = resolutionNote - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - fun resolutionReason(resolutionReason: ResolutionReason?) = - resolutionReason(JsonField.ofNullable(resolutionReason)) - - /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ - fun resolutionReason(resolutionReason: Optional) = - resolutionReason(resolutionReason.getOrNull()) - - /** - * Sets [Builder.resolutionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 } - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may - * have multiple dispute cases. - */ - 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 [DisputeRetrieveResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DisputeRetrieveResponse = - DisputeRetrieveResponse( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), - checkRequired("created", created), - checkRequired("customerFiledDate", customerFiledDate), - checkRequired("customerNote", customerNote), - checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, - checkRequired("networkFiledDate", networkFiledDate), - checkRequired("networkReasonCode", networkReasonCode), - checkRequired("prearbitrationDate", prearbitrationDate), - checkRequired("primaryClaimId", primaryClaimId), - checkRequired("reason", reason), - checkRequired("representmentDate", representmentDate), - checkRequired("resolutionDate", resolutionDate), - checkRequired("resolutionNote", resolutionNote), - checkRequired("resolutionReason", resolutionReason), - checkRequired("status", status), - checkRequired("transactionToken", transactionToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DisputeRetrieveResponse = apply { - if (validated) { - return@apply - } - - token() - amount() - arbitrationDate() - created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - 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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (arbitrationDate.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (customerFiledDate.asKnown().isPresent) 1 else 0) + - (if (customerNote.asKnown().isPresent) 1 else 0) + - (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + - (if (networkFiledDate.asKnown().isPresent) 1 else 0) + - (if (networkReasonCode.asKnown().isPresent) 1 else 0) + - (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + - (if (primaryClaimId.asKnown().isPresent) 1 else 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (representmentDate.asKnown().isPresent) 1 else 0) + - (if (resolutionDate.asKnown().isPresent) 1 else 0) + - (if (resolutionNote.asKnown().isPresent) 1 else 0) + - (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionToken.asKnown().isPresent) 1 else 0) - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") - - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") - - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") - - @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") - - @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") - - @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") - - @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") - - @JvmField val MISSING_AUTH = of("MISSING_AUTH") - - @JvmField val OTHER = of("OTHER") - - @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") - - @JvmField - val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - } - - /** - * 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 { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - /** 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) { - ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE - CANCELLED -> Value.CANCELLED - DUPLICATED -> Value.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Value.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT - MISSING_AUTH -> Value.MISSING_AUTH - OTHER -> Value.OTHER - PROCESSING_ERROR -> Value.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED - 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) { - ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE - CANCELLED -> Known.CANCELLED - DUPLICATED -> Known.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Known.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT - MISSING_AUTH -> Known.MISSING_AUTH - OTHER -> Known.OTHER - PROCESSING_ERROR -> Known.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED - else -> throw LithicInvalidDataException("Unknown Reason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Reason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Reason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - class ResolutionReason @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 CASE_LOST = of("CASE_LOST") - - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - - @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - - @JvmField - val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - - @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - - @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - - @JvmField - val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - - @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - - @JvmField val REFUNDED = of("REFUNDED") - - @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) - } - - /** An enum containing [ResolutionReason]'s known values. */ - enum class Known { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - } - - /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ResolutionReason] 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 { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - /** - * An enum member indicating that [ResolutionReason] 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) { - CASE_LOST -> Value.CASE_LOST - NETWORK_REJECTED -> Value.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Value.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER - REFUNDED -> Value.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Value.WITHDRAWN - WON_ARBITRATION -> Value.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Value.WON_PREARBITRATION - 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) { - CASE_LOST -> Known.CASE_LOST - NETWORK_REJECTED -> Known.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Known.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER - REFUNDED -> Known.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Known.WITHDRAWN - WON_ARBITRATION -> Known.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Known.WON_PREARBITRATION - else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ResolutionReason = 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 ResolutionReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") - - @JvmField val NEW = of("NEW") - - @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val SUBMITTED = of("SUBMITTED") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - } - - /** - * 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 { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - /** 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) { - ARBITRATION -> Value.ARBITRATION - CASE_CLOSED -> Value.CASE_CLOSED - CASE_WON -> Value.CASE_WON - NEW -> Value.NEW - PENDING_CUSTOMER -> Value.PENDING_CUSTOMER - PREARBITRATION -> Value.PREARBITRATION - REPRESENTMENT -> Value.REPRESENTMENT - SUBMITTED -> Value.SUBMITTED - 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) { - ARBITRATION -> Known.ARBITRATION - CASE_CLOSED -> Known.CASE_CLOSED - CASE_WON -> Known.CASE_WON - NEW -> Known.NEW - PENDING_CUSTOMER -> Known.PENDING_CUSTOMER - PREARBITRATION -> Known.PREARBITRATION - REPRESENTMENT -> Known.REPRESENTMENT - SUBMITTED -> Known.SUBMITTED - 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 - - 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 DisputeRetrieveResponse && - token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && - created == other.created && - customerFiledDate == other.customerFiledDate && - customerNote == other.customerNote && - networkClaimIds == other.networkClaimIds && - networkFiledDate == other.networkFiledDate && - networkReasonCode == other.networkReasonCode && - prearbitrationDate == other.prearbitrationDate && - primaryClaimId == other.primaryClaimId && - reason == other.reason && - representmentDate == other.representmentDate && - resolutionDate == other.resolutionDate && - resolutionNote == other.resolutionNote && - resolutionReason == other.resolutionReason && - status == other.status && - transactionToken == other.transactionToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DisputeRetrieveResponse{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateResponse.kt deleted file mode 100644 index d72180979..000000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateResponse.kt +++ /dev/null @@ -1,1737 +0,0 @@ -// 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 - -/** Dispute. */ -class DisputeUpdateResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, - private val created: JsonField, - private val customerFiledDate: JsonField, - private val customerNote: JsonField, - private val networkClaimIds: JsonField>, - private val networkFiledDate: JsonField, - private val networkReasonCode: JsonField, - private val prearbitrationDate: JsonField, - private val primaryClaimId: JsonField, - private val reason: JsonField, - private val representmentDate: JsonField, - private val resolutionDate: JsonField, - private val resolutionNote: JsonField, - private val resolutionReason: JsonField, - private val status: JsonField, - private val transactionToken: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("arbitration_date") - @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("customer_filed_date") - @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") - @ExcludeMissing - customerNote: JsonField = JsonMissing.of(), - @JsonProperty("network_claim_ids") - @ExcludeMissing - networkClaimIds: JsonField> = JsonMissing.of(), - @JsonProperty("network_filed_date") - @ExcludeMissing - networkFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("network_reason_code") - @ExcludeMissing - networkReasonCode: JsonField = JsonMissing.of(), - @JsonProperty("prearbitration_date") - @ExcludeMissing - prearbitrationDate: JsonField = JsonMissing.of(), - @JsonProperty("primary_claim_id") - @ExcludeMissing - primaryClaimId: JsonField = JsonMissing.of(), - @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), - @JsonProperty("representment_date") - @ExcludeMissing - representmentDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_date") - @ExcludeMissing - resolutionDate: JsonField = JsonMissing.of(), - @JsonProperty("resolution_note") - @ExcludeMissing - resolutionNote: JsonField = JsonMissing.of(), - @JsonProperty("resolution_reason") - @ExcludeMissing - resolutionReason: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("transaction_token") - @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), - ) : this( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - mutableMapOf(), - ) - - /** - * Globally unique identifier. - * - * @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") - - /** - * Amount under dispute. May be different from the original transaction amount. - * - * @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 amount(): Long = amount.getRequired("amount") - - /** - * Date dispute entered arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun arbitrationDate(): Optional = - arbitrationDate.getOptional("arbitration_date") - - /** - * Timestamp of when first Dispute was reported. - * - * @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") - - /** - * Date that the dispute was filed by the customer making the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerFiledDate(): Optional = - customerFiledDate.getOptional("customer_filed_date") - - /** - * End customer description of the reason for the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun customerNote(): Optional = customerNote.getOptional("customer_note") - - /** - * Unique identifiers for the dispute from the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") - - /** - * Date that the dispute was submitted to the network. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") - - /** - * Network reason code used to file the dispute. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") - - /** - * Date dispute entered pre-arbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun prearbitrationDate(): Optional = - prearbitrationDate.getOptional("prearbitration_date") - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - * - * @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") - - /** - * Date the representment was received. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") - - /** - * Date that the dispute was resolved. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") - - /** - * Note by Dispute team on the case resolution. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun resolutionReason(): Optional = - resolutionReason.getOptional("resolution_reason") - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - * - * @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") - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. - * - * @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 [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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [arbitrationDate]. - * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("arbitration_date") - @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate - - /** - * 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 [customerFiledDate]. - * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate - - /** - * Returns the raw JSON value of [customerNote]. - * - * Unlike [customerNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote - - /** - * Returns the raw JSON value of [networkClaimIds]. - * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds - - /** - * Returns the raw JSON value of [networkFiledDate]. - * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_filed_date") - @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate - - /** - * Returns the raw JSON value of [networkReasonCode]. - * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode - - /** - * Returns the raw JSON value of [prearbitrationDate]. - * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("prearbitration_date") - @ExcludeMissing - fun _prearbitrationDate(): JsonField = prearbitrationDate - - /** - * Returns the raw JSON value of [primaryClaimId]. - * - * Unlike [primaryClaimId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("primary_claim_id") - @ExcludeMissing - fun _primaryClaimId(): JsonField = primaryClaimId - - /** - * 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 [representmentDate]. - * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate - - /** - * Returns the raw JSON value of [resolutionDate]. - * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate - - /** - * Returns the raw JSON value of [resolutionNote]. - * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote - - /** - * Returns the raw JSON value of [resolutionReason]. - * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("resolution_reason") - @ExcludeMissing - fun _resolutionReason(): JsonField = resolutionReason - - /** - * 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 [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 [DisputeUpdateResponse]. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DisputeUpdateResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null - private var created: JsonField? = null - private var customerFiledDate: JsonField? = null - private var customerNote: JsonField? = null - private var networkClaimIds: JsonField>? = null - private var networkFiledDate: JsonField? = null - private var networkReasonCode: JsonField? = null - private var prearbitrationDate: JsonField? = null - private var primaryClaimId: JsonField? = null - private var reason: JsonField? = null - private var representmentDate: JsonField? = null - private var resolutionDate: JsonField? = null - private var resolutionNote: JsonField? = null - private var resolutionReason: JsonField? = null - private var status: JsonField? = null - private var transactionToken: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(disputeUpdateResponse: DisputeUpdateResponse) = apply { - token = disputeUpdateResponse.token - amount = disputeUpdateResponse.amount - arbitrationDate = disputeUpdateResponse.arbitrationDate - created = disputeUpdateResponse.created - customerFiledDate = disputeUpdateResponse.customerFiledDate - customerNote = disputeUpdateResponse.customerNote - networkClaimIds = disputeUpdateResponse.networkClaimIds.map { it.toMutableList() } - networkFiledDate = disputeUpdateResponse.networkFiledDate - networkReasonCode = disputeUpdateResponse.networkReasonCode - prearbitrationDate = disputeUpdateResponse.prearbitrationDate - primaryClaimId = disputeUpdateResponse.primaryClaimId - reason = disputeUpdateResponse.reason - representmentDate = disputeUpdateResponse.representmentDate - resolutionDate = disputeUpdateResponse.resolutionDate - resolutionNote = disputeUpdateResponse.resolutionNote - resolutionReason = disputeUpdateResponse.resolutionReason - status = disputeUpdateResponse.status - transactionToken = disputeUpdateResponse.transactionToken - additionalProperties = disputeUpdateResponse.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** Amount under dispute. May be different from the original transaction amount. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) - - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) - - /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.arbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } - - /** Timestamp of when first Dispute was reported. */ - 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 } - - /** Date that the dispute was filed by the customer making the dispute. */ - fun customerFiledDate(customerFiledDate: OffsetDateTime?) = - customerFiledDate(JsonField.ofNullable(customerFiledDate)) - - /** Alias for calling [Builder.customerFiledDate] with `customerFiledDate.orElse(null)`. */ - fun customerFiledDate(customerFiledDate: Optional) = - customerFiledDate(customerFiledDate.getOrNull()) - - /** - * Sets [Builder.customerFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.customerFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun customerFiledDate(customerFiledDate: JsonField) = apply { - this.customerFiledDate = customerFiledDate - } - - /** End customer description of the reason for the dispute. */ - fun customerNote(customerNote: String?) = customerNote(JsonField.ofNullable(customerNote)) - - /** Alias for calling [Builder.customerNote] with `customerNote.orElse(null)`. */ - fun customerNote(customerNote: Optional) = customerNote(customerNote.getOrNull()) - - /** - * Sets [Builder.customerNote] to an arbitrary JSON value. - * - * You should usually call [Builder.customerNote] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } - - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) - - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) - - /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. - * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [networkClaimIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addNetworkClaimId(networkClaimId: String) = apply { - networkClaimIds = - (networkClaimIds ?: JsonField.of(mutableListOf())).also { - checkKnown("networkClaimIds", it).add(networkClaimId) - } - } - - /** Date that the dispute was submitted to the network. */ - fun networkFiledDate(networkFiledDate: OffsetDateTime?) = - networkFiledDate(JsonField.ofNullable(networkFiledDate)) - - /** Alias for calling [Builder.networkFiledDate] with `networkFiledDate.orElse(null)`. */ - fun networkFiledDate(networkFiledDate: Optional) = - networkFiledDate(networkFiledDate.getOrNull()) - - /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. - * - * You should usually call [Builder.networkFiledDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate - } - - /** Network reason code used to file the dispute. */ - fun networkReasonCode(networkReasonCode: String?) = - networkReasonCode(JsonField.ofNullable(networkReasonCode)) - - /** Alias for calling [Builder.networkReasonCode] with `networkReasonCode.orElse(null)`. */ - fun networkReasonCode(networkReasonCode: Optional) = - networkReasonCode(networkReasonCode.getOrNull()) - - /** - * Sets [Builder.networkReasonCode] to an arbitrary JSON value. - * - * You should usually call [Builder.networkReasonCode] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode - } - - /** Date dispute entered pre-arbitration. */ - fun prearbitrationDate(prearbitrationDate: OffsetDateTime?) = - prearbitrationDate(JsonField.ofNullable(prearbitrationDate)) - - /** - * Alias for calling [Builder.prearbitrationDate] with `prearbitrationDate.orElse(null)`. - */ - fun prearbitrationDate(prearbitrationDate: Optional) = - prearbitrationDate(prearbitrationDate.getOrNull()) - - /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. - * - * You should usually call [Builder.prearbitrationDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate - } - - /** - * Unique identifier for the dispute from the network. If there are multiple, this will be - * the first claim id set by the network - */ - fun primaryClaimId(primaryClaimId: String?) = - primaryClaimId(JsonField.ofNullable(primaryClaimId)) - - /** Alias for calling [Builder.primaryClaimId] with `primaryClaimId.orElse(null)`. */ - fun primaryClaimId(primaryClaimId: Optional) = - primaryClaimId(primaryClaimId.getOrNull()) - - /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. - * - * You should usually call [Builder.primaryClaimId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant - * activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 } - - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) - - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) - - /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. - * - * You should usually call [Builder.representmentDate] with a well-typed [OffsetDateTime] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun representmentDate(representmentDate: JsonField) = apply { - this.representmentDate = representmentDate - } - - /** Date that the dispute was resolved. */ - fun resolutionDate(resolutionDate: OffsetDateTime?) = - resolutionDate(JsonField.ofNullable(resolutionDate)) - - /** Alias for calling [Builder.resolutionDate] with `resolutionDate.orElse(null)`. */ - fun resolutionDate(resolutionDate: Optional) = - resolutionDate(resolutionDate.getOrNull()) - - /** - * Sets [Builder.resolutionDate] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionDate] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } - - /** Note by Dispute team on the case resolution. */ - fun resolutionNote(resolutionNote: String?) = - resolutionNote(JsonField.ofNullable(resolutionNote)) - - /** Alias for calling [Builder.resolutionNote] with `resolutionNote.orElse(null)`. */ - fun resolutionNote(resolutionNote: Optional) = - resolutionNote(resolutionNote.getOrNull()) - - /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionNote] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun resolutionNote(resolutionNote: JsonField) = apply { - this.resolutionNote = resolutionNote - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - fun resolutionReason(resolutionReason: ResolutionReason?) = - resolutionReason(JsonField.ofNullable(resolutionReason)) - - /** Alias for calling [Builder.resolutionReason] with `resolutionReason.orElse(null)`. */ - fun resolutionReason(resolutionReason: Optional) = - resolutionReason(resolutionReason.getOrNull()) - - /** - * Sets [Builder.resolutionReason] to an arbitrary JSON value. - * - * You should usually call [Builder.resolutionReason] with a well-typed [ResolutionReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 } - - /** - * The transaction that is being disputed. A transaction can only be disputed once but may - * have multiple dispute cases. - */ - 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 [DisputeUpdateResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .amount() - * .arbitrationDate() - * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() - * .status() - * .transactionToken() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DisputeUpdateResponse = - DisputeUpdateResponse( - checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), - checkRequired("created", created), - checkRequired("customerFiledDate", customerFiledDate), - checkRequired("customerNote", customerNote), - checkRequired("networkClaimIds", networkClaimIds).map { it.toImmutable() }, - checkRequired("networkFiledDate", networkFiledDate), - checkRequired("networkReasonCode", networkReasonCode), - checkRequired("prearbitrationDate", prearbitrationDate), - checkRequired("primaryClaimId", primaryClaimId), - checkRequired("reason", reason), - checkRequired("representmentDate", representmentDate), - checkRequired("resolutionDate", resolutionDate), - checkRequired("resolutionNote", resolutionNote), - checkRequired("resolutionReason", resolutionReason), - checkRequired("status", status), - checkRequired("transactionToken", transactionToken), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DisputeUpdateResponse = apply { - if (validated) { - return@apply - } - - token() - amount() - arbitrationDate() - created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - 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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (arbitrationDate.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (if (customerFiledDate.asKnown().isPresent) 1 else 0) + - (if (customerNote.asKnown().isPresent) 1 else 0) + - (networkClaimIds.asKnown().getOrNull()?.size ?: 0) + - (if (networkFiledDate.asKnown().isPresent) 1 else 0) + - (if (networkReasonCode.asKnown().isPresent) 1 else 0) + - (if (prearbitrationDate.asKnown().isPresent) 1 else 0) + - (if (primaryClaimId.asKnown().isPresent) 1 else 0) + - (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (representmentDate.asKnown().isPresent) 1 else 0) + - (if (resolutionDate.asKnown().isPresent) 1 else 0) + - (if (resolutionNote.asKnown().isPresent) 1 else 0) + - (resolutionReason.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (transactionToken.asKnown().isPresent) 1 else 0) - - /** - * Dispute reason: - * * `ATM_CASH_MISDISPENSE`: ATM cash misdispense. - * * `CANCELLED`: Transaction was cancelled by the customer. - * * `DUPLICATED`: The transaction was a duplicate. - * * `FRAUD_CARD_NOT_PRESENT`: Fraudulent transaction, card not present. - * * `FRAUD_CARD_PRESENT`: Fraudulent transaction, card present. - * * `FRAUD_OTHER`: Fraudulent transaction, other types such as questionable merchant activity. - * * `GOODS_SERVICES_NOT_AS_DESCRIBED`: The goods or services were not as described. - * * `GOODS_SERVICES_NOT_RECEIVED`: The goods or services were not received. - * * `INCORRECT_AMOUNT`: The transaction amount was incorrect. - * * `MISSING_AUTH`: The transaction was missing authorization. - * * `OTHER`: Other reason. - * * `PROCESSING_ERROR`: Processing error. - * * `REFUND_NOT_PROCESSED`: The refund was not processed. - * * `RECURRING_TRANSACTION_NOT_CANCELLED`: The recurring transaction was not cancelled. - */ - 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 ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") - - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") - - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") - - @JvmField val FRAUD_OTHER = of("FRAUD_OTHER") - - @JvmField val GOODS_SERVICES_NOT_AS_DESCRIBED = of("GOODS_SERVICES_NOT_AS_DESCRIBED") - - @JvmField val GOODS_SERVICES_NOT_RECEIVED = of("GOODS_SERVICES_NOT_RECEIVED") - - @JvmField val INCORRECT_AMOUNT = of("INCORRECT_AMOUNT") - - @JvmField val MISSING_AUTH = of("MISSING_AUTH") - - @JvmField val OTHER = of("OTHER") - - @JvmField val PROCESSING_ERROR = of("PROCESSING_ERROR") - - @JvmField - val RECURRING_TRANSACTION_NOT_CANCELLED = of("RECURRING_TRANSACTION_NOT_CANCELLED") - - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") - - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) - } - - /** An enum containing [Reason]'s known values. */ - enum class Known { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - } - - /** - * 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 { - ATM_CASH_MISDISPENSE, - CANCELLED, - DUPLICATED, - FRAUD_CARD_NOT_PRESENT, - FRAUD_CARD_PRESENT, - FRAUD_OTHER, - GOODS_SERVICES_NOT_AS_DESCRIBED, - GOODS_SERVICES_NOT_RECEIVED, - INCORRECT_AMOUNT, - MISSING_AUTH, - OTHER, - PROCESSING_ERROR, - RECURRING_TRANSACTION_NOT_CANCELLED, - REFUND_NOT_PROCESSED, - /** 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) { - ATM_CASH_MISDISPENSE -> Value.ATM_CASH_MISDISPENSE - CANCELLED -> Value.CANCELLED - DUPLICATED -> Value.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Value.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Value.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Value.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Value.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Value.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Value.INCORRECT_AMOUNT - MISSING_AUTH -> Value.MISSING_AUTH - OTHER -> Value.OTHER - PROCESSING_ERROR -> Value.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Value.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Value.REFUND_NOT_PROCESSED - 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) { - ATM_CASH_MISDISPENSE -> Known.ATM_CASH_MISDISPENSE - CANCELLED -> Known.CANCELLED - DUPLICATED -> Known.DUPLICATED - FRAUD_CARD_NOT_PRESENT -> Known.FRAUD_CARD_NOT_PRESENT - FRAUD_CARD_PRESENT -> Known.FRAUD_CARD_PRESENT - FRAUD_OTHER -> Known.FRAUD_OTHER - GOODS_SERVICES_NOT_AS_DESCRIBED -> Known.GOODS_SERVICES_NOT_AS_DESCRIBED - GOODS_SERVICES_NOT_RECEIVED -> Known.GOODS_SERVICES_NOT_RECEIVED - INCORRECT_AMOUNT -> Known.INCORRECT_AMOUNT - MISSING_AUTH -> Known.MISSING_AUTH - OTHER -> Known.OTHER - PROCESSING_ERROR -> Known.PROCESSING_ERROR - RECURRING_TRANSACTION_NOT_CANCELLED -> Known.RECURRING_TRANSACTION_NOT_CANCELLED - REFUND_NOT_PROCESSED -> Known.REFUND_NOT_PROCESSED - else -> throw LithicInvalidDataException("Unknown Reason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): Reason = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Reason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Reason for the dispute resolution: - * * `CASE_LOST`: This case was lost at final arbitration. - * * `NETWORK_REJECTED`: Network rejected. - * * `NO_DISPUTE_RIGHTS_3DS`: No dispute rights, 3DS. - * * `NO_DISPUTE_RIGHTS_BELOW_THRESHOLD`: No dispute rights, below threshold. - * * `NO_DISPUTE_RIGHTS_CONTACTLESS`: No dispute rights, contactless. - * * `NO_DISPUTE_RIGHTS_HYBRID`: No dispute rights, hybrid. - * * `NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS`: No dispute rights, max chargebacks. - * * `NO_DISPUTE_RIGHTS_OTHER`: No dispute rights, other. - * * `PAST_FILING_DATE`: Past filing date. - * * `PREARBITRATION_REJECTED`: Prearbitration rejected. - * * `PROCESSOR_REJECTED_OTHER`: Processor rejected, other. - * * `REFUNDED`: Refunded. - * * `REFUNDED_AFTER_CHARGEBACK`: Refunded after chargeback. - * * `WITHDRAWN`: Withdrawn. - * * `WON_ARBITRATION`: Won arbitration. - * * `WON_FIRST_CHARGEBACK`: Won first chargeback. - * * `WON_PREARBITRATION`: Won prearbitration. - */ - class ResolutionReason @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 CASE_LOST = of("CASE_LOST") - - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") - - @JvmField val NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") - - @JvmField - val NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") - - @JvmField val NO_DISPUTE_RIGHTS_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") - - @JvmField val NO_DISPUTE_RIGHTS_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") - - @JvmField - val NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") - - @JvmField val NO_DISPUTE_RIGHTS_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") - - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") - - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") - - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") - - @JvmField val REFUNDED = of("REFUNDED") - - @JvmField val REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") - - @JvmField val WITHDRAWN = of("WITHDRAWN") - - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") - - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") - - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") - - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) - } - - /** An enum containing [ResolutionReason]'s known values. */ - enum class Known { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - } - - /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ResolutionReason] 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 { - CASE_LOST, - NETWORK_REJECTED, - NO_DISPUTE_RIGHTS_3DS, - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD, - NO_DISPUTE_RIGHTS_CONTACTLESS, - NO_DISPUTE_RIGHTS_HYBRID, - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS, - NO_DISPUTE_RIGHTS_OTHER, - PAST_FILING_DATE, - PREARBITRATION_REJECTED, - PROCESSOR_REJECTED_OTHER, - REFUNDED, - REFUNDED_AFTER_CHARGEBACK, - WITHDRAWN, - WON_ARBITRATION, - WON_FIRST_CHARGEBACK, - WON_PREARBITRATION, - /** - * An enum member indicating that [ResolutionReason] 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) { - CASE_LOST -> Value.CASE_LOST - NETWORK_REJECTED -> Value.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Value.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Value.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Value.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Value.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Value.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Value.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Value.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Value.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Value.PROCESSOR_REJECTED_OTHER - REFUNDED -> Value.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Value.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Value.WITHDRAWN - WON_ARBITRATION -> Value.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Value.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Value.WON_PREARBITRATION - 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) { - CASE_LOST -> Known.CASE_LOST - NETWORK_REJECTED -> Known.NETWORK_REJECTED - NO_DISPUTE_RIGHTS_3DS -> Known.NO_DISPUTE_RIGHTS_3DS - NO_DISPUTE_RIGHTS_BELOW_THRESHOLD -> Known.NO_DISPUTE_RIGHTS_BELOW_THRESHOLD - NO_DISPUTE_RIGHTS_CONTACTLESS -> Known.NO_DISPUTE_RIGHTS_CONTACTLESS - NO_DISPUTE_RIGHTS_HYBRID -> Known.NO_DISPUTE_RIGHTS_HYBRID - NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS -> Known.NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS - NO_DISPUTE_RIGHTS_OTHER -> Known.NO_DISPUTE_RIGHTS_OTHER - PAST_FILING_DATE -> Known.PAST_FILING_DATE - PREARBITRATION_REJECTED -> Known.PREARBITRATION_REJECTED - PROCESSOR_REJECTED_OTHER -> Known.PROCESSOR_REJECTED_OTHER - REFUNDED -> Known.REFUNDED - REFUNDED_AFTER_CHARGEBACK -> Known.REFUNDED_AFTER_CHARGEBACK - WITHDRAWN -> Known.WITHDRAWN - WON_ARBITRATION -> Known.WON_ARBITRATION - WON_FIRST_CHARGEBACK -> Known.WON_FIRST_CHARGEBACK - WON_PREARBITRATION -> Known.WON_PREARBITRATION - else -> throw LithicInvalidDataException("Unknown ResolutionReason: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): ResolutionReason = 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 ResolutionReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Status types: - * * `NEW` - New dispute case is opened. - * * `PENDING_CUSTOMER` - Lithic is waiting for customer to provide more information. - * * `SUBMITTED` - Dispute is submitted to the card network. - * * `REPRESENTMENT` - Case has entered second presentment. - * * `PREARBITRATION` - Case has entered prearbitration. - * * `ARBITRATION` - Case has entered arbitration. - * * `CASE_WON` - Case was won and credit will be issued. - * * `CASE_CLOSED` - Case was lost or withdrawn. - */ - 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 ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") - - @JvmField val NEW = of("NEW") - - @JvmField val PENDING_CUSTOMER = of("PENDING_CUSTOMER") - - @JvmField val PREARBITRATION = of("PREARBITRATION") - - @JvmField val REPRESENTMENT = of("REPRESENTMENT") - - @JvmField val SUBMITTED = of("SUBMITTED") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - } - - /** - * 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 { - ARBITRATION, - CASE_CLOSED, - CASE_WON, - NEW, - PENDING_CUSTOMER, - PREARBITRATION, - REPRESENTMENT, - SUBMITTED, - /** 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) { - ARBITRATION -> Value.ARBITRATION - CASE_CLOSED -> Value.CASE_CLOSED - CASE_WON -> Value.CASE_WON - NEW -> Value.NEW - PENDING_CUSTOMER -> Value.PENDING_CUSTOMER - PREARBITRATION -> Value.PREARBITRATION - REPRESENTMENT -> Value.REPRESENTMENT - SUBMITTED -> Value.SUBMITTED - 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) { - ARBITRATION -> Known.ARBITRATION - CASE_CLOSED -> Known.CASE_CLOSED - CASE_WON -> Known.CASE_WON - NEW -> Known.NEW - PENDING_CUSTOMER -> Known.PENDING_CUSTOMER - PREARBITRATION -> Known.PREARBITRATION - REPRESENTMENT -> Known.REPRESENTMENT - SUBMITTED -> Known.SUBMITTED - 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 - - 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 DisputeUpdateResponse && - token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && - created == other.created && - customerFiledDate == other.customerFiledDate && - customerNote == other.customerNote && - networkClaimIds == other.networkClaimIds && - networkFiledDate == other.networkFiledDate && - networkReasonCode == other.networkReasonCode && - prearbitrationDate == other.prearbitrationDate && - primaryClaimId == other.primaryClaimId && - reason == other.reason && - representmentDate == other.representmentDate && - resolutionDate == other.resolutionDate && - resolutionNote == other.resolutionNote && - resolutionReason == other.resolutionReason && - status == other.status && - transactionToken == other.transactionToken && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - amount, - arbitrationDate, - created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, - status, - transactionToken, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DisputeUpdateResponse{token=$token, amount=$amount, arbitrationDate=$arbitrationDate, created=$created, customerFiledDate=$customerFiledDate, customerNote=$customerNote, networkClaimIds=$networkClaimIds, networkFiledDate=$networkFiledDate, networkReasonCode=$networkReasonCode, prearbitrationDate=$prearbitrationDate, primaryClaimId=$primaryClaimId, reason=$reason, representmentDate=$representmentDate, resolutionDate=$resolutionDate, resolutionNote=$resolutionNote, resolutionReason=$resolutionReason, status=$status, transactionToken=$transactionToken, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeV2.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeV2.kt new file mode 100644 index 000000000..96a60f6bd --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeV2.kt @@ -0,0 +1,4812 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.annotation.JsonAnyGetter +import com.fasterxml.jackson.annotation.JsonAnySetter +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.core.JsonGenerator +import com.fasterxml.jackson.core.ObjectCodec +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.SerializerProvider +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.annotation.JsonSerialize +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.BaseDeserializer +import com.lithic.api.core.BaseSerializer +import com.lithic.api.core.Enum +import com.lithic.api.core.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkKnown +import com.lithic.api.core.checkRequired +import com.lithic.api.core.getOrThrow +import com.lithic.api.core.toImmutable +import com.lithic.api.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** The Dispute object tracks the progression of a dispute throughout its lifecycle. */ +class DisputeV2 +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val accountToken: JsonField, + private val cardToken: JsonField, + private val caseId: JsonField, + private val created: JsonField, + private val currency: JsonField, + private val disposition: JsonField, + private val events: JsonField>, + private val liabilityAllocation: JsonField, + private val merchant: JsonField, + private val network: JsonField, + private val status: JsonField, + private val transactionSeries: JsonField, + private val updated: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("card_token") @ExcludeMissing cardToken: JsonField = JsonMissing.of(), + @JsonProperty("case_id") @ExcludeMissing caseId: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + @JsonProperty("disposition") + @ExcludeMissing + disposition: JsonField = JsonMissing.of(), + @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), + @JsonProperty("liability_allocation") + @ExcludeMissing + liabilityAllocation: JsonField = JsonMissing.of(), + @JsonProperty("merchant") @ExcludeMissing merchant: JsonField = JsonMissing.of(), + @JsonProperty("network") @ExcludeMissing network: JsonField = JsonMissing.of(), + @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), + @JsonProperty("transaction_series") + @ExcludeMissing + transactionSeries: JsonField = JsonMissing.of(), + @JsonProperty("updated") + @ExcludeMissing + updated: JsonField = JsonMissing.of(), + ) : this( + token, + accountToken, + cardToken, + caseId, + created, + currency, + disposition, + events, + liabilityAllocation, + merchant, + network, + status, + transactionSeries, + updated, + mutableMapOf(), + ) + + /** + * Token assigned by Lithic for the dispute, 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 associated with the dispute, 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 accountToken(): String = accountToken.getRequired("account_token") + + /** + * Token for the card used in the dispute, 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 cardToken(): String = cardToken.getRequired("card_token") + + /** + * Identifier assigned by the network for this dispute. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun caseId(): Optional = caseId.getOptional("case_id") + + /** + * When the dispute 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") + + /** + * Three-letter ISO 4217 currency code. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun currency(): String = currency.getRequired("currency") + + /** + * Dispute resolution outcome + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun disposition(): Optional = disposition.getOptional("disposition") + + /** + * Chronological list of events that have occurred in the dispute lifecycle + * + * @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 events(): List = events.getRequired("events") + + /** + * Current breakdown of how liability is allocated for the disputed amount + * + * @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 liabilityAllocation(): LiabilityAllocation = + liabilityAllocation.getRequired("liability_allocation") + + /** + * @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 merchant(): Merchant = merchant.getRequired("merchant") + + /** + * Card network handling the dispute. + * + * @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 network(): Network = network.getRequired("network") + + /** + * Current status of the dispute. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun status(): Optional = status.getOptional("status") + + /** + * Contains identifiers for the transaction and specific event within being disputed; null if no + * transaction can be identified + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun transactionSeries(): Optional = + transactionSeries.getOptional("transaction_series") + + /** + * When the dispute 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 [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 [cardToken]. + * + * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken + + /** + * Returns the raw JSON value of [caseId]. + * + * Unlike [caseId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("case_id") @ExcludeMissing fun _caseId(): JsonField = caseId + + /** + * 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 [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [disposition]. + * + * Unlike [disposition], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("disposition") + @ExcludeMissing + fun _disposition(): JsonField = disposition + + /** + * Returns the raw JSON value of [events]. + * + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events + + /** + * Returns the raw JSON value of [liabilityAllocation]. + * + * Unlike [liabilityAllocation], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("liability_allocation") + @ExcludeMissing + fun _liabilityAllocation(): JsonField = liabilityAllocation + + /** + * Returns the raw JSON value of [merchant]. + * + * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant + + /** + * Returns the raw JSON value of [network]. + * + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network + + /** + * 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 [transactionSeries]. + * + * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_series") + @ExcludeMissing + fun _transactionSeries(): JsonField = transactionSeries + + /** + * 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 [DisputeV2]. + * + * The following fields are required: + * ```java + * .token() + * .accountToken() + * .cardToken() + * .caseId() + * .created() + * .currency() + * .disposition() + * .events() + * .liabilityAllocation() + * .merchant() + * .network() + * .status() + * .transactionSeries() + * .updated() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputeV2]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var accountToken: JsonField? = null + private var cardToken: JsonField? = null + private var caseId: JsonField? = null + private var created: JsonField? = null + private var currency: JsonField? = null + private var disposition: JsonField? = null + private var events: JsonField>? = null + private var liabilityAllocation: JsonField? = null + private var merchant: JsonField? = null + private var network: JsonField? = null + private var status: JsonField? = null + private var transactionSeries: JsonField? = null + private var updated: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(disputeV2: DisputeV2) = apply { + token = disputeV2.token + accountToken = disputeV2.accountToken + cardToken = disputeV2.cardToken + caseId = disputeV2.caseId + created = disputeV2.created + currency = disputeV2.currency + disposition = disputeV2.disposition + events = disputeV2.events.map { it.toMutableList() } + liabilityAllocation = disputeV2.liabilityAllocation + merchant = disputeV2.merchant + network = disputeV2.network + status = disputeV2.status + transactionSeries = disputeV2.transactionSeries + updated = disputeV2.updated + additionalProperties = disputeV2.additionalProperties.toMutableMap() + } + + /** Token assigned by Lithic for the dispute, 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 associated with the dispute, in UUID format. */ + fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + + /** + * 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 + } + + /** Token for the card used in the dispute, in UUID format. */ + fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken)) + + /** + * Sets [Builder.cardToken] to an arbitrary JSON value. + * + * You should usually call [Builder.cardToken] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } + + /** Identifier assigned by the network for this dispute. */ + fun caseId(caseId: String?) = caseId(JsonField.ofNullable(caseId)) + + /** Alias for calling [Builder.caseId] with `caseId.orElse(null)`. */ + fun caseId(caseId: Optional) = caseId(caseId.getOrNull()) + + /** + * Sets [Builder.caseId] to an arbitrary JSON value. + * + * You should usually call [Builder.caseId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun caseId(caseId: JsonField) = apply { this.caseId = caseId } + + /** When the dispute 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 } + + /** Three-letter ISO 4217 currency code. */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** Dispute resolution outcome */ + fun disposition(disposition: Disposition?) = disposition(JsonField.ofNullable(disposition)) + + /** Alias for calling [Builder.disposition] with `disposition.orElse(null)`. */ + fun disposition(disposition: Optional) = disposition(disposition.getOrNull()) + + /** + * Sets [Builder.disposition] to an arbitrary JSON value. + * + * You should usually call [Builder.disposition] with a well-typed [Disposition] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun disposition(disposition: JsonField) = apply { + this.disposition = disposition + } + + /** Chronological list of events that have occurred in the dispute lifecycle */ + fun events(events: List) = events(JsonField.of(events)) + + /** + * Sets [Builder.events] to an arbitrary JSON value. + * + * You should usually call [Builder.events] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun events(events: JsonField>) = apply { + this.events = events.map { it.toMutableList() } + } + + /** + * Adds a single [Event] to [events]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addEvent(event: Event) = apply { + events = + (events ?: JsonField.of(mutableListOf())).also { + checkKnown("events", it).add(event) + } + } + + /** Current breakdown of how liability is allocated for the disputed amount */ + fun liabilityAllocation(liabilityAllocation: LiabilityAllocation) = + liabilityAllocation(JsonField.of(liabilityAllocation)) + + /** + * Sets [Builder.liabilityAllocation] to an arbitrary JSON value. + * + * You should usually call [Builder.liabilityAllocation] with a well-typed + * [LiabilityAllocation] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun liabilityAllocation(liabilityAllocation: JsonField) = apply { + this.liabilityAllocation = liabilityAllocation + } + + fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) + + /** + * Sets [Builder.merchant] to an arbitrary JSON value. + * + * You should usually call [Builder.merchant] with a well-typed [Merchant] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } + + /** Card network handling the dispute. */ + fun network(network: Network) = network(JsonField.of(network)) + + /** + * Sets [Builder.network] to an arbitrary JSON value. + * + * You should usually call [Builder.network] with a well-typed [Network] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun network(network: JsonField) = apply { this.network = network } + + /** Current status of the dispute. */ + fun status(status: Status?) = status(JsonField.ofNullable(status)) + + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) + + /** + * 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 } + + /** + * Contains identifiers for the transaction and specific event within being disputed; null + * if no transaction can be identified + */ + fun transactionSeries(transactionSeries: TransactionSeries?) = + transactionSeries(JsonField.ofNullable(transactionSeries)) + + /** Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`. */ + fun transactionSeries(transactionSeries: Optional) = + transactionSeries(transactionSeries.getOrNull()) + + /** + * Sets [Builder.transactionSeries] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionSeries] with a well-typed [TransactionSeries] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun transactionSeries(transactionSeries: JsonField) = apply { + this.transactionSeries = transactionSeries + } + + /** When the dispute 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 [DisputeV2]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .accountToken() + * .cardToken() + * .caseId() + * .created() + * .currency() + * .disposition() + * .events() + * .liabilityAllocation() + * .merchant() + * .network() + * .status() + * .transactionSeries() + * .updated() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputeV2 = + DisputeV2( + checkRequired("token", token), + checkRequired("accountToken", accountToken), + checkRequired("cardToken", cardToken), + checkRequired("caseId", caseId), + checkRequired("created", created), + checkRequired("currency", currency), + checkRequired("disposition", disposition), + checkRequired("events", events).map { it.toImmutable() }, + checkRequired("liabilityAllocation", liabilityAllocation), + checkRequired("merchant", merchant), + checkRequired("network", network), + checkRequired("status", status), + checkRequired("transactionSeries", transactionSeries), + checkRequired("updated", updated), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DisputeV2 = apply { + if (validated) { + return@apply + } + + token() + accountToken() + cardToken() + caseId() + created() + currency() + disposition().ifPresent { it.validate() } + events().forEach { it.validate() } + liabilityAllocation().validate() + merchant().validate() + network().validate() + status().ifPresent { it.validate() } + transactionSeries().ifPresent { it.validate() } + 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 (accountToken.asKnown().isPresent) 1 else 0) + + (if (cardToken.asKnown().isPresent) 1 else 0) + + (if (caseId.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (disposition.asKnown().getOrNull()?.validity() ?: 0) + + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (liabilityAllocation.asKnown().getOrNull()?.validity() ?: 0) + + (merchant.asKnown().getOrNull()?.validity() ?: 0) + + (network.asKnown().getOrNull()?.validity() ?: 0) + + (status.asKnown().getOrNull()?.validity() ?: 0) + + (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.asKnown().isPresent) 1 else 0) + + /** Dispute resolution outcome */ + class Disposition @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 WON = of("WON") + + @JvmField val LOST = of("LOST") + + @JvmField val PARTIALLY_WON = of("PARTIALLY_WON") + + @JvmField val WITHDRAWN = of("WITHDRAWN") + + @JvmField val DENIED = of("DENIED") + + @JvmStatic fun of(value: String) = Disposition(JsonField.of(value)) + } + + /** An enum containing [Disposition]'s known values. */ + enum class Known { + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, + } + + /** + * An enum containing [Disposition]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Disposition] 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 { + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, + /** + * An enum member indicating that [Disposition] 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) { + WON -> Value.WON + LOST -> Value.LOST + PARTIALLY_WON -> Value.PARTIALLY_WON + WITHDRAWN -> Value.WITHDRAWN + DENIED -> Value.DENIED + 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) { + WON -> Known.WON + LOST -> Known.LOST + PARTIALLY_WON -> Known.PARTIALLY_WON + WITHDRAWN -> Known.WITHDRAWN + DENIED -> Known.DENIED + else -> throw LithicInvalidDataException("Unknown Disposition: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Disposition = 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 Disposition && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Event that occurred in the dispute lifecycle */ + class Event + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val token: JsonField, + private val created: JsonField, + private val data: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("data") @ExcludeMissing data: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(token, created, data, type, mutableMapOf()) + + /** + * Unique identifier for the event, 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 event 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 created(): OffsetDateTime = created.getRequired("created") + + /** + * Details specific to the event type + * + * @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 data(): Data = data.getRequired("data") + + /** + * Type of event + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [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 [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField = data + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Event]. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .data() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Event]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var created: JsonField? = null + private var data: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(event: Event) = apply { + token = event.token + created = event.created + data = event.data + type = event.type + additionalProperties = event.additionalProperties.toMutableMap() + } + + /** Unique identifier for the event, 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 event occurred */ + 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 } + + /** Details specific to the event type */ + fun data(data: Data) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed [Data] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun data(data: JsonField) = apply { this.data = data } + + /** Alias for calling [data] with `Data.ofWorkflow(workflow)`. */ + fun data(workflow: Data.WorkflowEventData) = data(Data.ofWorkflow(workflow)) + + /** Alias for calling [data] with `Data.ofFinancial(financial)`. */ + fun data(financial: Data.FinancialEventData) = data(Data.ofFinancial(financial)) + + /** Alias for calling [data] with `Data.ofCardholderLiability(cardholderLiability)`. */ + fun data(cardholderLiability: Data.CardholderLiabilityEventData) = + data(Data.ofCardholderLiability(cardholderLiability)) + + /** Type of event */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Event]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .created() + * .data() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Event = + Event( + checkRequired("token", token), + checkRequired("created", created), + checkRequired("data", data), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Event = apply { + if (validated) { + return@apply + } + + token() + created() + data().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (data.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Details specific to the event type */ + @JsonDeserialize(using = Data.Deserializer::class) + @JsonSerialize(using = Data.Serializer::class) + class Data + private constructor( + private val workflow: WorkflowEventData? = null, + private val financial: FinancialEventData? = null, + private val cardholderLiability: CardholderLiabilityEventData? = null, + private val _json: JsonValue? = null, + ) { + + /** Details specific to workflow events */ + fun workflow(): Optional = Optional.ofNullable(workflow) + + /** Details specific to financial events */ + fun financial(): Optional = Optional.ofNullable(financial) + + /** Details specific to cardholder liability events */ + fun cardholderLiability(): Optional = + Optional.ofNullable(cardholderLiability) + + fun isWorkflow(): Boolean = workflow != null + + fun isFinancial(): Boolean = financial != null + + fun isCardholderLiability(): Boolean = cardholderLiability != null + + /** Details specific to workflow events */ + fun asWorkflow(): WorkflowEventData = workflow.getOrThrow("workflow") + + /** Details specific to financial events */ + fun asFinancial(): FinancialEventData = financial.getOrThrow("financial") + + /** Details specific to cardholder liability events */ + fun asCardholderLiability(): CardholderLiabilityEventData = + cardholderLiability.getOrThrow("cardholderLiability") + + fun _json(): Optional = Optional.ofNullable(_json) + + fun accept(visitor: Visitor): T = + when { + workflow != null -> visitor.visitWorkflow(workflow) + financial != null -> visitor.visitFinancial(financial) + cardholderLiability != null -> + visitor.visitCardholderLiability(cardholderLiability) + else -> visitor.unknown(_json) + } + + private var validated: Boolean = false + + fun validate(): Data = apply { + if (validated) { + return@apply + } + + accept( + object : Visitor { + override fun visitWorkflow(workflow: WorkflowEventData) { + workflow.validate() + } + + override fun visitFinancial(financial: FinancialEventData) { + financial.validate() + } + + override fun visitCardholderLiability( + cardholderLiability: CardholderLiabilityEventData + ) { + cardholderLiability.validate() + } + } + ) + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + accept( + object : Visitor { + override fun visitWorkflow(workflow: WorkflowEventData) = + workflow.validity() + + override fun visitFinancial(financial: FinancialEventData) = + financial.validity() + + override fun visitCardholderLiability( + cardholderLiability: CardholderLiabilityEventData + ) = cardholderLiability.validity() + + override fun unknown(json: JsonValue?) = 0 + } + ) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Data && + workflow == other.workflow && + financial == other.financial && + cardholderLiability == other.cardholderLiability + } + + override fun hashCode(): Int = Objects.hash(workflow, financial, cardholderLiability) + + override fun toString(): String = + when { + workflow != null -> "Data{workflow=$workflow}" + financial != null -> "Data{financial=$financial}" + cardholderLiability != null -> "Data{cardholderLiability=$cardholderLiability}" + _json != null -> "Data{_unknown=$_json}" + else -> throw IllegalStateException("Invalid Data") + } + + companion object { + + /** Details specific to workflow events */ + @JvmStatic fun ofWorkflow(workflow: WorkflowEventData) = Data(workflow = workflow) + + /** Details specific to financial events */ + @JvmStatic + fun ofFinancial(financial: FinancialEventData) = Data(financial = financial) + + /** Details specific to cardholder liability events */ + @JvmStatic + fun ofCardholderLiability(cardholderLiability: CardholderLiabilityEventData) = + Data(cardholderLiability = cardholderLiability) + } + + /** + * An interface that defines how to map each variant of [Data] to a value of type [T]. + */ + interface Visitor { + + /** Details specific to workflow events */ + fun visitWorkflow(workflow: WorkflowEventData): T + + /** Details specific to financial events */ + fun visitFinancial(financial: FinancialEventData): T + + /** Details specific to cardholder liability events */ + fun visitCardholderLiability(cardholderLiability: CardholderLiabilityEventData): T + + /** + * Maps an unknown variant of [Data] to a value of type [T]. + * + * An instance of [Data] can contain an unknown variant if it was deserialized from + * data that doesn't match any known variant. For example, if the SDK is on an older + * version than the API, then the API may respond with new variants that the SDK is + * unaware of. + * + * @throws LithicInvalidDataException in the default implementation. + */ + fun unknown(json: JsonValue?): T { + throw LithicInvalidDataException("Unknown Data: $json") + } + } + + internal class Deserializer : BaseDeserializer(Data::class) { + + override fun ObjectCodec.deserialize(node: JsonNode): Data { + val json = JsonValue.fromJsonNode(node) + val type = json.asObject().getOrNull()?.get("type")?.asString()?.getOrNull() + + when (type) { + "WORKFLOW" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + Data(workflow = it, _json = json) + } ?: Data(_json = json) + } + "FINANCIAL" -> { + return tryDeserialize(node, jacksonTypeRef())?.let { + Data(financial = it, _json = json) + } ?: Data(_json = json) + } + "CARDHOLDER_LIABILITY" -> { + return tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Data(cardholderLiability = it, _json = json) } + ?: Data(_json = json) + } + } + + return Data(_json = json) + } + } + + internal class Serializer : BaseSerializer(Data::class) { + + override fun serialize( + value: Data, + generator: JsonGenerator, + provider: SerializerProvider, + ) { + when { + value.workflow != null -> generator.writeObject(value.workflow) + value.financial != null -> generator.writeObject(value.financial) + value.cardholderLiability != null -> + generator.writeObject(value.cardholderLiability) + value._json != null -> generator.writeObject(value._json) + else -> throw IllegalStateException("Invalid Data") + } + } + } + + /** Details specific to workflow events */ + class WorkflowEventData + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val action: JsonField, + private val amount: JsonField, + private val disposition: JsonField, + private val reason: JsonField, + private val stage: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("action") + @ExcludeMissing + action: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("disposition") + @ExcludeMissing + disposition: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + @JsonProperty("stage") + @ExcludeMissing + stage: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(action, amount, disposition, reason, stage, type, mutableMapOf()) + + /** + * Action taken in this stage + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun action(): Action = action.getRequired("action") + + /** + * Amount in minor units + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun amount(): Optional = amount.getOptional("amount") + + /** + * Dispute resolution outcome + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun disposition(): Optional = disposition.getOptional("disposition") + + /** + * Reason for the action + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun reason(): Optional = reason.getOptional("reason") + + /** + * Current stage of the dispute workflow + * + * @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 stage(): Stage = stage.getRequired("stage") + + /** + * Event type discriminator + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [action]. + * + * Unlike [action], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [disposition]. + * + * Unlike [disposition], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("disposition") + @ExcludeMissing + fun _disposition(): JsonField = disposition + + /** + * 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 [stage]. + * + * Unlike [stage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("stage") @ExcludeMissing fun _stage(): JsonField = stage + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [WorkflowEventData]. + * + * The following fields are required: + * ```java + * .action() + * .amount() + * .disposition() + * .reason() + * .stage() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [WorkflowEventData]. */ + class Builder internal constructor() { + + private var action: JsonField? = null + private var amount: JsonField? = null + private var disposition: JsonField? = null + private var reason: JsonField? = null + private var stage: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(workflowEventData: WorkflowEventData) = apply { + action = workflowEventData.action + amount = workflowEventData.amount + disposition = workflowEventData.disposition + reason = workflowEventData.reason + stage = workflowEventData.stage + type = workflowEventData.type + additionalProperties = workflowEventData.additionalProperties.toMutableMap() + } + + /** Action taken in this stage */ + fun action(action: Action) = action(JsonField.of(action)) + + /** + * Sets [Builder.action] to an arbitrary JSON value. + * + * You should usually call [Builder.action] with a well-typed [Action] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun action(action: JsonField) = apply { this.action = action } + + /** Amount in minor units */ + fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) + + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun amount(amount: Long) = amount(amount as Long?) + + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ + fun amount(amount: Optional) = amount(amount.getOrNull()) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** Dispute resolution outcome */ + fun disposition(disposition: Disposition?) = + disposition(JsonField.ofNullable(disposition)) + + /** Alias for calling [Builder.disposition] with `disposition.orElse(null)`. */ + fun disposition(disposition: Optional) = + disposition(disposition.getOrNull()) + + /** + * Sets [Builder.disposition] to an arbitrary JSON value. + * + * You should usually call [Builder.disposition] with a well-typed [Disposition] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun disposition(disposition: JsonField) = apply { + this.disposition = disposition + } + + /** Reason for the action */ + fun reason(reason: String?) = reason(JsonField.ofNullable(reason)) + + /** Alias for calling [Builder.reason] with `reason.orElse(null)`. */ + fun reason(reason: Optional) = reason(reason.getOrNull()) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [String] 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 stage of the dispute workflow */ + fun stage(stage: Stage) = stage(JsonField.of(stage)) + + /** + * Sets [Builder.stage] to an arbitrary JSON value. + * + * You should usually call [Builder.stage] with a well-typed [Stage] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun stage(stage: JsonField) = apply { this.stage = stage } + + /** Event type discriminator */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [WorkflowEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .action() + * .amount() + * .disposition() + * .reason() + * .stage() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): WorkflowEventData = + WorkflowEventData( + checkRequired("action", action), + checkRequired("amount", amount), + checkRequired("disposition", disposition), + checkRequired("reason", reason), + checkRequired("stage", stage), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): WorkflowEventData = apply { + if (validated) { + return@apply + } + + action().validate() + amount() + disposition().ifPresent { it.validate() } + reason() + stage().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (action.asKnown().getOrNull()?.validity() ?: 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (disposition.asKnown().getOrNull()?.validity() ?: 0) + + (if (reason.asKnown().isPresent) 1 else 0) + + (stage.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Action taken in this stage */ + class Action + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val OPENED = of("OPENED") + + @JvmField val CLOSED = of("CLOSED") + + @JvmField val REOPENED = of("REOPENED") + + @JvmStatic fun of(value: String) = Action(JsonField.of(value)) + } + + /** An enum containing [Action]'s known values. */ + enum class Known { + OPENED, + CLOSED, + REOPENED, + } + + /** + * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Action] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + OPENED, + CLOSED, + REOPENED, + /** + * An enum member indicating that [Action] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + OPENED -> Value.OPENED + CLOSED -> Value.CLOSED + REOPENED -> Value.REOPENED + 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) { + OPENED -> Known.OPENED + CLOSED -> Known.CLOSED + REOPENED -> Known.REOPENED + else -> throw LithicInvalidDataException("Unknown Action: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Dispute resolution outcome */ + class Disposition + @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 WON = of("WON") + + @JvmField val LOST = of("LOST") + + @JvmField val PARTIALLY_WON = of("PARTIALLY_WON") + + @JvmField val WITHDRAWN = of("WITHDRAWN") + + @JvmField val DENIED = of("DENIED") + + @JvmStatic fun of(value: String) = Disposition(JsonField.of(value)) + } + + /** An enum containing [Disposition]'s known values. */ + enum class Known { + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, + } + + /** + * An enum containing [Disposition]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Disposition] 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 { + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, + /** + * An enum member indicating that [Disposition] 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) { + WON -> Value.WON + LOST -> Value.LOST + PARTIALLY_WON -> Value.PARTIALLY_WON + WITHDRAWN -> Value.WITHDRAWN + DENIED -> Value.DENIED + 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) { + WON -> Known.WON + LOST -> Known.LOST + PARTIALLY_WON -> Known.PARTIALLY_WON + WITHDRAWN -> Known.WITHDRAWN + DENIED -> Known.DENIED + else -> throw LithicInvalidDataException("Unknown Disposition: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Disposition = 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 Disposition && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current stage of the dispute workflow */ + class Stage @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 = of("CLAIM") + + @JvmStatic fun of(value: String) = Stage(JsonField.of(value)) + } + + /** An enum containing [Stage]'s known values. */ + enum class Known { + CLAIM + } + + /** + * An enum containing [Stage]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Stage] 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, + /** + * An enum member indicating that [Stage] 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 -> Value.CLAIM + 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 -> Known.CLAIM + else -> throw LithicInvalidDataException("Unknown Stage: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Stage = 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 Stage && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Event type discriminator */ + 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 WORKFLOW = of("WORKFLOW") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + WORKFLOW + } + + /** + * 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 { + WORKFLOW, + /** + * 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) { + WORKFLOW -> Value.WORKFLOW + 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) { + WORKFLOW -> Known.WORKFLOW + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is WorkflowEventData && + action == other.action && + amount == other.amount && + disposition == other.disposition && + reason == other.reason && + stage == other.stage && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + action, + amount, + disposition, + reason, + stage, + type, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "WorkflowEventData{action=$action, amount=$amount, disposition=$disposition, reason=$reason, stage=$stage, type=$type, additionalProperties=$additionalProperties}" + } + + /** Details specific to financial events */ + class FinancialEventData + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val amount: JsonField, + private val polarity: JsonField, + private val stage: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("polarity") + @ExcludeMissing + polarity: JsonField = JsonMissing.of(), + @JsonProperty("stage") + @ExcludeMissing + stage: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(amount, polarity, stage, type, mutableMapOf()) + + /** + * Amount in minor units + * + * @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 amount(): Long = amount.getRequired("amount") + + /** + * Direction of funds flow + * + * @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 polarity(): Polarity = polarity.getRequired("polarity") + + /** + * Stage at which the financial event 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 stage(): Stage = stage.getRequired("stage") + + /** + * Event type discriminator + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * Returns the raw JSON value of [polarity]. + * + * Unlike [polarity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("polarity") + @ExcludeMissing + fun _polarity(): JsonField = polarity + + /** + * Returns the raw JSON value of [stage]. + * + * Unlike [stage], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("stage") @ExcludeMissing fun _stage(): JsonField = stage + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [FinancialEventData]. + * + * The following fields are required: + * ```java + * .amount() + * .polarity() + * .stage() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FinancialEventData]. */ + class Builder internal constructor() { + + private var amount: JsonField? = null + private var polarity: JsonField? = null + private var stage: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(financialEventData: FinancialEventData) = apply { + amount = financialEventData.amount + polarity = financialEventData.polarity + stage = financialEventData.stage + type = financialEventData.type + additionalProperties = + financialEventData.additionalProperties.toMutableMap() + } + + /** Amount in minor units */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** Direction of funds flow */ + fun polarity(polarity: Polarity) = polarity(JsonField.of(polarity)) + + /** + * Sets [Builder.polarity] to an arbitrary JSON value. + * + * You should usually call [Builder.polarity] with a well-typed [Polarity] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun polarity(polarity: JsonField) = apply { this.polarity = polarity } + + /** Stage at which the financial event occurred */ + fun stage(stage: Stage) = stage(JsonField.of(stage)) + + /** + * Sets [Builder.stage] to an arbitrary JSON value. + * + * You should usually call [Builder.stage] with a well-typed [Stage] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun stage(stage: JsonField) = apply { this.stage = stage } + + /** Event type discriminator */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FinancialEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .amount() + * .polarity() + * .stage() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): FinancialEventData = + FinancialEventData( + checkRequired("amount", amount), + checkRequired("polarity", polarity), + checkRequired("stage", stage), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): FinancialEventData = apply { + if (validated) { + return@apply + } + + amount() + polarity().validate() + stage().validate() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (amount.asKnown().isPresent) 1 else 0) + + (polarity.asKnown().getOrNull()?.validity() ?: 0) + + (stage.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Direction of funds flow */ + class Polarity + @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) = Polarity(JsonField.of(value)) + } + + /** An enum containing [Polarity]'s known values. */ + enum class Known { + CREDIT, + DEBIT, + } + + /** + * An enum containing [Polarity]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Polarity] 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 [Polarity] 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 Polarity: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Polarity = 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 Polarity && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Stage at which the financial event occurred */ + class Stage @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 CHARGEBACK = of("CHARGEBACK") + + @JvmField val REPRESENTMENT = of("REPRESENTMENT") + + @JvmField val PREARBITRATION = of("PREARBITRATION") + + @JvmField val ARBITRATION = of("ARBITRATION") + + @JvmField val COLLABORATION = of("COLLABORATION") + + @JvmStatic fun of(value: String) = Stage(JsonField.of(value)) + } + + /** An enum containing [Stage]'s known values. */ + enum class Known { + CHARGEBACK, + REPRESENTMENT, + PREARBITRATION, + ARBITRATION, + COLLABORATION, + } + + /** + * An enum containing [Stage]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Stage] 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 { + CHARGEBACK, + REPRESENTMENT, + PREARBITRATION, + ARBITRATION, + COLLABORATION, + /** + * An enum member indicating that [Stage] 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) { + CHARGEBACK -> Value.CHARGEBACK + REPRESENTMENT -> Value.REPRESENTMENT + PREARBITRATION -> Value.PREARBITRATION + ARBITRATION -> Value.ARBITRATION + COLLABORATION -> Value.COLLABORATION + 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) { + CHARGEBACK -> Known.CHARGEBACK + REPRESENTMENT -> Known.REPRESENTMENT + PREARBITRATION -> Known.PREARBITRATION + ARBITRATION -> Known.ARBITRATION + COLLABORATION -> Known.COLLABORATION + else -> throw LithicInvalidDataException("Unknown Stage: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Stage = 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 Stage && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Event type discriminator */ + 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 FINANCIAL = of("FINANCIAL") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + FINANCIAL + } + + /** + * 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 { + FINANCIAL, + /** + * 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) { + FINANCIAL -> Value.FINANCIAL + 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 -> Known.FINANCIAL + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is FinancialEventData && + amount == other.amount && + polarity == other.polarity && + stage == other.stage && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(amount, polarity, stage, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FinancialEventData{amount=$amount, polarity=$polarity, stage=$stage, type=$type, additionalProperties=$additionalProperties}" + } + + /** Details specific to cardholder liability events */ + class CardholderLiabilityEventData + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val action: JsonField, + private val amount: JsonField, + private val reason: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("action") + @ExcludeMissing + action: JsonField = JsonMissing.of(), + @JsonProperty("amount") + @ExcludeMissing + amount: JsonField = JsonMissing.of(), + @JsonProperty("reason") + @ExcludeMissing + reason: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(action, amount, reason, type, mutableMapOf()) + + /** + * Action taken regarding cardholder liability + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun action(): Action = action.getRequired("action") + + /** + * Amount in minor units + * + * @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 amount(): Long = amount.getRequired("amount") + + /** + * Reason for the action + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun reason(): String = reason.getRequired("reason") + + /** + * Event type discriminator + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [action]. + * + * Unlike [action], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("action") @ExcludeMissing fun _action(): JsonField = action + + /** + * Returns the raw JSON value of [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * 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 [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [CardholderLiabilityEventData]. + * + * The following fields are required: + * ```java + * .action() + * .amount() + * .reason() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardholderLiabilityEventData]. */ + class Builder internal constructor() { + + private var action: JsonField? = null + private var amount: JsonField? = null + private var reason: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(cardholderLiabilityEventData: CardholderLiabilityEventData) = + apply { + action = cardholderLiabilityEventData.action + amount = cardholderLiabilityEventData.amount + reason = cardholderLiabilityEventData.reason + type = cardholderLiabilityEventData.type + additionalProperties = + cardholderLiabilityEventData.additionalProperties.toMutableMap() + } + + /** Action taken regarding cardholder liability */ + fun action(action: Action) = action(JsonField.of(action)) + + /** + * Sets [Builder.action] to an arbitrary JSON value. + * + * You should usually call [Builder.action] with a well-typed [Action] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun action(action: JsonField) = apply { this.action = action } + + /** Amount in minor units */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** Reason for the action */ + fun reason(reason: String) = reason(JsonField.of(reason)) + + /** + * Sets [Builder.reason] to an arbitrary JSON value. + * + * You should usually call [Builder.reason] with a well-typed [String] 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 } + + /** Event type discriminator */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [CardholderLiabilityEventData]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .action() + * .amount() + * .reason() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardholderLiabilityEventData = + CardholderLiabilityEventData( + checkRequired("action", action), + checkRequired("amount", amount), + checkRequired("reason", reason), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): CardholderLiabilityEventData = apply { + if (validated) { + return@apply + } + + action().validate() + amount() + reason() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (action.asKnown().getOrNull()?.validity() ?: 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (reason.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** Action taken regarding cardholder liability */ + class Action + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data that + * doesn't match any known member, and you want to know that value. For example, + * if the SDK is on an older version than the API, then the API may respond with + * new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + @JvmField val PROVISIONAL_CREDIT_GRANTED = of("PROVISIONAL_CREDIT_GRANTED") + + @JvmField + val PROVISIONAL_CREDIT_REVERSED = of("PROVISIONAL_CREDIT_REVERSED") + + @JvmField val WRITTEN_OFF = of("WRITTEN_OFF") + + @JvmStatic fun of(value: String) = Action(JsonField.of(value)) + } + + /** An enum containing [Action]'s known values. */ + enum class Known { + PROVISIONAL_CREDIT_GRANTED, + PROVISIONAL_CREDIT_REVERSED, + WRITTEN_OFF, + } + + /** + * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Action] can contain an unknown value in a couple of cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + PROVISIONAL_CREDIT_GRANTED, + PROVISIONAL_CREDIT_REVERSED, + WRITTEN_OFF, + /** + * An enum member indicating that [Action] was instantiated with an unknown + * value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always known or + * if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + PROVISIONAL_CREDIT_GRANTED -> Value.PROVISIONAL_CREDIT_GRANTED + PROVISIONAL_CREDIT_REVERSED -> Value.PROVISIONAL_CREDIT_REVERSED + WRITTEN_OFF -> Value.WRITTEN_OFF + 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) { + PROVISIONAL_CREDIT_GRANTED -> Known.PROVISIONAL_CREDIT_GRANTED + PROVISIONAL_CREDIT_REVERSED -> Known.PROVISIONAL_CREDIT_REVERSED + WRITTEN_OFF -> Known.WRITTEN_OFF + else -> throw LithicInvalidDataException("Unknown Action: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Action = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Action && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Event type discriminator */ + 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 CARDHOLDER_LIABILITY = of("CARDHOLDER_LIABILITY") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + CARDHOLDER_LIABILITY + } + + /** + * 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 { + CARDHOLDER_LIABILITY, + /** + * 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) { + CARDHOLDER_LIABILITY -> Value.CARDHOLDER_LIABILITY + 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) { + CARDHOLDER_LIABILITY -> Known.CARDHOLDER_LIABILITY + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not + * have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardholderLiabilityEventData && + action == other.action && + amount == other.amount && + reason == other.reason && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(action, amount, reason, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "CardholderLiabilityEventData{action=$action, amount=$amount, reason=$reason, type=$type, additionalProperties=$additionalProperties}" + } + } + + /** Type of event */ + 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 WORKFLOW = of("WORKFLOW") + + @JvmField val FINANCIAL = of("FINANCIAL") + + @JvmField val CARDHOLDER_LIABILITY = of("CARDHOLDER_LIABILITY") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + WORKFLOW, + FINANCIAL, + CARDHOLDER_LIABILITY, + } + + /** + * 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 { + WORKFLOW, + FINANCIAL, + CARDHOLDER_LIABILITY, + /** 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) { + WORKFLOW -> Value.WORKFLOW + FINANCIAL -> Value.FINANCIAL + CARDHOLDER_LIABILITY -> Value.CARDHOLDER_LIABILITY + 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) { + WORKFLOW -> Known.WORKFLOW + FINANCIAL -> Known.FINANCIAL + CARDHOLDER_LIABILITY -> Known.CARDHOLDER_LIABILITY + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Event && + token == other.token && + created == other.created && + data == other.data && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(token, created, data, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Event{token=$token, created=$created, data=$data, type=$type, additionalProperties=$additionalProperties}" + } + + /** Current breakdown of how liability is allocated for the disputed amount */ + class LiabilityAllocation + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val deniedAmount: JsonField, + private val originalAmount: JsonField, + private val recoveredAmount: JsonField, + private val remainingAmount: JsonField, + private val writtenOffAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("denied_amount") + @ExcludeMissing + deniedAmount: JsonField = JsonMissing.of(), + @JsonProperty("original_amount") + @ExcludeMissing + originalAmount: JsonField = JsonMissing.of(), + @JsonProperty("recovered_amount") + @ExcludeMissing + recoveredAmount: JsonField = JsonMissing.of(), + @JsonProperty("remaining_amount") + @ExcludeMissing + remainingAmount: JsonField = JsonMissing.of(), + @JsonProperty("written_off_amount") + @ExcludeMissing + writtenOffAmount: JsonField = JsonMissing.of(), + ) : this( + deniedAmount, + originalAmount, + recoveredAmount, + remainingAmount, + writtenOffAmount, + mutableMapOf(), + ) + + /** + * The amount that has been denied to the cardholder + * + * @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 deniedAmount(): Long = deniedAmount.getRequired("denied_amount") + + /** + * The initial amount disputed + * + * @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 originalAmount(): Long = originalAmount.getRequired("original_amount") + + /** + * The amount that has been recovered from the merchant through the dispute process + * + * @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 recoveredAmount(): Long = recoveredAmount.getRequired("recovered_amount") + + /** + * Any disputed amount that is still outstanding, i.e. has not been recovered, written off, + * or denied + * + * @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 remainingAmount(): Long = remainingAmount.getRequired("remaining_amount") + + /** + * The amount the issuer has chosen to write off + * + * @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 writtenOffAmount(): Long = writtenOffAmount.getRequired("written_off_amount") + + /** + * Returns the raw JSON value of [deniedAmount]. + * + * Unlike [deniedAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("denied_amount") + @ExcludeMissing + fun _deniedAmount(): JsonField = deniedAmount + + /** + * Returns the raw JSON value of [originalAmount]. + * + * Unlike [originalAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("original_amount") + @ExcludeMissing + fun _originalAmount(): JsonField = originalAmount + + /** + * Returns the raw JSON value of [recoveredAmount]. + * + * Unlike [recoveredAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("recovered_amount") + @ExcludeMissing + fun _recoveredAmount(): JsonField = recoveredAmount + + /** + * Returns the raw JSON value of [remainingAmount]. + * + * Unlike [remainingAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("remaining_amount") + @ExcludeMissing + fun _remainingAmount(): JsonField = remainingAmount + + /** + * Returns the raw JSON value of [writtenOffAmount]. + * + * Unlike [writtenOffAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("written_off_amount") + @ExcludeMissing + fun _writtenOffAmount(): JsonField = writtenOffAmount + + @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 [LiabilityAllocation]. + * + * The following fields are required: + * ```java + * .deniedAmount() + * .originalAmount() + * .recoveredAmount() + * .remainingAmount() + * .writtenOffAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LiabilityAllocation]. */ + class Builder internal constructor() { + + private var deniedAmount: JsonField? = null + private var originalAmount: JsonField? = null + private var recoveredAmount: JsonField? = null + private var remainingAmount: JsonField? = null + private var writtenOffAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(liabilityAllocation: LiabilityAllocation) = apply { + deniedAmount = liabilityAllocation.deniedAmount + originalAmount = liabilityAllocation.originalAmount + recoveredAmount = liabilityAllocation.recoveredAmount + remainingAmount = liabilityAllocation.remainingAmount + writtenOffAmount = liabilityAllocation.writtenOffAmount + additionalProperties = liabilityAllocation.additionalProperties.toMutableMap() + } + + /** The amount that has been denied to the cardholder */ + fun deniedAmount(deniedAmount: Long) = deniedAmount(JsonField.of(deniedAmount)) + + /** + * Sets [Builder.deniedAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.deniedAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun deniedAmount(deniedAmount: JsonField) = apply { + this.deniedAmount = deniedAmount + } + + /** The initial amount disputed */ + fun originalAmount(originalAmount: Long) = originalAmount(JsonField.of(originalAmount)) + + /** + * Sets [Builder.originalAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.originalAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun originalAmount(originalAmount: JsonField) = apply { + this.originalAmount = originalAmount + } + + /** The amount that has been recovered from the merchant through the dispute process */ + fun recoveredAmount(recoveredAmount: Long) = + recoveredAmount(JsonField.of(recoveredAmount)) + + /** + * Sets [Builder.recoveredAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.recoveredAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun recoveredAmount(recoveredAmount: JsonField) = apply { + this.recoveredAmount = recoveredAmount + } + + /** + * Any disputed amount that is still outstanding, i.e. has not been recovered, written + * off, or denied + */ + fun remainingAmount(remainingAmount: Long) = + remainingAmount(JsonField.of(remainingAmount)) + + /** + * Sets [Builder.remainingAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.remainingAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun remainingAmount(remainingAmount: JsonField) = apply { + this.remainingAmount = remainingAmount + } + + /** The amount the issuer has chosen to write off */ + fun writtenOffAmount(writtenOffAmount: Long) = + writtenOffAmount(JsonField.of(writtenOffAmount)) + + /** + * Sets [Builder.writtenOffAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.writtenOffAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun writtenOffAmount(writtenOffAmount: JsonField) = apply { + this.writtenOffAmount = writtenOffAmount + } + + 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 [LiabilityAllocation]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .deniedAmount() + * .originalAmount() + * .recoveredAmount() + * .remainingAmount() + * .writtenOffAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): LiabilityAllocation = + LiabilityAllocation( + checkRequired("deniedAmount", deniedAmount), + checkRequired("originalAmount", originalAmount), + checkRequired("recoveredAmount", recoveredAmount), + checkRequired("remainingAmount", remainingAmount), + checkRequired("writtenOffAmount", writtenOffAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): LiabilityAllocation = apply { + if (validated) { + return@apply + } + + deniedAmount() + originalAmount() + recoveredAmount() + remainingAmount() + writtenOffAmount() + 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 (deniedAmount.asKnown().isPresent) 1 else 0) + + (if (originalAmount.asKnown().isPresent) 1 else 0) + + (if (recoveredAmount.asKnown().isPresent) 1 else 0) + + (if (remainingAmount.asKnown().isPresent) 1 else 0) + + (if (writtenOffAmount.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LiabilityAllocation && + deniedAmount == other.deniedAmount && + originalAmount == other.originalAmount && + recoveredAmount == other.recoveredAmount && + remainingAmount == other.remainingAmount && + writtenOffAmount == other.writtenOffAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + deniedAmount, + originalAmount, + recoveredAmount, + remainingAmount, + writtenOffAmount, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "LiabilityAllocation{deniedAmount=$deniedAmount, originalAmount=$originalAmount, recoveredAmount=$recoveredAmount, remainingAmount=$remainingAmount, writtenOffAmount=$writtenOffAmount, additionalProperties=$additionalProperties}" + } + + /** Card network handling the dispute. */ + class Network @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 VISA = of("VISA") + + @JvmField val MASTERCARD = of("MASTERCARD") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) + } + + /** An enum containing [Network]'s known values. */ + enum class Known { + VISA, + MASTERCARD, + } + + /** + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [Network] 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 { + VISA, + MASTERCARD, + /** An enum member indicating that [Network] 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) { + VISA -> Value.VISA + MASTERCARD -> Value.MASTERCARD + 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) { + VISA -> Known.VISA + MASTERCARD -> Known.MASTERCARD + else -> throw LithicInvalidDataException("Unknown Network: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): Network = 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 Network && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Current status of the dispute. */ + 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 OPEN = of("OPEN") + + @JvmField val CLOSED = of("CLOSED") + + @JvmStatic fun of(value: String) = Status(JsonField.of(value)) + } + + /** An enum containing [Status]'s known values. */ + enum class Known { + OPEN, + CLOSED, + } + + /** + * 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 { + OPEN, + CLOSED, + /** 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) { + OPEN -> Value.OPEN + CLOSED -> Value.CLOSED + 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) { + OPEN -> Known.OPEN + CLOSED -> Known.CLOSED + 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 + + 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() + } + + /** + * Contains identifiers for the transaction and specific event within being disputed; null if no + * transaction can be identified + */ + class TransactionSeries + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val relatedTransactionEventToken: JsonField, + private val relatedTransactionToken: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("related_transaction_event_token") + @ExcludeMissing + relatedTransactionEventToken: JsonField = JsonMissing.of(), + @JsonProperty("related_transaction_token") + @ExcludeMissing + relatedTransactionToken: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(relatedTransactionEventToken, relatedTransactionToken, type, mutableMapOf()) + + /** + * Token of the specific event in the original transaction being disputed, in UUID format; + * null if no event can be identified + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun relatedTransactionEventToken(): Optional = + relatedTransactionEventToken.getOptional("related_transaction_event_token") + + /** + * Token of the original 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 relatedTransactionToken(): String = + relatedTransactionToken.getRequired("related_transaction_token") + + /** + * The type of transaction series associating the dispute and the original transaction. + * Always set to DISPUTE + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") + + /** + * Returns the raw JSON value of [relatedTransactionEventToken]. + * + * Unlike [relatedTransactionEventToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("related_transaction_event_token") + @ExcludeMissing + fun _relatedTransactionEventToken(): JsonField = relatedTransactionEventToken + + /** + * Returns the raw JSON value of [relatedTransactionToken]. + * + * Unlike [relatedTransactionToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("related_transaction_token") + @ExcludeMissing + fun _relatedTransactionToken(): JsonField = relatedTransactionToken + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TransactionSeries]. + * + * The following fields are required: + * ```java + * .relatedTransactionEventToken() + * .relatedTransactionToken() + * .type() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TransactionSeries]. */ + class Builder internal constructor() { + + private var relatedTransactionEventToken: JsonField? = null + private var relatedTransactionToken: JsonField? = null + private var type: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(transactionSeries: TransactionSeries) = apply { + relatedTransactionEventToken = transactionSeries.relatedTransactionEventToken + relatedTransactionToken = transactionSeries.relatedTransactionToken + type = transactionSeries.type + additionalProperties = transactionSeries.additionalProperties.toMutableMap() + } + + /** + * Token of the specific event in the original transaction being disputed, in UUID + * format; null if no event can be identified + */ + fun relatedTransactionEventToken(relatedTransactionEventToken: String?) = + relatedTransactionEventToken(JsonField.ofNullable(relatedTransactionEventToken)) + + /** + * Alias for calling [Builder.relatedTransactionEventToken] with + * `relatedTransactionEventToken.orElse(null)`. + */ + fun relatedTransactionEventToken(relatedTransactionEventToken: Optional) = + relatedTransactionEventToken(relatedTransactionEventToken.getOrNull()) + + /** + * Sets [Builder.relatedTransactionEventToken] to an arbitrary JSON value. + * + * You should usually call [Builder.relatedTransactionEventToken] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun relatedTransactionEventToken(relatedTransactionEventToken: JsonField) = + apply { + this.relatedTransactionEventToken = relatedTransactionEventToken + } + + /** Token of the original transaction being disputed, in UUID format */ + fun relatedTransactionToken(relatedTransactionToken: String) = + relatedTransactionToken(JsonField.of(relatedTransactionToken)) + + /** + * Sets [Builder.relatedTransactionToken] to an arbitrary JSON value. + * + * You should usually call [Builder.relatedTransactionToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun relatedTransactionToken(relatedTransactionToken: JsonField) = apply { + this.relatedTransactionToken = relatedTransactionToken + } + + /** + * The type of transaction series associating the dispute and the original transaction. + * Always set to DISPUTE + */ + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TransactionSeries]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .relatedTransactionEventToken() + * .relatedTransactionToken() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TransactionSeries = + TransactionSeries( + checkRequired("relatedTransactionEventToken", relatedTransactionEventToken), + checkRequired("relatedTransactionToken", relatedTransactionToken), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TransactionSeries = apply { + if (validated) { + return@apply + } + + relatedTransactionEventToken() + relatedTransactionToken() + type().validate() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (relatedTransactionEventToken.asKnown().isPresent) 1 else 0) + + (if (relatedTransactionToken.asKnown().isPresent) 1 else 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * The type of transaction series associating the dispute and the original transaction. + * Always set to DISPUTE + */ + 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 DISPUTE = of("DISPUTE") + + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + } + + /** An enum containing [Type]'s known values. */ + enum class Known { + DISPUTE + } + + /** + * 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 { + DISPUTE, + /** 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) { + DISPUTE -> Value.DISPUTE + 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) { + DISPUTE -> Known.DISPUTE + else -> throw LithicInvalidDataException("Unknown Type: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for + * debugging and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + LithicInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Type = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Type && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is TransactionSeries && + relatedTransactionEventToken == other.relatedTransactionEventToken && + relatedTransactionToken == other.relatedTransactionToken && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + relatedTransactionEventToken, + relatedTransactionToken, + type, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TransactionSeries{relatedTransactionEventToken=$relatedTransactionEventToken, relatedTransactionToken=$relatedTransactionToken, type=$type, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputeV2 && + token == other.token && + accountToken == other.accountToken && + cardToken == other.cardToken && + caseId == other.caseId && + created == other.created && + currency == other.currency && + disposition == other.disposition && + events == other.events && + liabilityAllocation == other.liabilityAllocation && + merchant == other.merchant && + network == other.network && + status == other.status && + transactionSeries == other.transactionSeries && + updated == other.updated && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + accountToken, + cardToken, + caseId, + created, + currency, + disposition, + events, + liabilityAllocation, + merchant, + network, + status, + transactionSeries, + updated, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DisputeV2{token=$token, accountToken=$accountToken, cardToken=$cardToken, caseId=$caseId, created=$created, currency=$currency, disposition=$disposition, events=$events, liabilityAllocation=$liabilityAllocation, merchant=$merchant, network=$network, status=$status, transactionSeries=$transactionSeries, updated=$updated, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPage.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPage.kt new file mode 100644 index 000000000..6b15ee1b8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPage.kt @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.AutoPager +import com.lithic.api.core.Page +import com.lithic.api.core.checkRequired +import com.lithic.api.services.blocking.DisputesV2Service +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** @see DisputesV2Service.list */ +class DisputesV2ListPage +private constructor( + private val service: DisputesV2Service, + private val params: DisputesV2ListParams, + private val response: DisputesV2ListPageResponse, +) : Page { + + /** + * Delegates to [DisputesV2ListPageResponse], but gracefully handles missing data. + * + * @see DisputesV2ListPageResponse.data + */ + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() + + /** + * Delegates to [DisputesV2ListPageResponse], but gracefully handles missing data. + * + * @see DisputesV2ListPageResponse.hasMore + */ + fun hasMore(): Optional = response._hasMore().getOptional("has_more") + + override fun items(): List = data() + + override fun hasNextPage(): Boolean = items().isNotEmpty() + + fun nextPageParams(): DisputesV2ListParams = + if (params.endingBefore().isPresent) { + params.toBuilder().endingBefore(items().first()._token().getOptional("token")).build() + } else { + params.toBuilder().startingAfter(items().last()._token().getOptional("token")).build() + } + + override fun nextPage(): DisputesV2ListPage = service.list(nextPageParams()) + + fun autoPager(): AutoPager = AutoPager.from(this) + + /** The parameters that were used to request this page. */ + fun params(): DisputesV2ListParams = params + + /** The response that this page was parsed from. */ + fun response(): DisputesV2ListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DisputesV2ListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputesV2ListPage]. */ + class Builder internal constructor() { + + private var service: DisputesV2Service? = null + private var params: DisputesV2ListParams? = null + private var response: DisputesV2ListPageResponse? = null + + @JvmSynthetic + internal fun from(disputesV2ListPage: DisputesV2ListPage) = apply { + service = disputesV2ListPage.service + params = disputesV2ListPage.params + response = disputesV2ListPage.response + } + + fun service(service: DisputesV2Service) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: DisputesV2ListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: DisputesV2ListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [DisputesV2ListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputesV2ListPage = + DisputesV2ListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputesV2ListPage && + service == other.service && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, params, response) + + override fun toString() = + "DisputesV2ListPage{service=$service, params=$params, response=$response}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageAsync.kt new file mode 100644 index 000000000..f92eeaf63 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageAsync.kt @@ -0,0 +1,146 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.AutoPagerAsync +import com.lithic.api.core.PageAsync +import com.lithic.api.core.checkRequired +import com.lithic.api.services.async.DisputesV2ServiceAsync +import java.util.Objects +import java.util.Optional +import java.util.concurrent.CompletableFuture +import java.util.concurrent.Executor +import kotlin.jvm.optionals.getOrNull + +/** @see DisputesV2ServiceAsync.list */ +class DisputesV2ListPageAsync +private constructor( + private val service: DisputesV2ServiceAsync, + private val streamHandlerExecutor: Executor, + private val params: DisputesV2ListParams, + private val response: DisputesV2ListPageResponse, +) : PageAsync { + + /** + * Delegates to [DisputesV2ListPageResponse], but gracefully handles missing data. + * + * @see DisputesV2ListPageResponse.data + */ + fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() + + /** + * Delegates to [DisputesV2ListPageResponse], but gracefully handles missing data. + * + * @see DisputesV2ListPageResponse.hasMore + */ + fun hasMore(): Optional = response._hasMore().getOptional("has_more") + + override fun items(): List = data() + + override fun hasNextPage(): Boolean = items().isNotEmpty() + + fun nextPageParams(): DisputesV2ListParams = + if (params.endingBefore().isPresent) { + params.toBuilder().endingBefore(items().first()._token().getOptional("token")).build() + } else { + params.toBuilder().startingAfter(items().last()._token().getOptional("token")).build() + } + + override fun nextPage(): CompletableFuture = + service.list(nextPageParams()) + + fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) + + /** The parameters that were used to request this page. */ + fun params(): DisputesV2ListParams = params + + /** The response that this page was parsed from. */ + fun response(): DisputesV2ListPageResponse = response + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [DisputesV2ListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputesV2ListPageAsync]. */ + class Builder internal constructor() { + + private var service: DisputesV2ServiceAsync? = null + private var streamHandlerExecutor: Executor? = null + private var params: DisputesV2ListParams? = null + private var response: DisputesV2ListPageResponse? = null + + @JvmSynthetic + internal fun from(disputesV2ListPageAsync: DisputesV2ListPageAsync) = apply { + service = disputesV2ListPageAsync.service + streamHandlerExecutor = disputesV2ListPageAsync.streamHandlerExecutor + params = disputesV2ListPageAsync.params + response = disputesV2ListPageAsync.response + } + + fun service(service: DisputesV2ServiceAsync) = apply { this.service = service } + + fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { + this.streamHandlerExecutor = streamHandlerExecutor + } + + /** The parameters that were used to request this page. */ + fun params(params: DisputesV2ListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: DisputesV2ListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [DisputesV2ListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .streamHandlerExecutor() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputesV2ListPageAsync = + DisputesV2ListPageAsync( + checkRequired("service", service), + checkRequired("streamHandlerExecutor", streamHandlerExecutor), + checkRequired("params", params), + checkRequired("response", response), + ) + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputesV2ListPageAsync && + service == other.service && + streamHandlerExecutor == other.streamHandlerExecutor && + params == other.params && + response == other.response + } + + override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) + + override fun toString() = + "DisputesV2ListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageResponse.kt new file mode 100644 index 000000000..aec266095 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListPageResponse.kt @@ -0,0 +1,230 @@ +// 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.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.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** Response for listing disputes */ +class DisputesV2ListPageResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val data: JsonField>, + private val hasMore: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), + @JsonProperty("has_more") @ExcludeMissing hasMore: JsonField = JsonMissing.of(), + ) : this(data, hasMore, mutableMapOf()) + + /** + * Array of dispute objects + * + * @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 data(): List = data.getRequired("data") + + /** + * Whether there are more results available + * + * @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 hasMore(): Boolean = hasMore.getRequired("has_more") + + /** + * Returns the raw JSON value of [data]. + * + * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data + + /** + * Returns the raw JSON value of [hasMore]. + * + * Unlike [hasMore], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("has_more") @ExcludeMissing fun _hasMore(): JsonField = hasMore + + @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 [DisputesV2ListPageResponse]. + * + * The following fields are required: + * ```java + * .data() + * .hasMore() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputesV2ListPageResponse]. */ + class Builder internal constructor() { + + private var data: JsonField>? = null + private var hasMore: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(disputesV2ListPageResponse: DisputesV2ListPageResponse) = apply { + data = disputesV2ListPageResponse.data.map { it.toMutableList() } + hasMore = disputesV2ListPageResponse.hasMore + additionalProperties = disputesV2ListPageResponse.additionalProperties.toMutableMap() + } + + /** Array of dispute objects */ + fun data(data: List) = data(JsonField.of(data)) + + /** + * Sets [Builder.data] to an arbitrary JSON value. + * + * You should usually call [Builder.data] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun data(data: JsonField>) = apply { + this.data = data.map { it.toMutableList() } + } + + /** + * Adds a single [DisputeV2] to [Builder.data]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addData(data: DisputeV2) = apply { + this.data = + (this.data ?: JsonField.of(mutableListOf())).also { + checkKnown("data", it).add(data) + } + } + + /** Whether there are more results available */ + fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore)) + + /** + * Sets [Builder.hasMore] to an arbitrary JSON value. + * + * You should usually call [Builder.hasMore] with a well-typed [Boolean] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun hasMore(hasMore: JsonField) = apply { this.hasMore = hasMore } + + 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 [DisputesV2ListPageResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .data() + * .hasMore() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): DisputesV2ListPageResponse = + DisputesV2ListPageResponse( + checkRequired("data", data).map { it.toImmutable() }, + checkRequired("hasMore", hasMore), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): DisputesV2ListPageResponse = apply { + if (validated) { + return@apply + } + + data().forEach { it.validate() } + hasMore() + 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 = + (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (hasMore.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputesV2ListPageResponse && + data == other.data && + hasMore == other.hasMore && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(data, hasMore, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "DisputesV2ListPageResponse{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListParams.kt new file mode 100644 index 000000000..7a6bd5656 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2ListParams.kt @@ -0,0 +1,346 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import java.time.OffsetDateTime +import java.time.format.DateTimeFormatter +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Returns a paginated list of disputes. */ +class DisputesV2ListParams +private constructor( + private val accountToken: String?, + private val begin: OffsetDateTime?, + private val cardToken: String?, + private val disputedTransactionToken: String?, + private val end: OffsetDateTime?, + private val endingBefore: String?, + private val pageSize: Long?, + private val startingAfter: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** Filter by account token. */ + fun accountToken(): Optional = Optional.ofNullable(accountToken) + + /** RFC 3339 timestamp for filtering by created date, inclusive. */ + fun begin(): Optional = Optional.ofNullable(begin) + + /** Filter by card token. */ + fun cardToken(): Optional = Optional.ofNullable(cardToken) + + /** + * Filter by the token of the transaction being disputed. Corresponds with + * transaction_series.related_transaction_token in the Dispute. + */ + fun disputedTransactionToken(): Optional = Optional.ofNullable(disputedTransactionToken) + + /** RFC 3339 timestamp for filtering by created date, inclusive. */ + fun end(): Optional = Optional.ofNullable(end) + + /** + * A cursor representing an item's token before which a page of results should end. Used to + * retrieve the previous page of results before this item. + */ + fun endingBefore(): Optional = Optional.ofNullable(endingBefore) + + /** Number of items to return. */ + fun pageSize(): Optional = Optional.ofNullable(pageSize) + + /** + * A cursor representing an item's token after which a page of results should begin. Used to + * retrieve the next page of results after this item. + */ + fun startingAfter(): Optional = Optional.ofNullable(startingAfter) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): DisputesV2ListParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [DisputesV2ListParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputesV2ListParams]. */ + class Builder internal constructor() { + + private var accountToken: String? = null + private var begin: OffsetDateTime? = null + private var cardToken: String? = null + private var disputedTransactionToken: String? = null + private var end: OffsetDateTime? = null + private var endingBefore: String? = null + private var pageSize: Long? = null + private var startingAfter: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(disputesV2ListParams: DisputesV2ListParams) = apply { + accountToken = disputesV2ListParams.accountToken + begin = disputesV2ListParams.begin + cardToken = disputesV2ListParams.cardToken + disputedTransactionToken = disputesV2ListParams.disputedTransactionToken + end = disputesV2ListParams.end + endingBefore = disputesV2ListParams.endingBefore + pageSize = disputesV2ListParams.pageSize + startingAfter = disputesV2ListParams.startingAfter + additionalHeaders = disputesV2ListParams.additionalHeaders.toBuilder() + additionalQueryParams = disputesV2ListParams.additionalQueryParams.toBuilder() + } + + /** Filter by account token. */ + fun accountToken(accountToken: String?) = apply { this.accountToken = accountToken } + + /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */ + fun accountToken(accountToken: Optional) = accountToken(accountToken.getOrNull()) + + /** RFC 3339 timestamp for filtering by created date, inclusive. */ + fun begin(begin: OffsetDateTime?) = apply { this.begin = begin } + + /** Alias for calling [Builder.begin] with `begin.orElse(null)`. */ + fun begin(begin: Optional) = begin(begin.getOrNull()) + + /** Filter by card token. */ + fun cardToken(cardToken: String?) = apply { this.cardToken = cardToken } + + /** Alias for calling [Builder.cardToken] with `cardToken.orElse(null)`. */ + fun cardToken(cardToken: Optional) = cardToken(cardToken.getOrNull()) + + /** + * Filter by the token of the transaction being disputed. Corresponds with + * transaction_series.related_transaction_token in the Dispute. + */ + fun disputedTransactionToken(disputedTransactionToken: String?) = apply { + this.disputedTransactionToken = disputedTransactionToken + } + + /** + * Alias for calling [Builder.disputedTransactionToken] with + * `disputedTransactionToken.orElse(null)`. + */ + fun disputedTransactionToken(disputedTransactionToken: Optional) = + disputedTransactionToken(disputedTransactionToken.getOrNull()) + + /** RFC 3339 timestamp for filtering by created date, inclusive. */ + fun end(end: OffsetDateTime?) = apply { this.end = end } + + /** Alias for calling [Builder.end] with `end.orElse(null)`. */ + fun end(end: Optional) = end(end.getOrNull()) + + /** + * A cursor representing an item's token before which a page of results should end. Used to + * retrieve the previous page of results before this item. + */ + fun endingBefore(endingBefore: String?) = apply { this.endingBefore = endingBefore } + + /** Alias for calling [Builder.endingBefore] with `endingBefore.orElse(null)`. */ + fun endingBefore(endingBefore: Optional) = endingBefore(endingBefore.getOrNull()) + + /** Number of items to return. */ + fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize } + + /** + * Alias for [Builder.pageSize]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun pageSize(pageSize: Long) = pageSize(pageSize as Long?) + + /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */ + fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull()) + + /** + * A cursor representing an item's token after which a page of results should begin. Used to + * retrieve the next page of results after this item. + */ + fun startingAfter(startingAfter: String?) = apply { this.startingAfter = startingAfter } + + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ + fun startingAfter(startingAfter: Optional) = + startingAfter(startingAfter.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DisputesV2ListParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DisputesV2ListParams = + DisputesV2ListParams( + accountToken, + begin, + cardToken, + disputedTransactionToken, + end, + endingBefore, + pageSize, + startingAfter, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = + QueryParams.builder() + .apply { + accountToken?.let { put("account_token", it) } + begin?.let { put("begin", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } + cardToken?.let { put("card_token", it) } + disputedTransactionToken?.let { put("disputed_transaction_token", it) } + end?.let { put("end", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) } + endingBefore?.let { put("ending_before", it) } + pageSize?.let { put("page_size", it.toString()) } + startingAfter?.let { put("starting_after", it) } + putAll(additionalQueryParams) + } + .build() + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputesV2ListParams && + accountToken == other.accountToken && + begin == other.begin && + cardToken == other.cardToken && + disputedTransactionToken == other.disputedTransactionToken && + end == other.end && + endingBefore == other.endingBefore && + pageSize == other.pageSize && + startingAfter == other.startingAfter && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash( + accountToken, + begin, + cardToken, + disputedTransactionToken, + end, + endingBefore, + pageSize, + startingAfter, + additionalHeaders, + additionalQueryParams, + ) + + override fun toString() = + "DisputesV2ListParams{accountToken=$accountToken, begin=$begin, cardToken=$cardToken, disputedTransactionToken=$disputedTransactionToken, end=$end, endingBefore=$endingBefore, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2RetrieveParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2RetrieveParams.kt new file mode 100644 index 000000000..969660df8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputesV2RetrieveParams.kt @@ -0,0 +1,194 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Retrieves a specific dispute by its token. */ +class DisputesV2RetrieveParams +private constructor( + private val disputeToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun disputeToken(): Optional = Optional.ofNullable(disputeToken) + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): DisputesV2RetrieveParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [DisputesV2RetrieveParams]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [DisputesV2RetrieveParams]. */ + class Builder internal constructor() { + + private var disputeToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(disputesV2RetrieveParams: DisputesV2RetrieveParams) = apply { + disputeToken = disputesV2RetrieveParams.disputeToken + additionalHeaders = disputesV2RetrieveParams.additionalHeaders.toBuilder() + additionalQueryParams = disputesV2RetrieveParams.additionalQueryParams.toBuilder() + } + + fun disputeToken(disputeToken: String?) = apply { this.disputeToken = disputeToken } + + /** Alias for calling [Builder.disputeToken] with `disputeToken.orElse(null)`. */ + fun disputeToken(disputeToken: Optional) = disputeToken(disputeToken.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [DisputesV2RetrieveParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): DisputesV2RetrieveParams = + DisputesV2RetrieveParams( + disputeToken, + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _pathParam(index: Int): String = + when (index) { + 0 -> disputeToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is DisputesV2RetrieveParams && + disputeToken == other.disputeToken && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(disputeToken, additionalHeaders, additionalQueryParams) + + override fun toString() = + "DisputesV2RetrieveParams{disputeToken=$disputeToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EnhancedData.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EnhancedData.kt index 6d8c95667..602f864f8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EnhancedData.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EnhancedData.kt @@ -525,8 +525,15 @@ private constructor( fun tax(tax: JsonField) = apply { this.tax = tax } /** A customer identifier. */ - fun customerReferenceNumber(customerReferenceNumber: String) = - customerReferenceNumber(JsonField.of(customerReferenceNumber)) + fun customerReferenceNumber(customerReferenceNumber: String?) = + customerReferenceNumber(JsonField.ofNullable(customerReferenceNumber)) + + /** + * Alias for calling [Builder.customerReferenceNumber] with + * `customerReferenceNumber.orElse(null)`. + */ + fun customerReferenceNumber(customerReferenceNumber: Optional) = + customerReferenceNumber(customerReferenceNumber.getOrNull()) /** * Sets [Builder.customerReferenceNumber] to an arbitrary JSON value. @@ -540,8 +547,15 @@ private constructor( } /** A merchant identifier. */ - fun merchantReferenceNumber(merchantReferenceNumber: String) = - merchantReferenceNumber(JsonField.of(merchantReferenceNumber)) + fun merchantReferenceNumber(merchantReferenceNumber: String?) = + merchantReferenceNumber(JsonField.ofNullable(merchantReferenceNumber)) + + /** + * Alias for calling [Builder.merchantReferenceNumber] with + * `merchantReferenceNumber.orElse(null)`. + */ + fun merchantReferenceNumber(merchantReferenceNumber: Optional) = + merchantReferenceNumber(merchantReferenceNumber.getOrNull()) /** * Sets [Builder.merchantReferenceNumber] to an arbitrary JSON value. @@ -555,7 +569,10 @@ private constructor( } /** The date of the order. */ - fun orderDate(orderDate: LocalDate) = orderDate(JsonField.of(orderDate)) + fun orderDate(orderDate: LocalDate?) = orderDate(JsonField.ofNullable(orderDate)) + + /** Alias for calling [Builder.orderDate] with `orderDate.orElse(null)`. */ + fun orderDate(orderDate: Optional) = orderDate(orderDate.getOrNull()) /** * Sets [Builder.orderDate] to an arbitrary JSON value. @@ -777,7 +794,10 @@ private constructor( } /** The price of the item purchased in merchant currency. */ - fun amount(amount: String) = amount(JsonField.of(amount)) + fun amount(amount: String?) = amount(JsonField.ofNullable(amount)) + + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ + fun amount(amount: Optional) = amount(amount.getOrNull()) /** * Sets [Builder.amount] to an arbitrary JSON value. @@ -789,7 +809,12 @@ private constructor( fun amount(amount: JsonField) = apply { this.amount = amount } /** A human-readable description of the item. */ - fun description(description: String) = description(JsonField.of(description)) + fun description(description: String?) = + description(JsonField.ofNullable(description)) + + /** Alias for calling [Builder.description] with `description.orElse(null)`. */ + fun description(description: Optional) = + description(description.getOrNull()) /** * Sets [Builder.description] to an arbitrary JSON value. @@ -803,7 +828,12 @@ private constructor( } /** An identifier for the item purchased. */ - fun productCode(productCode: String) = productCode(JsonField.of(productCode)) + fun productCode(productCode: String?) = + productCode(JsonField.ofNullable(productCode)) + + /** Alias for calling [Builder.productCode] with `productCode.orElse(null)`. */ + fun productCode(productCode: Optional) = + productCode(productCode.getOrNull()) /** * Sets [Builder.productCode] to an arbitrary JSON value. @@ -817,7 +847,10 @@ private constructor( } /** The quantity of the item purchased. */ - fun quantity(quantity: String) = quantity(JsonField.of(quantity)) + fun quantity(quantity: String?) = quantity(JsonField.ofNullable(quantity)) + + /** Alias for calling [Builder.quantity] with `quantity.orElse(null)`. */ + fun quantity(quantity: Optional) = quantity(quantity.getOrNull()) /** * Sets [Builder.quantity] to an arbitrary JSON value. @@ -1028,7 +1061,17 @@ private constructor( } /** The amount of tax collected. */ - fun amount(amount: Long) = amount(JsonField.of(amount)) + fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) + + /** + * Alias for [Builder.amount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun amount(amount: Long) = amount(amount as Long?) + + /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ + fun amount(amount: Optional) = amount(amount.getOrNull()) /** * Sets [Builder.amount] to an arbitrary JSON value. @@ -1040,7 +1083,10 @@ private constructor( fun amount(amount: JsonField) = apply { this.amount = amount } /** A flag indicating whether the transaction is tax exempt or not. */ - fun exempt(exempt: TaxExemptIndicator) = exempt(JsonField.of(exempt)) + fun exempt(exempt: TaxExemptIndicator?) = exempt(JsonField.ofNullable(exempt)) + + /** Alias for calling [Builder.exempt] with `exempt.orElse(null)`. */ + fun exempt(exempt: Optional) = exempt(exempt.getOrNull()) /** * Sets [Builder.exempt] to an arbitrary JSON value. @@ -1052,8 +1098,12 @@ private constructor( fun exempt(exempt: JsonField) = apply { this.exempt = exempt } /** The tax ID of the merchant. */ - fun merchantTaxId(merchantTaxId: String) = - merchantTaxId(JsonField.of(merchantTaxId)) + fun merchantTaxId(merchantTaxId: String?) = + merchantTaxId(JsonField.ofNullable(merchantTaxId)) + + /** Alias for calling [Builder.merchantTaxId] with `merchantTaxId.orElse(null)`. */ + fun merchantTaxId(merchantTaxId: Optional) = + merchantTaxId(merchantTaxId.getOrNull()) /** * Sets [Builder.merchantTaxId] to an arbitrary JSON value. @@ -1538,7 +1588,12 @@ private constructor( * The driver number entered into the terminal at the time of sale, with leading zeros * stripped. */ - fun driverNumber(driverNumber: String) = driverNumber(JsonField.of(driverNumber)) + fun driverNumber(driverNumber: String?) = + driverNumber(JsonField.ofNullable(driverNumber)) + + /** Alias for calling [Builder.driverNumber] with `driverNumber.orElse(null)`. */ + fun driverNumber(driverNumber: Optional) = + driverNumber(driverNumber.getOrNull()) /** * Sets [Builder.driverNumber] to an arbitrary JSON value. @@ -1552,7 +1607,17 @@ private constructor( } /** The odometer reading entered into the terminal at the time of sale. */ - fun odometer(odometer: Long) = odometer(JsonField.of(odometer)) + fun odometer(odometer: Long?) = odometer(JsonField.ofNullable(odometer)) + + /** + * Alias for [Builder.odometer]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun odometer(odometer: Long) = odometer(odometer as Long?) + + /** Alias for calling [Builder.odometer] with `odometer.orElse(null)`. */ + fun odometer(odometer: Optional) = odometer(odometer.getOrNull()) /** * Sets [Builder.odometer] to an arbitrary JSON value. @@ -1581,7 +1646,12 @@ private constructor( * The vehicle number entered into the terminal at the time of sale, with leading zeros * stripped. */ - fun vehicleNumber(vehicleNumber: String) = vehicleNumber(JsonField.of(vehicleNumber)) + fun vehicleNumber(vehicleNumber: String?) = + vehicleNumber(JsonField.ofNullable(vehicleNumber)) + + /** Alias for calling [Builder.vehicleNumber] with `vehicleNumber.orElse(null)`. */ + fun vehicleNumber(vehicleNumber: Optional) = + vehicleNumber(vehicleNumber.getOrNull()) /** * Sets [Builder.vehicleNumber] to an arbitrary JSON value. @@ -1783,7 +1853,17 @@ private constructor( } /** The discount applied to the gross sale amount. */ - fun discount(discount: Long) = discount(JsonField.of(discount)) + fun discount(discount: Long?) = discount(JsonField.ofNullable(discount)) + + /** + * Alias for [Builder.discount]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun discount(discount: Long) = discount(discount as Long?) + + /** Alias for calling [Builder.discount] with `discount.orElse(null)`. */ + fun discount(discount: Optional) = discount(discount.getOrNull()) /** * Sets [Builder.discount] to an arbitrary JSON value. @@ -1795,7 +1875,17 @@ private constructor( fun discount(discount: JsonField) = apply { this.discount = discount } /** The gross sale amount. */ - fun grossSale(grossSale: Long) = grossSale(JsonField.of(grossSale)) + fun grossSale(grossSale: Long?) = grossSale(JsonField.ofNullable(grossSale)) + + /** + * Alias for [Builder.grossSale]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun grossSale(grossSale: Long) = grossSale(grossSale as Long?) + + /** Alias for calling [Builder.grossSale] with `grossSale.orElse(null)`. */ + fun grossSale(grossSale: Optional) = grossSale(grossSale.getOrNull()) /** * Sets [Builder.grossSale] to an arbitrary JSON value. @@ -1807,7 +1897,17 @@ private constructor( fun grossSale(grossSale: JsonField) = apply { this.grossSale = grossSale } /** The amount after discount. */ - fun netSale(netSale: Long) = netSale(JsonField.of(netSale)) + fun netSale(netSale: Long?) = netSale(JsonField.ofNullable(netSale)) + + /** + * Alias for [Builder.netSale]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun netSale(netSale: Long) = netSale(netSale as Long?) + + /** Alias for calling [Builder.netSale] with `netSale.orElse(null)`. */ + fun netSale(netSale: Optional) = netSale(netSale.getOrNull()) /** * Sets [Builder.netSale] to an arbitrary JSON value. @@ -2033,7 +2133,10 @@ private constructor( } /** The quantity of fuel purchased. */ - fun quantity(quantity: String) = quantity(JsonField.of(quantity)) + fun quantity(quantity: String?) = quantity(JsonField.ofNullable(quantity)) + + /** Alias for calling [Builder.quantity] with `quantity.orElse(null)`. */ + fun quantity(quantity: Optional) = quantity(quantity.getOrNull()) /** * Sets [Builder.quantity] to an arbitrary JSON value. @@ -2045,7 +2148,10 @@ private constructor( fun quantity(quantity: JsonField) = apply { this.quantity = quantity } /** The type of fuel purchased. */ - fun type(type: FuelType) = type(JsonField.of(type)) + fun type(type: FuelType?) = type(JsonField.ofNullable(type)) + + /** Alias for calling [Builder.type] with `type.orElse(null)`. */ + fun type(type: Optional) = type(type.getOrNull()) /** * Sets [Builder.type] to an arbitrary JSON value. @@ -2057,8 +2163,12 @@ private constructor( fun type(type: JsonField) = apply { this.type = type } /** Unit of measure for fuel disbursement. */ - fun unitOfMeasure(unitOfMeasure: FuelUnitOfMeasure) = - unitOfMeasure(JsonField.of(unitOfMeasure)) + fun unitOfMeasure(unitOfMeasure: FuelUnitOfMeasure?) = + unitOfMeasure(JsonField.ofNullable(unitOfMeasure)) + + /** Alias for calling [Builder.unitOfMeasure] with `unitOfMeasure.orElse(null)`. */ + fun unitOfMeasure(unitOfMeasure: Optional) = + unitOfMeasure(unitOfMeasure.getOrNull()) /** * Sets [Builder.unitOfMeasure] to an arbitrary JSON value. @@ -2072,7 +2182,17 @@ private constructor( } /** The price per unit of fuel. */ - fun unitPrice(unitPrice: Long) = unitPrice(JsonField.of(unitPrice)) + fun unitPrice(unitPrice: Long?) = unitPrice(JsonField.ofNullable(unitPrice)) + + /** + * Alias for [Builder.unitPrice]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun unitPrice(unitPrice: Long) = unitPrice(unitPrice as Long?) + + /** Alias for calling [Builder.unitPrice] with `unitPrice.orElse(null)`. */ + fun unitPrice(unitPrice: Optional) = unitPrice(unitPrice.getOrNull()) /** * Sets [Builder.unitPrice] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountAddress.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountAddress.kt index 2632d08d9..098c1fcdb 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountAddress.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountAddress.kt @@ -15,6 +15,7 @@ import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections import java.util.Objects import java.util.Optional +import kotlin.jvm.optionals.getOrNull class ExternalBankAccountAddress @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -220,7 +221,10 @@ private constructor( */ fun state(state: JsonField) = apply { this.state = state } - fun address2(address2: String) = address2(JsonField.of(address2)) + fun address2(address2: String?) = address2(JsonField.ofNullable(address2)) + + /** Alias for calling [Builder.address2] with `address2.orElse(null)`. */ + fun address2(address2: Optional) = address2(address2.getOrNull()) /** * Sets [Builder.address2] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateResponse.kt index 16fb72d0a..af26e919a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountCreateResponse.kt @@ -761,7 +761,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -775,7 +778,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -789,7 +795,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -801,7 +810,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -812,8 +824,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -827,8 +843,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -842,7 +865,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -853,7 +879,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -871,8 +902,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountListResponse.kt index 850ed9e8a..372181958 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountListResponse.kt @@ -760,7 +760,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -774,7 +777,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -788,7 +794,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -800,7 +809,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -811,8 +823,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -826,8 +842,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -841,7 +864,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -852,7 +878,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -870,8 +901,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetrieveResponse.kt index a3d06bd1e..3a05c857a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetrieveResponse.kt @@ -761,7 +761,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -775,7 +778,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -789,7 +795,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -801,7 +810,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -812,8 +824,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -827,8 +843,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -842,7 +865,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -853,7 +879,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -871,8 +902,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryMicroDepositsResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryMicroDepositsResponse.kt index 92c38cf1c..61488f6cb 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryMicroDepositsResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryMicroDepositsResponse.kt @@ -765,7 +765,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -779,7 +782,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -793,7 +799,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -805,7 +814,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -816,8 +828,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -831,8 +847,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -846,7 +869,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -857,7 +883,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -875,8 +906,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryPrenoteResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryPrenoteResponse.kt index 2265f44bd..c1c3ed88c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryPrenoteResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountRetryPrenoteResponse.kt @@ -762,7 +762,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -776,7 +779,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -790,7 +796,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -802,7 +811,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -813,8 +825,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -828,8 +844,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -843,7 +866,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -854,7 +880,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -872,8 +903,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParams.kt new file mode 100644 index 000000000..352fa730b --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParams.kt @@ -0,0 +1,246 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.JsonValue +import com.lithic.api.core.Params +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import com.lithic.api.core.toImmutable +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Unpause an external bank account */ +class ExternalBankAccountUnpauseParams +private constructor( + private val externalBankAccountToken: String?, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, + private val additionalBodyProperties: Map, +) : Params { + + fun externalBankAccountToken(): Optional = Optional.ofNullable(externalBankAccountToken) + + /** Additional body properties to send with the request. */ + fun _additionalBodyProperties(): Map = additionalBodyProperties + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + @JvmStatic fun none(): ExternalBankAccountUnpauseParams = builder().build() + + /** + * Returns a mutable builder for constructing an instance of + * [ExternalBankAccountUnpauseParams]. + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExternalBankAccountUnpauseParams]. */ + class Builder internal constructor() { + + private var externalBankAccountToken: String? = null + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + private var additionalBodyProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(externalBankAccountUnpauseParams: ExternalBankAccountUnpauseParams) = + apply { + externalBankAccountToken = externalBankAccountUnpauseParams.externalBankAccountToken + additionalHeaders = externalBankAccountUnpauseParams.additionalHeaders.toBuilder() + additionalQueryParams = + externalBankAccountUnpauseParams.additionalQueryParams.toBuilder() + additionalBodyProperties = + externalBankAccountUnpauseParams.additionalBodyProperties.toMutableMap() + } + + fun externalBankAccountToken(externalBankAccountToken: String?) = apply { + this.externalBankAccountToken = externalBankAccountToken + } + + /** + * Alias for calling [Builder.externalBankAccountToken] with + * `externalBankAccountToken.orElse(null)`. + */ + fun externalBankAccountToken(externalBankAccountToken: Optional) = + externalBankAccountToken(externalBankAccountToken.getOrNull()) + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + this.additionalBodyProperties.clear() + putAllAdditionalBodyProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + additionalBodyProperties.put(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + this.additionalBodyProperties.putAll(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { + additionalBodyProperties.remove(key) + } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalBodyProperty) + } + + /** + * Returns an immutable instance of [ExternalBankAccountUnpauseParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): ExternalBankAccountUnpauseParams = + ExternalBankAccountUnpauseParams( + externalBankAccountToken, + additionalHeaders.build(), + additionalQueryParams.build(), + additionalBodyProperties.toImmutable(), + ) + } + + fun _body(): Optional> = + Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + + fun _pathParam(index: Int): String = + when (index) { + 0 -> externalBankAccountToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ExternalBankAccountUnpauseParams && + externalBankAccountToken == other.externalBankAccountToken && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams && + additionalBodyProperties == other.additionalBodyProperties + } + + override fun hashCode(): Int = + Objects.hash( + externalBankAccountToken, + additionalHeaders, + additionalQueryParams, + additionalBodyProperties, + ) + + override fun toString() = + "ExternalBankAccountUnpauseParams{externalBankAccountToken=$externalBankAccountToken, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponse.kt new file mode 100644 index 000000000..0c50e93c4 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponse.kt @@ -0,0 +1,1533 @@ +// 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.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.time.LocalDate +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +class ExternalBankAccountUnpauseResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val country: JsonField, + private val created: JsonField, + private val currency: JsonField, + private val lastFour: JsonField, + private val owner: JsonField, + private val ownerType: JsonField, + private val routingNumber: JsonField, + private val state: JsonField, + private val type: JsonField, + private val verificationAttempts: JsonField, + private val verificationMethod: JsonField, + private val verificationState: JsonField, + private val accountToken: JsonField, + private val address: JsonField, + private val companyId: JsonField, + private val dob: JsonField, + private val doingBusinessAs: JsonField, + private val financialAccountToken: JsonField, + private val name: JsonField, + private val userDefinedId: JsonField, + private val verificationFailedReason: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + @JsonProperty("last_four") @ExcludeMissing lastFour: JsonField = JsonMissing.of(), + @JsonProperty("owner") @ExcludeMissing owner: JsonField = JsonMissing.of(), + @JsonProperty("owner_type") + @ExcludeMissing + ownerType: JsonField = JsonMissing.of(), + @JsonProperty("routing_number") + @ExcludeMissing + routingNumber: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("verification_attempts") + @ExcludeMissing + verificationAttempts: JsonField = JsonMissing.of(), + @JsonProperty("verification_method") + @ExcludeMissing + verificationMethod: JsonField = JsonMissing.of(), + @JsonProperty("verification_state") + @ExcludeMissing + verificationState: JsonField = JsonMissing.of(), + @JsonProperty("account_token") + @ExcludeMissing + accountToken: JsonField = JsonMissing.of(), + @JsonProperty("address") + @ExcludeMissing + address: JsonField = JsonMissing.of(), + @JsonProperty("company_id") @ExcludeMissing companyId: JsonField = JsonMissing.of(), + @JsonProperty("dob") @ExcludeMissing dob: JsonField = JsonMissing.of(), + @JsonProperty("doing_business_as") + @ExcludeMissing + doingBusinessAs: JsonField = JsonMissing.of(), + @JsonProperty("financial_account_token") + @ExcludeMissing + financialAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), + @JsonProperty("user_defined_id") + @ExcludeMissing + userDefinedId: JsonField = JsonMissing.of(), + @JsonProperty("verification_failed_reason") + @ExcludeMissing + verificationFailedReason: JsonField = JsonMissing.of(), + ) : this( + token, + country, + created, + currency, + lastFour, + owner, + ownerType, + routingNumber, + state, + type, + verificationAttempts, + verificationMethod, + verificationState, + accountToken, + address, + companyId, + dob, + doingBusinessAs, + financialAccountToken, + name, + userDefinedId, + verificationFailedReason, + mutableMapOf(), + ) + + /** + * A globally unique identifier for this record of an external bank account association. If a + * program links an external bank account to more than one end-user or to both the program and + * the end-user, then Lithic will return each record of the association + * + * @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") + + /** + * The country that the bank account is located in using ISO 3166-1. We will only accept USA + * bank accounts e.g., USA + * + * @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 country(): String = country.getRequired("country") + + /** + * An ISO 8601 string representing when this funding source was added to the Lithic account. + * + * @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") + + /** + * currency of the external account 3-character alphabetic ISO 4217 code + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun currency(): String = currency.getRequired("currency") + + /** + * The last 4 digits of the bank account. Derived by Lithic from the account number passed + * + * @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 lastFour(): String = lastFour.getRequired("last_four") + + /** + * Legal Name of the business or individual who owns the external account. This will appear in + * statements + * + * @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 owner(): String = owner.getRequired("owner") + + /** + * Owner Type + * + * @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 ownerType(): OwnerType = ownerType.getRequired("owner_type") + + /** + * Routing Number + * + * @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 routingNumber(): String = routingNumber.getRequired("routing_number") + + /** + * Account State + * + * @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 state(): State = state.getRequired("state") + + /** + * Account Type + * + * @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(): AccountType = type.getRequired("type") + + /** + * The number of attempts at verification + * + * @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 verificationAttempts(): Long = verificationAttempts.getRequired("verification_attempts") + + /** + * Verification Method + * + * @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 verificationMethod(): VerificationMethod = + verificationMethod.getRequired("verification_method") + + /** + * Verification State + * + * @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 verificationState(): VerificationState = verificationState.getRequired("verification_state") + + /** + * Indicates which Lithic account the external account is associated with. For external accounts + * that are associated with the program, account_token field returned will be null + * + * @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") + + /** + * Address + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun address(): Optional = address.getOptional("address") + + /** + * Optional field that helps identify bank accounts in receipts + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun companyId(): Optional = companyId.getOptional("company_id") + + /** + * Date of Birth of the Individual that owns the external bank account + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dob(): Optional = dob.getOptional("dob") + + /** + * Doing Business As + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun doingBusinessAs(): Optional = doingBusinessAs.getOptional("doing_business_as") + + /** + * The financial account token of the operating account to fund the micro deposits + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun financialAccountToken(): Optional = + financialAccountToken.getOptional("financial_account_token") + + /** + * The nickname for this External Bank Account + * + * @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") + + /** + * User Defined ID + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun userDefinedId(): Optional = userDefinedId.getOptional("user_defined_id") + + /** + * Optional free text description of the reason for the failed verification. For ACH + * micro-deposits returned, this field will display the reason return code sent by the ACH + * network + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun verificationFailedReason(): Optional = + verificationFailedReason.getOptional("verification_failed_reason") + + /** + * 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 [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [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 [currency]. + * + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency + + /** + * Returns the raw JSON value of [lastFour]. + * + * Unlike [lastFour], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("last_four") @ExcludeMissing fun _lastFour(): JsonField = lastFour + + /** + * Returns the raw JSON value of [owner]. + * + * Unlike [owner], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("owner") @ExcludeMissing fun _owner(): JsonField = owner + + /** + * Returns the raw JSON value of [ownerType]. + * + * Unlike [ownerType], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("owner_type") @ExcludeMissing fun _ownerType(): JsonField = ownerType + + /** + * Returns the raw JSON value of [routingNumber]. + * + * Unlike [routingNumber], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("routing_number") + @ExcludeMissing + fun _routingNumber(): JsonField = routingNumber + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + /** + * Returns the raw JSON value of [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 [verificationAttempts]. + * + * Unlike [verificationAttempts], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification_attempts") + @ExcludeMissing + fun _verificationAttempts(): JsonField = verificationAttempts + + /** + * Returns the raw JSON value of [verificationMethod]. + * + * Unlike [verificationMethod], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification_method") + @ExcludeMissing + fun _verificationMethod(): JsonField = verificationMethod + + /** + * Returns the raw JSON value of [verificationState]. + * + * Unlike [verificationState], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("verification_state") + @ExcludeMissing + fun _verificationState(): JsonField = verificationState + + /** + * 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 [address]. + * + * Unlike [address], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("address") + @ExcludeMissing + fun _address(): JsonField = address + + /** + * Returns the raw JSON value of [companyId]. + * + * Unlike [companyId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("company_id") @ExcludeMissing fun _companyId(): JsonField = companyId + + /** + * Returns the raw JSON value of [dob]. + * + * Unlike [dob], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("dob") @ExcludeMissing fun _dob(): JsonField = dob + + /** + * Returns the raw JSON value of [doingBusinessAs]. + * + * Unlike [doingBusinessAs], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("doing_business_as") + @ExcludeMissing + fun _doingBusinessAs(): JsonField = doingBusinessAs + + /** + * Returns the raw JSON value of [financialAccountToken]. + * + * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("financial_account_token") + @ExcludeMissing + fun _financialAccountToken(): JsonField = financialAccountToken + + /** + * 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 [userDefinedId]. + * + * Unlike [userDefinedId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("user_defined_id") + @ExcludeMissing + fun _userDefinedId(): JsonField = userDefinedId + + /** + * Returns the raw JSON value of [verificationFailedReason]. + * + * Unlike [verificationFailedReason], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("verification_failed_reason") + @ExcludeMissing + fun _verificationFailedReason(): JsonField = verificationFailedReason + + @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 + * [ExternalBankAccountUnpauseResponse]. + * + * The following fields are required: + * ```java + * .token() + * .country() + * .created() + * .currency() + * .lastFour() + * .owner() + * .ownerType() + * .routingNumber() + * .state() + * .type() + * .verificationAttempts() + * .verificationMethod() + * .verificationState() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ExternalBankAccountUnpauseResponse]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var country: JsonField? = null + private var created: JsonField? = null + private var currency: JsonField? = null + private var lastFour: JsonField? = null + private var owner: JsonField? = null + private var ownerType: JsonField? = null + private var routingNumber: JsonField? = null + private var state: JsonField? = null + private var type: JsonField? = null + private var verificationAttempts: JsonField? = null + private var verificationMethod: JsonField? = null + private var verificationState: JsonField? = null + private var accountToken: JsonField = JsonMissing.of() + private var address: JsonField = JsonMissing.of() + private var companyId: JsonField = JsonMissing.of() + private var dob: JsonField = JsonMissing.of() + private var doingBusinessAs: JsonField = JsonMissing.of() + private var financialAccountToken: JsonField = JsonMissing.of() + private var name: JsonField = JsonMissing.of() + private var userDefinedId: JsonField = JsonMissing.of() + private var verificationFailedReason: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(externalBankAccountUnpauseResponse: ExternalBankAccountUnpauseResponse) = + apply { + token = externalBankAccountUnpauseResponse.token + country = externalBankAccountUnpauseResponse.country + created = externalBankAccountUnpauseResponse.created + currency = externalBankAccountUnpauseResponse.currency + lastFour = externalBankAccountUnpauseResponse.lastFour + owner = externalBankAccountUnpauseResponse.owner + ownerType = externalBankAccountUnpauseResponse.ownerType + routingNumber = externalBankAccountUnpauseResponse.routingNumber + state = externalBankAccountUnpauseResponse.state + type = externalBankAccountUnpauseResponse.type + verificationAttempts = externalBankAccountUnpauseResponse.verificationAttempts + verificationMethod = externalBankAccountUnpauseResponse.verificationMethod + verificationState = externalBankAccountUnpauseResponse.verificationState + accountToken = externalBankAccountUnpauseResponse.accountToken + address = externalBankAccountUnpauseResponse.address + companyId = externalBankAccountUnpauseResponse.companyId + dob = externalBankAccountUnpauseResponse.dob + doingBusinessAs = externalBankAccountUnpauseResponse.doingBusinessAs + financialAccountToken = externalBankAccountUnpauseResponse.financialAccountToken + name = externalBankAccountUnpauseResponse.name + userDefinedId = externalBankAccountUnpauseResponse.userDefinedId + verificationFailedReason = + externalBankAccountUnpauseResponse.verificationFailedReason + additionalProperties = + externalBankAccountUnpauseResponse.additionalProperties.toMutableMap() + } + + /** + * A globally unique identifier for this record of an external bank account association. If + * a program links an external bank account to more than one end-user or to both the program + * and the end-user, then Lithic will return each record of the association + */ + 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 } + + /** + * The country that the bank account is located in using ISO 3166-1. We will only accept USA + * bank accounts e.g., USA + */ + fun country(country: String) = country(JsonField.of(country)) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** + * An ISO 8601 string representing when this funding source was added to the Lithic account. + */ + 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 } + + /** currency of the external account 3-character alphabetic ISO 4217 code */ + fun currency(currency: String) = currency(JsonField.of(currency)) + + /** + * Sets [Builder.currency] to an arbitrary JSON value. + * + * You should usually call [Builder.currency] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun currency(currency: JsonField) = apply { this.currency = currency } + + /** + * The last 4 digits of the bank account. Derived by Lithic from the account number passed + */ + fun lastFour(lastFour: String) = lastFour(JsonField.of(lastFour)) + + /** + * Sets [Builder.lastFour] to an arbitrary JSON value. + * + * You should usually call [Builder.lastFour] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun lastFour(lastFour: JsonField) = apply { this.lastFour = lastFour } + + /** + * Legal Name of the business or individual who owns the external account. This will appear + * in statements + */ + fun owner(owner: String) = owner(JsonField.of(owner)) + + /** + * Sets [Builder.owner] to an arbitrary JSON value. + * + * You should usually call [Builder.owner] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun owner(owner: JsonField) = apply { this.owner = owner } + + /** Owner Type */ + fun ownerType(ownerType: OwnerType) = ownerType(JsonField.of(ownerType)) + + /** + * Sets [Builder.ownerType] to an arbitrary JSON value. + * + * You should usually call [Builder.ownerType] with a well-typed [OwnerType] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun ownerType(ownerType: JsonField) = apply { this.ownerType = ownerType } + + /** Routing Number */ + fun routingNumber(routingNumber: String) = routingNumber(JsonField.of(routingNumber)) + + /** + * Sets [Builder.routingNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.routingNumber] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun routingNumber(routingNumber: JsonField) = apply { + this.routingNumber = routingNumber + } + + /** Account State */ + fun state(state: State) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [State] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + /** Account Type */ + fun type(type: AccountType) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [AccountType] 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 number of attempts at verification */ + fun verificationAttempts(verificationAttempts: Long) = + verificationAttempts(JsonField.of(verificationAttempts)) + + /** + * Sets [Builder.verificationAttempts] to an arbitrary JSON value. + * + * You should usually call [Builder.verificationAttempts] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun verificationAttempts(verificationAttempts: JsonField) = apply { + this.verificationAttempts = verificationAttempts + } + + /** Verification Method */ + fun verificationMethod(verificationMethod: VerificationMethod) = + verificationMethod(JsonField.of(verificationMethod)) + + /** + * Sets [Builder.verificationMethod] to an arbitrary JSON value. + * + * You should usually call [Builder.verificationMethod] with a well-typed + * [VerificationMethod] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun verificationMethod(verificationMethod: JsonField) = apply { + this.verificationMethod = verificationMethod + } + + /** Verification State */ + fun verificationState(verificationState: VerificationState) = + verificationState(JsonField.of(verificationState)) + + /** + * Sets [Builder.verificationState] to an arbitrary JSON value. + * + * You should usually call [Builder.verificationState] with a well-typed [VerificationState] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun verificationState(verificationState: JsonField) = apply { + this.verificationState = verificationState + } + + /** + * Indicates which Lithic account the external account is associated with. For external + * accounts that are associated with the program, account_token field returned will be null + */ + 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 + } + + /** Address */ + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) + + /** + * Sets [Builder.address] to an arbitrary JSON value. + * + * You should usually call [Builder.address] with a well-typed [ExternalBankAccountAddress] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun address(address: JsonField) = apply { + this.address = address + } + + /** Optional field that helps identify bank accounts in receipts */ + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) + + /** + * Sets [Builder.companyId] to an arbitrary JSON value. + * + * You should usually call [Builder.companyId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun companyId(companyId: JsonField) = apply { this.companyId = companyId } + + /** Date of Birth of the Individual that owns the external bank account */ + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) + + /** + * Sets [Builder.dob] to an arbitrary JSON value. + * + * You should usually call [Builder.dob] with a well-typed [LocalDate] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun dob(dob: JsonField) = apply { this.dob = dob } + + /** Doing Business As */ + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) + + /** + * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. + * + * You should usually call [Builder.doingBusinessAs] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun doingBusinessAs(doingBusinessAs: JsonField) = apply { + this.doingBusinessAs = doingBusinessAs + } + + /** The financial account token of the operating account to fund the micro deposits */ + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) + + /** + * Sets [Builder.financialAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.financialAccountToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun financialAccountToken(financialAccountToken: JsonField) = apply { + this.financialAccountToken = financialAccountToken + } + + /** The nickname for this External Bank Account */ + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) + + /** + * 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 } + + /** User Defined ID */ + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) + + /** + * Sets [Builder.userDefinedId] to an arbitrary JSON value. + * + * You should usually call [Builder.userDefinedId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun userDefinedId(userDefinedId: JsonField) = apply { + this.userDefinedId = userDefinedId + } + + /** + * Optional free text description of the reason for the failed verification. For ACH + * micro-deposits returned, this field will display the reason return code sent by the ACH + * network + */ + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) + + /** + * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. + * + * You should usually call [Builder.verificationFailedReason] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun verificationFailedReason(verificationFailedReason: JsonField) = apply { + this.verificationFailedReason = verificationFailedReason + } + + 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 [ExternalBankAccountUnpauseResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .country() + * .created() + * .currency() + * .lastFour() + * .owner() + * .ownerType() + * .routingNumber() + * .state() + * .type() + * .verificationAttempts() + * .verificationMethod() + * .verificationState() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ExternalBankAccountUnpauseResponse = + ExternalBankAccountUnpauseResponse( + checkRequired("token", token), + checkRequired("country", country), + checkRequired("created", created), + checkRequired("currency", currency), + checkRequired("lastFour", lastFour), + checkRequired("owner", owner), + checkRequired("ownerType", ownerType), + checkRequired("routingNumber", routingNumber), + checkRequired("state", state), + checkRequired("type", type), + checkRequired("verificationAttempts", verificationAttempts), + checkRequired("verificationMethod", verificationMethod), + checkRequired("verificationState", verificationState), + accountToken, + address, + companyId, + dob, + doingBusinessAs, + financialAccountToken, + name, + userDefinedId, + verificationFailedReason, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): ExternalBankAccountUnpauseResponse = apply { + if (validated) { + return@apply + } + + token() + country() + created() + currency() + lastFour() + owner() + ownerType().validate() + routingNumber() + state().validate() + type().validate() + verificationAttempts() + verificationMethod().validate() + verificationState().validate() + accountToken() + address().ifPresent { it.validate() } + companyId() + dob() + doingBusinessAs() + financialAccountToken() + name() + userDefinedId() + verificationFailedReason() + 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 (country.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (if (currency.asKnown().isPresent) 1 else 0) + + (if (lastFour.asKnown().isPresent) 1 else 0) + + (if (owner.asKnown().isPresent) 1 else 0) + + (ownerType.asKnown().getOrNull()?.validity() ?: 0) + + (if (routingNumber.asKnown().isPresent) 1 else 0) + + (state.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (verificationAttempts.asKnown().isPresent) 1 else 0) + + (verificationMethod.asKnown().getOrNull()?.validity() ?: 0) + + (verificationState.asKnown().getOrNull()?.validity() ?: 0) + + (if (accountToken.asKnown().isPresent) 1 else 0) + + (address.asKnown().getOrNull()?.validity() ?: 0) + + (if (companyId.asKnown().isPresent) 1 else 0) + + (if (dob.asKnown().isPresent) 1 else 0) + + (if (doingBusinessAs.asKnown().isPresent) 1 else 0) + + (if (financialAccountToken.asKnown().isPresent) 1 else 0) + + (if (name.asKnown().isPresent) 1 else 0) + + (if (userDefinedId.asKnown().isPresent) 1 else 0) + + (if (verificationFailedReason.asKnown().isPresent) 1 else 0) + + /** Account State */ + class State @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 ENABLED = of("ENABLED") + + @JvmField val CLOSED = of("CLOSED") + + @JvmField val PAUSED = of("PAUSED") + + @JvmStatic fun of(value: String) = State(JsonField.of(value)) + } + + /** An enum containing [State]'s known values. */ + enum class Known { + ENABLED, + CLOSED, + PAUSED, + } + + /** + * An enum containing [State]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [State] 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 { + ENABLED, + CLOSED, + PAUSED, + /** An enum member indicating that [State] 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) { + ENABLED -> Value.ENABLED + CLOSED -> Value.CLOSED + PAUSED -> Value.PAUSED + 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) { + ENABLED -> Known.ENABLED + CLOSED -> Known.CLOSED + PAUSED -> Known.PAUSED + else -> throw LithicInvalidDataException("Unknown State: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): State = 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 State && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Account Type */ + class AccountType @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 CHECKING = of("CHECKING") + + @JvmField val SAVINGS = of("SAVINGS") + + @JvmStatic fun of(value: String) = AccountType(JsonField.of(value)) + } + + /** An enum containing [AccountType]'s known values. */ + enum class Known { + CHECKING, + SAVINGS, + } + + /** + * An enum containing [AccountType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [AccountType] 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 { + CHECKING, + SAVINGS, + /** + * An enum member indicating that [AccountType] 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) { + CHECKING -> Value.CHECKING + SAVINGS -> Value.SAVINGS + 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) { + CHECKING -> Known.CHECKING + SAVINGS -> Known.SAVINGS + else -> throw LithicInvalidDataException("Unknown AccountType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): AccountType = 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 AccountType && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + /** Verification State */ + class VerificationState @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 ENABLED = of("ENABLED") + + @JvmField val FAILED_VERIFICATION = of("FAILED_VERIFICATION") + + @JvmField val INSUFFICIENT_FUNDS = of("INSUFFICIENT_FUNDS") + + @JvmStatic fun of(value: String) = VerificationState(JsonField.of(value)) + } + + /** An enum containing [VerificationState]'s known values. */ + enum class Known { + PENDING, + ENABLED, + FAILED_VERIFICATION, + INSUFFICIENT_FUNDS, + } + + /** + * An enum containing [VerificationState]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [VerificationState] 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, + ENABLED, + FAILED_VERIFICATION, + INSUFFICIENT_FUNDS, + /** + * An enum member indicating that [VerificationState] 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 + ENABLED -> Value.ENABLED + FAILED_VERIFICATION -> Value.FAILED_VERIFICATION + INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS + 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 + ENABLED -> Known.ENABLED + FAILED_VERIFICATION -> Known.FAILED_VERIFICATION + INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS + else -> throw LithicInvalidDataException("Unknown VerificationState: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): VerificationState = 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 VerificationState && 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 ExternalBankAccountUnpauseResponse && + token == other.token && + country == other.country && + created == other.created && + currency == other.currency && + lastFour == other.lastFour && + owner == other.owner && + ownerType == other.ownerType && + routingNumber == other.routingNumber && + state == other.state && + type == other.type && + verificationAttempts == other.verificationAttempts && + verificationMethod == other.verificationMethod && + verificationState == other.verificationState && + accountToken == other.accountToken && + address == other.address && + companyId == other.companyId && + dob == other.dob && + doingBusinessAs == other.doingBusinessAs && + financialAccountToken == other.financialAccountToken && + name == other.name && + userDefinedId == other.userDefinedId && + verificationFailedReason == other.verificationFailedReason && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + token, + country, + created, + currency, + lastFour, + owner, + ownerType, + routingNumber, + state, + type, + verificationAttempts, + verificationMethod, + verificationState, + accountToken, + address, + companyId, + dob, + doingBusinessAs, + financialAccountToken, + name, + userDefinedId, + verificationFailedReason, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ExternalBankAccountUnpauseResponse{token=$token, country=$country, created=$created, currency=$currency, lastFour=$lastFour, owner=$owner, ownerType=$ownerType, routingNumber=$routingNumber, state=$state, type=$type, verificationAttempts=$verificationAttempts, verificationMethod=$verificationMethod, verificationState=$verificationState, accountToken=$accountToken, address=$address, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, financialAccountToken=$financialAccountToken, name=$name, userDefinedId=$userDefinedId, verificationFailedReason=$verificationFailedReason, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUpdateResponse.kt index 158be950b..5bdd71dde 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUpdateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalBankAccountUpdateResponse.kt @@ -761,7 +761,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -775,7 +778,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -789,7 +795,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -801,7 +810,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -812,8 +824,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -827,8 +843,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -842,7 +865,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -853,7 +879,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -871,8 +902,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt index 70df56882..66f6df7a2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPayment.kt @@ -543,7 +543,12 @@ private constructor( this.settledAmount = settledAmount } - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -690,6 +695,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -700,6 +707,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -717,6 +725,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -738,6 +747,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -757,6 +767,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPaymentListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPaymentListParams.kt index 2cbb2b6d2..53ccb3803 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPaymentListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ExternalPaymentListParams.kt @@ -660,6 +660,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -670,6 +672,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -687,6 +690,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -708,6 +712,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -727,6 +732,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt index 5a39523a9..edbbc859b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccount.kt @@ -650,11 +650,11 @@ private constructor( ) /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun autoCollectionConfiguration(): AutoCollectionConfigurationResponse = - autoCollectionConfiguration.getRequired("auto_collection_configuration") + fun autoCollectionConfiguration(): Optional = + autoCollectionConfiguration.getOptional("auto_collection_configuration") /** * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -788,8 +788,16 @@ private constructor( } fun autoCollectionConfiguration( - autoCollectionConfiguration: AutoCollectionConfigurationResponse - ) = autoCollectionConfiguration(JsonField.of(autoCollectionConfiguration)) + autoCollectionConfiguration: AutoCollectionConfigurationResponse? + ) = autoCollectionConfiguration(JsonField.ofNullable(autoCollectionConfiguration)) + + /** + * Alias for calling [Builder.autoCollectionConfiguration] with + * `autoCollectionConfiguration.orElse(null)`. + */ + fun autoCollectionConfiguration( + autoCollectionConfiguration: Optional + ) = autoCollectionConfiguration(autoCollectionConfiguration.getOrNull()) /** * Sets [Builder.autoCollectionConfiguration] to an arbitrary JSON value. @@ -934,7 +942,7 @@ private constructor( return@apply } - autoCollectionConfiguration().validate() + autoCollectionConfiguration().ifPresent { it.validate() } creditLimit() creditProductToken() externalBankAccountToken() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialEvent.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialEvent.kt new file mode 100644 index 000000000..e79f4f5d8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialEvent.kt @@ -0,0 +1,985 @@ +// 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.errors.LithicInvalidDataException +import java.time.OffsetDateTime +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** Financial Event */ +class FinancialEvent +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val token: JsonField, + private val amount: JsonField, + private val created: JsonField, + private val result: JsonField, + private val type: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), + @JsonProperty("created") + @ExcludeMissing + created: JsonField = JsonMissing.of(), + @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + ) : this(token, amount, created, result, type, mutableMapOf()) + + /** + * Globally unique identifier. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun token(): Optional = token.getOptional("token") + + /** + * Amount of the financial event that has been settled in the currency's smallest unit (e.g., + * cents). + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun amount(): Optional = amount.getOptional("amount") + + /** + * Date and time when the financial event occurred. UTC time zone. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun created(): Optional = created.getOptional("created") + + /** + * APPROVED financial events were successful while DECLINED financial events were declined by + * user, Lithic, or the network. + * + * @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") + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun type(): Optional = type.getOptional("type") + + /** + * 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 [amount]. + * + * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount + + /** + * 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 [result]. + * + * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result + + /** + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [FinancialEvent]. */ + class Builder internal constructor() { + + private var token: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() + private var created: JsonField = JsonMissing.of() + private var result: JsonField = JsonMissing.of() + private var type: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(financialEvent: FinancialEvent) = apply { + token = financialEvent.token + amount = financialEvent.amount + created = financialEvent.created + result = financialEvent.result + type = financialEvent.type + additionalProperties = financialEvent.additionalProperties.toMutableMap() + } + + /** Globally unique identifier. */ + 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 } + + /** + * Amount of the financial event that has been settled in the currency's smallest unit + * (e.g., cents). + */ + fun amount(amount: Long) = amount(JsonField.of(amount)) + + /** + * Sets [Builder.amount] to an arbitrary JSON value. + * + * You should usually call [Builder.amount] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun amount(amount: JsonField) = apply { this.amount = amount } + + /** Date and time when the financial event occurred. UTC time zone. */ + 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 } + + /** + * APPROVED financial events were successful while DECLINED financial events were declined + * by user, Lithic, or the network. + */ + 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 type(type: FinancialEventType) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [FinancialEventType] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun type(type: JsonField) = apply { this.type = type } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [FinancialEvent]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): FinancialEvent = + FinancialEvent( + token, + amount, + created, + result, + type, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): FinancialEvent = apply { + if (validated) { + return@apply + } + + token() + amount() + created() + result().ifPresent { it.validate() } + type().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 = + (if (token.asKnown().isPresent) 1 else 0) + + (if (amount.asKnown().isPresent) 1 else 0) + + (if (created.asKnown().isPresent) 1 else 0) + + (result.asKnown().getOrNull()?.validity() ?: 0) + + (type.asKnown().getOrNull()?.validity() ?: 0) + + /** + * APPROVED financial events were successful while DECLINED financial events were declined by + * user, Lithic, or the network. + */ + 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 + + 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() + } + + class FinancialEventType + @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 ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") + + @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") + + @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") + + @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") + + @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") + + @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") + + @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") + + @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") + + @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") + + @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") + + @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") + + @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") + + @JvmField val ACH_RETURN_REJECTED = of("ACH_RETURN_REJECTED") + + @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") + + @JvmField val AUTHORIZATION = of("AUTHORIZATION") + + @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE") + + @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY") + + @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL") + + @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY") + + @JvmField val BILLING_ERROR = of("BILLING_ERROR") + + @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL") + + @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") + + @JvmField val CASH_BACK = of("CASH_BACK") + + @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL") + + @JvmField val CLEARING = of("CLEARING") + + @JvmField val COLLECTION = of("COLLECTION") + + @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") + + @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") + + @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION") + + @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE") + + @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") + + @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL") + + @JvmField val DISPUTE_WON = of("DISPUTE_WON") + + @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED") + + @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED") + + @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED") + + @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED") + + @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED") + + @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED") + + @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED") + + @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED") + + @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED") + + @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED") + + @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED") + + @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED") + + @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED") + + @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED") + + @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED") + + @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED") + + @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED") + + @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED") + + @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED") + + @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED") + + @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION") + + @JvmField val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION") + + @JvmField val INTEREST = of("INTEREST") + + @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL") + + @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT") + + @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") + + @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL") + + @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") + + @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") + + @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL") + + @JvmField val SERVICE = of("SERVICE") + + @JvmField val RETURN = of("RETURN") + + @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL") + + @JvmField val TRANSFER = of("TRANSFER") + + @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS") + + @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT") + + @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL") + + @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT") + + @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value)) + } + + /** An enum containing [FinancialEventType]'s known values. */ + enum class Known { + ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, + ACH_ORIGINATION_PROCESSED, + ACH_ORIGINATION_RELEASED, + ACH_ORIGINATION_REJECTED, + ACH_ORIGINATION_REVIEWED, + ACH_ORIGINATION_SETTLED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, + ACH_RETURN_REJECTED, + ACH_RETURN_SETTLED, + AUTHORIZATION, + AUTHORIZATION_ADVICE, + AUTHORIZATION_EXPIRY, + AUTHORIZATION_REVERSAL, + BALANCE_INQUIRY, + BILLING_ERROR, + BILLING_ERROR_REVERSAL, + CARD_TO_CARD, + CASH_BACK, + CASH_BACK_REVERSAL, + CLEARING, + COLLECTION, + CORRECTION_CREDIT, + CORRECTION_DEBIT, + CREDIT_AUTHORIZATION, + CREDIT_AUTHORIZATION_ADVICE, + CURRENCY_CONVERSION, + CURRENCY_CONVERSION_REVERSAL, + DISPUTE_WON, + EXTERNAL_ACH_CANCELED, + EXTERNAL_ACH_INITIATED, + EXTERNAL_ACH_RELEASED, + EXTERNAL_ACH_REVERSED, + EXTERNAL_ACH_SETTLED, + EXTERNAL_CHECK_CANCELED, + EXTERNAL_CHECK_INITIATED, + EXTERNAL_CHECK_RELEASED, + EXTERNAL_CHECK_REVERSED, + EXTERNAL_CHECK_SETTLED, + EXTERNAL_TRANSFER_CANCELED, + EXTERNAL_TRANSFER_INITIATED, + EXTERNAL_TRANSFER_RELEASED, + EXTERNAL_TRANSFER_REVERSED, + EXTERNAL_TRANSFER_SETTLED, + EXTERNAL_WIRE_CANCELED, + EXTERNAL_WIRE_INITIATED, + EXTERNAL_WIRE_RELEASED, + EXTERNAL_WIRE_REVERSED, + EXTERNAL_WIRE_SETTLED, + FINANCIAL_AUTHORIZATION, + FINANCIAL_CREDIT_AUTHORIZATION, + INTEREST, + INTEREST_REVERSAL, + INTERNAL_ADJUSTMENT, + LATE_PAYMENT, + LATE_PAYMENT_REVERSAL, + LOSS_WRITE_OFF, + PROVISIONAL_CREDIT, + PROVISIONAL_CREDIT_REVERSAL, + SERVICE, + RETURN, + RETURN_REVERSAL, + TRANSFER, + TRANSFER_INSUFFICIENT_FUNDS, + RETURNED_PAYMENT, + RETURNED_PAYMENT_REVERSAL, + LITHIC_NETWORK_PAYMENT, + } + + /** + * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [FinancialEventType] 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 { + ACH_ORIGINATION_CANCELLED, + ACH_ORIGINATION_INITIATED, + ACH_ORIGINATION_PROCESSED, + ACH_ORIGINATION_RELEASED, + ACH_ORIGINATION_REJECTED, + ACH_ORIGINATION_REVIEWED, + ACH_ORIGINATION_SETTLED, + ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, + ACH_RECEIPT_SETTLED, + ACH_RETURN_INITIATED, + ACH_RETURN_PROCESSED, + ACH_RETURN_REJECTED, + ACH_RETURN_SETTLED, + AUTHORIZATION, + AUTHORIZATION_ADVICE, + AUTHORIZATION_EXPIRY, + AUTHORIZATION_REVERSAL, + BALANCE_INQUIRY, + BILLING_ERROR, + BILLING_ERROR_REVERSAL, + CARD_TO_CARD, + CASH_BACK, + CASH_BACK_REVERSAL, + CLEARING, + COLLECTION, + CORRECTION_CREDIT, + CORRECTION_DEBIT, + CREDIT_AUTHORIZATION, + CREDIT_AUTHORIZATION_ADVICE, + CURRENCY_CONVERSION, + CURRENCY_CONVERSION_REVERSAL, + DISPUTE_WON, + EXTERNAL_ACH_CANCELED, + EXTERNAL_ACH_INITIATED, + EXTERNAL_ACH_RELEASED, + EXTERNAL_ACH_REVERSED, + EXTERNAL_ACH_SETTLED, + EXTERNAL_CHECK_CANCELED, + EXTERNAL_CHECK_INITIATED, + EXTERNAL_CHECK_RELEASED, + EXTERNAL_CHECK_REVERSED, + EXTERNAL_CHECK_SETTLED, + EXTERNAL_TRANSFER_CANCELED, + EXTERNAL_TRANSFER_INITIATED, + EXTERNAL_TRANSFER_RELEASED, + EXTERNAL_TRANSFER_REVERSED, + EXTERNAL_TRANSFER_SETTLED, + EXTERNAL_WIRE_CANCELED, + EXTERNAL_WIRE_INITIATED, + EXTERNAL_WIRE_RELEASED, + EXTERNAL_WIRE_REVERSED, + EXTERNAL_WIRE_SETTLED, + FINANCIAL_AUTHORIZATION, + FINANCIAL_CREDIT_AUTHORIZATION, + INTEREST, + INTEREST_REVERSAL, + INTERNAL_ADJUSTMENT, + LATE_PAYMENT, + LATE_PAYMENT_REVERSAL, + LOSS_WRITE_OFF, + PROVISIONAL_CREDIT, + PROVISIONAL_CREDIT_REVERSAL, + SERVICE, + RETURN, + RETURN_REVERSAL, + TRANSFER, + TRANSFER_INSUFFICIENT_FUNDS, + RETURNED_PAYMENT, + RETURNED_PAYMENT_REVERSAL, + LITHIC_NETWORK_PAYMENT, + /** + * An enum member indicating that [FinancialEventType] 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) { + ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED + ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED + ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED + ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED + ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED + ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED + ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED + ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED + ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED + ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED + AUTHORIZATION -> Value.AUTHORIZATION + AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE + AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY + AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL + BALANCE_INQUIRY -> Value.BALANCE_INQUIRY + BILLING_ERROR -> Value.BILLING_ERROR + BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL + CARD_TO_CARD -> Value.CARD_TO_CARD + CASH_BACK -> Value.CASH_BACK + CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL + CLEARING -> Value.CLEARING + COLLECTION -> Value.COLLECTION + CORRECTION_CREDIT -> Value.CORRECTION_CREDIT + CORRECTION_DEBIT -> Value.CORRECTION_DEBIT + CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION + CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE + CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION + CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL + DISPUTE_WON -> Value.DISPUTE_WON + EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED + EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED + EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED + EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED + EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED + EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED + EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED + EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED + EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED + EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED + EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED + EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED + EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED + EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED + EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED + EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED + EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED + EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED + EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED + EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED + FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION + FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION + INTEREST -> Value.INTEREST + INTEREST_REVERSAL -> Value.INTEREST_REVERSAL + INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT + LATE_PAYMENT -> Value.LATE_PAYMENT + LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL + LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF + PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT + PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL + SERVICE -> Value.SERVICE + RETURN -> Value.RETURN + RETURN_REVERSAL -> Value.RETURN_REVERSAL + TRANSFER -> Value.TRANSFER + TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS + RETURNED_PAYMENT -> Value.RETURNED_PAYMENT + RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL + LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT + 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) { + ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED + ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED + ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED + ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED + ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED + ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED + ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED + ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED + ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED + ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED + ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED + ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED + ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED + ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED + AUTHORIZATION -> Known.AUTHORIZATION + AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE + AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY + AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL + BALANCE_INQUIRY -> Known.BALANCE_INQUIRY + BILLING_ERROR -> Known.BILLING_ERROR + BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL + CARD_TO_CARD -> Known.CARD_TO_CARD + CASH_BACK -> Known.CASH_BACK + CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL + CLEARING -> Known.CLEARING + COLLECTION -> Known.COLLECTION + CORRECTION_CREDIT -> Known.CORRECTION_CREDIT + CORRECTION_DEBIT -> Known.CORRECTION_DEBIT + CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION + CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE + CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION + CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL + DISPUTE_WON -> Known.DISPUTE_WON + EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED + EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED + EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED + EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED + EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED + EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED + EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED + EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED + EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED + EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED + EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED + EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED + EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED + EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED + EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED + EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED + EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED + EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED + EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED + EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED + FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION + FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION + INTEREST -> Known.INTEREST + INTEREST_REVERSAL -> Known.INTEREST_REVERSAL + INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT + LATE_PAYMENT -> Known.LATE_PAYMENT + LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL + LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF + PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT + PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL + SERVICE -> Known.SERVICE + RETURN -> Known.RETURN + RETURN_REVERSAL -> Known.RETURN_REVERSAL + TRANSFER -> Known.TRANSFER + TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS + RETURNED_PAYMENT -> Known.RETURNED_PAYMENT + RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL + LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT + else -> throw LithicInvalidDataException("Unknown FinancialEventType: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): FinancialEventType = 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 FinancialEventType && 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 FinancialEvent && + token == other.token && + amount == other.amount && + created == other.created && + result == other.result && + type == other.type && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(token, amount, created, result, type, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt index 2a7e97dc0..d82a2df00 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt @@ -18,7 +18,6 @@ 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 FinancialTransaction @@ -753,986 +752,6 @@ private constructor( override fun toString() = value.toString() } - /** Financial Event */ - class FinancialEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(token, amount, created, result, type, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun token(): Optional = token.getOptional("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun created(): Optional = created.getOptional("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were declined - * by user, Lithic, or the network. - * - * @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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * 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 [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinancialEvent]. */ - class Builder internal constructor() { - - private var token: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() - private var created: JsonField = JsonMissing.of() - private var result: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(financialEvent: FinancialEvent) = apply { - token = financialEvent.token - amount = financialEvent.amount - created = financialEvent.created - result = financialEvent.result - type = financialEvent.type - additionalProperties = financialEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - 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 } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 type(type: FinancialEventType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [FinancialEventType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FinancialEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): FinancialEvent = - FinancialEvent( - token, - amount, - created, - result, - type, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FinancialEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().ifPresent { it.validate() } - type().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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were declined - * by user, Lithic, or the network. - */ - 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 - - 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() - } - - class FinancialEventType - @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 ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_REJECTED = of("ACH_RETURN_REJECTED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmField val AUTHORIZATION = of("AUTHORIZATION") - - @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE") - - @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY") - - @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL") - - @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL") - - @JvmField val CLEARING = of("CLEARING") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") - - @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") - - @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION") - - @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED") - - @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED") - - @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED") - - @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED") - - @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED") - - @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED") - - @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED") - - @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED") - - @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED") - - @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED") - - @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED") - - @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED") - - @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED") - - @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED") - - @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED") - - @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED") - - @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED") - - @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED") - - @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED") - - @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED") - - @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION") - - @JvmField val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL") - - @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val RETURN = of("RETURN") - - @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS") - - @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT") - - @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL") - - @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT") - - @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value)) - } - - /** An enum containing [FinancialEventType]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - } - - /** - * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialEventType] 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 { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - /** - * An enum member indicating that [FinancialEventType] 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) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - AUTHORIZATION -> Value.AUTHORIZATION - AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - BILLING_ERROR -> Value.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Value.CARD_TO_CARD - CASH_BACK -> Value.CASH_BACK - CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL - CLEARING -> Value.CLEARING - COLLECTION -> Value.COLLECTION - CORRECTION_CREDIT -> Value.CORRECTION_CREDIT - CORRECTION_DEBIT -> Value.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Value.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Value.INTEREST - INTEREST_REVERSAL -> Value.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Value.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Value.SERVICE - RETURN -> Value.RETURN - RETURN_REVERSAL -> Value.RETURN_REVERSAL - TRANSFER -> Value.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Value.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT - 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) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - AUTHORIZATION -> Known.AUTHORIZATION - AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - BILLING_ERROR -> Known.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Known.CARD_TO_CARD - CASH_BACK -> Known.CASH_BACK - CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL - CLEARING -> Known.CLEARING - COLLECTION -> Known.COLLECTION - CORRECTION_CREDIT -> Known.CORRECTION_CREDIT - CORRECTION_DEBIT -> Known.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Known.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Known.INTEREST - INTEREST_REVERSAL -> Known.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Known.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Known.SERVICE - RETURN -> Known.RETURN - RETURN_REVERSAL -> Known.RETURN_REVERSAL - TRANSFER -> Known.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Known.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT - else -> throw LithicInvalidDataException("Unknown FinancialEventType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): FinancialEventType = 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 FinancialEventType && 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 FinancialEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, amount, created, result, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" - } - /** * APPROVED transactions were successful while DECLINED transactions were declined by user, * Lithic, or the network. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/LoanTape.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/LoanTape.kt index 8e2a92715..606e51277 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/LoanTape.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/LoanTape.kt @@ -866,7 +866,10 @@ private constructor( fun ytdTotals(ytdTotals: JsonField) = apply { this.ytdTotals = ytdTotals } /** Interest tier to which this account belongs to */ - fun tier(tier: String) = tier(JsonField.of(tier)) + fun tier(tier: String?) = tier(JsonField.ofNullable(tier)) + + /** Alias for calling [Builder.tier] with `tier.orElse(null)`. */ + fun tier(tier: Optional) = tier(tier.getOrNull()) /** * Sets [Builder.tier] to an arbitrary JSON value. @@ -2474,250 +2477,6 @@ private constructor( (pastDue.asKnown().getOrNull()?.validity() ?: 0) + (pastStatementsDue.asKnown().getOrNull()?.validity() ?: 0) - /** - * Amount due for the prior billing cycle. Any amounts not fully paid off on this due date - * will be considered past due the next day - */ - class CategoryBalances - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val fees: JsonField, - private val interest: JsonField, - private val principal: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), - @JsonProperty("interest") - @ExcludeMissing - interest: JsonField = JsonMissing.of(), - @JsonProperty("principal") - @ExcludeMissing - principal: JsonField = JsonMissing.of(), - ) : this(fees, interest, principal, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun fees(): Long = fees.getRequired("fees") - - /** - * @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 interest(): Long = interest.getRequired("interest") - - /** - * @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 principal(): Long = principal.getRequired("principal") - - /** - * Returns the raw JSON value of [fees]. - * - * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees - - /** - * Returns the raw JSON value of [interest]. - * - * Unlike [interest], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest - - /** - * Returns the raw JSON value of [principal]. - * - * Unlike [principal], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("principal") @ExcludeMissing fun _principal(): JsonField = principal - - @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 [CategoryBalances]. - * - * The following fields are required: - * ```java - * .fees() - * .interest() - * .principal() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CategoryBalances]. */ - class Builder internal constructor() { - - private var fees: JsonField? = null - private var interest: JsonField? = null - private var principal: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(categoryBalances: CategoryBalances) = apply { - fees = categoryBalances.fees - interest = categoryBalances.interest - principal = categoryBalances.principal - additionalProperties = categoryBalances.additionalProperties.toMutableMap() - } - - fun fees(fees: Long) = fees(JsonField.of(fees)) - - /** - * Sets [Builder.fees] to an arbitrary JSON value. - * - * You should usually call [Builder.fees] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fees(fees: JsonField) = apply { this.fees = fees } - - fun interest(interest: Long) = interest(JsonField.of(interest)) - - /** - * Sets [Builder.interest] to an arbitrary JSON value. - * - * You should usually call [Builder.interest] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun interest(interest: JsonField) = apply { this.interest = interest } - - fun principal(principal: Long) = principal(JsonField.of(principal)) - - /** - * Sets [Builder.principal] to an arbitrary JSON value. - * - * You should usually call [Builder.principal] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun principal(principal: JsonField) = apply { this.principal = principal } - - 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 [CategoryBalances]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fees() - * .interest() - * .principal() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CategoryBalances = - CategoryBalances( - checkRequired("fees", fees), - checkRequired("interest", interest), - checkRequired("principal", principal), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CategoryBalances = apply { - if (validated) { - return@apply - } - - fees() - interest() - principal() - 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 (fees.asKnown().isPresent) 1 else 0) + - (if (interest.asKnown().isPresent) 1 else 0) + - (if (principal.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CategoryBalances && - fees == other.fees && - interest == other.interest && - principal == other.principal && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(fees, interest, principal, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CategoryBalances{fees=$fees, interest=$interest, principal=$principal, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -2741,653 +2500,135 @@ private constructor( "Balances{due=$due, nextStatementDue=$nextStatementDue, pastDue=$pastDue, pastStatementsDue=$pastStatementsDue, additionalProperties=$additionalProperties}" } - class StatementTotals + class InterestDetails @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val balanceTransfers: JsonField, - private val cashAdvances: JsonField, - private val credits: JsonField, - private val debits: JsonField, - private val fees: JsonField, - private val interest: JsonField, - private val payments: JsonField, - private val purchases: JsonField, - private val creditDetails: JsonValue, - private val debitDetails: JsonValue, - private val paymentDetails: JsonValue, + private val actualInterestCharged: JsonField, + private val dailyBalanceAmounts: JsonField, + private val effectiveApr: JsonField, + private val interestCalculationMethod: JsonField, + private val interestForPeriod: JsonField, + private val primeRate: JsonField, + private val minimumInterestCharged: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("balance_transfers") + @JsonProperty("actual_interest_charged") + @ExcludeMissing + actualInterestCharged: JsonField = JsonMissing.of(), + @JsonProperty("daily_balance_amounts") @ExcludeMissing - balanceTransfers: JsonField = JsonMissing.of(), - @JsonProperty("cash_advances") + dailyBalanceAmounts: JsonField = JsonMissing.of(), + @JsonProperty("effective_apr") @ExcludeMissing - cashAdvances: JsonField = JsonMissing.of(), - @JsonProperty("credits") @ExcludeMissing credits: JsonField = JsonMissing.of(), - @JsonProperty("debits") @ExcludeMissing debits: JsonField = JsonMissing.of(), - @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), - @JsonProperty("interest") @ExcludeMissing interest: JsonField = JsonMissing.of(), - @JsonProperty("payments") @ExcludeMissing payments: JsonField = JsonMissing.of(), - @JsonProperty("purchases") + effectiveApr: JsonField = JsonMissing.of(), + @JsonProperty("interest_calculation_method") @ExcludeMissing - purchases: JsonField = JsonMissing.of(), - @JsonProperty("credit_details") + interestCalculationMethod: JsonField = JsonMissing.of(), + @JsonProperty("interest_for_period") @ExcludeMissing - creditDetails: JsonValue = JsonMissing.of(), - @JsonProperty("debit_details") + interestForPeriod: JsonField = JsonMissing.of(), + @JsonProperty("prime_rate") @ExcludeMissing - debitDetails: JsonValue = JsonMissing.of(), - @JsonProperty("payment_details") + primeRate: JsonField = JsonMissing.of(), + @JsonProperty("minimum_interest_charged") @ExcludeMissing - paymentDetails: JsonValue = JsonMissing.of(), + minimumInterestCharged: JsonField = JsonMissing.of(), ) : this( - balanceTransfers, - cashAdvances, - credits, - debits, - fees, - interest, - payments, - purchases, - creditDetails, - debitDetails, - paymentDetails, + actualInterestCharged, + dailyBalanceAmounts, + effectiveApr, + interestCalculationMethod, + interestForPeriod, + primeRate, + minimumInterestCharged, mutableMapOf(), ) /** - * Opening balance transferred from previous account in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun balanceTransfers(): Long = balanceTransfers.getRequired("balance_transfers") + fun actualInterestCharged(): Optional = + actualInterestCharged.getOptional("actual_interest_charged") /** - * ATM and cashback transactions in cents - * * @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 cashAdvances(): Long = cashAdvances.getRequired("cash_advances") + fun dailyBalanceAmounts(): CategoryDetails = + dailyBalanceAmounts.getRequired("daily_balance_amounts") /** - * Volume of credit management operation transactions less any balance transfers in cents - * * @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 credits(): Long = credits.getRequired("credits") + fun effectiveApr(): CategoryDetails = effectiveApr.getRequired("effective_apr") /** - * Volume of debit management operation transactions less any interest in cents - * * @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 debits(): Long = debits.getRequired("debits") + fun interestCalculationMethod(): InterestCalculationMethod = + interestCalculationMethod.getRequired("interest_calculation_method") /** - * Volume of debit management operation transactions less any interest in cents - * * @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 fees(): Long = fees.getRequired("fees") + fun interestForPeriod(): CategoryDetails = + interestForPeriod.getRequired("interest_for_period") /** - * Interest accrued in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun interest(): Long = interest.getRequired("interest") + fun primeRate(): Optional = primeRate.getOptional("prime_rate") /** - * Any funds transfers which affective the balance in cents - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun payments(): Long = payments.getRequired("payments") + fun minimumInterestCharged(): Optional = + minimumInterestCharged.getOptional("minimum_interest_charged") /** - * Net card transaction volume less any cash advances in cents + * Returns the raw JSON value of [actualInterestCharged]. * - * @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). + * Unlike [actualInterestCharged], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun purchases(): Long = purchases.getRequired("purchases") - - /** Breakdown of credits */ - @JsonProperty("credit_details") - @ExcludeMissing - fun _creditDetails(): JsonValue = creditDetails - - /** Breakdown of debits */ - @JsonProperty("debit_details") @ExcludeMissing fun _debitDetails(): JsonValue = debitDetails - - /** Breakdown of payments */ - @JsonProperty("payment_details") + @JsonProperty("actual_interest_charged") @ExcludeMissing - fun _paymentDetails(): JsonValue = paymentDetails + fun _actualInterestCharged(): JsonField = actualInterestCharged /** - * Returns the raw JSON value of [balanceTransfers]. + * Returns the raw JSON value of [dailyBalanceAmounts]. * - * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [dailyBalanceAmounts], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("balance_transfers") + @JsonProperty("daily_balance_amounts") @ExcludeMissing - fun _balanceTransfers(): JsonField = balanceTransfers + fun _dailyBalanceAmounts(): JsonField = dailyBalanceAmounts /** - * Returns the raw JSON value of [cashAdvances]. + * Returns the raw JSON value of [effectiveApr]. * - * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected + * Unlike [effectiveApr], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("cash_advances") + @JsonProperty("effective_apr") @ExcludeMissing - fun _cashAdvances(): JsonField = cashAdvances + fun _effectiveApr(): JsonField = effectiveApr /** - * Returns the raw JSON value of [credits]. + * Returns the raw JSON value of [interestCalculationMethod]. * - * Unlike [credits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("credits") @ExcludeMissing fun _credits(): JsonField = credits - - /** - * Returns the raw JSON value of [debits]. - * - * Unlike [debits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("debits") @ExcludeMissing fun _debits(): JsonField = debits - - /** - * Returns the raw JSON value of [fees]. - * - * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees - - /** - * Returns the raw JSON value of [interest]. - * - * Unlike [interest], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest - - /** - * Returns the raw JSON value of [payments]. - * - * Unlike [payments], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("payments") @ExcludeMissing fun _payments(): JsonField = payments - - /** - * Returns the raw JSON value of [purchases]. - * - * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("purchases") @ExcludeMissing fun _purchases(): JsonField = purchases - - @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 [StatementTotals]. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .credits() - * .debits() - * .fees() - * .interest() - * .payments() - * .purchases() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [StatementTotals]. */ - class Builder internal constructor() { - - private var balanceTransfers: JsonField? = null - private var cashAdvances: JsonField? = null - private var credits: JsonField? = null - private var debits: JsonField? = null - private var fees: JsonField? = null - private var interest: JsonField? = null - private var payments: JsonField? = null - private var purchases: JsonField? = null - private var creditDetails: JsonValue = JsonMissing.of() - private var debitDetails: JsonValue = JsonMissing.of() - private var paymentDetails: JsonValue = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(statementTotals: StatementTotals) = apply { - balanceTransfers = statementTotals.balanceTransfers - cashAdvances = statementTotals.cashAdvances - credits = statementTotals.credits - debits = statementTotals.debits - fees = statementTotals.fees - interest = statementTotals.interest - payments = statementTotals.payments - purchases = statementTotals.purchases - creditDetails = statementTotals.creditDetails - debitDetails = statementTotals.debitDetails - paymentDetails = statementTotals.paymentDetails - additionalProperties = statementTotals.additionalProperties.toMutableMap() - } - - /** Opening balance transferred from previous account in cents */ - fun balanceTransfers(balanceTransfers: Long) = - balanceTransfers(JsonField.of(balanceTransfers)) - - /** - * Sets [Builder.balanceTransfers] to an arbitrary JSON value. - * - * You should usually call [Builder.balanceTransfers] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun balanceTransfers(balanceTransfers: JsonField) = apply { - this.balanceTransfers = balanceTransfers - } - - /** ATM and cashback transactions in cents */ - fun cashAdvances(cashAdvances: Long) = cashAdvances(JsonField.of(cashAdvances)) - - /** - * Sets [Builder.cashAdvances] to an arbitrary JSON value. - * - * You should usually call [Builder.cashAdvances] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cashAdvances(cashAdvances: JsonField) = apply { - this.cashAdvances = cashAdvances - } - - /** - * Volume of credit management operation transactions less any balance transfers in - * cents - */ - fun credits(credits: Long) = credits(JsonField.of(credits)) - - /** - * Sets [Builder.credits] to an arbitrary JSON value. - * - * You should usually call [Builder.credits] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun credits(credits: JsonField) = apply { this.credits = credits } - - /** Volume of debit management operation transactions less any interest in cents */ - fun debits(debits: Long) = debits(JsonField.of(debits)) - - /** - * Sets [Builder.debits] to an arbitrary JSON value. - * - * You should usually call [Builder.debits] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun debits(debits: JsonField) = apply { this.debits = debits } - - /** Volume of debit management operation transactions less any interest in cents */ - fun fees(fees: Long) = fees(JsonField.of(fees)) - - /** - * Sets [Builder.fees] to an arbitrary JSON value. - * - * You should usually call [Builder.fees] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun fees(fees: JsonField) = apply { this.fees = fees } - - /** Interest accrued in cents */ - fun interest(interest: Long) = interest(JsonField.of(interest)) - - /** - * Sets [Builder.interest] to an arbitrary JSON value. - * - * You should usually call [Builder.interest] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun interest(interest: JsonField) = apply { this.interest = interest } - - /** Any funds transfers which affective the balance in cents */ - fun payments(payments: Long) = payments(JsonField.of(payments)) - - /** - * Sets [Builder.payments] to an arbitrary JSON value. - * - * You should usually call [Builder.payments] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun payments(payments: JsonField) = apply { this.payments = payments } - - /** Net card transaction volume less any cash advances in cents */ - fun purchases(purchases: Long) = purchases(JsonField.of(purchases)) - - /** - * Sets [Builder.purchases] to an arbitrary JSON value. - * - * You should usually call [Builder.purchases] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun purchases(purchases: JsonField) = apply { this.purchases = purchases } - - /** Breakdown of credits */ - fun creditDetails(creditDetails: JsonValue) = apply { - this.creditDetails = creditDetails - } - - /** Breakdown of debits */ - fun debitDetails(debitDetails: JsonValue) = apply { this.debitDetails = debitDetails } - - /** Breakdown of payments */ - fun paymentDetails(paymentDetails: JsonValue) = apply { - this.paymentDetails = paymentDetails - } - - 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 [StatementTotals]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .credits() - * .debits() - * .fees() - * .interest() - * .payments() - * .purchases() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): StatementTotals = - StatementTotals( - checkRequired("balanceTransfers", balanceTransfers), - checkRequired("cashAdvances", cashAdvances), - checkRequired("credits", credits), - checkRequired("debits", debits), - checkRequired("fees", fees), - checkRequired("interest", interest), - checkRequired("payments", payments), - checkRequired("purchases", purchases), - creditDetails, - debitDetails, - paymentDetails, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): StatementTotals = apply { - if (validated) { - return@apply - } - - balanceTransfers() - cashAdvances() - credits() - debits() - fees() - interest() - payments() - purchases() - 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 (balanceTransfers.asKnown().isPresent) 1 else 0) + - (if (cashAdvances.asKnown().isPresent) 1 else 0) + - (if (credits.asKnown().isPresent) 1 else 0) + - (if (debits.asKnown().isPresent) 1 else 0) + - (if (fees.asKnown().isPresent) 1 else 0) + - (if (interest.asKnown().isPresent) 1 else 0) + - (if (payments.asKnown().isPresent) 1 else 0) + - (if (purchases.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StatementTotals && - balanceTransfers == other.balanceTransfers && - cashAdvances == other.cashAdvances && - credits == other.credits && - debits == other.debits && - fees == other.fees && - interest == other.interest && - payments == other.payments && - purchases == other.purchases && - creditDetails == other.creditDetails && - debitDetails == other.debitDetails && - paymentDetails == other.paymentDetails && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - balanceTransfers, - cashAdvances, - credits, - debits, - fees, - interest, - payments, - purchases, - creditDetails, - debitDetails, - paymentDetails, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, debits=$debits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, creditDetails=$creditDetails, debitDetails=$debitDetails, paymentDetails=$paymentDetails, additionalProperties=$additionalProperties}" - } - - class InterestDetails - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val actualInterestCharged: JsonField, - private val dailyBalanceAmounts: JsonField, - private val effectiveApr: JsonField, - private val interestCalculationMethod: JsonField, - private val interestForPeriod: JsonField, - private val primeRate: JsonField, - private val minimumInterestCharged: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("actual_interest_charged") - @ExcludeMissing - actualInterestCharged: JsonField = JsonMissing.of(), - @JsonProperty("daily_balance_amounts") - @ExcludeMissing - dailyBalanceAmounts: JsonField = JsonMissing.of(), - @JsonProperty("effective_apr") - @ExcludeMissing - effectiveApr: JsonField = JsonMissing.of(), - @JsonProperty("interest_calculation_method") - @ExcludeMissing - interestCalculationMethod: JsonField = JsonMissing.of(), - @JsonProperty("interest_for_period") - @ExcludeMissing - interestForPeriod: JsonField = JsonMissing.of(), - @JsonProperty("prime_rate") - @ExcludeMissing - primeRate: JsonField = JsonMissing.of(), - @JsonProperty("minimum_interest_charged") - @ExcludeMissing - minimumInterestCharged: JsonField = JsonMissing.of(), - ) : this( - actualInterestCharged, - dailyBalanceAmounts, - effectiveApr, - interestCalculationMethod, - interestForPeriod, - primeRate, - minimumInterestCharged, - mutableMapOf(), - ) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun actualInterestCharged(): Optional = - actualInterestCharged.getOptional("actual_interest_charged") - - /** - * @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 dailyBalanceAmounts(): CategoryDetails = - dailyBalanceAmounts.getRequired("daily_balance_amounts") - - /** - * @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 effectiveApr(): CategoryDetails = effectiveApr.getRequired("effective_apr") - - /** - * @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 interestCalculationMethod(): InterestCalculationMethod = - interestCalculationMethod.getRequired("interest_calculation_method") - - /** - * @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 interestForPeriod(): CategoryDetails = - interestForPeriod.getRequired("interest_for_period") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun primeRate(): Optional = primeRate.getOptional("prime_rate") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun minimumInterestCharged(): Optional = - minimumInterestCharged.getOptional("minimum_interest_charged") - - /** - * Returns the raw JSON value of [actualInterestCharged]. - * - * Unlike [actualInterestCharged], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("actual_interest_charged") - @ExcludeMissing - fun _actualInterestCharged(): JsonField = actualInterestCharged - - /** - * Returns the raw JSON value of [dailyBalanceAmounts]. - * - * Unlike [dailyBalanceAmounts], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("daily_balance_amounts") - @ExcludeMissing - fun _dailyBalanceAmounts(): JsonField = dailyBalanceAmounts - - /** - * Returns the raw JSON value of [effectiveApr]. - * - * Unlike [effectiveApr], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("effective_apr") - @ExcludeMissing - fun _effectiveApr(): JsonField = effectiveApr - - /** - * Returns the raw JSON value of [interestCalculationMethod]. - * - * Unlike [interestCalculationMethod], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [interestCalculationMethod], this method doesn't throw if the JSON field has an + * unexpected type. */ @JsonProperty("interest_calculation_method") @ExcludeMissing @@ -3612,340 +2853,86 @@ private constructor( 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 [InterestDetails]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .actualInterestCharged() - * .dailyBalanceAmounts() - * .effectiveApr() - * .interestCalculationMethod() - * .interestForPeriod() - * .primeRate() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): InterestDetails = - InterestDetails( - checkRequired("actualInterestCharged", actualInterestCharged), - checkRequired("dailyBalanceAmounts", dailyBalanceAmounts), - checkRequired("effectiveApr", effectiveApr), - checkRequired("interestCalculationMethod", interestCalculationMethod), - checkRequired("interestForPeriod", interestForPeriod), - checkRequired("primeRate", primeRate), - minimumInterestCharged, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): InterestDetails = apply { - if (validated) { - return@apply - } - - actualInterestCharged() - dailyBalanceAmounts().validate() - effectiveApr().validate() - interestCalculationMethod().validate() - interestForPeriod().validate() - primeRate() - minimumInterestCharged() - 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 (actualInterestCharged.asKnown().isPresent) 1 else 0) + - (dailyBalanceAmounts.asKnown().getOrNull()?.validity() ?: 0) + - (effectiveApr.asKnown().getOrNull()?.validity() ?: 0) + - (interestCalculationMethod.asKnown().getOrNull()?.validity() ?: 0) + - (interestForPeriod.asKnown().getOrNull()?.validity() ?: 0) + - (if (primeRate.asKnown().isPresent) 1 else 0) + - (if (minimumInterestCharged.asKnown().isPresent) 1 else 0) - - class CategoryDetails - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val balanceTransfers: JsonField, - private val cashAdvances: JsonField, - private val purchases: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("balance_transfers") - @ExcludeMissing - balanceTransfers: JsonField = JsonMissing.of(), - @JsonProperty("cash_advances") - @ExcludeMissing - cashAdvances: JsonField = JsonMissing.of(), - @JsonProperty("purchases") - @ExcludeMissing - purchases: JsonField = JsonMissing.of(), - ) : this(balanceTransfers, cashAdvances, purchases, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun balanceTransfers(): String = balanceTransfers.getRequired("balance_transfers") - - /** - * @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 cashAdvances(): String = cashAdvances.getRequired("cash_advances") - - /** - * @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 purchases(): String = purchases.getRequired("purchases") - - /** - * Returns the raw JSON value of [balanceTransfers]. - * - * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("balance_transfers") - @ExcludeMissing - fun _balanceTransfers(): JsonField = balanceTransfers - - /** - * Returns the raw JSON value of [cashAdvances]. - * - * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("cash_advances") - @ExcludeMissing - fun _cashAdvances(): JsonField = cashAdvances - - /** - * Returns the raw JSON value of [purchases]. - * - * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("purchases") - @ExcludeMissing - fun _purchases(): JsonField = purchases - - @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 [CategoryDetails]. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .purchases() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CategoryDetails]. */ - class Builder internal constructor() { - - private var balanceTransfers: JsonField? = null - private var cashAdvances: JsonField? = null - private var purchases: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(categoryDetails: CategoryDetails) = apply { - balanceTransfers = categoryDetails.balanceTransfers - cashAdvances = categoryDetails.cashAdvances - purchases = categoryDetails.purchases - additionalProperties = categoryDetails.additionalProperties.toMutableMap() - } - - fun balanceTransfers(balanceTransfers: String) = - balanceTransfers(JsonField.of(balanceTransfers)) - - /** - * Sets [Builder.balanceTransfers] to an arbitrary JSON value. - * - * You should usually call [Builder.balanceTransfers] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun balanceTransfers(balanceTransfers: JsonField) = apply { - this.balanceTransfers = balanceTransfers - } - - fun cashAdvances(cashAdvances: String) = cashAdvances(JsonField.of(cashAdvances)) - - /** - * Sets [Builder.cashAdvances] to an arbitrary JSON value. - * - * You should usually call [Builder.cashAdvances] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cashAdvances(cashAdvances: JsonField) = apply { - this.cashAdvances = cashAdvances - } - - fun purchases(purchases: String) = purchases(JsonField.of(purchases)) - - /** - * Sets [Builder.purchases] to an arbitrary JSON value. - * - * You should usually call [Builder.purchases] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun purchases(purchases: JsonField) = apply { this.purchases = purchases } - - 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 [CategoryDetails]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .purchases() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CategoryDetails = - CategoryDetails( - checkRequired("balanceTransfers", balanceTransfers), - checkRequired("cashAdvances", cashAdvances), - checkRequired("purchases", purchases), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } - fun validate(): CategoryDetails = apply { - if (validated) { - return@apply - } + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - balanceTransfers() - cashAdvances() - purchases() - validated = true + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) } - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. + * Returns an immutable instance of [InterestDetails]. * - * Used for best match union deserialization. + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .actualInterestCharged() + * .dailyBalanceAmounts() + * .effectiveApr() + * .interestCalculationMethod() + * .interestForPeriod() + * .primeRate() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ - @JvmSynthetic - internal fun validity(): Int = - (if (balanceTransfers.asKnown().isPresent) 1 else 0) + - (if (cashAdvances.asKnown().isPresent) 1 else 0) + - (if (purchases.asKnown().isPresent) 1 else 0) + fun build(): InterestDetails = + InterestDetails( + checkRequired("actualInterestCharged", actualInterestCharged), + checkRequired("dailyBalanceAmounts", dailyBalanceAmounts), + checkRequired("effectiveApr", effectiveApr), + checkRequired("interestCalculationMethod", interestCalculationMethod), + checkRequired("interestForPeriod", interestForPeriod), + checkRequired("primeRate", primeRate), + minimumInterestCharged, + additionalProperties.toMutableMap(), + ) + } - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + private var validated: Boolean = false - return other is CategoryDetails && - balanceTransfers == other.balanceTransfers && - cashAdvances == other.cashAdvances && - purchases == other.purchases && - additionalProperties == other.additionalProperties + fun validate(): InterestDetails = apply { + if (validated) { + return@apply } - private val hashCode: Int by lazy { - Objects.hash(balanceTransfers, cashAdvances, purchases, additionalProperties) - } + actualInterestCharged() + dailyBalanceAmounts().validate() + effectiveApr().validate() + interestCalculationMethod().validate() + interestForPeriod().validate() + primeRate() + minimumInterestCharged() + validated = true + } - override fun hashCode(): Int = hashCode + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LithicInvalidDataException) { + false + } - override fun toString() = - "CategoryDetails{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, purchases=$purchases, additionalProperties=$additionalProperties}" - } + /** + * 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 (actualInterestCharged.asKnown().isPresent) 1 else 0) + + (dailyBalanceAmounts.asKnown().getOrNull()?.validity() ?: 0) + + (effectiveApr.asKnown().getOrNull()?.validity() ?: 0) + + (interestCalculationMethod.asKnown().getOrNull()?.validity() ?: 0) + + (interestForPeriod.asKnown().getOrNull()?.validity() ?: 0) + + (if (primeRate.asKnown().isPresent) 1 else 0) + + (if (minimumInterestCharged.asKnown().isPresent) 1 else 0) class InterestCalculationMethod @JsonCreator @@ -4311,234 +3298,6 @@ private constructor( "BalanceDetails{amount=$amount, remaining=$remaining, additionalProperties=$additionalProperties}" } - class CategoryBalances - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val fees: JsonField, - private val interest: JsonField, - private val principal: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), - @JsonProperty("interest") @ExcludeMissing interest: JsonField = JsonMissing.of(), - @JsonProperty("principal") @ExcludeMissing principal: JsonField = JsonMissing.of(), - ) : this(fees, interest, principal, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fees(): Long = fees.getRequired("fees") - - /** - * @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 interest(): Long = interest.getRequired("interest") - - /** - * @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 principal(): Long = principal.getRequired("principal") - - /** - * Returns the raw JSON value of [fees]. - * - * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees - - /** - * Returns the raw JSON value of [interest]. - * - * Unlike [interest], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest - - /** - * Returns the raw JSON value of [principal]. - * - * Unlike [principal], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("principal") @ExcludeMissing fun _principal(): JsonField = principal - - @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 [CategoryBalances]. - * - * The following fields are required: - * ```java - * .fees() - * .interest() - * .principal() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CategoryBalances]. */ - class Builder internal constructor() { - - private var fees: JsonField? = null - private var interest: JsonField? = null - private var principal: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(categoryBalances: CategoryBalances) = apply { - fees = categoryBalances.fees - interest = categoryBalances.interest - principal = categoryBalances.principal - additionalProperties = categoryBalances.additionalProperties.toMutableMap() - } - - fun fees(fees: Long) = fees(JsonField.of(fees)) - - /** - * Sets [Builder.fees] to an arbitrary JSON value. - * - * You should usually call [Builder.fees] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun fees(fees: JsonField) = apply { this.fees = fees } - - fun interest(interest: Long) = interest(JsonField.of(interest)) - - /** - * Sets [Builder.interest] to an arbitrary JSON value. - * - * You should usually call [Builder.interest] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun interest(interest: JsonField) = apply { this.interest = interest } - - fun principal(principal: Long) = principal(JsonField.of(principal)) - - /** - * Sets [Builder.principal] to an arbitrary JSON value. - * - * You should usually call [Builder.principal] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun principal(principal: JsonField) = apply { this.principal = principal } - - 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 [CategoryBalances]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fees() - * .interest() - * .principal() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CategoryBalances = - CategoryBalances( - checkRequired("fees", fees), - checkRequired("interest", interest), - checkRequired("principal", principal), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CategoryBalances = apply { - if (validated) { - return@apply - } - - fees() - interest() - principal() - 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 (fees.asKnown().isPresent) 1 else 0) + - (if (interest.asKnown().isPresent) 1 else 0) + - (if (principal.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CategoryBalances && - fees == other.fees && - interest == other.interest && - principal == other.principal && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(fees, interest, principal, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CategoryBalances{fees=$fees, interest=$interest, principal=$principal, additionalProperties=$additionalProperties}" - } - override fun equals(other: Any?): Boolean { if (this === other) { return true diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationListParams.kt index 274692ebc..44adbc6aa 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationListParams.kt @@ -525,6 +525,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -535,6 +537,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -552,6 +555,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -573,6 +577,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -592,6 +597,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt index ac9f93ccd..7d47c146b 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/ManagementOperationTransaction.kt @@ -631,7 +631,12 @@ private constructor( this.transactionSeries = transactionSeries } - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -784,6 +789,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -794,6 +801,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -811,6 +819,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -832,6 +841,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -851,6 +861,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } @@ -1531,7 +1542,10 @@ private constructor( */ fun type(type: JsonField) = apply { this.type = type } - fun subtype(subtype: String) = subtype(JsonField.of(subtype)) + fun subtype(subtype: String?) = subtype(JsonField.ofNullable(subtype)) + + /** Alias for calling [Builder.subtype] with `subtype.orElse(null)`. */ + fun subtype(subtype: Optional) = subtype(subtype.getOrNull()) /** * Sets [Builder.subtype] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Merchant.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Merchant.kt new file mode 100644 index 000000000..a445045e2 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Merchant.kt @@ -0,0 +1,439 @@ +// 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.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects + +class Merchant +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val acceptorId: JsonField, + private val acquiringInstitutionId: JsonField, + private val city: JsonField, + private val country: JsonField, + private val descriptor: JsonField, + private val mcc: JsonField, + private val state: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("acceptor_id") + @ExcludeMissing + acceptorId: JsonField = JsonMissing.of(), + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + acquiringInstitutionId: JsonField = JsonMissing.of(), + @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), + @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), + @JsonProperty("descriptor") + @ExcludeMissing + descriptor: JsonField = JsonMissing.of(), + @JsonProperty("mcc") @ExcludeMissing mcc: JsonField = JsonMissing.of(), + @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), + ) : this( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + mutableMapOf(), + ) + + /** + * Unique alphanumeric identifier for the payment card acceptor (merchant). + * + * @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 acceptorId(): String = acceptorId.getRequired("acceptor_id") + + /** + * Unique numeric identifier of the acquiring institution. + * + * @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 acquiringInstitutionId(): String = + acquiringInstitutionId.getRequired("acquiring_institution_id") + + /** + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. + * + * @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 city(): String = city.getRequired("city") + + /** + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 country + * codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. + * + * @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 country(): String = country.getRequired("country") + + /** + * Short description of card acceptor. + * + * @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 descriptor(): String = descriptor.getRequired("descriptor") + + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to + * classify a business by the types of goods or services it provides. + * + * @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 mcc(): String = mcc.getRequired("mcc") + + /** + * Geographic state of card acceptor. + * + * @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 state(): String = state.getRequired("state") + + /** + * Returns the raw JSON value of [acceptorId]. + * + * Unlike [acceptorId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("acceptor_id") @ExcludeMissing fun _acceptorId(): JsonField = acceptorId + + /** + * Returns the raw JSON value of [acquiringInstitutionId]. + * + * Unlike [acquiringInstitutionId], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("acquiring_institution_id") + @ExcludeMissing + fun _acquiringInstitutionId(): JsonField = acquiringInstitutionId + + /** + * Returns the raw JSON value of [city]. + * + * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city + + /** + * Returns the raw JSON value of [country]. + * + * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country + + /** + * Returns the raw JSON value of [descriptor]. + * + * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("descriptor") @ExcludeMissing fun _descriptor(): JsonField = descriptor + + /** + * Returns the raw JSON value of [mcc]. + * + * Unlike [mcc], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("mcc") @ExcludeMissing fun _mcc(): JsonField = mcc + + /** + * Returns the raw JSON value of [state]. + * + * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state + + @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 [Merchant]. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Merchant]. */ + class Builder internal constructor() { + + private var acceptorId: JsonField? = null + private var acquiringInstitutionId: JsonField? = null + private var city: JsonField? = null + private var country: JsonField? = null + private var descriptor: JsonField? = null + private var mcc: JsonField? = null + private var state: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(merchant: Merchant) = apply { + acceptorId = merchant.acceptorId + acquiringInstitutionId = merchant.acquiringInstitutionId + city = merchant.city + country = merchant.country + descriptor = merchant.descriptor + mcc = merchant.mcc + state = merchant.state + additionalProperties = merchant.additionalProperties.toMutableMap() + } + + /** Unique alphanumeric identifier for the payment card acceptor (merchant). */ + fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId)) + + /** + * Sets [Builder.acceptorId] to an arbitrary JSON value. + * + * You should usually call [Builder.acceptorId] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId } + + /** Unique numeric identifier of the acquiring institution. */ + fun acquiringInstitutionId(acquiringInstitutionId: String) = + acquiringInstitutionId(JsonField.of(acquiringInstitutionId)) + + /** + * Sets [Builder.acquiringInstitutionId] to an arbitrary JSON value. + * + * You should usually call [Builder.acquiringInstitutionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply { + this.acquiringInstitutionId = acquiringInstitutionId + } + + /** + * City of card acceptor. Note that in many cases, particularly in card-not-present + * transactions, merchants may send through a phone number or URL in this field. + */ + fun city(city: String) = city(JsonField.of(city)) + + /** + * Sets [Builder.city] to an arbitrary JSON value. + * + * You should usually call [Builder.city] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun city(city: JsonField) = apply { this.city = city } + + /** + * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 + * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. + */ + fun country(country: String) = country(JsonField.of(country)) + + /** + * Sets [Builder.country] to an arbitrary JSON value. + * + * You should usually call [Builder.country] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun country(country: JsonField) = apply { this.country = country } + + /** Short description of card acceptor. */ + fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) + + /** + * Sets [Builder.descriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.descriptor] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } + + /** + * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to + * classify a business by the types of goods or services it provides. + */ + fun mcc(mcc: String) = mcc(JsonField.of(mcc)) + + /** + * Sets [Builder.mcc] to an arbitrary JSON value. + * + * You should usually call [Builder.mcc] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun mcc(mcc: JsonField) = apply { this.mcc = mcc } + + /** Geographic state of card acceptor. */ + fun state(state: String) = state(JsonField.of(state)) + + /** + * Sets [Builder.state] to an arbitrary JSON value. + * + * You should usually call [Builder.state] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun state(state: JsonField) = apply { this.state = state } + + 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 [Merchant]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .acceptorId() + * .acquiringInstitutionId() + * .city() + * .country() + * .descriptor() + * .mcc() + * .state() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Merchant = + Merchant( + checkRequired("acceptorId", acceptorId), + checkRequired("acquiringInstitutionId", acquiringInstitutionId), + checkRequired("city", city), + checkRequired("country", country), + checkRequired("descriptor", descriptor), + checkRequired("mcc", mcc), + checkRequired("state", state), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Merchant = apply { + if (validated) { + return@apply + } + + acceptorId() + acquiringInstitutionId() + city() + country() + descriptor() + mcc() + state() + 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 (acceptorId.asKnown().isPresent) 1 else 0) + + (if (acquiringInstitutionId.asKnown().isPresent) 1 else 0) + + (if (city.asKnown().isPresent) 1 else 0) + + (if (country.asKnown().isPresent) 1 else 0) + + (if (descriptor.asKnown().isPresent) 1 else 0) + + (if (mcc.asKnown().isPresent) 1 else 0) + + (if (state.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Merchant && + acceptorId == other.acceptorId && + acquiringInstitutionId == other.acquiringInstitutionId && + city == other.city && + country == other.country && + descriptor == other.descriptor && + mcc == other.mcc && + state == other.state && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + acceptorId, + acquiringInstitutionId, + city, + country, + descriptor, + mcc, + state, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Merchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/MicroDepositCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/MicroDepositCreateResponse.kt index 4405bf129..fe3d96dbb 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/MicroDepositCreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/MicroDepositCreateResponse.kt @@ -757,7 +757,10 @@ private constructor( * Indicates which Lithic account the external account is associated with. For external * accounts that are associated with the program, account_token field returned will be null */ - fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) + 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. @@ -771,7 +774,10 @@ private constructor( } /** Address */ - fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address)) + fun address(address: ExternalBankAccountAddress?) = address(JsonField.ofNullable(address)) + + /** Alias for calling [Builder.address] with `address.orElse(null)`. */ + fun address(address: Optional) = address(address.getOrNull()) /** * Sets [Builder.address] to an arbitrary JSON value. @@ -785,7 +791,10 @@ private constructor( } /** Optional field that helps identify bank accounts in receipts */ - fun companyId(companyId: String) = companyId(JsonField.of(companyId)) + fun companyId(companyId: String?) = companyId(JsonField.ofNullable(companyId)) + + /** Alias for calling [Builder.companyId] with `companyId.orElse(null)`. */ + fun companyId(companyId: Optional) = companyId(companyId.getOrNull()) /** * Sets [Builder.companyId] to an arbitrary JSON value. @@ -797,7 +806,10 @@ private constructor( fun companyId(companyId: JsonField) = apply { this.companyId = companyId } /** Date of Birth of the Individual that owns the external bank account */ - fun dob(dob: LocalDate) = dob(JsonField.of(dob)) + fun dob(dob: LocalDate?) = dob(JsonField.ofNullable(dob)) + + /** Alias for calling [Builder.dob] with `dob.orElse(null)`. */ + fun dob(dob: Optional) = dob(dob.getOrNull()) /** * Sets [Builder.dob] to an arbitrary JSON value. @@ -808,8 +820,12 @@ private constructor( fun dob(dob: JsonField) = apply { this.dob = dob } /** Doing Business As */ - fun doingBusinessAs(doingBusinessAs: String) = - doingBusinessAs(JsonField.of(doingBusinessAs)) + fun doingBusinessAs(doingBusinessAs: String?) = + doingBusinessAs(JsonField.ofNullable(doingBusinessAs)) + + /** Alias for calling [Builder.doingBusinessAs] with `doingBusinessAs.orElse(null)`. */ + fun doingBusinessAs(doingBusinessAs: Optional) = + doingBusinessAs(doingBusinessAs.getOrNull()) /** * Sets [Builder.doingBusinessAs] to an arbitrary JSON value. @@ -823,8 +839,15 @@ private constructor( } /** The financial account token of the operating account to fund the micro deposits */ - fun financialAccountToken(financialAccountToken: String) = - financialAccountToken(JsonField.of(financialAccountToken)) + fun financialAccountToken(financialAccountToken: String?) = + financialAccountToken(JsonField.ofNullable(financialAccountToken)) + + /** + * Alias for calling [Builder.financialAccountToken] with + * `financialAccountToken.orElse(null)`. + */ + fun financialAccountToken(financialAccountToken: Optional) = + financialAccountToken(financialAccountToken.getOrNull()) /** * Sets [Builder.financialAccountToken] to an arbitrary JSON value. @@ -838,7 +861,10 @@ private constructor( } /** The nickname for this External Bank Account */ - fun name(name: String) = name(JsonField.of(name)) + fun name(name: String?) = name(JsonField.ofNullable(name)) + + /** Alias for calling [Builder.name] with `name.orElse(null)`. */ + fun name(name: Optional) = name(name.getOrNull()) /** * Sets [Builder.name] to an arbitrary JSON value. @@ -849,7 +875,12 @@ private constructor( fun name(name: JsonField) = apply { this.name = name } /** User Defined ID */ - fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId)) + fun userDefinedId(userDefinedId: String?) = + userDefinedId(JsonField.ofNullable(userDefinedId)) + + /** Alias for calling [Builder.userDefinedId] with `userDefinedId.orElse(null)`. */ + fun userDefinedId(userDefinedId: Optional) = + userDefinedId(userDefinedId.getOrNull()) /** * Sets [Builder.userDefinedId] to an arbitrary JSON value. @@ -867,8 +898,15 @@ private constructor( * micro-deposits returned, this field will display the reason return code sent by the ACH * network */ - fun verificationFailedReason(verificationFailedReason: String) = - verificationFailedReason(JsonField.of(verificationFailedReason)) + fun verificationFailedReason(verificationFailedReason: String?) = + verificationFailedReason(JsonField.ofNullable(verificationFailedReason)) + + /** + * Alias for calling [Builder.verificationFailedReason] with + * `verificationFailedReason.orElse(null)`. + */ + fun verificationFailedReason(verificationFailedReason: Optional) = + verificationFailedReason(verificationFailedReason.getOrNull()) /** * Sets [Builder.verificationFailedReason] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt index dc8f4779f..229b5a287 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Payment.kt @@ -234,13 +234,13 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Related account tokens for the transaction + * Account tokens related to a payment transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun relatedAccountTokens(): RelatedAccountTokens = - relatedAccountTokens.getRequired("related_account_tokens") + fun relatedAccountTokens(): Optional = + relatedAccountTokens.getOptional("related_account_tokens") /** * Transaction result @@ -753,9 +753,16 @@ private constructor( this.pendingAmount = pendingAmount } - /** Related account tokens for the transaction */ - fun relatedAccountTokens(relatedAccountTokens: RelatedAccountTokens) = - relatedAccountTokens(JsonField.of(relatedAccountTokens)) + /** Account tokens related to a payment transaction */ + fun relatedAccountTokens(relatedAccountTokens: RelatedAccountTokens?) = + relatedAccountTokens(JsonField.ofNullable(relatedAccountTokens)) + + /** + * Alias for calling [Builder.relatedAccountTokens] with + * `relatedAccountTokens.orElse(null)`. + */ + fun relatedAccountTokens(relatedAccountTokens: Optional) = + relatedAccountTokens(relatedAccountTokens.getOrNull()) /** * Sets [Builder.relatedAccountTokens] to an arbitrary JSON value. @@ -1006,7 +1013,7 @@ private constructor( method().validate() methodAttributes().validate() pendingAmount() - relatedAccountTokens().validate() + relatedAccountTokens().ifPresent { it.validate() } result().validate() settledAmount() source().validate() @@ -2192,6 +2199,8 @@ private constructor( @JvmField val APPROVED = of("APPROVED") + @JvmField val DECLINED = of("DECLINED") + @JvmField val FUNDS_INSUFFICIENT = of("FUNDS_INSUFFICIENT") @JvmField val ACCOUNT_INVALID = of("ACCOUNT_INVALID") @@ -2209,6 +2218,7 @@ private constructor( /** An enum containing [DetailedResult]'s known values. */ enum class Known { APPROVED, + DECLINED, FUNDS_INSUFFICIENT, ACCOUNT_INVALID, PROGRAM_TRANSACTION_LIMIT_EXCEEDED, @@ -2227,6 +2237,7 @@ private constructor( */ enum class Value { APPROVED, + DECLINED, FUNDS_INSUFFICIENT, ACCOUNT_INVALID, PROGRAM_TRANSACTION_LIMIT_EXCEEDED, @@ -2249,6 +2260,7 @@ private constructor( fun value(): Value = when (this) { APPROVED -> Value.APPROVED + DECLINED -> Value.DECLINED FUNDS_INSUFFICIENT -> Value.FUNDS_INSUFFICIENT ACCOUNT_INVALID -> Value.ACCOUNT_INVALID PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> Value.PROGRAM_TRANSACTION_LIMIT_EXCEEDED @@ -2269,6 +2281,7 @@ private constructor( fun known(): Known = when (this) { APPROVED -> Known.APPROVED + DECLINED -> Known.DECLINED FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT ACCOUNT_INVALID -> Known.ACCOUNT_INVALID PROGRAM_TRANSACTION_LIMIT_EXCEEDED -> Known.PROGRAM_TRANSACTION_LIMIT_EXCEEDED @@ -3969,7 +3982,7 @@ private constructor( } } - /** Related account tokens for the transaction */ + /** Account tokens related to a payment transaction */ class RelatedAccountTokens @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -4486,6 +4499,8 @@ private constructor( @JvmField val CANCELED = of("CANCELED") + @JvmField val RETURNED = of("RETURNED") + @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value)) } @@ -4496,6 +4511,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, } /** @@ -4513,6 +4529,7 @@ private constructor( DECLINED, REVERSED, CANCELED, + RETURNED, /** * An enum member indicating that [TransactionStatus] was instantiated with an unknown * value. @@ -4534,6 +4551,7 @@ private constructor( DECLINED -> Value.DECLINED REVERSED -> Value.REVERSED CANCELED -> Value.CANCELED + RETURNED -> Value.RETURNED else -> Value._UNKNOWN } @@ -4553,6 +4571,7 @@ private constructor( DECLINED -> Known.DECLINED REVERSED -> Known.REVERSED CANCELED -> Known.CANCELED + RETURNED -> Known.RETURNED else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value") } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt index 45bb37004..d915118ed 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentCreateResponse.kt @@ -260,13 +260,13 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Related account tokens for the transaction + * Account tokens related to a payment transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun relatedAccountTokens(): Payment.RelatedAccountTokens = - relatedAccountTokens.getRequired("related_account_tokens") + fun relatedAccountTokens(): Optional = + relatedAccountTokens.getOptional("related_account_tokens") /** * Transaction result @@ -810,9 +810,16 @@ private constructor( this.pendingAmount = pendingAmount } - /** Related account tokens for the transaction */ - fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens) = - relatedAccountTokens(JsonField.of(relatedAccountTokens)) + /** Account tokens related to a payment transaction */ + fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens?) = + relatedAccountTokens(JsonField.ofNullable(relatedAccountTokens)) + + /** + * Alias for calling [Builder.relatedAccountTokens] with + * `relatedAccountTokens.orElse(null)`. + */ + fun relatedAccountTokens(relatedAccountTokens: Optional) = + relatedAccountTokens(relatedAccountTokens.getOrNull()) /** * Sets [Builder.relatedAccountTokens] to an arbitrary JSON value. @@ -1077,7 +1084,7 @@ private constructor( method().validate() methodAttributes().validate() pendingAmount() - relatedAccountTokens().validate() + relatedAccountTokens().ifPresent { it.validate() } result().validate() settledAmount() source().validate() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt index f5ae80f5d..b18727010 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentRetryResponse.kt @@ -260,13 +260,13 @@ private constructor( fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount") /** - * Related account tokens for the transaction + * Account tokens related to a payment transaction * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun relatedAccountTokens(): Payment.RelatedAccountTokens = - relatedAccountTokens.getRequired("related_account_tokens") + fun relatedAccountTokens(): Optional = + relatedAccountTokens.getOptional("related_account_tokens") /** * Transaction result @@ -810,9 +810,16 @@ private constructor( this.pendingAmount = pendingAmount } - /** Related account tokens for the transaction */ - fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens) = - relatedAccountTokens(JsonField.of(relatedAccountTokens)) + /** Account tokens related to a payment transaction */ + fun relatedAccountTokens(relatedAccountTokens: Payment.RelatedAccountTokens?) = + relatedAccountTokens(JsonField.ofNullable(relatedAccountTokens)) + + /** + * Alias for calling [Builder.relatedAccountTokens] with + * `relatedAccountTokens.orElse(null)`. + */ + fun relatedAccountTokens(relatedAccountTokens: Optional) = + relatedAccountTokens(relatedAccountTokens.getOrNull()) /** * Sets [Builder.relatedAccountTokens] to an arbitrary JSON value. @@ -1077,7 +1084,7 @@ private constructor( method().validate() methodAttributes().validate() pendingAmount() - relatedAccountTokens().validate() + relatedAccountTokens().ifPresent { it.validate() } result().validate() settledAmount() source().validate() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnParams.kt new file mode 100644 index 000000000..d06496048 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnParams.kt @@ -0,0 +1,802 @@ +// 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.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.Params +import com.lithic.api.core.checkRequired +import com.lithic.api.core.http.Headers +import com.lithic.api.core.http.QueryParams +import com.lithic.api.errors.LithicInvalidDataException +import java.time.LocalDate +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Return an ACH payment with a specified return reason code. Returns must be initiated within the + * time window specified by NACHA rules for each return code (typically 2 banking days for most + * codes, 60 calendar days for unauthorized debits). For a complete list of return codes and their + * meanings, see the + * [ACH Return Reasons documentation](https://docs.lithic.com/docs/ach-overview#ach-return-reasons). + * + * Note: + * * This endpoint does not modify the state of the financial account associated with the payment. + * If you would like to change the account state, use the + * [Update financial account status](https://docs.lithic.com/reference/updatefinancialaccountstatus) + * endpoint. + * * By default this endpoint is not enabled for your account. Please contact your implementations + * manager to enable this feature. + */ +class PaymentReturnParams +private constructor( + private val paymentToken: String?, + private val body: PaymentReturnRequest, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + fun paymentToken(): Optional = Optional.ofNullable(paymentToken) + + /** + * Globally unique identifier for the financial account + * + * @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 financialAccountToken(): String = body.financialAccountToken() + + /** + * ACH return reason code indicating the reason for returning the payment. Supported codes + * include R01-R53 and R80-R85. For a complete list of return codes and their meanings, see + * [ACH Return Reasons](https://docs.lithic.com/docs/ach-overview#ach-return-reasons) + * + * @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 returnReasonCode(): String = body.returnReasonCode() + + /** + * Optional additional information about the return. Limited to 44 characters + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun addenda(): Optional = body.addenda() + + /** + * Date of death in YYYY-MM-DD format. Required when using return codes **R14** (representative + * payee deceased) or **R15** (beneficiary or account holder deceased) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfDeath(): Optional = body.dateOfDeath() + + /** + * Optional memo for the return. Limited to 10 characters + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = body.memo() + + /** + * Returns the raw JSON value of [financialAccountToken]. + * + * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _financialAccountToken(): JsonField = body._financialAccountToken() + + /** + * Returns the raw JSON value of [returnReasonCode]. + * + * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + fun _returnReasonCode(): JsonField = body._returnReasonCode() + + /** + * Returns the raw JSON value of [addenda]. + * + * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _addenda(): JsonField = body._addenda() + + /** + * Returns the raw JSON value of [dateOfDeath]. + * + * Unlike [dateOfDeath], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _dateOfDeath(): JsonField = body._dateOfDeath() + + /** + * Returns the raw JSON value of [memo]. + * + * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _memo(): JsonField = body._memo() + + fun _additionalBodyProperties(): Map = body._additionalProperties() + + /** Additional headers to send with the request. */ + fun _additionalHeaders(): Headers = additionalHeaders + + /** Additional query param to send with the request. */ + fun _additionalQueryParams(): QueryParams = additionalQueryParams + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PaymentReturnParams]. + * + * The following fields are required: + * ```java + * .financialAccountToken() + * .returnReasonCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PaymentReturnParams]. */ + class Builder internal constructor() { + + private var paymentToken: String? = null + private var body: PaymentReturnRequest.Builder = PaymentReturnRequest.builder() + private var additionalHeaders: Headers.Builder = Headers.builder() + private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() + + @JvmSynthetic + internal fun from(paymentReturnParams: PaymentReturnParams) = apply { + paymentToken = paymentReturnParams.paymentToken + body = paymentReturnParams.body.toBuilder() + additionalHeaders = paymentReturnParams.additionalHeaders.toBuilder() + additionalQueryParams = paymentReturnParams.additionalQueryParams.toBuilder() + } + + fun paymentToken(paymentToken: String?) = apply { this.paymentToken = paymentToken } + + /** Alias for calling [Builder.paymentToken] with `paymentToken.orElse(null)`. */ + fun paymentToken(paymentToken: Optional) = paymentToken(paymentToken.getOrNull()) + + /** + * Sets the entire request body. + * + * This is generally only useful if you are already constructing the body separately. + * Otherwise, it's more convenient to use the top-level setters instead: + * - [financialAccountToken] + * - [returnReasonCode] + * - [addenda] + * - [dateOfDeath] + * - [memo] + * - etc. + */ + fun body(body: PaymentReturnRequest) = apply { this.body = body.toBuilder() } + + /** Globally unique identifier for the financial account */ + fun financialAccountToken(financialAccountToken: String) = apply { + body.financialAccountToken(financialAccountToken) + } + + /** + * Sets [Builder.financialAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.financialAccountToken] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun financialAccountToken(financialAccountToken: JsonField) = apply { + body.financialAccountToken(financialAccountToken) + } + + /** + * ACH return reason code indicating the reason for returning the payment. Supported codes + * include R01-R53 and R80-R85. For a complete list of return codes and their meanings, see + * [ACH Return Reasons](https://docs.lithic.com/docs/ach-overview#ach-return-reasons) + */ + fun returnReasonCode(returnReasonCode: String) = apply { + body.returnReasonCode(returnReasonCode) + } + + /** + * Sets [Builder.returnReasonCode] to an arbitrary JSON value. + * + * You should usually call [Builder.returnReasonCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun returnReasonCode(returnReasonCode: JsonField) = apply { + body.returnReasonCode(returnReasonCode) + } + + /** Optional additional information about the return. Limited to 44 characters */ + fun addenda(addenda: String?) = apply { body.addenda(addenda) } + + /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ + fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + + /** + * Sets [Builder.addenda] to an arbitrary JSON value. + * + * You should usually call [Builder.addenda] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun addenda(addenda: JsonField) = apply { body.addenda(addenda) } + + /** + * Date of death in YYYY-MM-DD format. Required when using return codes **R14** + * (representative payee deceased) or **R15** (beneficiary or account holder deceased) + */ + fun dateOfDeath(dateOfDeath: LocalDate?) = apply { body.dateOfDeath(dateOfDeath) } + + /** Alias for calling [Builder.dateOfDeath] with `dateOfDeath.orElse(null)`. */ + fun dateOfDeath(dateOfDeath: Optional) = dateOfDeath(dateOfDeath.getOrNull()) + + /** + * Sets [Builder.dateOfDeath] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfDeath] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateOfDeath(dateOfDeath: JsonField) = apply { body.dateOfDeath(dateOfDeath) } + + /** Optional memo for the return. Limited to 10 characters */ + fun memo(memo: String?) = apply { body.memo(memo) } + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * Sets [Builder.memo] to an arbitrary JSON value. + * + * You should usually call [Builder.memo] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun memo(memo: JsonField) = apply { body.memo(memo) } + + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { + body.additionalProperties(additionalBodyProperties) + } + + fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { + body.putAdditionalProperty(key, value) + } + + fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = + apply { + body.putAllAdditionalProperties(additionalBodyProperties) + } + + fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } + + fun removeAllAdditionalBodyProperties(keys: Set) = apply { + body.removeAllAdditionalProperties(keys) + } + + fun additionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) + } + + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) + } + + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.put(name, values) + } + + fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.putAll(additionalHeaders) + } + + fun replaceAdditionalHeaders(name: String, value: String) = apply { + additionalHeaders.replace(name, value) + } + + fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.replace(name, values) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.replaceAll(additionalHeaders) + } + + fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } + + fun removeAllAdditionalHeaders(names: Set) = apply { + additionalHeaders.removeAll(names) + } + + fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) + } + + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) + } + + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.put(key, values) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.putAll(additionalQueryParams) + } + + fun replaceAdditionalQueryParams(key: String, value: String) = apply { + additionalQueryParams.replace(key, value) + } + + fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.replace(key, values) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + this.additionalQueryParams.replaceAll(additionalQueryParams) + } + + fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } + + fun removeAllAdditionalQueryParams(keys: Set) = apply { + additionalQueryParams.removeAll(keys) + } + + /** + * Returns an immutable instance of [PaymentReturnParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .financialAccountToken() + * .returnReasonCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PaymentReturnParams = + PaymentReturnParams( + paymentToken, + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): PaymentReturnRequest = body + + fun _pathParam(index: Int): String = + when (index) { + 0 -> paymentToken ?: "" + else -> "" + } + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + /** Request to return an ACH payment */ + class PaymentReturnRequest + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val financialAccountToken: JsonField, + private val returnReasonCode: JsonField, + private val addenda: JsonField, + private val dateOfDeath: JsonField, + private val memo: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("financial_account_token") + @ExcludeMissing + financialAccountToken: JsonField = JsonMissing.of(), + @JsonProperty("return_reason_code") + @ExcludeMissing + returnReasonCode: JsonField = JsonMissing.of(), + @JsonProperty("addenda") @ExcludeMissing addenda: JsonField = JsonMissing.of(), + @JsonProperty("date_of_death") + @ExcludeMissing + dateOfDeath: JsonField = JsonMissing.of(), + @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), + ) : this( + financialAccountToken, + returnReasonCode, + addenda, + dateOfDeath, + memo, + mutableMapOf(), + ) + + /** + * Globally unique identifier for the financial account + * + * @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 financialAccountToken(): String = + financialAccountToken.getRequired("financial_account_token") + + /** + * ACH return reason code indicating the reason for returning the payment. Supported codes + * include R01-R53 and R80-R85. For a complete list of return codes and their meanings, see + * [ACH Return Reasons](https://docs.lithic.com/docs/ach-overview#ach-return-reasons) + * + * @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 returnReasonCode(): String = returnReasonCode.getRequired("return_reason_code") + + /** + * Optional additional information about the return. Limited to 44 characters + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun addenda(): Optional = addenda.getOptional("addenda") + + /** + * Date of death in YYYY-MM-DD format. Required when using return codes **R14** + * (representative payee deceased) or **R15** (beneficiary or account holder deceased) + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun dateOfDeath(): Optional = dateOfDeath.getOptional("date_of_death") + + /** + * Optional memo for the return. Limited to 10 characters + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun memo(): Optional = memo.getOptional("memo") + + /** + * Returns the raw JSON value of [financialAccountToken]. + * + * Unlike [financialAccountToken], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("financial_account_token") + @ExcludeMissing + fun _financialAccountToken(): JsonField = financialAccountToken + + /** + * Returns the raw JSON value of [returnReasonCode]. + * + * Unlike [returnReasonCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("return_reason_code") + @ExcludeMissing + fun _returnReasonCode(): JsonField = returnReasonCode + + /** + * Returns the raw JSON value of [addenda]. + * + * Unlike [addenda], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("addenda") @ExcludeMissing fun _addenda(): JsonField = addenda + + /** + * Returns the raw JSON value of [dateOfDeath]. + * + * Unlike [dateOfDeath], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("date_of_death") + @ExcludeMissing + fun _dateOfDeath(): JsonField = dateOfDeath + + /** + * Returns the raw JSON value of [memo]. + * + * Unlike [memo], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo + + @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 [PaymentReturnRequest]. + * + * The following fields are required: + * ```java + * .financialAccountToken() + * .returnReasonCode() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PaymentReturnRequest]. */ + class Builder internal constructor() { + + private var financialAccountToken: JsonField? = null + private var returnReasonCode: JsonField? = null + private var addenda: JsonField = JsonMissing.of() + private var dateOfDeath: JsonField = JsonMissing.of() + private var memo: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentReturnRequest: PaymentReturnRequest) = apply { + financialAccountToken = paymentReturnRequest.financialAccountToken + returnReasonCode = paymentReturnRequest.returnReasonCode + addenda = paymentReturnRequest.addenda + dateOfDeath = paymentReturnRequest.dateOfDeath + memo = paymentReturnRequest.memo + additionalProperties = paymentReturnRequest.additionalProperties.toMutableMap() + } + + /** Globally unique identifier for the financial account */ + fun financialAccountToken(financialAccountToken: String) = + financialAccountToken(JsonField.of(financialAccountToken)) + + /** + * Sets [Builder.financialAccountToken] to an arbitrary JSON value. + * + * You should usually call [Builder.financialAccountToken] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun financialAccountToken(financialAccountToken: JsonField) = apply { + this.financialAccountToken = financialAccountToken + } + + /** + * ACH return reason code indicating the reason for returning the payment. Supported + * codes include R01-R53 and R80-R85. For a complete list of return codes and their + * meanings, see + * [ACH Return Reasons](https://docs.lithic.com/docs/ach-overview#ach-return-reasons) + */ + fun returnReasonCode(returnReasonCode: String) = + returnReasonCode(JsonField.of(returnReasonCode)) + + /** + * Sets [Builder.returnReasonCode] to an arbitrary JSON value. + * + * You should usually call [Builder.returnReasonCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun returnReasonCode(returnReasonCode: JsonField) = apply { + this.returnReasonCode = returnReasonCode + } + + /** Optional additional information about the return. Limited to 44 characters */ + fun addenda(addenda: String?) = addenda(JsonField.ofNullable(addenda)) + + /** Alias for calling [Builder.addenda] with `addenda.orElse(null)`. */ + fun addenda(addenda: Optional) = addenda(addenda.getOrNull()) + + /** + * Sets [Builder.addenda] to an arbitrary JSON value. + * + * You should usually call [Builder.addenda] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun addenda(addenda: JsonField) = apply { this.addenda = addenda } + + /** + * Date of death in YYYY-MM-DD format. Required when using return codes **R14** + * (representative payee deceased) or **R15** (beneficiary or account holder deceased) + */ + fun dateOfDeath(dateOfDeath: LocalDate?) = + dateOfDeath(JsonField.ofNullable(dateOfDeath)) + + /** Alias for calling [Builder.dateOfDeath] with `dateOfDeath.orElse(null)`. */ + fun dateOfDeath(dateOfDeath: Optional) = dateOfDeath(dateOfDeath.getOrNull()) + + /** + * Sets [Builder.dateOfDeath] to an arbitrary JSON value. + * + * You should usually call [Builder.dateOfDeath] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dateOfDeath(dateOfDeath: JsonField) = apply { + this.dateOfDeath = dateOfDeath + } + + /** Optional memo for the return. Limited to 10 characters */ + fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) + + /** Alias for calling [Builder.memo] with `memo.orElse(null)`. */ + fun memo(memo: Optional) = memo(memo.getOrNull()) + + /** + * Sets [Builder.memo] to an arbitrary JSON value. + * + * You should usually call [Builder.memo] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun memo(memo: JsonField) = apply { this.memo = memo } + + 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 [PaymentReturnRequest]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .financialAccountToken() + * .returnReasonCode() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PaymentReturnRequest = + PaymentReturnRequest( + checkRequired("financialAccountToken", financialAccountToken), + checkRequired("returnReasonCode", returnReasonCode), + addenda, + dateOfDeath, + memo, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): PaymentReturnRequest = apply { + if (validated) { + return@apply + } + + financialAccountToken() + returnReasonCode() + addenda() + dateOfDeath() + memo() + 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 (financialAccountToken.asKnown().isPresent) 1 else 0) + + (if (returnReasonCode.asKnown().isPresent) 1 else 0) + + (if (addenda.asKnown().isPresent) 1 else 0) + + (if (dateOfDeath.asKnown().isPresent) 1 else 0) + + (if (memo.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentReturnRequest && + financialAccountToken == other.financialAccountToken && + returnReasonCode == other.returnReasonCode && + addenda == other.addenda && + dateOfDeath == other.dateOfDeath && + memo == other.memo && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + financialAccountToken, + returnReasonCode, + addenda, + dateOfDeath, + memo, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PaymentReturnRequest{financialAccountToken=$financialAccountToken, returnReasonCode=$returnReasonCode, addenda=$addenda, dateOfDeath=$dateOfDeath, memo=$memo, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is PaymentReturnParams && + paymentToken == other.paymentToken && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = + Objects.hash(paymentToken, body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "PaymentReturnParams{paymentToken=$paymentToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnResponse.kt new file mode 100644 index 000000000..49ac4fad5 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentReturnResponse.kt @@ -0,0 +1,402 @@ +// 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.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects +import kotlin.jvm.optionals.getOrNull + +/** Response from ACH operations including returns */ +class PaymentReturnResponse +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val result: JsonField, + private val transactionGroupUuid: JsonField, + private val transactionUuid: JsonField, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("result") + @ExcludeMissing + result: JsonField = JsonMissing.of(), + @JsonProperty("transaction_group_uuid") + @ExcludeMissing + transactionGroupUuid: JsonField = JsonMissing.of(), + @JsonProperty("transaction_uuid") + @ExcludeMissing + transactionUuid: JsonField = JsonMissing.of(), + ) : this(result, transactionGroupUuid, transactionUuid, mutableMapOf()) + + /** + * Transaction result + * + * @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 result(): TransactionResult = result.getRequired("result") + + /** + * Globally unique identifier for the transaction group + * + * @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 transactionGroupUuid(): String = transactionGroupUuid.getRequired("transaction_group_uuid") + + /** + * Globally unique identifier for the transaction + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun transactionUuid(): String = transactionUuid.getRequired("transaction_uuid") + + /** + * 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 + + /** + * Returns the raw JSON value of [transactionGroupUuid]. + * + * Unlike [transactionGroupUuid], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("transaction_group_uuid") + @ExcludeMissing + fun _transactionGroupUuid(): JsonField = transactionGroupUuid + + /** + * Returns the raw JSON value of [transactionUuid]. + * + * Unlike [transactionUuid], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("transaction_uuid") + @ExcludeMissing + fun _transactionUuid(): JsonField = transactionUuid + + @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 [PaymentReturnResponse]. + * + * The following fields are required: + * ```java + * .result() + * .transactionGroupUuid() + * .transactionUuid() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [PaymentReturnResponse]. */ + class Builder internal constructor() { + + private var result: JsonField? = null + private var transactionGroupUuid: JsonField? = null + private var transactionUuid: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(paymentReturnResponse: PaymentReturnResponse) = apply { + result = paymentReturnResponse.result + transactionGroupUuid = paymentReturnResponse.transactionGroupUuid + transactionUuid = paymentReturnResponse.transactionUuid + additionalProperties = paymentReturnResponse.additionalProperties.toMutableMap() + } + + /** Transaction result */ + fun result(result: TransactionResult) = result(JsonField.of(result)) + + /** + * Sets [Builder.result] to an arbitrary JSON value. + * + * You should usually call [Builder.result] with a well-typed [TransactionResult] 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 } + + /** Globally unique identifier for the transaction group */ + fun transactionGroupUuid(transactionGroupUuid: String) = + transactionGroupUuid(JsonField.of(transactionGroupUuid)) + + /** + * Sets [Builder.transactionGroupUuid] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionGroupUuid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionGroupUuid(transactionGroupUuid: JsonField) = apply { + this.transactionGroupUuid = transactionGroupUuid + } + + /** Globally unique identifier for the transaction */ + fun transactionUuid(transactionUuid: String) = + transactionUuid(JsonField.of(transactionUuid)) + + /** + * Sets [Builder.transactionUuid] to an arbitrary JSON value. + * + * You should usually call [Builder.transactionUuid] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun transactionUuid(transactionUuid: JsonField) = apply { + this.transactionUuid = transactionUuid + } + + 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 [PaymentReturnResponse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .result() + * .transactionGroupUuid() + * .transactionUuid() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PaymentReturnResponse = + PaymentReturnResponse( + checkRequired("result", result), + checkRequired("transactionGroupUuid", transactionGroupUuid), + checkRequired("transactionUuid", transactionUuid), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): PaymentReturnResponse = apply { + if (validated) { + return@apply + } + + result().validate() + transactionGroupUuid() + transactionUuid() + 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 = + (result.asKnown().getOrNull()?.validity() ?: 0) + + (if (transactionGroupUuid.asKnown().isPresent) 1 else 0) + + (if (transactionUuid.asKnown().isPresent) 1 else 0) + + /** Transaction result */ + class TransactionResult @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) = TransactionResult(JsonField.of(value)) + } + + /** An enum containing [TransactionResult]'s known values. */ + enum class Known { + APPROVED, + DECLINED, + } + + /** + * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN] member. + * + * An instance of [TransactionResult] 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 [TransactionResult] 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 TransactionResult: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily for debugging + * and generally doesn't throw. + * + * @throws LithicInvalidDataException if this class instance's value does not have the + * expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } + + private var validated: Boolean = false + + fun validate(): TransactionResult = 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 TransactionResult && 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 PaymentReturnResponse && + result == other.result && + transactionGroupUuid == other.transactionGroupUuid && + transactionUuid == other.transactionUuid && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(result, transactionGroupUuid, transactionUuid, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "PaymentReturnResponse{result=$result, transactionGroupUuid=$transactionGroupUuid, transactionUuid=$transactionUuid, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Statement.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Statement.kt index a3a7136dd..d6f076ff7 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Statement.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Statement.kt @@ -2386,524 +2386,6 @@ private constructor( "AmountDue{amount=$amount, pastDue=$pastDue, additionalProperties=$additionalProperties}" } - class StatementTotals - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val balanceTransfers: JsonField, - private val cashAdvances: JsonField, - private val credits: JsonField, - private val debits: JsonField, - private val fees: JsonField, - private val interest: JsonField, - private val payments: JsonField, - private val purchases: JsonField, - private val creditDetails: JsonValue, - private val debitDetails: JsonValue, - private val paymentDetails: JsonValue, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("balance_transfers") - @ExcludeMissing - balanceTransfers: JsonField = JsonMissing.of(), - @JsonProperty("cash_advances") - @ExcludeMissing - cashAdvances: JsonField = JsonMissing.of(), - @JsonProperty("credits") @ExcludeMissing credits: JsonField = JsonMissing.of(), - @JsonProperty("debits") @ExcludeMissing debits: JsonField = JsonMissing.of(), - @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), - @JsonProperty("interest") @ExcludeMissing interest: JsonField = JsonMissing.of(), - @JsonProperty("payments") @ExcludeMissing payments: JsonField = JsonMissing.of(), - @JsonProperty("purchases") - @ExcludeMissing - purchases: JsonField = JsonMissing.of(), - @JsonProperty("credit_details") - @ExcludeMissing - creditDetails: JsonValue = JsonMissing.of(), - @JsonProperty("debit_details") - @ExcludeMissing - debitDetails: JsonValue = JsonMissing.of(), - @JsonProperty("payment_details") - @ExcludeMissing - paymentDetails: JsonValue = JsonMissing.of(), - ) : this( - balanceTransfers, - cashAdvances, - credits, - debits, - fees, - interest, - payments, - purchases, - creditDetails, - debitDetails, - paymentDetails, - mutableMapOf(), - ) - - /** - * Opening balance transferred from previous account in cents - * - * @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 balanceTransfers(): Long = balanceTransfers.getRequired("balance_transfers") - - /** - * ATM and cashback transactions in cents - * - * @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 cashAdvances(): Long = cashAdvances.getRequired("cash_advances") - - /** - * Volume of credit management operation transactions less any balance transfers in cents - * - * @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 credits(): Long = credits.getRequired("credits") - - /** - * Volume of debit management operation transactions less any interest in cents - * - * @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 debits(): Long = debits.getRequired("debits") - - /** - * Volume of debit management operation transactions less any interest in cents - * - * @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 fees(): Long = fees.getRequired("fees") - - /** - * Interest accrued in cents - * - * @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 interest(): Long = interest.getRequired("interest") - - /** - * Any funds transfers which affective the balance in cents - * - * @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 payments(): Long = payments.getRequired("payments") - - /** - * Net card transaction volume less any cash advances in cents - * - * @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 purchases(): Long = purchases.getRequired("purchases") - - /** Breakdown of credits */ - @JsonProperty("credit_details") - @ExcludeMissing - fun _creditDetails(): JsonValue = creditDetails - - /** Breakdown of debits */ - @JsonProperty("debit_details") @ExcludeMissing fun _debitDetails(): JsonValue = debitDetails - - /** Breakdown of payments */ - @JsonProperty("payment_details") - @ExcludeMissing - fun _paymentDetails(): JsonValue = paymentDetails - - /** - * Returns the raw JSON value of [balanceTransfers]. - * - * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("balance_transfers") - @ExcludeMissing - fun _balanceTransfers(): JsonField = balanceTransfers - - /** - * Returns the raw JSON value of [cashAdvances]. - * - * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("cash_advances") - @ExcludeMissing - fun _cashAdvances(): JsonField = cashAdvances - - /** - * Returns the raw JSON value of [credits]. - * - * Unlike [credits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("credits") @ExcludeMissing fun _credits(): JsonField = credits - - /** - * Returns the raw JSON value of [debits]. - * - * Unlike [debits], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("debits") @ExcludeMissing fun _debits(): JsonField = debits - - /** - * Returns the raw JSON value of [fees]. - * - * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees - - /** - * Returns the raw JSON value of [interest]. - * - * Unlike [interest], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest - - /** - * Returns the raw JSON value of [payments]. - * - * Unlike [payments], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("payments") @ExcludeMissing fun _payments(): JsonField = payments - - /** - * Returns the raw JSON value of [purchases]. - * - * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("purchases") @ExcludeMissing fun _purchases(): JsonField = purchases - - @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 [StatementTotals]. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .credits() - * .debits() - * .fees() - * .interest() - * .payments() - * .purchases() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [StatementTotals]. */ - class Builder internal constructor() { - - private var balanceTransfers: JsonField? = null - private var cashAdvances: JsonField? = null - private var credits: JsonField? = null - private var debits: JsonField? = null - private var fees: JsonField? = null - private var interest: JsonField? = null - private var payments: JsonField? = null - private var purchases: JsonField? = null - private var creditDetails: JsonValue = JsonMissing.of() - private var debitDetails: JsonValue = JsonMissing.of() - private var paymentDetails: JsonValue = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(statementTotals: StatementTotals) = apply { - balanceTransfers = statementTotals.balanceTransfers - cashAdvances = statementTotals.cashAdvances - credits = statementTotals.credits - debits = statementTotals.debits - fees = statementTotals.fees - interest = statementTotals.interest - payments = statementTotals.payments - purchases = statementTotals.purchases - creditDetails = statementTotals.creditDetails - debitDetails = statementTotals.debitDetails - paymentDetails = statementTotals.paymentDetails - additionalProperties = statementTotals.additionalProperties.toMutableMap() - } - - /** Opening balance transferred from previous account in cents */ - fun balanceTransfers(balanceTransfers: Long) = - balanceTransfers(JsonField.of(balanceTransfers)) - - /** - * Sets [Builder.balanceTransfers] to an arbitrary JSON value. - * - * You should usually call [Builder.balanceTransfers] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun balanceTransfers(balanceTransfers: JsonField) = apply { - this.balanceTransfers = balanceTransfers - } - - /** ATM and cashback transactions in cents */ - fun cashAdvances(cashAdvances: Long) = cashAdvances(JsonField.of(cashAdvances)) - - /** - * Sets [Builder.cashAdvances] to an arbitrary JSON value. - * - * You should usually call [Builder.cashAdvances] with a well-typed [Long] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cashAdvances(cashAdvances: JsonField) = apply { - this.cashAdvances = cashAdvances - } - - /** - * Volume of credit management operation transactions less any balance transfers in - * cents - */ - fun credits(credits: Long) = credits(JsonField.of(credits)) - - /** - * Sets [Builder.credits] to an arbitrary JSON value. - * - * You should usually call [Builder.credits] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun credits(credits: JsonField) = apply { this.credits = credits } - - /** Volume of debit management operation transactions less any interest in cents */ - fun debits(debits: Long) = debits(JsonField.of(debits)) - - /** - * Sets [Builder.debits] to an arbitrary JSON value. - * - * You should usually call [Builder.debits] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun debits(debits: JsonField) = apply { this.debits = debits } - - /** Volume of debit management operation transactions less any interest in cents */ - fun fees(fees: Long) = fees(JsonField.of(fees)) - - /** - * Sets [Builder.fees] to an arbitrary JSON value. - * - * You should usually call [Builder.fees] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun fees(fees: JsonField) = apply { this.fees = fees } - - /** Interest accrued in cents */ - fun interest(interest: Long) = interest(JsonField.of(interest)) - - /** - * Sets [Builder.interest] to an arbitrary JSON value. - * - * You should usually call [Builder.interest] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun interest(interest: JsonField) = apply { this.interest = interest } - - /** Any funds transfers which affective the balance in cents */ - fun payments(payments: Long) = payments(JsonField.of(payments)) - - /** - * Sets [Builder.payments] to an arbitrary JSON value. - * - * You should usually call [Builder.payments] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun payments(payments: JsonField) = apply { this.payments = payments } - - /** Net card transaction volume less any cash advances in cents */ - fun purchases(purchases: Long) = purchases(JsonField.of(purchases)) - - /** - * Sets [Builder.purchases] to an arbitrary JSON value. - * - * You should usually call [Builder.purchases] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun purchases(purchases: JsonField) = apply { this.purchases = purchases } - - /** Breakdown of credits */ - fun creditDetails(creditDetails: JsonValue) = apply { - this.creditDetails = creditDetails - } - - /** Breakdown of debits */ - fun debitDetails(debitDetails: JsonValue) = apply { this.debitDetails = debitDetails } - - /** Breakdown of payments */ - fun paymentDetails(paymentDetails: JsonValue) = apply { - this.paymentDetails = paymentDetails - } - - 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 [StatementTotals]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .credits() - * .debits() - * .fees() - * .interest() - * .payments() - * .purchases() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): StatementTotals = - StatementTotals( - checkRequired("balanceTransfers", balanceTransfers), - checkRequired("cashAdvances", cashAdvances), - checkRequired("credits", credits), - checkRequired("debits", debits), - checkRequired("fees", fees), - checkRequired("interest", interest), - checkRequired("payments", payments), - checkRequired("purchases", purchases), - creditDetails, - debitDetails, - paymentDetails, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): StatementTotals = apply { - if (validated) { - return@apply - } - - balanceTransfers() - cashAdvances() - credits() - debits() - fees() - interest() - payments() - purchases() - 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 (balanceTransfers.asKnown().isPresent) 1 else 0) + - (if (cashAdvances.asKnown().isPresent) 1 else 0) + - (if (credits.asKnown().isPresent) 1 else 0) + - (if (debits.asKnown().isPresent) 1 else 0) + - (if (fees.asKnown().isPresent) 1 else 0) + - (if (interest.asKnown().isPresent) 1 else 0) + - (if (payments.asKnown().isPresent) 1 else 0) + - (if (purchases.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is StatementTotals && - balanceTransfers == other.balanceTransfers && - cashAdvances == other.cashAdvances && - credits == other.credits && - debits == other.debits && - fees == other.fees && - interest == other.interest && - payments == other.payments && - purchases == other.purchases && - creditDetails == other.creditDetails && - debitDetails == other.debitDetails && - paymentDetails == other.paymentDetails && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - balanceTransfers, - cashAdvances, - credits, - debits, - fees, - interest, - payments, - purchases, - creditDetails, - debitDetails, - paymentDetails, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, debits=$debits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, creditDetails=$creditDetails, debitDetails=$debitDetails, paymentDetails=$paymentDetails, additionalProperties=$additionalProperties}" - } - class StatementType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -3473,260 +2955,6 @@ private constructor( (if (primeRate.asKnown().isPresent) 1 else 0) + (if (minimumInterestCharged.asKnown().isPresent) 1 else 0) - class CategoryDetails - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val balanceTransfers: JsonField, - private val cashAdvances: JsonField, - private val purchases: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("balance_transfers") - @ExcludeMissing - balanceTransfers: JsonField = JsonMissing.of(), - @JsonProperty("cash_advances") - @ExcludeMissing - cashAdvances: JsonField = JsonMissing.of(), - @JsonProperty("purchases") - @ExcludeMissing - purchases: JsonField = JsonMissing.of(), - ) : this(balanceTransfers, cashAdvances, purchases, mutableMapOf()) - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun balanceTransfers(): String = balanceTransfers.getRequired("balance_transfers") - - /** - * @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 cashAdvances(): String = cashAdvances.getRequired("cash_advances") - - /** - * @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 purchases(): String = purchases.getRequired("purchases") - - /** - * Returns the raw JSON value of [balanceTransfers]. - * - * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("balance_transfers") - @ExcludeMissing - fun _balanceTransfers(): JsonField = balanceTransfers - - /** - * Returns the raw JSON value of [cashAdvances]. - * - * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("cash_advances") - @ExcludeMissing - fun _cashAdvances(): JsonField = cashAdvances - - /** - * Returns the raw JSON value of [purchases]. - * - * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("purchases") - @ExcludeMissing - fun _purchases(): JsonField = purchases - - @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 [CategoryDetails]. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .purchases() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CategoryDetails]. */ - class Builder internal constructor() { - - private var balanceTransfers: JsonField? = null - private var cashAdvances: JsonField? = null - private var purchases: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(categoryDetails: CategoryDetails) = apply { - balanceTransfers = categoryDetails.balanceTransfers - cashAdvances = categoryDetails.cashAdvances - purchases = categoryDetails.purchases - additionalProperties = categoryDetails.additionalProperties.toMutableMap() - } - - fun balanceTransfers(balanceTransfers: String) = - balanceTransfers(JsonField.of(balanceTransfers)) - - /** - * Sets [Builder.balanceTransfers] to an arbitrary JSON value. - * - * You should usually call [Builder.balanceTransfers] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun balanceTransfers(balanceTransfers: JsonField) = apply { - this.balanceTransfers = balanceTransfers - } - - fun cashAdvances(cashAdvances: String) = cashAdvances(JsonField.of(cashAdvances)) - - /** - * Sets [Builder.cashAdvances] to an arbitrary JSON value. - * - * You should usually call [Builder.cashAdvances] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cashAdvances(cashAdvances: JsonField) = apply { - this.cashAdvances = cashAdvances - } - - fun purchases(purchases: String) = purchases(JsonField.of(purchases)) - - /** - * Sets [Builder.purchases] to an arbitrary JSON value. - * - * You should usually call [Builder.purchases] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun purchases(purchases: JsonField) = apply { this.purchases = purchases } - - 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 [CategoryDetails]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .balanceTransfers() - * .cashAdvances() - * .purchases() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CategoryDetails = - CategoryDetails( - checkRequired("balanceTransfers", balanceTransfers), - checkRequired("cashAdvances", cashAdvances), - checkRequired("purchases", purchases), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CategoryDetails = apply { - if (validated) { - return@apply - } - - balanceTransfers() - cashAdvances() - purchases() - 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 (balanceTransfers.asKnown().isPresent) 1 else 0) + - (if (cashAdvances.asKnown().isPresent) 1 else 0) + - (if (purchases.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CategoryDetails && - balanceTransfers == other.balanceTransfers && - cashAdvances == other.cashAdvances && - purchases == other.purchases && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(balanceTransfers, cashAdvances, purchases, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CategoryDetails{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, purchases=$purchases, additionalProperties=$additionalProperties}" - } - class InterestCalculationMethod @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementTotals.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementTotals.kt new file mode 100644 index 000000000..cbabdf772 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementTotals.kt @@ -0,0 +1,513 @@ +// 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.ExcludeMissing +import com.lithic.api.core.JsonField +import com.lithic.api.core.JsonMissing +import com.lithic.api.core.JsonValue +import com.lithic.api.core.checkRequired +import com.lithic.api.errors.LithicInvalidDataException +import java.util.Collections +import java.util.Objects + +class StatementTotals +@JsonCreator(mode = JsonCreator.Mode.DISABLED) +private constructor( + private val balanceTransfers: JsonField, + private val cashAdvances: JsonField, + private val credits: JsonField, + private val debits: JsonField, + private val fees: JsonField, + private val interest: JsonField, + private val payments: JsonField, + private val purchases: JsonField, + private val creditDetails: JsonValue, + private val debitDetails: JsonValue, + private val paymentDetails: JsonValue, + private val additionalProperties: MutableMap, +) { + + @JsonCreator + private constructor( + @JsonProperty("balance_transfers") + @ExcludeMissing + balanceTransfers: JsonField = JsonMissing.of(), + @JsonProperty("cash_advances") + @ExcludeMissing + cashAdvances: JsonField = JsonMissing.of(), + @JsonProperty("credits") @ExcludeMissing credits: JsonField = JsonMissing.of(), + @JsonProperty("debits") @ExcludeMissing debits: JsonField = JsonMissing.of(), + @JsonProperty("fees") @ExcludeMissing fees: JsonField = JsonMissing.of(), + @JsonProperty("interest") @ExcludeMissing interest: JsonField = JsonMissing.of(), + @JsonProperty("payments") @ExcludeMissing payments: JsonField = JsonMissing.of(), + @JsonProperty("purchases") @ExcludeMissing purchases: JsonField = JsonMissing.of(), + @JsonProperty("credit_details") @ExcludeMissing creditDetails: JsonValue = JsonMissing.of(), + @JsonProperty("debit_details") @ExcludeMissing debitDetails: JsonValue = JsonMissing.of(), + @JsonProperty("payment_details") + @ExcludeMissing + paymentDetails: JsonValue = JsonMissing.of(), + ) : this( + balanceTransfers, + cashAdvances, + credits, + debits, + fees, + interest, + payments, + purchases, + creditDetails, + debitDetails, + paymentDetails, + mutableMapOf(), + ) + + /** + * Opening balance transferred from previous account in cents + * + * @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 balanceTransfers(): Long = balanceTransfers.getRequired("balance_transfers") + + /** + * ATM and cashback transactions in cents + * + * @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 cashAdvances(): Long = cashAdvances.getRequired("cash_advances") + + /** + * Volume of credit management operation transactions less any balance transfers in cents + * + * @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 credits(): Long = credits.getRequired("credits") + + /** + * Volume of debit management operation transactions less any interest in cents + * + * @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 debits(): Long = debits.getRequired("debits") + + /** + * Volume of debit management operation transactions less any interest in cents + * + * @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 fees(): Long = fees.getRequired("fees") + + /** + * Interest accrued in cents + * + * @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 interest(): Long = interest.getRequired("interest") + + /** + * Any funds transfers which affective the balance in cents + * + * @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 payments(): Long = payments.getRequired("payments") + + /** + * Net card transaction volume less any cash advances in cents + * + * @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 purchases(): Long = purchases.getRequired("purchases") + + /** Breakdown of credits */ + @JsonProperty("credit_details") @ExcludeMissing fun _creditDetails(): JsonValue = creditDetails + + /** Breakdown of debits */ + @JsonProperty("debit_details") @ExcludeMissing fun _debitDetails(): JsonValue = debitDetails + + /** Breakdown of payments */ + @JsonProperty("payment_details") + @ExcludeMissing + fun _paymentDetails(): JsonValue = paymentDetails + + /** + * Returns the raw JSON value of [balanceTransfers]. + * + * Unlike [balanceTransfers], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("balance_transfers") + @ExcludeMissing + fun _balanceTransfers(): JsonField = balanceTransfers + + /** + * Returns the raw JSON value of [cashAdvances]. + * + * Unlike [cashAdvances], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("cash_advances") + @ExcludeMissing + fun _cashAdvances(): JsonField = cashAdvances + + /** + * Returns the raw JSON value of [credits]. + * + * Unlike [credits], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("credits") @ExcludeMissing fun _credits(): JsonField = credits + + /** + * Returns the raw JSON value of [debits]. + * + * Unlike [debits], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("debits") @ExcludeMissing fun _debits(): JsonField = debits + + /** + * Returns the raw JSON value of [fees]. + * + * Unlike [fees], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("fees") @ExcludeMissing fun _fees(): JsonField = fees + + /** + * Returns the raw JSON value of [interest]. + * + * Unlike [interest], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("interest") @ExcludeMissing fun _interest(): JsonField = interest + + /** + * Returns the raw JSON value of [payments]. + * + * Unlike [payments], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("payments") @ExcludeMissing fun _payments(): JsonField = payments + + /** + * Returns the raw JSON value of [purchases]. + * + * Unlike [purchases], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("purchases") @ExcludeMissing fun _purchases(): JsonField = purchases + + @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 [StatementTotals]. + * + * The following fields are required: + * ```java + * .balanceTransfers() + * .cashAdvances() + * .credits() + * .debits() + * .fees() + * .interest() + * .payments() + * .purchases() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [StatementTotals]. */ + class Builder internal constructor() { + + private var balanceTransfers: JsonField? = null + private var cashAdvances: JsonField? = null + private var credits: JsonField? = null + private var debits: JsonField? = null + private var fees: JsonField? = null + private var interest: JsonField? = null + private var payments: JsonField? = null + private var purchases: JsonField? = null + private var creditDetails: JsonValue = JsonMissing.of() + private var debitDetails: JsonValue = JsonMissing.of() + private var paymentDetails: JsonValue = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(statementTotals: StatementTotals) = apply { + balanceTransfers = statementTotals.balanceTransfers + cashAdvances = statementTotals.cashAdvances + credits = statementTotals.credits + debits = statementTotals.debits + fees = statementTotals.fees + interest = statementTotals.interest + payments = statementTotals.payments + purchases = statementTotals.purchases + creditDetails = statementTotals.creditDetails + debitDetails = statementTotals.debitDetails + paymentDetails = statementTotals.paymentDetails + additionalProperties = statementTotals.additionalProperties.toMutableMap() + } + + /** Opening balance transferred from previous account in cents */ + fun balanceTransfers(balanceTransfers: Long) = + balanceTransfers(JsonField.of(balanceTransfers)) + + /** + * Sets [Builder.balanceTransfers] to an arbitrary JSON value. + * + * You should usually call [Builder.balanceTransfers] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun balanceTransfers(balanceTransfers: JsonField) = apply { + this.balanceTransfers = balanceTransfers + } + + /** ATM and cashback transactions in cents */ + fun cashAdvances(cashAdvances: Long) = cashAdvances(JsonField.of(cashAdvances)) + + /** + * Sets [Builder.cashAdvances] to an arbitrary JSON value. + * + * You should usually call [Builder.cashAdvances] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun cashAdvances(cashAdvances: JsonField) = apply { this.cashAdvances = cashAdvances } + + /** + * Volume of credit management operation transactions less any balance transfers in cents + */ + fun credits(credits: Long) = credits(JsonField.of(credits)) + + /** + * Sets [Builder.credits] to an arbitrary JSON value. + * + * You should usually call [Builder.credits] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun credits(credits: JsonField) = apply { this.credits = credits } + + /** Volume of debit management operation transactions less any interest in cents */ + fun debits(debits: Long) = debits(JsonField.of(debits)) + + /** + * Sets [Builder.debits] to an arbitrary JSON value. + * + * You should usually call [Builder.debits] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun debits(debits: JsonField) = apply { this.debits = debits } + + /** Volume of debit management operation transactions less any interest in cents */ + fun fees(fees: Long) = fees(JsonField.of(fees)) + + /** + * Sets [Builder.fees] to an arbitrary JSON value. + * + * You should usually call [Builder.fees] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun fees(fees: JsonField) = apply { this.fees = fees } + + /** Interest accrued in cents */ + fun interest(interest: Long) = interest(JsonField.of(interest)) + + /** + * Sets [Builder.interest] to an arbitrary JSON value. + * + * You should usually call [Builder.interest] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun interest(interest: JsonField) = apply { this.interest = interest } + + /** Any funds transfers which affective the balance in cents */ + fun payments(payments: Long) = payments(JsonField.of(payments)) + + /** + * Sets [Builder.payments] to an arbitrary JSON value. + * + * You should usually call [Builder.payments] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun payments(payments: JsonField) = apply { this.payments = payments } + + /** Net card transaction volume less any cash advances in cents */ + fun purchases(purchases: Long) = purchases(JsonField.of(purchases)) + + /** + * Sets [Builder.purchases] to an arbitrary JSON value. + * + * You should usually call [Builder.purchases] with a well-typed [Long] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun purchases(purchases: JsonField) = apply { this.purchases = purchases } + + /** Breakdown of credits */ + fun creditDetails(creditDetails: JsonValue) = apply { this.creditDetails = creditDetails } + + /** Breakdown of debits */ + fun debitDetails(debitDetails: JsonValue) = apply { this.debitDetails = debitDetails } + + /** Breakdown of payments */ + fun paymentDetails(paymentDetails: JsonValue) = apply { + this.paymentDetails = paymentDetails + } + + 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 [StatementTotals]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .balanceTransfers() + * .cashAdvances() + * .credits() + * .debits() + * .fees() + * .interest() + * .payments() + * .purchases() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): StatementTotals = + StatementTotals( + checkRequired("balanceTransfers", balanceTransfers), + checkRequired("cashAdvances", cashAdvances), + checkRequired("credits", credits), + checkRequired("debits", debits), + checkRequired("fees", fees), + checkRequired("interest", interest), + checkRequired("payments", payments), + checkRequired("purchases", purchases), + creditDetails, + debitDetails, + paymentDetails, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): StatementTotals = apply { + if (validated) { + return@apply + } + + balanceTransfers() + cashAdvances() + credits() + debits() + fees() + interest() + payments() + purchases() + 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 (balanceTransfers.asKnown().isPresent) 1 else 0) + + (if (cashAdvances.asKnown().isPresent) 1 else 0) + + (if (credits.asKnown().isPresent) 1 else 0) + + (if (debits.asKnown().isPresent) 1 else 0) + + (if (fees.asKnown().isPresent) 1 else 0) + + (if (interest.asKnown().isPresent) 1 else 0) + + (if (payments.asKnown().isPresent) 1 else 0) + + (if (purchases.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is StatementTotals && + balanceTransfers == other.balanceTransfers && + cashAdvances == other.cashAdvances && + credits == other.credits && + debits == other.debits && + fees == other.fees && + interest == other.interest && + payments == other.payments && + purchases == other.purchases && + creditDetails == other.creditDetails && + debitDetails == other.debitDetails && + paymentDetails == other.paymentDetails && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + balanceTransfers, + cashAdvances, + credits, + debits, + fees, + interest, + payments, + purchases, + creditDetails, + debitDetails, + paymentDetails, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, debits=$debits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, creditDetails=$creditDetails, debitDetails=$debitDetails, paymentDetails=$paymentDetails, additionalProperties=$additionalProperties}" +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt index 037f354e4..5ef9f16ab 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transaction.kt @@ -3689,438 +3689,6 @@ private constructor( "CardholderAuthentication{authenticationMethod=$authenticationMethod, authenticationResult=$authenticationResult, decisionMadeBy=$decisionMadeBy, liabilityShift=$liabilityShift, threeDSAuthenticationToken=$threeDSAuthenticationToken, additionalProperties=$additionalProperties}" } - class Merchant - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val acceptorId: JsonField, - private val acquiringInstitutionId: JsonField, - private val city: JsonField, - private val country: JsonField, - private val descriptor: JsonField, - private val mcc: JsonField, - private val state: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("acceptor_id") - @ExcludeMissing - acceptorId: JsonField = JsonMissing.of(), - @JsonProperty("acquiring_institution_id") - @ExcludeMissing - acquiringInstitutionId: JsonField = JsonMissing.of(), - @JsonProperty("city") @ExcludeMissing city: JsonField = JsonMissing.of(), - @JsonProperty("country") @ExcludeMissing country: JsonField = JsonMissing.of(), - @JsonProperty("descriptor") - @ExcludeMissing - descriptor: JsonField = JsonMissing.of(), - @JsonProperty("mcc") @ExcludeMissing mcc: JsonField = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - ) : this( - acceptorId, - acquiringInstitutionId, - city, - country, - descriptor, - mcc, - state, - mutableMapOf(), - ) - - /** - * Unique alphanumeric identifier for the payment card acceptor (merchant). - * - * @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 acceptorId(): String = acceptorId.getRequired("acceptor_id") - - /** - * Unique numeric identifier of the acquiring institution. - * - * @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 acquiringInstitutionId(): String = - acquiringInstitutionId.getRequired("acquiring_institution_id") - - /** - * City of card acceptor. Note that in many cases, particularly in card-not-present - * transactions, merchants may send through a phone number or URL in this field. - * - * @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 city(): String = city.getRequired("city") - - /** - * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 - * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. - * - * @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 country(): String = country.getRequired("country") - - /** - * Short description of card acceptor. - * - * @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 descriptor(): String = descriptor.getRequired("descriptor") - - /** - * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to - * classify a business by the types of goods or services it provides. - * - * @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 mcc(): String = mcc.getRequired("mcc") - - /** - * Geographic state of card acceptor. - * - * @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 state(): String = state.getRequired("state") - - /** - * Returns the raw JSON value of [acceptorId]. - * - * Unlike [acceptorId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("acceptor_id") - @ExcludeMissing - fun _acceptorId(): JsonField = acceptorId - - /** - * Returns the raw JSON value of [acquiringInstitutionId]. - * - * Unlike [acquiringInstitutionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("acquiring_institution_id") - @ExcludeMissing - fun _acquiringInstitutionId(): JsonField = acquiringInstitutionId - - /** - * Returns the raw JSON value of [city]. - * - * Unlike [city], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("city") @ExcludeMissing fun _city(): JsonField = city - - /** - * Returns the raw JSON value of [country]. - * - * Unlike [country], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country - - /** - * Returns the raw JSON value of [descriptor]. - * - * Unlike [descriptor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("descriptor") - @ExcludeMissing - fun _descriptor(): JsonField = descriptor - - /** - * Returns the raw JSON value of [mcc]. - * - * Unlike [mcc], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("mcc") @ExcludeMissing fun _mcc(): JsonField = mcc - - /** - * Returns the raw JSON value of [state]. - * - * Unlike [state], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("state") @ExcludeMissing fun _state(): JsonField = state - - @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 [Merchant]. - * - * The following fields are required: - * ```java - * .acceptorId() - * .acquiringInstitutionId() - * .city() - * .country() - * .descriptor() - * .mcc() - * .state() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Merchant]. */ - class Builder internal constructor() { - - private var acceptorId: JsonField? = null - private var acquiringInstitutionId: JsonField? = null - private var city: JsonField? = null - private var country: JsonField? = null - private var descriptor: JsonField? = null - private var mcc: JsonField? = null - private var state: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(merchant: Merchant) = apply { - acceptorId = merchant.acceptorId - acquiringInstitutionId = merchant.acquiringInstitutionId - city = merchant.city - country = merchant.country - descriptor = merchant.descriptor - mcc = merchant.mcc - state = merchant.state - additionalProperties = merchant.additionalProperties.toMutableMap() - } - - /** Unique alphanumeric identifier for the payment card acceptor (merchant). */ - fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId)) - - /** - * Sets [Builder.acceptorId] to an arbitrary JSON value. - * - * You should usually call [Builder.acceptorId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId } - - /** Unique numeric identifier of the acquiring institution. */ - fun acquiringInstitutionId(acquiringInstitutionId: String) = - acquiringInstitutionId(JsonField.of(acquiringInstitutionId)) - - /** - * Sets [Builder.acquiringInstitutionId] to an arbitrary JSON value. - * - * You should usually call [Builder.acquiringInstitutionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply { - this.acquiringInstitutionId = acquiringInstitutionId - } - - /** - * City of card acceptor. Note that in many cases, particularly in card-not-present - * transactions, merchants may send through a phone number or URL in this field. - */ - fun city(city: String) = city(JsonField.of(city)) - - /** - * Sets [Builder.city] to an arbitrary JSON value. - * - * You should usually call [Builder.city] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun city(city: JsonField) = apply { this.city = city } - - /** - * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3 - * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles. - */ - fun country(country: String) = country(JsonField.of(country)) - - /** - * Sets [Builder.country] to an arbitrary JSON value. - * - * You should usually call [Builder.country] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun country(country: JsonField) = apply { this.country = country } - - /** Short description of card acceptor. */ - fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor)) - - /** - * Sets [Builder.descriptor] to an arbitrary JSON value. - * - * You should usually call [Builder.descriptor] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor } - - /** - * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used - * to classify a business by the types of goods or services it provides. - */ - fun mcc(mcc: String) = mcc(JsonField.of(mcc)) - - /** - * Sets [Builder.mcc] to an arbitrary JSON value. - * - * You should usually call [Builder.mcc] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun mcc(mcc: JsonField) = apply { this.mcc = mcc } - - /** Geographic state of card acceptor. */ - fun state(state: String) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun state(state: JsonField) = apply { this.state = state } - - 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 [Merchant]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .acceptorId() - * .acquiringInstitutionId() - * .city() - * .country() - * .descriptor() - * .mcc() - * .state() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Merchant = - Merchant( - checkRequired("acceptorId", acceptorId), - checkRequired("acquiringInstitutionId", acquiringInstitutionId), - checkRequired("city", city), - checkRequired("country", country), - checkRequired("descriptor", descriptor), - checkRequired("mcc", mcc), - checkRequired("state", state), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Merchant = apply { - if (validated) { - return@apply - } - - acceptorId() - acquiringInstitutionId() - city() - country() - descriptor() - mcc() - state() - 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 (acceptorId.asKnown().isPresent) 1 else 0) + - (if (acquiringInstitutionId.asKnown().isPresent) 1 else 0) + - (if (city.asKnown().isPresent) 1 else 0) + - (if (country.asKnown().isPresent) 1 else 0) + - (if (descriptor.asKnown().isPresent) 1 else 0) + - (if (mcc.asKnown().isPresent) 1 else 0) + - (if (state.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Merchant && - acceptorId == other.acceptorId && - acquiringInstitutionId == other.acquiringInstitutionId && - city == other.city && - country == other.country && - descriptor == other.descriptor && - mcc == other.mcc && - state == other.state && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - acceptorId, - acquiringInstitutionId, - city, - country, - descriptor, - mcc, - state, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Merchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, additionalProperties=$additionalProperties}" - } - /** * Card network of the authorization. Value is `UNKNOWN` when Lithic cannot determine the * network code from the upstream provider. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt index 18f5cee25..779436a8e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt @@ -792,986 +792,6 @@ private constructor( override fun toString() = value.toString() } - /** Financial Event */ - class FinancialEvent - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val token: JsonField, - private val amount: JsonField, - private val created: JsonField, - private val result: JsonField, - private val type: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created") - @ExcludeMissing - created: JsonField = JsonMissing.of(), - @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), - @JsonProperty("type") - @ExcludeMissing - type: JsonField = JsonMissing.of(), - ) : this(token, amount, created, result, type, mutableMapOf()) - - /** - * Globally unique identifier. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun token(): Optional = token.getOptional("token") - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Date and time when the financial event occurred. UTC time zone. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun created(): Optional = created.getOptional("created") - - /** - * APPROVED financial events were successful while DECLINED financial events were declined - * by user, Lithic, or the network. - * - * @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") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun type(): Optional = type.getOptional("type") - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * 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 [result]. - * - * Unlike [result], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [FinancialEvent]. */ - class Builder internal constructor() { - - private var token: JsonField = JsonMissing.of() - private var amount: JsonField = JsonMissing.of() - private var created: JsonField = JsonMissing.of() - private var result: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(financialEvent: FinancialEvent) = apply { - token = financialEvent.token - amount = financialEvent.amount - created = financialEvent.created - result = financialEvent.result - type = financialEvent.type - additionalProperties = financialEvent.additionalProperties.toMutableMap() - } - - /** Globally unique identifier. */ - 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 } - - /** - * Amount of the financial event that has been settled in the currency's smallest unit - * (e.g., cents). - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** Date and time when the financial event occurred. UTC time zone. */ - 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 } - - /** - * APPROVED financial events were successful while DECLINED financial events were - * declined by user, Lithic, or the network. - */ - 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 type(type: FinancialEventType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [FinancialEventType] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [FinancialEvent]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): FinancialEvent = - FinancialEvent( - token, - amount, - created, - result, - type, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): FinancialEvent = apply { - if (validated) { - return@apply - } - - token() - amount() - created() - result().ifPresent { it.validate() } - type().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 = - (if (token.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (created.asKnown().isPresent) 1 else 0) + - (result.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) - - /** - * APPROVED financial events were successful while DECLINED financial events were declined - * by user, Lithic, or the network. - */ - 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 - - 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() - } - - class FinancialEventType - @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 ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED") - - @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED") - - @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - - @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") - - @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") - - @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED") - - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") - - @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED") - - @JvmField val ACH_RECEIPT_RELEASED = of("ACH_RECEIPT_RELEASED") - - @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED") - - @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED") - - @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED") - - @JvmField val ACH_RETURN_REJECTED = of("ACH_RETURN_REJECTED") - - @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED") - - @JvmField val AUTHORIZATION = of("AUTHORIZATION") - - @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE") - - @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY") - - @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL") - - @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY") - - @JvmField val BILLING_ERROR = of("BILLING_ERROR") - - @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL") - - @JvmField val CARD_TO_CARD = of("CARD_TO_CARD") - - @JvmField val CASH_BACK = of("CASH_BACK") - - @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL") - - @JvmField val CLEARING = of("CLEARING") - - @JvmField val COLLECTION = of("COLLECTION") - - @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT") - - @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT") - - @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION") - - @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE") - - @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION") - - @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL") - - @JvmField val DISPUTE_WON = of("DISPUTE_WON") - - @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED") - - @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED") - - @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED") - - @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED") - - @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED") - - @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED") - - @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED") - - @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED") - - @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED") - - @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED") - - @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED") - - @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED") - - @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED") - - @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED") - - @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED") - - @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED") - - @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED") - - @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED") - - @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED") - - @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED") - - @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION") - - @JvmField val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION") - - @JvmField val INTEREST = of("INTEREST") - - @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL") - - @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT") - - @JvmField val LATE_PAYMENT = of("LATE_PAYMENT") - - @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL") - - @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF") - - @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT") - - @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL") - - @JvmField val SERVICE = of("SERVICE") - - @JvmField val RETURN = of("RETURN") - - @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL") - - @JvmField val TRANSFER = of("TRANSFER") - - @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS") - - @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT") - - @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL") - - @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT") - - @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value)) - } - - /** An enum containing [FinancialEventType]'s known values. */ - enum class Known { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - } - - /** - * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialEventType] 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 { - ACH_ORIGINATION_CANCELLED, - ACH_ORIGINATION_INITIATED, - ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_RELEASED, - ACH_ORIGINATION_REJECTED, - ACH_ORIGINATION_REVIEWED, - ACH_ORIGINATION_SETTLED, - ACH_RECEIPT_PROCESSED, - ACH_RECEIPT_RELEASED, - ACH_RECEIPT_SETTLED, - ACH_RETURN_INITIATED, - ACH_RETURN_PROCESSED, - ACH_RETURN_REJECTED, - ACH_RETURN_SETTLED, - AUTHORIZATION, - AUTHORIZATION_ADVICE, - AUTHORIZATION_EXPIRY, - AUTHORIZATION_REVERSAL, - BALANCE_INQUIRY, - BILLING_ERROR, - BILLING_ERROR_REVERSAL, - CARD_TO_CARD, - CASH_BACK, - CASH_BACK_REVERSAL, - CLEARING, - COLLECTION, - CORRECTION_CREDIT, - CORRECTION_DEBIT, - CREDIT_AUTHORIZATION, - CREDIT_AUTHORIZATION_ADVICE, - CURRENCY_CONVERSION, - CURRENCY_CONVERSION_REVERSAL, - DISPUTE_WON, - EXTERNAL_ACH_CANCELED, - EXTERNAL_ACH_INITIATED, - EXTERNAL_ACH_RELEASED, - EXTERNAL_ACH_REVERSED, - EXTERNAL_ACH_SETTLED, - EXTERNAL_CHECK_CANCELED, - EXTERNAL_CHECK_INITIATED, - EXTERNAL_CHECK_RELEASED, - EXTERNAL_CHECK_REVERSED, - EXTERNAL_CHECK_SETTLED, - EXTERNAL_TRANSFER_CANCELED, - EXTERNAL_TRANSFER_INITIATED, - EXTERNAL_TRANSFER_RELEASED, - EXTERNAL_TRANSFER_REVERSED, - EXTERNAL_TRANSFER_SETTLED, - EXTERNAL_WIRE_CANCELED, - EXTERNAL_WIRE_INITIATED, - EXTERNAL_WIRE_RELEASED, - EXTERNAL_WIRE_REVERSED, - EXTERNAL_WIRE_SETTLED, - FINANCIAL_AUTHORIZATION, - FINANCIAL_CREDIT_AUTHORIZATION, - INTEREST, - INTEREST_REVERSAL, - INTERNAL_ADJUSTMENT, - LATE_PAYMENT, - LATE_PAYMENT_REVERSAL, - LOSS_WRITE_OFF, - PROVISIONAL_CREDIT, - PROVISIONAL_CREDIT_REVERSAL, - SERVICE, - RETURN, - RETURN_REVERSAL, - TRANSFER, - TRANSFER_INSUFFICIENT_FUNDS, - RETURNED_PAYMENT, - RETURNED_PAYMENT_REVERSAL, - LITHIC_NETWORK_PAYMENT, - /** - * An enum member indicating that [FinancialEventType] 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) { - ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Value.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Value.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED - AUTHORIZATION -> Value.AUTHORIZATION - AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Value.BALANCE_INQUIRY - BILLING_ERROR -> Value.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Value.CARD_TO_CARD - CASH_BACK -> Value.CASH_BACK - CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL - CLEARING -> Value.CLEARING - COLLECTION -> Value.COLLECTION - CORRECTION_CREDIT -> Value.CORRECTION_CREDIT - CORRECTION_DEBIT -> Value.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Value.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Value.INTEREST - INTEREST_REVERSAL -> Value.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Value.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Value.SERVICE - RETURN -> Value.RETURN - RETURN_REVERSAL -> Value.RETURN_REVERSAL - TRANSFER -> Value.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Value.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT - 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) { - ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED - ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED - ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED - ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED - ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED - ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED - ACH_RECEIPT_RELEASED -> Known.ACH_RECEIPT_RELEASED - ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED - ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED - ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED - ACH_RETURN_REJECTED -> Known.ACH_RETURN_REJECTED - ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED - AUTHORIZATION -> Known.AUTHORIZATION - AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE - AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY - AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL - BALANCE_INQUIRY -> Known.BALANCE_INQUIRY - BILLING_ERROR -> Known.BILLING_ERROR - BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL - CARD_TO_CARD -> Known.CARD_TO_CARD - CASH_BACK -> Known.CASH_BACK - CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL - CLEARING -> Known.CLEARING - COLLECTION -> Known.COLLECTION - CORRECTION_CREDIT -> Known.CORRECTION_CREDIT - CORRECTION_DEBIT -> Known.CORRECTION_DEBIT - CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION - CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE - CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION - CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL - DISPUTE_WON -> Known.DISPUTE_WON - EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED - EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED - EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED - EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED - EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED - EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED - EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED - EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED - EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED - EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED - EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED - EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED - EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED - EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED - EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED - EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED - EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED - EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED - EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED - EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED - FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION - FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION - INTEREST -> Known.INTEREST - INTEREST_REVERSAL -> Known.INTEREST_REVERSAL - INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT - LATE_PAYMENT -> Known.LATE_PAYMENT - LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL - LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF - PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT - PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL - SERVICE -> Known.SERVICE - RETURN -> Known.RETURN - RETURN_REVERSAL -> Known.RETURN_REVERSAL - TRANSFER -> Known.TRANSFER - TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS - RETURNED_PAYMENT -> Known.RETURNED_PAYMENT - RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL - LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT - else -> throw LithicInvalidDataException("Unknown FinancialEventType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): FinancialEventType = 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 FinancialEventType && 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 FinancialEvent && - token == other.token && - amount == other.amount && - created == other.created && - result == other.result && - type == other.type && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(token, amount, created, result, type, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}" - } - /** * APPROVED transactions were successful while DECLINED transactions were declined by user, * Lithic, or the network. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt index 51e02d126..cecbac3ec 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2CreateResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -597,7 +598,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -890,6 +892,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -986,6 +1004,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1004,6 +1025,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1014,6 +1041,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1028,6 +1059,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1040,6 +1077,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1079,6 +1120,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1121,6 +1174,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1135,7 +1196,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1145,6 +1208,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1157,6 +1222,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1183,6 +1252,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1205,6 +1283,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1249,6 +1335,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1283,6 +1381,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1449,6 +1551,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1545,6 +1663,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1563,6 +1684,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1573,6 +1700,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1587,6 +1718,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1599,6 +1736,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1638,6 +1779,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1680,6 +1833,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1694,7 +1855,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1704,6 +1867,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1716,6 +1881,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1742,6 +1911,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1764,6 +1942,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1808,6 +1994,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1842,6 +2040,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1890,6 +2092,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1897,6 +2105,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1911,6 +2122,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1928,6 +2142,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1944,6 +2161,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2136,7 +2356,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt index 5553d2af3..990c9afef 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2DraftResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -596,7 +597,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -889,6 +891,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -985,6 +1003,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1003,6 +1024,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1013,6 +1040,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1027,6 +1058,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1039,6 +1076,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1078,6 +1119,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1120,6 +1173,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1134,7 +1195,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1144,6 +1207,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1156,6 +1221,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1182,6 +1251,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1204,6 +1282,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1248,6 +1334,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1282,6 +1380,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1448,6 +1550,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1544,6 +1662,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1562,6 +1683,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1572,6 +1699,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1586,6 +1717,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1598,6 +1735,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1637,6 +1778,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1679,6 +1832,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1693,7 +1854,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1703,6 +1866,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1715,6 +1880,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1741,6 +1910,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1763,6 +1941,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1807,6 +1993,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1841,6 +2039,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1889,6 +2091,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1896,6 +2104,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1910,6 +2121,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1927,6 +2141,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1943,6 +2160,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2135,7 +2355,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt index 297af5fff..5b695d862 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ListResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -596,7 +597,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -889,6 +891,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -985,6 +1003,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1003,6 +1024,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1013,6 +1040,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1027,6 +1058,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1039,6 +1076,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1078,6 +1119,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1120,6 +1173,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1134,7 +1195,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1144,6 +1207,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1156,6 +1221,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1182,6 +1251,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1204,6 +1282,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1248,6 +1334,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1282,6 +1380,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1448,6 +1550,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1544,6 +1662,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1562,6 +1683,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1572,6 +1699,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1586,6 +1717,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1598,6 +1735,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1637,6 +1778,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1679,6 +1832,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1693,7 +1854,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1703,6 +1866,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1715,6 +1880,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1741,6 +1910,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1763,6 +1941,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1807,6 +1993,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1841,6 +2039,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1889,6 +2091,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1896,6 +2104,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1910,6 +2121,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1927,6 +2141,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1943,6 +2160,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2135,7 +2355,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt index 4fa344618..2e39b9789 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2PromoteResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -597,7 +598,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -890,6 +892,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -986,6 +1004,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1004,6 +1025,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1014,6 +1041,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1028,6 +1059,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1040,6 +1077,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1079,6 +1120,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1121,6 +1174,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1135,7 +1196,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1145,6 +1208,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1157,6 +1222,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1183,6 +1252,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1205,6 +1283,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1249,6 +1335,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1283,6 +1381,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1449,6 +1551,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1545,6 +1663,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1563,6 +1684,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1573,6 +1700,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1587,6 +1718,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1599,6 +1736,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1638,6 +1779,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1680,6 +1833,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1694,7 +1855,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1704,6 +1867,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1716,6 +1881,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1742,6 +1911,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1764,6 +1942,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1808,6 +1994,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1842,6 +2040,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1890,6 +2092,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1897,6 +2105,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1911,6 +2122,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1928,6 +2142,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1944,6 +2161,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2136,7 +2356,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt index 65bb1aa61..18cabbff0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -597,7 +598,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -890,6 +892,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -986,6 +1004,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1004,6 +1025,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1014,6 +1041,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1028,6 +1059,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1040,6 +1077,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1079,6 +1120,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1121,6 +1174,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1135,7 +1196,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1145,6 +1208,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1157,6 +1222,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1183,6 +1252,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1205,6 +1283,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1249,6 +1335,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1283,6 +1381,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1449,6 +1551,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1545,6 +1663,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1563,6 +1684,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1573,6 +1700,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1587,6 +1718,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1599,6 +1736,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1638,6 +1779,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1680,6 +1833,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1694,7 +1855,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1704,6 +1867,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1716,6 +1881,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1742,6 +1911,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1764,6 +1942,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1808,6 +1994,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1842,6 +2040,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1890,6 +2092,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1897,6 +2105,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1911,6 +2122,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1928,6 +2142,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1944,6 +2161,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2136,7 +2356,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt index 971bdb5f2..18ebaf6c7 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2UpdateResponse.kt @@ -193,7 +193,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. * * @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). @@ -597,7 +598,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ fun type(type: AuthRuleType) = type(JsonField.of(type)) @@ -890,6 +892,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -986,6 +1004,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1004,6 +1025,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1014,6 +1041,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1028,6 +1059,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1040,6 +1077,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1079,6 +1120,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1121,6 +1174,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1135,7 +1196,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1145,6 +1208,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1157,6 +1222,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1183,6 +1252,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1205,6 +1283,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1249,6 +1335,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1283,6 +1381,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1449,6 +1551,22 @@ private constructor( Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) ) + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalAchAction(conditionalAchAction)`. + */ + fun parameters(conditionalAchAction: ConditionalAchActionParameters) = + parameters(Parameters.ofConditionalAchAction(conditionalAchAction)) + + /** + * Alias for calling [parameters] with + * `Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction)`. + */ + fun parameters(conditionalTokenizationAction: ConditionalTokenizationActionParameters) = + parameters( + Parameters.ofConditionalTokenizationAction(conditionalTokenizationAction) + ) + /** * The version of the rule, this is incremented whenever the rule's parameters change. */ @@ -1545,6 +1663,9 @@ private constructor( private val conditional3dsAction: Conditional3dsActionParameters? = null, private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = null, + private val conditionalAchAction: ConditionalAchActionParameters? = null, + private val conditionalTokenizationAction: ConditionalTokenizationActionParameters? = + null, private val _json: JsonValue? = null, ) { @@ -1563,6 +1684,12 @@ private constructor( Optional = Optional.ofNullable(conditionalAuthorizationAction) + fun conditionalAchAction(): Optional = + Optional.ofNullable(conditionalAchAction) + + fun conditionalTokenizationAction(): Optional = + Optional.ofNullable(conditionalTokenizationAction) + fun isConditionalBlock(): Boolean = conditionalBlock != null fun isVelocityLimitParams(): Boolean = velocityLimitParams != null @@ -1573,6 +1700,10 @@ private constructor( fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null + fun isConditionalAchAction(): Boolean = conditionalAchAction != null + + fun isConditionalTokenizationAction(): Boolean = conditionalTokenizationAction != null + fun asConditionalBlock(): ConditionalBlockParameters = conditionalBlock.getOrThrow("conditionalBlock") @@ -1587,6 +1718,12 @@ private constructor( fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") + fun asConditionalAchAction(): ConditionalAchActionParameters = + conditionalAchAction.getOrThrow("conditionalAchAction") + + fun asConditionalTokenizationAction(): ConditionalTokenizationActionParameters = + conditionalTokenizationAction.getOrThrow("conditionalTokenizationAction") + fun _json(): Optional = Optional.ofNullable(_json) fun accept(visitor: Visitor): T = @@ -1599,6 +1736,10 @@ private constructor( visitor.visitConditional3dsAction(conditional3dsAction) conditionalAuthorizationAction != null -> visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) + conditionalAchAction != null -> + visitor.visitConditionalAchAction(conditionalAchAction) + conditionalTokenizationAction != null -> + visitor.visitConditionalTokenizationAction(conditionalTokenizationAction) else -> visitor.unknown(_json) } @@ -1638,6 +1779,18 @@ private constructor( ) { conditionalAuthorizationAction.validate() } + + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) { + conditionalAchAction.validate() + } + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) { + conditionalTokenizationAction.validate() + } } ) validated = true @@ -1680,6 +1833,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = conditionalAuthorizationAction.validity() + override fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ) = conditionalAchAction.validity() + + override fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = conditionalTokenizationAction.validity() + override fun unknown(json: JsonValue?) = 0 } ) @@ -1694,7 +1855,9 @@ private constructor( velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock && conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction + conditionalAuthorizationAction == other.conditionalAuthorizationAction && + conditionalAchAction == other.conditionalAchAction && + conditionalTokenizationAction == other.conditionalTokenizationAction } override fun hashCode(): Int = @@ -1704,6 +1867,8 @@ private constructor( merchantLock, conditional3dsAction, conditionalAuthorizationAction, + conditionalAchAction, + conditionalTokenizationAction, ) override fun toString(): String = @@ -1716,6 +1881,10 @@ private constructor( "Parameters{conditional3dsAction=$conditional3dsAction}" conditionalAuthorizationAction != null -> "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" + conditionalAchAction != null -> + "Parameters{conditionalAchAction=$conditionalAchAction}" + conditionalTokenizationAction != null -> + "Parameters{conditionalTokenizationAction=$conditionalTokenizationAction}" _json != null -> "Parameters{_unknown=$_json}" else -> throw IllegalStateException("Invalid Parameters") } @@ -1742,6 +1911,15 @@ private constructor( fun ofConditionalAuthorizationAction( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) + + @JvmStatic + fun ofConditionalAchAction(conditionalAchAction: ConditionalAchActionParameters) = + Parameters(conditionalAchAction = conditionalAchAction) + + @JvmStatic + fun ofConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ) = Parameters(conditionalTokenizationAction = conditionalTokenizationAction) } /** @@ -1764,6 +1942,14 @@ private constructor( conditionalAuthorizationAction: ConditionalAuthorizationActionParameters ): T + fun visitConditionalAchAction( + conditionalAchAction: ConditionalAchActionParameters + ): T + + fun visitConditionalTokenizationAction( + conditionalTokenizationAction: ConditionalTokenizationActionParameters + ): T + /** * Maps an unknown variant of [Parameters] to a value of type [T]. * @@ -1808,6 +1994,18 @@ private constructor( _json = json, ) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { Parameters(conditionalAchAction = it, _json = json) }, + tryDeserialize( + node, + jacksonTypeRef(), + ) + ?.let { + Parameters(conditionalTokenizationAction = it, _json = json) + }, ) .filterNotNull() .allMaxBy { it.validity() } @@ -1842,6 +2040,10 @@ private constructor( generator.writeObject(value.conditional3dsAction) value.conditionalAuthorizationAction != null -> generator.writeObject(value.conditionalAuthorizationAction) + value.conditionalAchAction != null -> + generator.writeObject(value.conditionalAchAction) + value.conditionalTokenizationAction != null -> + generator.writeObject(value.conditionalTokenizationAction) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid Parameters") } @@ -1890,6 +2092,12 @@ private constructor( @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") + @JvmField val TOKENIZATION = of("TOKENIZATION") + + @JvmField val ACH_CREDIT_RECEIPT = of("ACH_CREDIT_RECEIPT") + + @JvmField val ACH_DEBIT_RECEIPT = of("ACH_DEBIT_RECEIPT") + @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) } @@ -1897,6 +2105,9 @@ private constructor( enum class Known { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, } /** @@ -1911,6 +2122,9 @@ private constructor( enum class Value { AUTHORIZATION, THREE_DS_AUTHENTICATION, + TOKENIZATION, + ACH_CREDIT_RECEIPT, + ACH_DEBIT_RECEIPT, /** * An enum member indicating that [EventStream] was instantiated with an unknown value. */ @@ -1928,6 +2142,9 @@ private constructor( when (this) { AUTHORIZATION -> Value.AUTHORIZATION THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION + TOKENIZATION -> Value.TOKENIZATION + ACH_CREDIT_RECEIPT -> Value.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Value.ACH_DEBIT_RECEIPT else -> Value._UNKNOWN } @@ -1944,6 +2161,9 @@ private constructor( when (this) { AUTHORIZATION -> Known.AUTHORIZATION THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION + TOKENIZATION -> Known.TOKENIZATION + ACH_CREDIT_RECEIPT -> Known.ACH_CREDIT_RECEIPT + ACH_DEBIT_RECEIPT -> Known.ACH_DEBIT_RECEIPT else -> throw LithicInvalidDataException("Unknown EventStream: $value") } @@ -2136,7 +2356,8 @@ private constructor( * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. + * - `CONDITIONAL_ACTION`: AUTHORIZATION, THREE_DS_AUTHENTICATION, TOKENIZATION, + * ACH_CREDIT_RECEIPT, or ACH_DEBIT_RECEIPT event stream. */ class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : Enum { diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt index 1d22ad6fe..c8e21360f 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsync.kt @@ -5,11 +5,10 @@ package com.lithic.api.services.async import com.lithic.api.core.ClientOptions import com.lithic.api.core.RequestOptions import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.Dispute import com.lithic.api.models.DisputeCreateParams -import com.lithic.api.models.DisputeCreateResponse import com.lithic.api.models.DisputeDeleteEvidenceParams import com.lithic.api.models.DisputeDeleteParams -import com.lithic.api.models.DisputeDeleteResponse import com.lithic.api.models.DisputeEvidence import com.lithic.api.models.DisputeInitiateEvidenceUploadParams import com.lithic.api.models.DisputeListEvidencesPageAsync @@ -18,9 +17,7 @@ import com.lithic.api.models.DisputeListPageAsync import com.lithic.api.models.DisputeListParams import com.lithic.api.models.DisputeRetrieveEvidenceParams import com.lithic.api.models.DisputeRetrieveParams -import com.lithic.api.models.DisputeRetrieveResponse import com.lithic.api.models.DisputeUpdateParams -import com.lithic.api.models.DisputeUpdateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer @@ -39,17 +36,17 @@ interface DisputeServiceAsync { fun withOptions(modifier: Consumer): DisputeServiceAsync /** Initiate a dispute. */ - fun create(params: DisputeCreateParams): CompletableFuture = + fun create(params: DisputeCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see create */ fun create( params: DisputeCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** Get dispute. */ - fun retrieve(disputeToken: String): CompletableFuture = + fun retrieve(disputeToken: String): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none()) /** @see retrieve */ @@ -57,35 +54,31 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ fun retrieve( disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), - ): CompletableFuture = - retrieve(disputeToken, params, RequestOptions.none()) + ): CompletableFuture = retrieve(disputeToken, params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see retrieve */ - fun retrieve(params: DisputeRetrieveParams): CompletableFuture = + fun retrieve(params: DisputeRetrieveParams): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see retrieve */ - fun retrieve( - disputeToken: String, - requestOptions: RequestOptions, - ): CompletableFuture = + fun retrieve(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** Update dispute. Can only be modified if status is `NEW`. */ - fun update(disputeToken: String): CompletableFuture = + fun update(disputeToken: String): CompletableFuture = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -93,31 +86,27 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), - ): CompletableFuture = - update(disputeToken, params, RequestOptions.none()) + ): CompletableFuture = update(disputeToken, params, RequestOptions.none()) /** @see update */ fun update( params: DisputeUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see update */ - fun update(params: DisputeUpdateParams): CompletableFuture = + fun update(params: DisputeUpdateParams): CompletableFuture = update(params, RequestOptions.none()) /** @see update */ - fun update( - disputeToken: String, - requestOptions: RequestOptions, - ): CompletableFuture = + fun update(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = update(disputeToken, DisputeUpdateParams.none(), requestOptions) /** List disputes. */ @@ -139,7 +128,7 @@ interface DisputeServiceAsync { list(DisputeListParams.none(), requestOptions) /** Withdraw dispute. */ - fun delete(disputeToken: String): CompletableFuture = + fun delete(disputeToken: String): CompletableFuture = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -147,31 +136,27 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), - ): CompletableFuture = - delete(disputeToken, params, RequestOptions.none()) + ): CompletableFuture = delete(disputeToken, params, RequestOptions.none()) /** @see delete */ fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** @see delete */ - fun delete(params: DisputeDeleteParams): CompletableFuture = + fun delete(params: DisputeDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see delete */ - fun delete( - disputeToken: String, - requestOptions: RequestOptions, - ): CompletableFuture = + fun delete(disputeToken: String, requestOptions: RequestOptions): CompletableFuture = delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** @@ -336,24 +321,20 @@ interface DisputeServiceAsync { * Returns a raw HTTP response for `post /v1/disputes`, but is otherwise the same as * [DisputeServiceAsync.create]. */ - fun create( - params: DisputeCreateParams - ): CompletableFuture> = + fun create(params: DisputeCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see create */ fun create( params: DisputeCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** * Returns a raw HTTP response for `get /v1/disputes/{dispute_token}`, but is otherwise the * same as [DisputeServiceAsync.retrieve]. */ - fun retrieve( - disputeToken: String - ): CompletableFuture> = + fun retrieve(disputeToken: String): CompletableFuture> = retrieve(disputeToken, DisputeRetrieveParams.none()) /** @see retrieve */ @@ -361,42 +342,38 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ fun retrieve( disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), - ): CompletableFuture> = + ): CompletableFuture> = retrieve(disputeToken, params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see retrieve */ - fun retrieve( - params: DisputeRetrieveParams - ): CompletableFuture> = + fun retrieve(params: DisputeRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see retrieve */ fun retrieve( disputeToken: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** * Returns a raw HTTP response for `patch /v1/disputes/{dispute_token}`, but is otherwise * the same as [DisputeServiceAsync.update]. */ - fun update( - disputeToken: String - ): CompletableFuture> = + fun update(disputeToken: String): CompletableFuture> = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -404,33 +381,31 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), - ): CompletableFuture> = + ): CompletableFuture> = update(disputeToken, params, RequestOptions.none()) /** @see update */ fun update( params: DisputeUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see update */ - fun update( - params: DisputeUpdateParams - ): CompletableFuture> = + fun update(params: DisputeUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) /** @see update */ fun update( disputeToken: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = update(disputeToken, DisputeUpdateParams.none(), requestOptions) /** @@ -462,9 +437,7 @@ interface DisputeServiceAsync { * Returns a raw HTTP response for `delete /v1/disputes/{dispute_token}`, but is otherwise * the same as [DisputeServiceAsync.delete]. */ - fun delete( - disputeToken: String - ): CompletableFuture> = + fun delete(disputeToken: String): CompletableFuture> = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -472,33 +445,31 @@ interface DisputeServiceAsync { disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = + ): CompletableFuture> = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), - ): CompletableFuture> = + ): CompletableFuture> = delete(disputeToken, params, RequestOptions.none()) /** @see delete */ fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> + ): CompletableFuture> /** @see delete */ - fun delete( - params: DisputeDeleteParams - ): CompletableFuture> = + fun delete(params: DisputeDeleteParams): CompletableFuture> = delete(params, RequestOptions.none()) /** @see delete */ fun delete( disputeToken: String, requestOptions: RequestOptions, - ): CompletableFuture> = + ): CompletableFuture> = delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt index b3d8c2fa7..2150207e3 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt @@ -20,11 +20,10 @@ import com.lithic.api.core.http.multipartFormData import com.lithic.api.core.http.parseable import com.lithic.api.core.prepareAsync import com.lithic.api.errors.LithicInvalidDataException +import com.lithic.api.models.Dispute import com.lithic.api.models.DisputeCreateParams -import com.lithic.api.models.DisputeCreateResponse import com.lithic.api.models.DisputeDeleteEvidenceParams import com.lithic.api.models.DisputeDeleteParams -import com.lithic.api.models.DisputeDeleteResponse import com.lithic.api.models.DisputeEvidence import com.lithic.api.models.DisputeInitiateEvidenceUploadParams import com.lithic.api.models.DisputeListEvidencesPageAsync @@ -35,9 +34,7 @@ import com.lithic.api.models.DisputeListPageResponse import com.lithic.api.models.DisputeListParams import com.lithic.api.models.DisputeRetrieveEvidenceParams import com.lithic.api.models.DisputeRetrieveParams -import com.lithic.api.models.DisputeRetrieveResponse import com.lithic.api.models.DisputeUpdateParams -import com.lithic.api.models.DisputeUpdateResponse import java.util.concurrent.CompletableFuture import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -57,21 +54,21 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun create( params: DisputeCreateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // post /v1/disputes withRawResponse().create(params, requestOptions).thenApply { it.parse() } override fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /v1/disputes/{dispute_token} withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } override fun update( params: DisputeUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // patch /v1/disputes/{dispute_token} withRawResponse().update(params, requestOptions).thenApply { it.parse() } @@ -85,7 +82,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // delete /v1/disputes/{dispute_token} withRawResponse().delete(params, requestOptions).thenApply { it.parse() } @@ -130,13 +127,12 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun create( params: DisputeCreateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -161,13 +157,13 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) @@ -194,13 +190,12 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun update( params: DisputeUpdateParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) @@ -266,13 +261,12 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions, - ): CompletableFuture> { + ): CompletableFuture> { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsync.kt new file mode 100644 index 000000000..c3d6d089a --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsync.kt @@ -0,0 +1,162 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.DisputeV2 +import com.lithic.api.models.DisputesV2ListPageAsync +import com.lithic.api.models.DisputesV2ListParams +import com.lithic.api.models.DisputesV2RetrieveParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface DisputesV2ServiceAsync { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DisputesV2ServiceAsync + + /** Retrieves a specific dispute by its token. */ + fun retrieve(disputeToken: String): CompletableFuture = + retrieve(disputeToken, DisputesV2RetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + ): CompletableFuture = retrieve(disputeToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see retrieve */ + fun retrieve(params: DisputesV2RetrieveParams): CompletableFuture = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + retrieve(disputeToken, DisputesV2RetrieveParams.none(), requestOptions) + + /** Returns a paginated list of disputes. */ + fun list(): CompletableFuture = list(DisputesV2ListParams.none()) + + /** @see list */ + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see list */ + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none() + ): CompletableFuture = list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): CompletableFuture = + list(DisputesV2ListParams.none(), requestOptions) + + /** + * A view of [DisputesV2ServiceAsync] that provides access to raw HTTP responses for each + * method. + */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DisputesV2ServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `get /v2/disputes/{dispute_token}`, but is otherwise the + * same as [DisputesV2ServiceAsync.retrieve]. + */ + fun retrieve(disputeToken: String): CompletableFuture> = + retrieve(disputeToken, DisputesV2RetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + ): CompletableFuture> = + retrieve(disputeToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see retrieve */ + fun retrieve( + params: DisputesV2RetrieveParams + ): CompletableFuture> = retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + retrieve(disputeToken, DisputesV2RetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v2/disputes`, but is otherwise the same as + * [DisputesV2ServiceAsync.list]. + */ + fun list(): CompletableFuture> = + list(DisputesV2ListParams.none()) + + /** @see list */ + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see list */ + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none() + ): CompletableFuture> = + list(params, RequestOptions.none()) + + /** @see list */ + fun list( + requestOptions: RequestOptions + ): CompletableFuture> = + list(DisputesV2ListParams.none(), requestOptions) + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncImpl.kt new file mode 100644 index 000000000..875ab7d0d --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncImpl.kt @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorBodyHandler +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +import com.lithic.api.core.http.HttpResponse +import com.lithic.api.core.http.HttpResponse.Handler +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.core.http.parseable +import com.lithic.api.core.prepareAsync +import com.lithic.api.models.DisputeV2 +import com.lithic.api.models.DisputesV2ListPageAsync +import com.lithic.api.models.DisputesV2ListPageResponse +import com.lithic.api.models.DisputesV2ListParams +import com.lithic.api.models.DisputesV2RetrieveParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class DisputesV2ServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : + DisputesV2ServiceAsync { + + private val withRawResponse: DisputesV2ServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DisputesV2ServiceAsync.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DisputesV2ServiceAsync = + DisputesV2ServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v2/disputes/{dispute_token} + withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + + override fun list( + params: DisputesV2ListParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // get /v2/disputes + withRawResponse().list(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DisputesV2ServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DisputesV2ServiceAsync.WithRawResponse = + DisputesV2ServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("disputeToken", params.disputeToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "disputes", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: DisputesV2ListParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "disputes") + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + DisputesV2ListPageAsync.builder() + .service(DisputesV2ServiceAsyncImpl(clientOptions)) + .streamHandlerExecutor(clientOptions.streamHandlerExecutor) + .params(params) + .response(it) + .build() + } + } + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsync.kt index bd470953b..b014de4b9 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsync.kt @@ -15,6 +15,8 @@ import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsParams import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsResponse import com.lithic.api.models.ExternalBankAccountRetryPrenoteParams import com.lithic.api.models.ExternalBankAccountRetryPrenoteResponse +import com.lithic.api.models.ExternalBankAccountUnpauseParams +import com.lithic.api.models.ExternalBankAccountUnpauseResponse import com.lithic.api.models.ExternalBankAccountUpdateParams import com.lithic.api.models.ExternalBankAccountUpdateResponse import com.lithic.api.services.async.externalBankAccounts.MicroDepositServiceAsync @@ -262,6 +264,49 @@ interface ExternalBankAccountServiceAsync { requestOptions, ) + /** Unpause an external bank account */ + fun unpause( + externalBankAccountToken: String + ): CompletableFuture = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + unpause( + params.toBuilder().externalBankAccountToken(externalBankAccountToken).build(), + requestOptions, + ) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + ): CompletableFuture = + unpause(externalBankAccountToken, params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** @see unpause */ + fun unpause( + params: ExternalBankAccountUnpauseParams + ): CompletableFuture = + unpause(params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + requestOptions: RequestOptions, + ): CompletableFuture = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none(), requestOptions) + /** * A view of [ExternalBankAccountServiceAsync] that provides access to raw HTTP responses for * each method. @@ -535,5 +580,56 @@ interface ExternalBankAccountServiceAsync { ExternalBankAccountRetryPrenoteParams.none(), requestOptions, ) + + /** + * Returns a raw HTTP response for `post + * /v1/external_bank_accounts/{external_bank_account_token}/unpause`, but is otherwise the + * same as [ExternalBankAccountServiceAsync.unpause]. + */ + fun unpause( + externalBankAccountToken: String + ): CompletableFuture> = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + unpause( + params.toBuilder().externalBankAccountToken(externalBankAccountToken).build(), + requestOptions, + ) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + ): CompletableFuture> = + unpause(externalBankAccountToken, params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + + /** @see unpause */ + fun unpause( + params: ExternalBankAccountUnpauseParams + ): CompletableFuture> = + unpause(params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + requestOptions: RequestOptions, + ): CompletableFuture> = + unpause( + externalBankAccountToken, + ExternalBankAccountUnpauseParams.none(), + requestOptions, + ) } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt index 8d0e8a75c..2fe1f632c 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt @@ -27,6 +27,8 @@ import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsParams import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsResponse import com.lithic.api.models.ExternalBankAccountRetryPrenoteParams import com.lithic.api.models.ExternalBankAccountRetryPrenoteResponse +import com.lithic.api.models.ExternalBankAccountUnpauseParams +import com.lithic.api.models.ExternalBankAccountUnpauseResponse import com.lithic.api.models.ExternalBankAccountUpdateParams import com.lithic.api.models.ExternalBankAccountUpdateResponse import com.lithic.api.services.async.externalBankAccounts.MicroDepositServiceAsync @@ -100,6 +102,13 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc // post /v1/external_bank_accounts/{external_bank_account_token}/retry_prenote withRawResponse().retryPrenote(params, requestOptions).thenApply { it.parse() } + override fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/external_bank_accounts/{external_bank_account_token}/unpause + withRawResponse().unpause(params, requestOptions).thenApply { it.parse() } + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ExternalBankAccountServiceAsync.WithRawResponse { @@ -333,5 +342,44 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc } } } + + private val unpauseHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalBankAccountToken", params.externalBankAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "external_bank_accounts", + params._pathParam(0), + "unpause", + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { unpauseHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt index c4f022604..8ec1ec651 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsync.kt @@ -13,6 +13,8 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentReturnParams +import com.lithic.api.models.PaymentReturnResponse import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateActionResponse import com.lithic.api.models.PaymentSimulateReceiptParams @@ -133,6 +135,45 @@ interface PaymentServiceAsync { ): CompletableFuture = retry(paymentToken, PaymentRetryParams.none(), requestOptions) + /** + * Return an ACH payment with a specified return reason code. Returns must be initiated within + * the time window specified by NACHA rules for each return code (typically 2 banking days for + * most codes, 60 calendar days for unauthorized debits). For a complete list of return codes + * and their meanings, see the + * [ACH Return Reasons documentation](https://docs.lithic.com/docs/ach-overview#ach-return-reasons). + * + * Note: + * * This endpoint does not modify the state of the financial account associated with the + * payment. If you would like to change the account state, use the + * [Update financial account status](https://docs.lithic.com/reference/updatefinancialaccountstatus) + * endpoint. + * * By default this endpoint is not enabled for your account. Please contact your + * implementations manager to enable this feature. + */ + fun return_( + paymentToken: String, + params: PaymentReturnParams, + ): CompletableFuture = + return_(paymentToken, params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + paymentToken: String, + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture = + return_(params.toBuilder().paymentToken(paymentToken).build(), requestOptions) + + /** @see return_ */ + fun return_(params: PaymentReturnParams): CompletableFuture = + return_(params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + /** Simulate payment lifecycle event */ fun simulateAction( paymentToken: String, @@ -330,6 +371,36 @@ interface PaymentServiceAsync { ): CompletableFuture> = retry(paymentToken, PaymentRetryParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `post /v1/payments/{payment_token}/return`, but is + * otherwise the same as [PaymentServiceAsync.return_]. + */ + fun return_( + paymentToken: String, + params: PaymentReturnParams, + ): CompletableFuture> = + return_(paymentToken, params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + paymentToken: String, + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> = + return_(params.toBuilder().paymentToken(paymentToken).build(), requestOptions) + + /** @see return_ */ + fun return_( + params: PaymentReturnParams + ): CompletableFuture> = + return_(params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + /** * Returns a raw HTTP response for `post /v1/simulate/payments/{payment_token}/action`, but * is otherwise the same as [PaymentServiceAsync.simulateAction]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt index 4202c3781..2806dbab2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/PaymentServiceAsyncImpl.kt @@ -25,6 +25,8 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentReturnParams +import com.lithic.api.models.PaymentReturnResponse import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateActionResponse import com.lithic.api.models.PaymentSimulateReceiptParams @@ -77,6 +79,13 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl // post /v1/payments/{payment_token}/retry withRawResponse().retry(params, requestOptions).thenApply { it.parse() } + override fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /v1/payments/{payment_token}/return + withRawResponse().return_(params, requestOptions).thenApply { it.parse() } + override fun simulateAction( params: PaymentSimulateActionParams, requestOptions: RequestOptions, @@ -254,6 +263,40 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl } } + private val returnHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("paymentToken", params.paymentToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "payments", params._pathParam(0), "return") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + errorHandler.handle(response).parseable { + response + .use { returnHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + } + private val simulateActionHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt index 8b059bc40..6a3513de8 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeService.kt @@ -6,11 +6,10 @@ import com.google.errorprone.annotations.MustBeClosed import com.lithic.api.core.ClientOptions import com.lithic.api.core.RequestOptions import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.Dispute import com.lithic.api.models.DisputeCreateParams -import com.lithic.api.models.DisputeCreateResponse import com.lithic.api.models.DisputeDeleteEvidenceParams import com.lithic.api.models.DisputeDeleteParams -import com.lithic.api.models.DisputeDeleteResponse import com.lithic.api.models.DisputeEvidence import com.lithic.api.models.DisputeInitiateEvidenceUploadParams import com.lithic.api.models.DisputeListEvidencesPage @@ -19,9 +18,7 @@ import com.lithic.api.models.DisputeListPage import com.lithic.api.models.DisputeListParams import com.lithic.api.models.DisputeRetrieveEvidenceParams import com.lithic.api.models.DisputeRetrieveParams -import com.lithic.api.models.DisputeRetrieveResponse import com.lithic.api.models.DisputeUpdateParams -import com.lithic.api.models.DisputeUpdateResponse import java.util.function.Consumer interface DisputeService { @@ -39,17 +36,16 @@ interface DisputeService { fun withOptions(modifier: Consumer): DisputeService /** Initiate a dispute. */ - fun create(params: DisputeCreateParams): DisputeCreateResponse = - create(params, RequestOptions.none()) + fun create(params: DisputeCreateParams): Dispute = create(params, RequestOptions.none()) /** @see create */ fun create( params: DisputeCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeCreateResponse + ): Dispute /** Get dispute. */ - fun retrieve(disputeToken: String): DisputeRetrieveResponse = + fun retrieve(disputeToken: String): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none()) /** @see retrieve */ @@ -57,59 +53,54 @@ interface DisputeService { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeRetrieveResponse = - retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): Dispute = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ fun retrieve( disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), - ): DisputeRetrieveResponse = retrieve(disputeToken, params, RequestOptions.none()) + ): Dispute = retrieve(disputeToken, params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeRetrieveResponse + ): Dispute /** @see retrieve */ - fun retrieve(params: DisputeRetrieveParams): DisputeRetrieveResponse = - retrieve(params, RequestOptions.none()) + fun retrieve(params: DisputeRetrieveParams): Dispute = retrieve(params, RequestOptions.none()) /** @see retrieve */ - fun retrieve(disputeToken: String, requestOptions: RequestOptions): DisputeRetrieveResponse = + fun retrieve(disputeToken: String, requestOptions: RequestOptions): Dispute = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** Update dispute. Can only be modified if status is `NEW`. */ - fun update(disputeToken: String): DisputeUpdateResponse = - update(disputeToken, DisputeUpdateParams.none()) + fun update(disputeToken: String): Dispute = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeUpdateResponse = - update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): Dispute = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), - ): DisputeUpdateResponse = update(disputeToken, params, RequestOptions.none()) + ): Dispute = update(disputeToken, params, RequestOptions.none()) /** @see update */ fun update( params: DisputeUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeUpdateResponse + ): Dispute /** @see update */ - fun update(params: DisputeUpdateParams): DisputeUpdateResponse = - update(params, RequestOptions.none()) + fun update(params: DisputeUpdateParams): Dispute = update(params, RequestOptions.none()) /** @see update */ - fun update(disputeToken: String, requestOptions: RequestOptions): DisputeUpdateResponse = + fun update(disputeToken: String, requestOptions: RequestOptions): Dispute = update(disputeToken, DisputeUpdateParams.none(), requestOptions) /** List disputes. */ @@ -130,35 +121,32 @@ interface DisputeService { list(DisputeListParams.none(), requestOptions) /** Withdraw dispute. */ - fun delete(disputeToken: String): DisputeDeleteResponse = - delete(disputeToken, DisputeDeleteParams.none()) + fun delete(disputeToken: String): Dispute = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeDeleteResponse = - delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): Dispute = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), - ): DisputeDeleteResponse = delete(disputeToken, params, RequestOptions.none()) + ): Dispute = delete(disputeToken, params, RequestOptions.none()) /** @see delete */ fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), - ): DisputeDeleteResponse + ): Dispute /** @see delete */ - fun delete(params: DisputeDeleteParams): DisputeDeleteResponse = - delete(params, RequestOptions.none()) + fun delete(params: DisputeDeleteParams): Dispute = delete(params, RequestOptions.none()) /** @see delete */ - fun delete(disputeToken: String, requestOptions: RequestOptions): DisputeDeleteResponse = + fun delete(disputeToken: String, requestOptions: RequestOptions): Dispute = delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** @@ -312,7 +300,7 @@ interface DisputeService { * [DisputeService.create]. */ @MustBeClosed - fun create(params: DisputeCreateParams): HttpResponseFor = + fun create(params: DisputeCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ @@ -320,14 +308,14 @@ interface DisputeService { fun create( params: DisputeCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** * Returns a raw HTTP response for `get /v1/disputes/{dispute_token}`, but is otherwise the * same as [DisputeService.retrieve]. */ @MustBeClosed - fun retrieve(disputeToken: String): HttpResponseFor = + fun retrieve(disputeToken: String): HttpResponseFor = retrieve(disputeToken, DisputeRetrieveParams.none()) /** @see retrieve */ @@ -336,7 +324,7 @@ interface DisputeService { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ @@ -344,19 +332,18 @@ interface DisputeService { fun retrieve( disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), - ): HttpResponseFor = - retrieve(disputeToken, params, RequestOptions.none()) + ): HttpResponseFor = retrieve(disputeToken, params, RequestOptions.none()) /** @see retrieve */ @MustBeClosed fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see retrieve */ @MustBeClosed - fun retrieve(params: DisputeRetrieveParams): HttpResponseFor = + fun retrieve(params: DisputeRetrieveParams): HttpResponseFor = retrieve(params, RequestOptions.none()) /** @see retrieve */ @@ -364,7 +351,7 @@ interface DisputeService { fun retrieve( disputeToken: String, requestOptions: RequestOptions, - ): HttpResponseFor = + ): HttpResponseFor = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** @@ -372,7 +359,7 @@ interface DisputeService { * the same as [DisputeService.update]. */ @MustBeClosed - fun update(disputeToken: String): HttpResponseFor = + fun update(disputeToken: String): HttpResponseFor = update(disputeToken, DisputeUpdateParams.none()) /** @see update */ @@ -381,7 +368,7 @@ interface DisputeService { disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ @@ -389,27 +376,23 @@ interface DisputeService { fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), - ): HttpResponseFor = - update(disputeToken, params, RequestOptions.none()) + ): HttpResponseFor = update(disputeToken, params, RequestOptions.none()) /** @see update */ @MustBeClosed fun update( params: DisputeUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see update */ @MustBeClosed - fun update(params: DisputeUpdateParams): HttpResponseFor = + fun update(params: DisputeUpdateParams): HttpResponseFor = update(params, RequestOptions.none()) /** @see update */ @MustBeClosed - fun update( - disputeToken: String, - requestOptions: RequestOptions, - ): HttpResponseFor = + fun update(disputeToken: String, requestOptions: RequestOptions): HttpResponseFor = update(disputeToken, DisputeUpdateParams.none(), requestOptions) /** @@ -441,7 +424,7 @@ interface DisputeService { * the same as [DisputeService.delete]. */ @MustBeClosed - fun delete(disputeToken: String): HttpResponseFor = + fun delete(disputeToken: String): HttpResponseFor = delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ @@ -450,7 +433,7 @@ interface DisputeService { disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ @@ -458,27 +441,23 @@ interface DisputeService { fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), - ): HttpResponseFor = - delete(disputeToken, params, RequestOptions.none()) + ): HttpResponseFor = delete(disputeToken, params, RequestOptions.none()) /** @see delete */ @MustBeClosed fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor + ): HttpResponseFor /** @see delete */ @MustBeClosed - fun delete(params: DisputeDeleteParams): HttpResponseFor = + fun delete(params: DisputeDeleteParams): HttpResponseFor = delete(params, RequestOptions.none()) /** @see delete */ @MustBeClosed - fun delete( - disputeToken: String, - requestOptions: RequestOptions, - ): HttpResponseFor = + fun delete(disputeToken: String, requestOptions: RequestOptions): HttpResponseFor = delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeServiceImpl.kt index 6064587da..47cb54392 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputeServiceImpl.kt @@ -20,11 +20,10 @@ import com.lithic.api.core.http.multipartFormData import com.lithic.api.core.http.parseable import com.lithic.api.core.prepare import com.lithic.api.errors.LithicInvalidDataException +import com.lithic.api.models.Dispute import com.lithic.api.models.DisputeCreateParams -import com.lithic.api.models.DisputeCreateResponse import com.lithic.api.models.DisputeDeleteEvidenceParams import com.lithic.api.models.DisputeDeleteParams -import com.lithic.api.models.DisputeDeleteResponse import com.lithic.api.models.DisputeEvidence import com.lithic.api.models.DisputeInitiateEvidenceUploadParams import com.lithic.api.models.DisputeListEvidencesPage @@ -35,9 +34,7 @@ import com.lithic.api.models.DisputeListPageResponse import com.lithic.api.models.DisputeListParams import com.lithic.api.models.DisputeRetrieveEvidenceParams import com.lithic.api.models.DisputeRetrieveParams -import com.lithic.api.models.DisputeRetrieveResponse import com.lithic.api.models.DisputeUpdateParams -import com.lithic.api.models.DisputeUpdateResponse import java.util.function.Consumer import kotlin.jvm.optionals.getOrNull @@ -53,24 +50,15 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO override fun withOptions(modifier: Consumer): DisputeService = DisputeServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: DisputeCreateParams, - requestOptions: RequestOptions, - ): DisputeCreateResponse = + override fun create(params: DisputeCreateParams, requestOptions: RequestOptions): Dispute = // post /v1/disputes withRawResponse().create(params, requestOptions).parse() - override fun retrieve( - params: DisputeRetrieveParams, - requestOptions: RequestOptions, - ): DisputeRetrieveResponse = + override fun retrieve(params: DisputeRetrieveParams, requestOptions: RequestOptions): Dispute = // get /v1/disputes/{dispute_token} withRawResponse().retrieve(params, requestOptions).parse() - override fun update( - params: DisputeUpdateParams, - requestOptions: RequestOptions, - ): DisputeUpdateResponse = + override fun update(params: DisputeUpdateParams, requestOptions: RequestOptions): Dispute = // patch /v1/disputes/{dispute_token} withRawResponse().update(params, requestOptions).parse() @@ -78,10 +66,7 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO // get /v1/disputes withRawResponse().list(params, requestOptions).parse() - override fun delete( - params: DisputeDeleteParams, - requestOptions: RequestOptions, - ): DisputeDeleteResponse = + override fun delete(params: DisputeDeleteParams, requestOptions: RequestOptions): Dispute = // delete /v1/disputes/{dispute_token} withRawResponse().delete(params, requestOptions).parse() @@ -126,13 +111,12 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO clientOptions.toBuilder().apply(modifier::accept).build() ) - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun create( params: DisputeCreateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -154,13 +138,13 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) override fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) @@ -184,13 +168,12 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun update( params: DisputeUpdateParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) @@ -249,13 +232,12 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper) + private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper) override fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions, - ): HttpResponseFor { + ): HttpResponseFor { // We check here instead of in the params builder because this can be specified // positionally or in the params class. checkRequired("disputeToken", params.disputeToken().getOrNull()) diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2Service.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2Service.kt new file mode 100644 index 000000000..d8017f679 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2Service.kt @@ -0,0 +1,158 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.google.errorprone.annotations.MustBeClosed +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.models.DisputeV2 +import com.lithic.api.models.DisputesV2ListPage +import com.lithic.api.models.DisputesV2ListParams +import com.lithic.api.models.DisputesV2RetrieveParams +import java.util.function.Consumer + +interface DisputesV2Service { + + /** + * Returns a view of this service that provides access to raw HTTP responses for each method. + */ + fun withRawResponse(): WithRawResponse + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions(modifier: Consumer): DisputesV2Service + + /** Retrieves a specific dispute by its token. */ + fun retrieve(disputeToken: String): DisputeV2 = + retrieve(disputeToken, DisputesV2RetrieveParams.none()) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DisputeV2 = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + + /** @see retrieve */ + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + ): DisputeV2 = retrieve(disputeToken, params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): DisputeV2 + + /** @see retrieve */ + fun retrieve(params: DisputesV2RetrieveParams): DisputeV2 = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + fun retrieve(disputeToken: String, requestOptions: RequestOptions): DisputeV2 = + retrieve(disputeToken, DisputesV2RetrieveParams.none(), requestOptions) + + /** Returns a paginated list of disputes. */ + fun list(): DisputesV2ListPage = list(DisputesV2ListParams.none()) + + /** @see list */ + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): DisputesV2ListPage + + /** @see list */ + fun list(params: DisputesV2ListParams = DisputesV2ListParams.none()): DisputesV2ListPage = + list(params, RequestOptions.none()) + + /** @see list */ + fun list(requestOptions: RequestOptions): DisputesV2ListPage = + list(DisputesV2ListParams.none(), requestOptions) + + /** A view of [DisputesV2Service] that provides access to raw HTTP responses for each method. */ + interface WithRawResponse { + + /** + * Returns a view of this service with the given option modifications applied. + * + * The original service is not modified. + */ + fun withOptions( + modifier: Consumer + ): DisputesV2Service.WithRawResponse + + /** + * Returns a raw HTTP response for `get /v2/disputes/{dispute_token}`, but is otherwise the + * same as [DisputesV2Service.retrieve]. + */ + @MustBeClosed + fun retrieve(disputeToken: String): HttpResponseFor = + retrieve(disputeToken, DisputesV2RetrieveParams.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + disputeToken: String, + params: DisputesV2RetrieveParams = DisputesV2RetrieveParams.none(), + ): HttpResponseFor = retrieve(disputeToken, params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see retrieve */ + @MustBeClosed + fun retrieve(params: DisputesV2RetrieveParams): HttpResponseFor = + retrieve(params, RequestOptions.none()) + + /** @see retrieve */ + @MustBeClosed + fun retrieve( + disputeToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + retrieve(disputeToken, DisputesV2RetrieveParams.none(), requestOptions) + + /** + * Returns a raw HTTP response for `get /v2/disputes`, but is otherwise the same as + * [DisputesV2Service.list]. + */ + @MustBeClosed + fun list(): HttpResponseFor = list(DisputesV2ListParams.none()) + + /** @see list */ + @MustBeClosed + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see list */ + @MustBeClosed + fun list( + params: DisputesV2ListParams = DisputesV2ListParams.none() + ): HttpResponseFor = list(params, RequestOptions.none()) + + /** @see list */ + @MustBeClosed + fun list(requestOptions: RequestOptions): HttpResponseFor = + list(DisputesV2ListParams.none(), requestOptions) + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceImpl.kt new file mode 100644 index 000000000..4f294e8f8 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceImpl.kt @@ -0,0 +1,129 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.core.ClientOptions +import com.lithic.api.core.RequestOptions +import com.lithic.api.core.checkRequired +import com.lithic.api.core.handlers.errorBodyHandler +import com.lithic.api.core.handlers.errorHandler +import com.lithic.api.core.handlers.jsonHandler +import com.lithic.api.core.http.HttpMethod +import com.lithic.api.core.http.HttpRequest +import com.lithic.api.core.http.HttpResponse +import com.lithic.api.core.http.HttpResponse.Handler +import com.lithic.api.core.http.HttpResponseFor +import com.lithic.api.core.http.parseable +import com.lithic.api.core.prepare +import com.lithic.api.models.DisputeV2 +import com.lithic.api.models.DisputesV2ListPage +import com.lithic.api.models.DisputesV2ListPageResponse +import com.lithic.api.models.DisputesV2ListParams +import com.lithic.api.models.DisputesV2RetrieveParams +import java.util.function.Consumer +import kotlin.jvm.optionals.getOrNull + +class DisputesV2ServiceImpl internal constructor(private val clientOptions: ClientOptions) : + DisputesV2Service { + + private val withRawResponse: DisputesV2Service.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): DisputesV2Service.WithRawResponse = withRawResponse + + override fun withOptions(modifier: Consumer): DisputesV2Service = + DisputesV2ServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions, + ): DisputeV2 = + // get /v2/disputes/{dispute_token} + withRawResponse().retrieve(params, requestOptions).parse() + + override fun list( + params: DisputesV2ListParams, + requestOptions: RequestOptions, + ): DisputesV2ListPage = + // get /v2/disputes + withRawResponse().list(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + DisputesV2Service.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): DisputesV2Service.WithRawResponse = + DisputesV2ServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun retrieve( + params: DisputesV2RetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("disputeToken", params.disputeToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "disputes", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { retrieveHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + + private val listHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun list( + params: DisputesV2ListParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v2", "disputes") + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { listHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + .let { + DisputesV2ListPage.builder() + .service(DisputesV2ServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() + } + } + } + } +} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountService.kt index 9d2176645..641e0eeef 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountService.kt @@ -16,6 +16,8 @@ import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsParams import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsResponse import com.lithic.api.models.ExternalBankAccountRetryPrenoteParams import com.lithic.api.models.ExternalBankAccountRetryPrenoteResponse +import com.lithic.api.models.ExternalBankAccountUnpauseParams +import com.lithic.api.models.ExternalBankAccountUnpauseResponse import com.lithic.api.models.ExternalBankAccountUpdateParams import com.lithic.api.models.ExternalBankAccountUpdateResponse import com.lithic.api.services.blocking.externalBankAccounts.MicroDepositService @@ -248,6 +250,45 @@ interface ExternalBankAccountService { requestOptions, ) + /** Unpause an external bank account */ + fun unpause(externalBankAccountToken: String): ExternalBankAccountUnpauseResponse = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): ExternalBankAccountUnpauseResponse = + unpause( + params.toBuilder().externalBankAccountToken(externalBankAccountToken).build(), + requestOptions, + ) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + ): ExternalBankAccountUnpauseResponse = + unpause(externalBankAccountToken, params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): ExternalBankAccountUnpauseResponse + + /** @see unpause */ + fun unpause(params: ExternalBankAccountUnpauseParams): ExternalBankAccountUnpauseResponse = + unpause(params, RequestOptions.none()) + + /** @see unpause */ + fun unpause( + externalBankAccountToken: String, + requestOptions: RequestOptions, + ): ExternalBankAccountUnpauseResponse = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none(), requestOptions) + /** * A view of [ExternalBankAccountService] that provides access to raw HTTP responses for each * method. @@ -550,5 +591,62 @@ interface ExternalBankAccountService { ExternalBankAccountRetryPrenoteParams.none(), requestOptions, ) + + /** + * Returns a raw HTTP response for `post + * /v1/external_bank_accounts/{external_bank_account_token}/unpause`, but is otherwise the + * same as [ExternalBankAccountService.unpause]. + */ + @MustBeClosed + fun unpause( + externalBankAccountToken: String + ): HttpResponseFor = + unpause(externalBankAccountToken, ExternalBankAccountUnpauseParams.none()) + + /** @see unpause */ + @MustBeClosed + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + unpause( + params.toBuilder().externalBankAccountToken(externalBankAccountToken).build(), + requestOptions, + ) + + /** @see unpause */ + @MustBeClosed + fun unpause( + externalBankAccountToken: String, + params: ExternalBankAccountUnpauseParams = ExternalBankAccountUnpauseParams.none(), + ): HttpResponseFor = + unpause(externalBankAccountToken, params, RequestOptions.none()) + + /** @see unpause */ + @MustBeClosed + fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + + /** @see unpause */ + @MustBeClosed + fun unpause( + params: ExternalBankAccountUnpauseParams + ): HttpResponseFor = + unpause(params, RequestOptions.none()) + + /** @see unpause */ + @MustBeClosed + fun unpause( + externalBankAccountToken: String, + requestOptions: RequestOptions, + ): HttpResponseFor = + unpause( + externalBankAccountToken, + ExternalBankAccountUnpauseParams.none(), + requestOptions, + ) } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceImpl.kt index 4e560015f..5309aba3d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceImpl.kt @@ -27,6 +27,8 @@ import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsParams import com.lithic.api.models.ExternalBankAccountRetryMicroDepositsResponse import com.lithic.api.models.ExternalBankAccountRetryPrenoteParams import com.lithic.api.models.ExternalBankAccountRetryPrenoteResponse +import com.lithic.api.models.ExternalBankAccountUnpauseParams +import com.lithic.api.models.ExternalBankAccountUnpauseResponse import com.lithic.api.models.ExternalBankAccountUpdateParams import com.lithic.api.models.ExternalBankAccountUpdateResponse import com.lithic.api.services.blocking.externalBankAccounts.MicroDepositService @@ -96,6 +98,13 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc // post /v1/external_bank_accounts/{external_bank_account_token}/retry_prenote withRawResponse().retryPrenote(params, requestOptions).parse() + override fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions, + ): ExternalBankAccountUnpauseResponse = + // post /v1/external_bank_accounts/{external_bank_account_token}/unpause + withRawResponse().unpause(params, requestOptions).parse() + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ExternalBankAccountService.WithRawResponse { @@ -310,5 +319,41 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc } } } + + private val unpauseHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun unpause( + params: ExternalBankAccountUnpauseParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("externalBankAccountToken", params.externalBankAccountToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments( + "v1", + "external_bank_accounts", + params._pathParam(0), + "unpause", + ) + .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { unpauseHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt index 27d8f93b5..a6660e8f4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentService.kt @@ -14,6 +14,8 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentReturnParams +import com.lithic.api.models.PaymentReturnResponse import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateActionResponse import com.lithic.api.models.PaymentSimulateReceiptParams @@ -127,6 +129,42 @@ interface PaymentService { fun retry(paymentToken: String, requestOptions: RequestOptions): PaymentRetryResponse = retry(paymentToken, PaymentRetryParams.none(), requestOptions) + /** + * Return an ACH payment with a specified return reason code. Returns must be initiated within + * the time window specified by NACHA rules for each return code (typically 2 banking days for + * most codes, 60 calendar days for unauthorized debits). For a complete list of return codes + * and their meanings, see the + * [ACH Return Reasons documentation](https://docs.lithic.com/docs/ach-overview#ach-return-reasons). + * + * Note: + * * This endpoint does not modify the state of the financial account associated with the + * payment. If you would like to change the account state, use the + * [Update financial account status](https://docs.lithic.com/reference/updatefinancialaccountstatus) + * endpoint. + * * By default this endpoint is not enabled for your account. Please contact your + * implementations manager to enable this feature. + */ + fun return_(paymentToken: String, params: PaymentReturnParams): PaymentReturnResponse = + return_(paymentToken, params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + paymentToken: String, + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PaymentReturnResponse = + return_(params.toBuilder().paymentToken(paymentToken).build(), requestOptions) + + /** @see return_ */ + fun return_(params: PaymentReturnParams): PaymentReturnResponse = + return_(params, RequestOptions.none()) + + /** @see return_ */ + fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): PaymentReturnResponse + /** Simulate payment lifecycle event */ fun simulateAction( paymentToken: String, @@ -319,6 +357,38 @@ interface PaymentService { ): HttpResponseFor = retry(paymentToken, PaymentRetryParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `post /v1/payments/{payment_token}/return`, but is + * otherwise the same as [PaymentService.return_]. + */ + @MustBeClosed + fun return_( + paymentToken: String, + params: PaymentReturnParams, + ): HttpResponseFor = + return_(paymentToken, params, RequestOptions.none()) + + /** @see return_ */ + @MustBeClosed + fun return_( + paymentToken: String, + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor = + return_(params.toBuilder().paymentToken(paymentToken).build(), requestOptions) + + /** @see return_ */ + @MustBeClosed + fun return_(params: PaymentReturnParams): HttpResponseFor = + return_(params, RequestOptions.none()) + + /** @see return_ */ + @MustBeClosed + fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + /** * Returns a raw HTTP response for `post /v1/simulate/payments/{payment_token}/action`, but * is otherwise the same as [PaymentService.simulateAction]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt index 54bc1ca65..e204ed271 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/PaymentServiceImpl.kt @@ -25,6 +25,8 @@ import com.lithic.api.models.PaymentListParams import com.lithic.api.models.PaymentRetrieveParams import com.lithic.api.models.PaymentRetryParams import com.lithic.api.models.PaymentRetryResponse +import com.lithic.api.models.PaymentReturnParams +import com.lithic.api.models.PaymentReturnResponse import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateActionResponse import com.lithic.api.models.PaymentSimulateReceiptParams @@ -70,6 +72,13 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO // post /v1/payments/{payment_token}/retry withRawResponse().retry(params, requestOptions).parse() + override fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions, + ): PaymentReturnResponse = + // post /v1/payments/{payment_token}/return + withRawResponse().return_(params, requestOptions).parse() + override fun simulateAction( params: PaymentSimulateActionParams, requestOptions: RequestOptions, @@ -234,6 +243,37 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO } } + private val returnHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun return_( + params: PaymentReturnParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("paymentToken", params.paymentToken().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("v1", "payments", params._pathParam(0), "return") + .body(json(clientOptions.jsonMapper, params._body())) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return errorHandler.handle(response).parseable { + response + .use { returnHandler.handle(it) } + .also { + if (requestOptions.responseValidation!!) { + it.validate() + } + } + } + } + private val simulateActionHandler: Handler = jsonHandler(clientOptions.jsonMapper) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt index ae69ba112..97cb2ad4d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListPageResponseTest.kt @@ -25,21 +25,12 @@ internal class AccountActivityListPageResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) @@ -72,21 +63,12 @@ internal class AccountActivityListPageResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) @@ -123,21 +105,12 @@ internal class AccountActivityListPageResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt index edeb03768..b70f59d9d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityListResponseTest.kt @@ -26,19 +26,12 @@ internal class AccountActivityListResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityListResponse.FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.FinancialTransaction.FinancialEvent.Result - .APPROVED - ) - .type( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) @@ -74,20 +67,12 @@ internal class AccountActivityListResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityListResponse.FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityListResponse.FinancialTransaction.FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family(AccountActivityListResponse.FinancialTransaction.Family.INTERNAL) @@ -242,43 +227,48 @@ internal class AccountActivityListResponseTest { val card = AccountActivityListResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -287,61 +277,59 @@ internal class AccountActivityListResponseTest { .authenticationResult( Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) - .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES - ) + .decisionMadeBy(Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) - .pinCapability(Transaction.Pos.PosTerminal.PinCapability.CAPABLE) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) + .pinCapability( + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE + ) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) + .settledAmount(0L) .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() @@ -351,14 +339,14 @@ internal class AccountActivityListResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts.Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -366,7 +354,7 @@ internal class AccountActivityListResponseTest { .merchant( Transaction.TransactionEvent.TransactionEventAmounts.Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -380,15 +368,15 @@ internal class AccountActivityListResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -399,12 +387,10 @@ internal class AccountActivityListResponseTest { ) .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard.builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber("original_switch_serial_number") - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -426,7 +412,7 @@ internal class AccountActivityListResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -479,43 +465,48 @@ internal class AccountActivityListResponseTest { AccountActivityListResponse.ofCard( AccountActivityListResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -526,63 +517,61 @@ internal class AccountActivityListResponseTest { Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES + Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK ) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift ._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) .pinCapability( - Transaction.Pos.PosTerminal.PinCapability.CAPABLE + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE ) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) + .settledAmount(0L) .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() @@ -592,15 +581,15 @@ internal class AccountActivityListResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts .Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -609,7 +598,7 @@ internal class AccountActivityListResponseTest { Transaction.TransactionEvent.TransactionEventAmounts .Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -624,15 +613,15 @@ internal class AccountActivityListResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -644,14 +633,10 @@ internal class AccountActivityListResponseTest { .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard .builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber( - "original_switch_serial_number" - ) - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -674,7 +659,7 @@ internal class AccountActivityListResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -724,16 +709,16 @@ internal class AccountActivityListResponseTest { fun ofPayment() { val payment = Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -741,16 +726,16 @@ internal class AccountActivityListResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -763,22 +748,22 @@ internal class AccountActivityListResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() @@ -798,16 +783,16 @@ internal class AccountActivityListResponseTest { val accountActivityListResponse = AccountActivityListResponse.ofPayment( Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -815,16 +800,16 @@ internal class AccountActivityListResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -837,22 +822,22 @@ internal class AccountActivityListResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt index 48a8736ba..371813022 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountActivityRetrieveTransactionResponseTest.kt @@ -30,23 +30,12 @@ internal class AccountActivityRetrieveTransactionResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityRetrieveTransactionResponse.FinancialTransaction.FinancialEvent - .builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family( @@ -95,24 +84,12 @@ internal class AccountActivityRetrieveTransactionResponseTest { .currency("USD") .descriptor("descriptor") .addEvent( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .FinancialEvent - .builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .FinancialEvent - .Result - .APPROVED - ) - .type( - AccountActivityRetrieveTransactionResponse.FinancialTransaction - .FinancialEvent - .FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .family( @@ -277,43 +254,48 @@ internal class AccountActivityRetrieveTransactionResponseTest { val card = AccountActivityRetrieveTransactionResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -322,61 +304,59 @@ internal class AccountActivityRetrieveTransactionResponseTest { .authenticationResult( Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) - .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES - ) + .decisionMadeBy(Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) - .pinCapability(Transaction.Pos.PosTerminal.PinCapability.CAPABLE) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) + .pinCapability( + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE + ) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) + .settledAmount(0L) .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() @@ -386,14 +366,14 @@ internal class AccountActivityRetrieveTransactionResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts.Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -401,7 +381,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .merchant( Transaction.TransactionEvent.TransactionEventAmounts.Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -415,15 +395,15 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -434,12 +414,10 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard.builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber("original_switch_serial_number") - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -461,7 +439,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -515,43 +493,48 @@ internal class AccountActivityRetrieveTransactionResponseTest { AccountActivityRetrieveTransactionResponse.ofCard( AccountActivityRetrieveTransactionResponse.CardTransaction.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -562,63 +545,61 @@ internal class AccountActivityRetrieveTransactionResponseTest { Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES + Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK ) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift ._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) .pinCapability( - Transaction.Pos.PosTerminal.PinCapability.CAPABLE + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE ) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) + .settledAmount(0L) .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() @@ -628,15 +609,15 @@ internal class AccountActivityRetrieveTransactionResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts .Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -645,7 +626,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { Transaction.TransactionEvent.TransactionEventAmounts .Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -660,15 +641,15 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -680,14 +661,10 @@ internal class AccountActivityRetrieveTransactionResponseTest { .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard .builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber( - "original_switch_serial_number" - ) - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -710,7 +687,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -761,16 +738,16 @@ internal class AccountActivityRetrieveTransactionResponseTest { fun ofPayment() { val payment = Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -778,16 +755,16 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -800,22 +777,22 @@ internal class AccountActivityRetrieveTransactionResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() @@ -836,16 +813,16 @@ internal class AccountActivityRetrieveTransactionResponseTest { val accountActivityRetrieveTransactionResponse = AccountActivityRetrieveTransactionResponse.ofPayment( Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -853,16 +830,16 @@ internal class AccountActivityRetrieveTransactionResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -875,22 +852,22 @@ internal class AccountActivityRetrieveTransactionResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleConditionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleConditionTest.kt index 1573fd128..fa41c82fb 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleConditionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleConditionTest.kt @@ -14,13 +14,13 @@ internal class AuthRuleConditionTest { val authRuleCondition = AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() - assertThat(authRuleCondition.attribute()).contains(ConditionalAttribute.MCC) - assertThat(authRuleCondition.operation()).contains(AuthRuleCondition.Operation.IS_ONE_OF) - assertThat(authRuleCondition.value()).contains(AuthRuleCondition.Value.ofRegex("string")) + assertThat(authRuleCondition.attribute()).isEqualTo(ConditionalAttribute.MCC) + assertThat(authRuleCondition.operation()).isEqualTo(ConditionalOperation.IS_ONE_OF) + assertThat(authRuleCondition.value()).isEqualTo(ConditionalValue.ofRegex("string")) } @Test @@ -29,7 +29,7 @@ internal class AuthRuleConditionTest { val authRuleCondition = AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2CreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2CreateParamsTest.kt index 78cbbf23c..e3e275794 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2CreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2CreateParamsTest.kt @@ -17,7 +17,7 @@ internal class AuthRuleV2CreateParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -48,7 +48,7 @@ internal class AuthRuleV2CreateParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -79,7 +79,7 @@ internal class AuthRuleV2CreateParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -108,7 +108,13 @@ internal class AuthRuleV2CreateParamsTest { AuthRuleV2CreateParams.Body.AccountLevelRule.builder() .parameters( ConditionalBlockParameters.builder() - .addCondition(AuthRuleCondition.builder().build()) + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) .build() ) .type( @@ -127,7 +133,13 @@ internal class AuthRuleV2CreateParamsTest { AuthRuleV2CreateParams.Body.AccountLevelRule.builder() .parameters( ConditionalBlockParameters.builder() - .addCondition(AuthRuleCondition.builder().build()) + .addCondition( + AuthRuleCondition.builder() + .attribute(ConditionalAttribute.MCC) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) .build() ) .type( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2DraftParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2DraftParamsTest.kt index 56c368426..61c7f0df1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2DraftParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2DraftParamsTest.kt @@ -16,7 +16,7 @@ internal class AuthRuleV2DraftParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -47,7 +47,7 @@ internal class AuthRuleV2DraftParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -64,7 +64,7 @@ internal class AuthRuleV2DraftParamsTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt index fcbf51e69..1244611cb 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListPageResponseTest.kt @@ -26,7 +26,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -42,7 +42,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -77,7 +77,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -93,7 +93,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -132,7 +132,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -148,7 +148,7 @@ internal class AuthRuleV2ListPageResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardFinancialTransactionListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardFinancialTransactionListPageResponseTest.kt index 5c6ad6c58..6fe1c94ca 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardFinancialTransactionListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CardFinancialTransactionListPageResponseTest.kt @@ -22,15 +22,12 @@ internal class CardFinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) @@ -52,15 +49,12 @@ internal class CardFinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) @@ -86,15 +80,12 @@ internal class CardFinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryBalancesTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryBalancesTest.kt new file mode 100644 index 000000000..c8da8c468 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryBalancesTest.kt @@ -0,0 +1,36 @@ +// 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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class CategoryBalancesTest { + + @Test + fun create() { + val categoryBalances = + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() + + assertThat(categoryBalances.fees()).isEqualTo(0L) + assertThat(categoryBalances.interest()).isEqualTo(0L) + assertThat(categoryBalances.principal()).isEqualTo(0L) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val categoryBalances = + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() + + val roundtrippedCategoryBalances = + jsonMapper.readValue( + jsonMapper.writeValueAsString(categoryBalances), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCategoryBalances).isEqualTo(categoryBalances) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryDetailsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryDetailsTest.kt new file mode 100644 index 000000000..92cb0d1d5 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/CategoryDetailsTest.kt @@ -0,0 +1,44 @@ +// 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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class CategoryDetailsTest { + + @Test + fun create() { + val categoryDetails = + CategoryDetails.builder() + .balanceTransfers("balance_transfers") + .cashAdvances("cash_advances") + .purchases("purchases") + .build() + + assertThat(categoryDetails.balanceTransfers()).isEqualTo("balance_transfers") + assertThat(categoryDetails.cashAdvances()).isEqualTo("cash_advances") + assertThat(categoryDetails.purchases()).isEqualTo("purchases") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val categoryDetails = + CategoryDetails.builder() + .balanceTransfers("balance_transfers") + .cashAdvances("cash_advances") + .purchases("purchases") + .build() + + val roundtrippedCategoryDetails = + jsonMapper.readValue( + jsonMapper.writeValueAsString(categoryDetails), + jacksonTypeRef(), + ) + + assertThat(roundtrippedCategoryDetails).isEqualTo(categoryDetails) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/Conditional3dsActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/Conditional3dsActionParametersTest.kt index a098cd990..0788cb826 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/Conditional3dsActionParametersTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/Conditional3dsActionParametersTest.kt @@ -17,7 +17,7 @@ internal class Conditional3dsActionParametersTest { .addCondition( Conditional3dsActionParameters.Condition.builder() .attribute(Conditional3dsActionParameters.Condition.Attribute.MCC) - .operation(Conditional3dsActionParameters.Condition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -29,7 +29,7 @@ internal class Conditional3dsActionParametersTest { .containsExactly( Conditional3dsActionParameters.Condition.builder() .attribute(Conditional3dsActionParameters.Condition.Attribute.MCC) - .operation(Conditional3dsActionParameters.Condition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -44,7 +44,7 @@ internal class Conditional3dsActionParametersTest { .addCondition( Conditional3dsActionParameters.Condition.builder() .attribute(Conditional3dsActionParameters.Condition.Attribute.MCC) - .operation(Conditional3dsActionParameters.Condition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt new file mode 100644 index 000000000..aa1dda148 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAchActionParametersTest.kt @@ -0,0 +1,76 @@ +// 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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ConditionalAchActionParametersTest { + + @Test + fun create() { + val conditionalAchActionParameters = + ConditionalAchActionParameters.builder() + .action( + ConditionalAchActionParameters.Action.ApproveAction.builder() + .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + .build() + ) + .addCondition( + ConditionalAchActionParameters.Condition.builder() + .attribute(ConditionalAchActionParameters.Condition.Attribute.COMPANY_NAME) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + + assertThat(conditionalAchActionParameters.action()) + .isEqualTo( + ConditionalAchActionParameters.Action.ofApprove( + ConditionalAchActionParameters.Action.ApproveAction.builder() + .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + .build() + ) + ) + assertThat(conditionalAchActionParameters.conditions()) + .containsExactly( + ConditionalAchActionParameters.Condition.builder() + .attribute(ConditionalAchActionParameters.Condition.Attribute.COMPANY_NAME) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val conditionalAchActionParameters = + ConditionalAchActionParameters.builder() + .action( + ConditionalAchActionParameters.Action.ApproveAction.builder() + .type(ConditionalAchActionParameters.Action.ApproveAction.Type.APPROVE) + .build() + ) + .addCondition( + ConditionalAchActionParameters.Condition.builder() + .attribute(ConditionalAchActionParameters.Condition.Attribute.COMPANY_NAME) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + + val roundtrippedConditionalAchActionParameters = + jsonMapper.readValue( + jsonMapper.writeValueAsString(conditionalAchActionParameters), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConditionalAchActionParameters) + .isEqualTo(conditionalAchActionParameters) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParametersTest.kt index dc16e4d71..9ada3b0af 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParametersTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalAuthorizationActionParametersTest.kt @@ -17,9 +17,7 @@ internal class ConditionalAuthorizationActionParametersTest { .addCondition( ConditionalAuthorizationActionParameters.Condition.builder() .attribute(ConditionalAuthorizationActionParameters.Condition.Attribute.MCC) - .operation( - ConditionalAuthorizationActionParameters.Condition.Operation.IS_ONE_OF - ) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -31,9 +29,7 @@ internal class ConditionalAuthorizationActionParametersTest { .containsExactly( ConditionalAuthorizationActionParameters.Condition.builder() .attribute(ConditionalAuthorizationActionParameters.Condition.Attribute.MCC) - .operation( - ConditionalAuthorizationActionParameters.Condition.Operation.IS_ONE_OF - ) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -48,9 +44,7 @@ internal class ConditionalAuthorizationActionParametersTest { .addCondition( ConditionalAuthorizationActionParameters.Condition.builder() .attribute(ConditionalAuthorizationActionParameters.Condition.Attribute.MCC) - .operation( - ConditionalAuthorizationActionParameters.Condition.Operation.IS_ONE_OF - ) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalBlockParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalBlockParametersTest.kt index f08c1eac9..e918c9fe0 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalBlockParametersTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalBlockParametersTest.kt @@ -16,7 +16,7 @@ internal class ConditionalBlockParametersTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -26,7 +26,7 @@ internal class ConditionalBlockParametersTest { .containsExactly( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -40,7 +40,7 @@ internal class ConditionalBlockParametersTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.kt new file mode 100644 index 000000000..115ba4bad --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalTokenizationActionParametersTest.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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ConditionalTokenizationActionParametersTest { + + @Test + fun create() { + val conditionalTokenizationActionParameters = + ConditionalTokenizationActionParameters.builder() + .action( + ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + .type( + ConditionalTokenizationActionParameters.Action.DeclineAction.Type + .DECLINE + ) + .reason( + ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + .ACCOUNT_SCORE_1 + ) + .build() + ) + .addCondition( + ConditionalTokenizationActionParameters.Condition.builder() + .attribute( + ConditionalTokenizationActionParameters.Condition.Attribute.TIMESTAMP + ) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + + assertThat(conditionalTokenizationActionParameters.action()) + .isEqualTo( + ConditionalTokenizationActionParameters.Action.ofDecline( + ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + .type( + ConditionalTokenizationActionParameters.Action.DeclineAction.Type + .DECLINE + ) + .reason( + ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + .ACCOUNT_SCORE_1 + ) + .build() + ) + ) + assertThat(conditionalTokenizationActionParameters.conditions()) + .containsExactly( + ConditionalTokenizationActionParameters.Condition.builder() + .attribute( + ConditionalTokenizationActionParameters.Condition.Attribute.TIMESTAMP + ) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val conditionalTokenizationActionParameters = + ConditionalTokenizationActionParameters.builder() + .action( + ConditionalTokenizationActionParameters.Action.DeclineAction.builder() + .type( + ConditionalTokenizationActionParameters.Action.DeclineAction.Type + .DECLINE + ) + .reason( + ConditionalTokenizationActionParameters.Action.DeclineAction.Reason + .ACCOUNT_SCORE_1 + ) + .build() + ) + .addCondition( + ConditionalTokenizationActionParameters.Condition.builder() + .attribute( + ConditionalTokenizationActionParameters.Condition.Attribute.TIMESTAMP + ) + .operation(ConditionalOperation.IS_ONE_OF) + .value("string") + .build() + ) + .build() + + val roundtrippedConditionalTokenizationActionParameters = + jsonMapper.readValue( + jsonMapper.writeValueAsString(conditionalTokenizationActionParameters), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConditionalTokenizationActionParameters) + .isEqualTo(conditionalTokenizationActionParameters) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalValueTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalValueTest.kt new file mode 100644 index 000000000..098004ffa --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ConditionalValueTest.kt @@ -0,0 +1,98 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue +import com.lithic.api.core.jsonMapper +import com.lithic.api.errors.LithicInvalidDataException +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +internal class ConditionalValueTest { + + @Test + fun ofRegex() { + val regex = "string" + + val conditionalValue = ConditionalValue.ofRegex(regex) + + assertThat(conditionalValue.regex()).contains(regex) + assertThat(conditionalValue.number()).isEmpty + assertThat(conditionalValue.listOfStrings()).isEmpty + } + + @Test + fun ofRegexRoundtrip() { + val jsonMapper = jsonMapper() + val conditionalValue = ConditionalValue.ofRegex("string") + + val roundtrippedConditionalValue = + jsonMapper.readValue( + jsonMapper.writeValueAsString(conditionalValue), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConditionalValue).isEqualTo(conditionalValue) + } + + @Test + fun ofNumber() { + val number = 0L + + val conditionalValue = ConditionalValue.ofNumber(number) + + assertThat(conditionalValue.regex()).isEmpty + assertThat(conditionalValue.number()).contains(number) + assertThat(conditionalValue.listOfStrings()).isEmpty + } + + @Test + fun ofNumberRoundtrip() { + val jsonMapper = jsonMapper() + val conditionalValue = ConditionalValue.ofNumber(0L) + + val roundtrippedConditionalValue = + jsonMapper.readValue( + jsonMapper.writeValueAsString(conditionalValue), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConditionalValue).isEqualTo(conditionalValue) + } + + @Test + fun ofListOfStrings() { + val listOfStrings = listOf("string") + + val conditionalValue = ConditionalValue.ofListOfStrings(listOfStrings) + + assertThat(conditionalValue.regex()).isEmpty + assertThat(conditionalValue.number()).isEmpty + assertThat(conditionalValue.listOfStrings()).contains(listOfStrings) + } + + @Test + fun ofListOfStringsRoundtrip() { + val jsonMapper = jsonMapper() + val conditionalValue = ConditionalValue.ofListOfStrings(listOf("string")) + + val roundtrippedConditionalValue = + jsonMapper.readValue( + jsonMapper.writeValueAsString(conditionalValue), + jacksonTypeRef(), + ) + + assertThat(roundtrippedConditionalValue).isEqualTo(conditionalValue) + } + + @Test + fun incompatibleJsonShapeDeserializesToUnknown() { + val value = JsonValue.from(mapOf("invalid" to "object")) + val conditionalValue = jsonMapper().convertValue(value, jacksonTypeRef()) + + val e = assertThrows { conditionalValue.validate() } + assertThat(e).hasMessageStartingWith("Unknown ") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeCreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeCreateResponseTest.kt deleted file mode 100644 index a96b16667..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeCreateResponseTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -// 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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DisputeCreateResponseTest { - - @Test - fun create() { - val disputeCreateResponse = - DisputeCreateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeCreateResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeCreateResponse.ResolutionReason.CASE_LOST) - .status(DisputeCreateResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(disputeCreateResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(disputeCreateResponse.amount()).isEqualTo(0L) - assertThat(disputeCreateResponse.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.customerFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.customerNote()).contains("customer_note") - assertThat(disputeCreateResponse.networkClaimIds().getOrNull()).containsExactly("string") - assertThat(disputeCreateResponse.networkFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.networkReasonCode()).contains("network_reason_code") - assertThat(disputeCreateResponse.prearbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.primaryClaimId()).contains("primary_claim_id") - assertThat(disputeCreateResponse.reason()) - .isEqualTo(DisputeCreateResponse.Reason.ATM_CASH_MISDISPENSE) - assertThat(disputeCreateResponse.representmentDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.resolutionDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeCreateResponse.resolutionNote()).contains("resolution_note") - assertThat(disputeCreateResponse.resolutionReason()) - .contains(DisputeCreateResponse.ResolutionReason.CASE_LOST) - assertThat(disputeCreateResponse.status()) - .isEqualTo(DisputeCreateResponse.Status.ARBITRATION) - assertThat(disputeCreateResponse.transactionToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val disputeCreateResponse = - DisputeCreateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeCreateResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeCreateResponse.ResolutionReason.CASE_LOST) - .status(DisputeCreateResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedDisputeCreateResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(disputeCreateResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDisputeCreateResponse).isEqualTo(disputeCreateResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeDeleteResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeDeleteResponseTest.kt deleted file mode 100644 index b880d2a63..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeDeleteResponseTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -// 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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DisputeDeleteResponseTest { - - @Test - fun create() { - val disputeDeleteResponse = - DisputeDeleteResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeDeleteResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeDeleteResponse.ResolutionReason.CASE_LOST) - .status(DisputeDeleteResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(disputeDeleteResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(disputeDeleteResponse.amount()).isEqualTo(0L) - assertThat(disputeDeleteResponse.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.customerFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.customerNote()).contains("customer_note") - assertThat(disputeDeleteResponse.networkClaimIds().getOrNull()).containsExactly("string") - assertThat(disputeDeleteResponse.networkFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.networkReasonCode()).contains("network_reason_code") - assertThat(disputeDeleteResponse.prearbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.primaryClaimId()).contains("primary_claim_id") - assertThat(disputeDeleteResponse.reason()) - .isEqualTo(DisputeDeleteResponse.Reason.ATM_CASH_MISDISPENSE) - assertThat(disputeDeleteResponse.representmentDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.resolutionDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeDeleteResponse.resolutionNote()).contains("resolution_note") - assertThat(disputeDeleteResponse.resolutionReason()) - .contains(DisputeDeleteResponse.ResolutionReason.CASE_LOST) - assertThat(disputeDeleteResponse.status()) - .isEqualTo(DisputeDeleteResponse.Status.ARBITRATION) - assertThat(disputeDeleteResponse.transactionToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val disputeDeleteResponse = - DisputeDeleteResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeDeleteResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeDeleteResponse.ResolutionReason.CASE_LOST) - .status(DisputeDeleteResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedDisputeDeleteResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(disputeDeleteResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDisputeDeleteResponse).isEqualTo(disputeDeleteResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListPageResponseTest.kt index a2405cd31..293e7dad6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListPageResponseTest.kt @@ -15,7 +15,7 @@ internal class DisputeListPageResponseTest { val disputeListPageResponse = DisputeListPageResponse.builder() .addData( - DisputeListResponse.builder() + Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -27,12 +27,12 @@ internal class DisputeListPageResponseTest { .networkReasonCode("network_reason_code") .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .primaryClaimId("primary_claim_id") - .reason(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) + .reason(Dispute.Reason.ATM_CASH_MISDISPENSE) .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionNote("resolution_note") - .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) - .status(DisputeListResponse.Status.ARBITRATION) + .resolutionReason(Dispute.ResolutionReason.CASE_LOST) + .status(Dispute.Status.ARBITRATION) .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -41,7 +41,7 @@ internal class DisputeListPageResponseTest { assertThat(disputeListPageResponse.data()) .containsExactly( - DisputeListResponse.builder() + Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -53,12 +53,12 @@ internal class DisputeListPageResponseTest { .networkReasonCode("network_reason_code") .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .primaryClaimId("primary_claim_id") - .reason(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) + .reason(Dispute.Reason.ATM_CASH_MISDISPENSE) .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionNote("resolution_note") - .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) - .status(DisputeListResponse.Status.ARBITRATION) + .resolutionReason(Dispute.ResolutionReason.CASE_LOST) + .status(Dispute.Status.ARBITRATION) .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -71,7 +71,7 @@ internal class DisputeListPageResponseTest { val disputeListPageResponse = DisputeListPageResponse.builder() .addData( - DisputeListResponse.builder() + Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) @@ -83,12 +83,12 @@ internal class DisputeListPageResponseTest { .networkReasonCode("network_reason_code") .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .primaryClaimId("primary_claim_id") - .reason(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) + .reason(Dispute.Reason.ATM_CASH_MISDISPENSE) .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .resolutionNote("resolution_note") - .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) - .status(DisputeListResponse.Status.ARBITRATION) + .resolutionReason(Dispute.ResolutionReason.CASE_LOST) + .status(Dispute.Status.ARBITRATION) .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListResponseTest.kt deleted file mode 100644 index b50cd00c1..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListResponseTest.kt +++ /dev/null @@ -1,101 +0,0 @@ -// 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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DisputeListResponseTest { - - @Test - fun create() { - val disputeListResponse = - DisputeListResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) - .status(DisputeListResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(disputeListResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(disputeListResponse.amount()).isEqualTo(0L) - assertThat(disputeListResponse.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.customerFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.customerNote()).contains("customer_note") - assertThat(disputeListResponse.networkClaimIds().getOrNull()).containsExactly("string") - assertThat(disputeListResponse.networkFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.networkReasonCode()).contains("network_reason_code") - assertThat(disputeListResponse.prearbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.primaryClaimId()).contains("primary_claim_id") - assertThat(disputeListResponse.reason()) - .isEqualTo(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) - assertThat(disputeListResponse.representmentDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.resolutionDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeListResponse.resolutionNote()).contains("resolution_note") - assertThat(disputeListResponse.resolutionReason()) - .contains(DisputeListResponse.ResolutionReason.CASE_LOST) - assertThat(disputeListResponse.status()).isEqualTo(DisputeListResponse.Status.ARBITRATION) - assertThat(disputeListResponse.transactionToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val disputeListResponse = - DisputeListResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeListResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) - .status(DisputeListResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedDisputeListResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(disputeListResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDisputeListResponse).isEqualTo(disputeListResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeRetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeRetrieveResponseTest.kt deleted file mode 100644 index 0ea0cd655..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeRetrieveResponseTest.kt +++ /dev/null @@ -1,103 +0,0 @@ -// 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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DisputeRetrieveResponseTest { - - @Test - fun create() { - val disputeRetrieveResponse = - DisputeRetrieveResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeRetrieveResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeRetrieveResponse.ResolutionReason.CASE_LOST) - .status(DisputeRetrieveResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(disputeRetrieveResponse.token()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(disputeRetrieveResponse.amount()).isEqualTo(0L) - assertThat(disputeRetrieveResponse.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.customerFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.customerNote()).contains("customer_note") - assertThat(disputeRetrieveResponse.networkClaimIds().getOrNull()).containsExactly("string") - assertThat(disputeRetrieveResponse.networkFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.networkReasonCode()).contains("network_reason_code") - assertThat(disputeRetrieveResponse.prearbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.primaryClaimId()).contains("primary_claim_id") - assertThat(disputeRetrieveResponse.reason()) - .isEqualTo(DisputeRetrieveResponse.Reason.ATM_CASH_MISDISPENSE) - assertThat(disputeRetrieveResponse.representmentDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.resolutionDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeRetrieveResponse.resolutionNote()).contains("resolution_note") - assertThat(disputeRetrieveResponse.resolutionReason()) - .contains(DisputeRetrieveResponse.ResolutionReason.CASE_LOST) - assertThat(disputeRetrieveResponse.status()) - .isEqualTo(DisputeRetrieveResponse.Status.ARBITRATION) - assertThat(disputeRetrieveResponse.transactionToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val disputeRetrieveResponse = - DisputeRetrieveResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeRetrieveResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeRetrieveResponse.ResolutionReason.CASE_LOST) - .status(DisputeRetrieveResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedDisputeRetrieveResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(disputeRetrieveResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDisputeRetrieveResponse).isEqualTo(disputeRetrieveResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeTest.kt index 23299e757..df4031fb1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeTest.kt @@ -5,6 +5,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.lithic.api.core.jsonMapper import java.time.OffsetDateTime +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -15,117 +16,49 @@ internal class DisputeTest { val dispute = Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .caseId("case_id") + .amount(0L) + .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("USD") - .disposition(Dispute.Disposition.WON) - .addEvent( - Dispute.Event.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .data( - Dispute.Event.Data.WorkflowEventData.builder() - .action(Dispute.Event.Data.WorkflowEventData.Action.OPENED) - .amount(0L) - .disposition(Dispute.Event.Data.WorkflowEventData.Disposition.WON) - .reason("reason") - .stage(Dispute.Event.Data.WorkflowEventData.Stage.CLAIM) - .build() - ) - .type(Dispute.Event.Type.WORKFLOW) - .build() - ) - .liabilityAllocation( - Dispute.LiabilityAllocation.builder() - .deniedAmount(0L) - .originalAmount(0L) - .recoveredAmount(0L) - .remainingAmount(0L) - .writtenOffAmount(0L) - .build() - ) - .merchant( - Dispute.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") - .country("USA") - .descriptor("COFFEE SHOP") - .mcc("5812") - .state("NY") - .build() - ) - .network(Dispute.Network.VISA) - .status(Dispute.Status.OPEN) - .transactionSeries( - Dispute.TransactionSeries.builder() - .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Dispute.TransactionSeries.Type.DISPUTE) - .build() - ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerNote("customer_note") + .addNetworkClaimId("string") + .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .networkReasonCode("network_reason_code") + .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .primaryClaimId("primary_claim_id") + .reason(Dispute.Reason.ATM_CASH_MISDISPENSE) + .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .resolutionNote("resolution_note") + .resolutionReason(Dispute.ResolutionReason.CASE_LOST) + .status(Dispute.Status.ARBITRATION) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() assertThat(dispute.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(dispute.accountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(dispute.cardToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(dispute.caseId()).contains("case_id") + assertThat(dispute.amount()).isEqualTo(0L) + assertThat(dispute.arbitrationDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(dispute.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(dispute.currency()).isEqualTo("USD") - assertThat(dispute.disposition()).contains(Dispute.Disposition.WON) - assertThat(dispute.events()) - .containsExactly( - Dispute.Event.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .data( - Dispute.Event.Data.WorkflowEventData.builder() - .action(Dispute.Event.Data.WorkflowEventData.Action.OPENED) - .amount(0L) - .disposition(Dispute.Event.Data.WorkflowEventData.Disposition.WON) - .reason("reason") - .stage(Dispute.Event.Data.WorkflowEventData.Stage.CLAIM) - .build() - ) - .type(Dispute.Event.Type.WORKFLOW) - .build() - ) - assertThat(dispute.liabilityAllocation()) - .isEqualTo( - Dispute.LiabilityAllocation.builder() - .deniedAmount(0L) - .originalAmount(0L) - .recoveredAmount(0L) - .remainingAmount(0L) - .writtenOffAmount(0L) - .build() - ) - assertThat(dispute.merchant()) - .isEqualTo( - Dispute.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") - .country("USA") - .descriptor("COFFEE SHOP") - .mcc("5812") - .state("NY") - .build() - ) - assertThat(dispute.network()).isEqualTo(Dispute.Network.VISA) - assertThat(dispute.status()).contains(Dispute.Status.OPEN) - assertThat(dispute.transactionSeries()) - .contains( - Dispute.TransactionSeries.builder() - .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Dispute.TransactionSeries.Type.DISPUTE) - .build() - ) - assertThat(dispute.updated()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.customerFiledDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.customerNote()).contains("customer_note") + assertThat(dispute.networkClaimIds().getOrNull()).containsExactly("string") + assertThat(dispute.networkFiledDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.networkReasonCode()).contains("network_reason_code") + assertThat(dispute.prearbitrationDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.primaryClaimId()).contains("primary_claim_id") + assertThat(dispute.reason()).isEqualTo(Dispute.Reason.ATM_CASH_MISDISPENSE) + assertThat(dispute.representmentDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.resolutionDate()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(dispute.resolutionNote()).contains("resolution_note") + assertThat(dispute.resolutionReason()).contains(Dispute.ResolutionReason.CASE_LOST) + assertThat(dispute.status()).isEqualTo(Dispute.Status.ARBITRATION) + assertThat(dispute.transactionToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } @Test @@ -134,58 +67,23 @@ internal class DisputeTest { val dispute = Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .caseId("case_id") + .amount(0L) + .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .currency("USD") - .disposition(Dispute.Disposition.WON) - .addEvent( - Dispute.Event.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .data( - Dispute.Event.Data.WorkflowEventData.builder() - .action(Dispute.Event.Data.WorkflowEventData.Action.OPENED) - .amount(0L) - .disposition(Dispute.Event.Data.WorkflowEventData.Disposition.WON) - .reason("reason") - .stage(Dispute.Event.Data.WorkflowEventData.Stage.CLAIM) - .build() - ) - .type(Dispute.Event.Type.WORKFLOW) - .build() - ) - .liabilityAllocation( - Dispute.LiabilityAllocation.builder() - .deniedAmount(0L) - .originalAmount(0L) - .recoveredAmount(0L) - .remainingAmount(0L) - .writtenOffAmount(0L) - .build() - ) - .merchant( - Dispute.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") - .country("USA") - .descriptor("COFFEE SHOP") - .mcc("5812") - .state("NY") - .build() - ) - .network(Dispute.Network.VISA) - .status(Dispute.Status.OPEN) - .transactionSeries( - Dispute.TransactionSeries.builder() - .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Dispute.TransactionSeries.Type.DISPUTE) - .build() - ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .customerNote("customer_note") + .addNetworkClaimId("string") + .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .networkReasonCode("network_reason_code") + .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .primaryClaimId("primary_claim_id") + .reason(Dispute.Reason.ATM_CASH_MISDISPENSE) + .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .resolutionNote("resolution_note") + .resolutionReason(Dispute.ResolutionReason.CASE_LOST) + .status(Dispute.Status.ARBITRATION) + .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val roundtrippedDispute = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeUpdateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeUpdateResponseTest.kt deleted file mode 100644 index 38373e654..000000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeUpdateResponseTest.kt +++ /dev/null @@ -1,102 +0,0 @@ -// 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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class DisputeUpdateResponseTest { - - @Test - fun create() { - val disputeUpdateResponse = - DisputeUpdateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeUpdateResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeUpdateResponse.ResolutionReason.CASE_LOST) - .status(DisputeUpdateResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(disputeUpdateResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(disputeUpdateResponse.amount()).isEqualTo(0L) - assertThat(disputeUpdateResponse.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.customerFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.customerNote()).contains("customer_note") - assertThat(disputeUpdateResponse.networkClaimIds().getOrNull()).containsExactly("string") - assertThat(disputeUpdateResponse.networkFiledDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.networkReasonCode()).contains("network_reason_code") - assertThat(disputeUpdateResponse.prearbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.primaryClaimId()).contains("primary_claim_id") - assertThat(disputeUpdateResponse.reason()) - .isEqualTo(DisputeUpdateResponse.Reason.ATM_CASH_MISDISPENSE) - assertThat(disputeUpdateResponse.representmentDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.resolutionDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(disputeUpdateResponse.resolutionNote()).contains("resolution_note") - assertThat(disputeUpdateResponse.resolutionReason()) - .contains(DisputeUpdateResponse.ResolutionReason.CASE_LOST) - assertThat(disputeUpdateResponse.status()) - .isEqualTo(DisputeUpdateResponse.Status.ARBITRATION) - assertThat(disputeUpdateResponse.transactionToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val disputeUpdateResponse = - DisputeUpdateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .customerNote("customer_note") - .addNetworkClaimId("string") - .networkFiledDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .networkReasonCode("network_reason_code") - .prearbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .primaryClaimId("primary_claim_id") - .reason(DisputeUpdateResponse.Reason.ATM_CASH_MISDISPENSE) - .representmentDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .resolutionNote("resolution_note") - .resolutionReason(DisputeUpdateResponse.ResolutionReason.CASE_LOST) - .status(DisputeUpdateResponse.Status.ARBITRATION) - .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedDisputeUpdateResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(disputeUpdateResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedDisputeUpdateResponse).isEqualTo(disputeUpdateResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeV2Test.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeV2Test.kt new file mode 100644 index 000000000..145b0dd36 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeV2Test.kt @@ -0,0 +1,202 @@ +// 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 DisputeV2Test { + + @Test + fun create() { + val disputeV2 = + DisputeV2.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("USD") + .disposition(DisputeV2.Disposition.WON) + .addEvent( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action(DisputeV2.Event.Data.WorkflowEventData.Action.OPENED) + .amount(0L) + .disposition(DisputeV2.Event.Data.WorkflowEventData.Disposition.WON) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + .liabilityAllocation( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + .merchant( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + .network(DisputeV2.Network.VISA) + .status(DisputeV2.Status.OPEN) + .transactionSeries( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + assertThat(disputeV2.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(disputeV2.accountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(disputeV2.cardToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(disputeV2.caseId()).contains("case_id") + assertThat(disputeV2.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(disputeV2.currency()).isEqualTo("USD") + assertThat(disputeV2.disposition()).contains(DisputeV2.Disposition.WON) + assertThat(disputeV2.events()) + .containsExactly( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action(DisputeV2.Event.Data.WorkflowEventData.Action.OPENED) + .amount(0L) + .disposition(DisputeV2.Event.Data.WorkflowEventData.Disposition.WON) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + assertThat(disputeV2.liabilityAllocation()) + .isEqualTo( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + assertThat(disputeV2.merchant()) + .isEqualTo( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + assertThat(disputeV2.network()).isEqualTo(DisputeV2.Network.VISA) + assertThat(disputeV2.status()).contains(DisputeV2.Status.OPEN) + assertThat(disputeV2.transactionSeries()) + .contains( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + assertThat(disputeV2.updated()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val disputeV2 = + DisputeV2.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("USD") + .disposition(DisputeV2.Disposition.WON) + .addEvent( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action(DisputeV2.Event.Data.WorkflowEventData.Action.OPENED) + .amount(0L) + .disposition(DisputeV2.Event.Data.WorkflowEventData.Disposition.WON) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + .liabilityAllocation( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + .merchant( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + .network(DisputeV2.Network.VISA) + .status(DisputeV2.Status.OPEN) + .transactionSeries( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + + val roundtrippedDisputeV2 = + jsonMapper.readValue( + jsonMapper.writeValueAsString(disputeV2), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDisputeV2).isEqualTo(disputeV2) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListPageResponseTest.kt new file mode 100644 index 000000000..73eedede1 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListPageResponseTest.kt @@ -0,0 +1,228 @@ +// 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 DisputesV2ListPageResponseTest { + + @Test + fun create() { + val disputesV2ListPageResponse = + DisputesV2ListPageResponse.builder() + .addData( + DisputeV2.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("USD") + .disposition(DisputeV2.Disposition.WON) + .addEvent( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action( + DisputeV2.Event.Data.WorkflowEventData.Action.OPENED + ) + .amount(0L) + .disposition( + DisputeV2.Event.Data.WorkflowEventData.Disposition.WON + ) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + .liabilityAllocation( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + .merchant( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + .network(DisputeV2.Network.VISA) + .status(DisputeV2.Status.OPEN) + .transactionSeries( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" + ) + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .hasMore(true) + .build() + + assertThat(disputesV2ListPageResponse.data()) + .containsExactly( + DisputeV2.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("USD") + .disposition(DisputeV2.Disposition.WON) + .addEvent( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action(DisputeV2.Event.Data.WorkflowEventData.Action.OPENED) + .amount(0L) + .disposition( + DisputeV2.Event.Data.WorkflowEventData.Disposition.WON + ) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + .liabilityAllocation( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + .merchant( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + .network(DisputeV2.Network.VISA) + .status(DisputeV2.Status.OPEN) + .transactionSeries( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + assertThat(disputesV2ListPageResponse.hasMore()).isEqualTo(true) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val disputesV2ListPageResponse = + DisputesV2ListPageResponse.builder() + .addData( + DisputeV2.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("USD") + .disposition(DisputeV2.Disposition.WON) + .addEvent( + DisputeV2.Event.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .data( + DisputeV2.Event.Data.WorkflowEventData.builder() + .action( + DisputeV2.Event.Data.WorkflowEventData.Action.OPENED + ) + .amount(0L) + .disposition( + DisputeV2.Event.Data.WorkflowEventData.Disposition.WON + ) + .reason("reason") + .stage(DisputeV2.Event.Data.WorkflowEventData.Stage.CLAIM) + .type(DisputeV2.Event.Data.WorkflowEventData.Type.WORKFLOW) + .build() + ) + .type(DisputeV2.Event.Type.WORKFLOW) + .build() + ) + .liabilityAllocation( + DisputeV2.LiabilityAllocation.builder() + .deniedAmount(0L) + .originalAmount(0L) + .recoveredAmount(0L) + .remainingAmount(0L) + .writtenOffAmount(0L) + .build() + ) + .merchant( + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + ) + .network(DisputeV2.Network.VISA) + .status(DisputeV2.Status.OPEN) + .transactionSeries( + DisputeV2.TransactionSeries.builder() + .relatedTransactionEventToken( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e" + ) + .relatedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .type(DisputeV2.TransactionSeries.Type.DISPUTE) + .build() + ) + .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .build() + ) + .hasMore(true) + .build() + + val roundtrippedDisputesV2ListPageResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(disputesV2ListPageResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedDisputesV2ListPageResponse).isEqualTo(disputesV2ListPageResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListParamsTest.kt new file mode 100644 index 000000000..1f545a3d4 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2ListParamsTest.kt @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.lithic.api.core.http.QueryParams +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DisputesV2ListParamsTest { + + @Test + fun create() { + DisputesV2ListParams.builder() + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .disputedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .endingBefore("ending_before") + .pageSize(1L) + .startingAfter("starting_after") + .build() + } + + @Test + fun queryParams() { + val params = + DisputesV2ListParams.builder() + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .disputedTransactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .endingBefore("ending_before") + .pageSize(1L) + .startingAfter("starting_after") + .build() + + val queryParams = params._queryParams() + + assertThat(queryParams) + .isEqualTo( + QueryParams.builder() + .put("account_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("begin", "2019-12-27T18:11:19.117Z") + .put("card_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("disputed_transaction_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .put("end", "2019-12-27T18:11:19.117Z") + .put("ending_before", "ending_before") + .put("page_size", "1") + .put("starting_after", "starting_after") + .build() + ) + } + + @Test + fun queryParamsWithoutOptionalFields() { + val params = DisputesV2ListParams.builder().build() + + val queryParams = params._queryParams() + + assertThat(queryParams).isEqualTo(QueryParams.builder().build()) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2RetrieveParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2RetrieveParamsTest.kt new file mode 100644 index 000000000..6091c45c1 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputesV2RetrieveParamsTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class DisputesV2RetrieveParamsTest { + + @Test + fun create() { + DisputesV2RetrieveParams.builder() + .disputeToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + DisputesV2RetrieveParams.builder() + .disputeToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParamsTest.kt new file mode 100644 index 000000000..1031bcc6b --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseParamsTest.kt @@ -0,0 +1,28 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ExternalBankAccountUnpauseParamsTest { + + @Test + fun create() { + ExternalBankAccountUnpauseParams.builder() + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + } + + @Test + fun pathParams() { + val params = + ExternalBankAccountUnpauseParams.builder() + .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponseTest.kt new file mode 100644 index 000000000..1bf900680 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountUnpauseResponseTest.kt @@ -0,0 +1,142 @@ +// 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.LocalDate +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class ExternalBankAccountUnpauseResponseTest { + + @Test + fun create() { + val externalBankAccountUnpauseResponse = + ExternalBankAccountUnpauseResponse.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .country("country") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .lastFour("last_four") + .owner("owner") + .ownerType(OwnerType.INDIVIDUAL) + .routingNumber("routing_number") + .state(ExternalBankAccountUnpauseResponse.State.ENABLED) + .type(ExternalBankAccountUnpauseResponse.AccountType.CHECKING) + .verificationAttempts(0L) + .verificationMethod(VerificationMethod.MANUAL) + .verificationState(ExternalBankAccountUnpauseResponse.VerificationState.PENDING) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .address( + ExternalBankAccountAddress.builder() + .address1("x") + .city("x") + .country("USD") + .postalCode("11201") + .state("xx") + .address2("x") + .build() + ) + .companyId("company_id") + .dob(LocalDate.parse("2019-12-27")) + .doingBusinessAs("doing_business_as") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .userDefinedId("user_defined_id") + .verificationFailedReason("verification_failed_reason") + .build() + + assertThat(externalBankAccountUnpauseResponse.token()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(externalBankAccountUnpauseResponse.country()).isEqualTo("country") + assertThat(externalBankAccountUnpauseResponse.created()) + .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(externalBankAccountUnpauseResponse.currency()).isEqualTo("currency") + assertThat(externalBankAccountUnpauseResponse.lastFour()).isEqualTo("last_four") + assertThat(externalBankAccountUnpauseResponse.owner()).isEqualTo("owner") + assertThat(externalBankAccountUnpauseResponse.ownerType()).isEqualTo(OwnerType.INDIVIDUAL) + assertThat(externalBankAccountUnpauseResponse.routingNumber()).isEqualTo("routing_number") + assertThat(externalBankAccountUnpauseResponse.state()) + .isEqualTo(ExternalBankAccountUnpauseResponse.State.ENABLED) + assertThat(externalBankAccountUnpauseResponse.type()) + .isEqualTo(ExternalBankAccountUnpauseResponse.AccountType.CHECKING) + assertThat(externalBankAccountUnpauseResponse.verificationAttempts()).isEqualTo(0L) + assertThat(externalBankAccountUnpauseResponse.verificationMethod()) + .isEqualTo(VerificationMethod.MANUAL) + assertThat(externalBankAccountUnpauseResponse.verificationState()) + .isEqualTo(ExternalBankAccountUnpauseResponse.VerificationState.PENDING) + assertThat(externalBankAccountUnpauseResponse.accountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(externalBankAccountUnpauseResponse.address()) + .contains( + ExternalBankAccountAddress.builder() + .address1("x") + .city("x") + .country("USD") + .postalCode("11201") + .state("xx") + .address2("x") + .build() + ) + assertThat(externalBankAccountUnpauseResponse.companyId()).contains("company_id") + assertThat(externalBankAccountUnpauseResponse.dob()).contains(LocalDate.parse("2019-12-27")) + assertThat(externalBankAccountUnpauseResponse.doingBusinessAs()) + .contains("doing_business_as") + assertThat(externalBankAccountUnpauseResponse.financialAccountToken()) + .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(externalBankAccountUnpauseResponse.name()).contains("name") + assertThat(externalBankAccountUnpauseResponse.userDefinedId()).contains("user_defined_id") + assertThat(externalBankAccountUnpauseResponse.verificationFailedReason()) + .contains("verification_failed_reason") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val externalBankAccountUnpauseResponse = + ExternalBankAccountUnpauseResponse.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .country("country") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .currency("currency") + .lastFour("last_four") + .owner("owner") + .ownerType(OwnerType.INDIVIDUAL) + .routingNumber("routing_number") + .state(ExternalBankAccountUnpauseResponse.State.ENABLED) + .type(ExternalBankAccountUnpauseResponse.AccountType.CHECKING) + .verificationAttempts(0L) + .verificationMethod(VerificationMethod.MANUAL) + .verificationState(ExternalBankAccountUnpauseResponse.VerificationState.PENDING) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .address( + ExternalBankAccountAddress.builder() + .address1("x") + .city("x") + .country("USD") + .postalCode("11201") + .state("xx") + .address2("x") + .build() + ) + .companyId("company_id") + .dob(LocalDate.parse("2019-12-27")) + .doingBusinessAs("doing_business_as") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .userDefinedId("user_defined_id") + .verificationFailedReason("verification_failed_reason") + .build() + + val roundtrippedExternalBankAccountUnpauseResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(externalBankAccountUnpauseResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedExternalBankAccountUnpauseResponse) + .isEqualTo(externalBankAccountUnpauseResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountLoanTapeListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountLoanTapeListPageResponseTest.kt index 0979ae26e..8ec282ffc 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountLoanTapeListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountLoanTapeListPageResponseTest.kt @@ -48,28 +48,28 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balances( LoanTape.Balances.builder() .due( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) @@ -82,7 +82,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .creditProductToken("credit_product_token") .date(LocalDate.parse("2019-12-27")) .dayTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -103,14 +103,14 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -120,7 +120,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -134,14 +134,10 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build() ) .paymentAllocation( - LoanTape.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .periodTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -162,7 +158,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .version(0L) .ytdTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -215,28 +211,28 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balances( LoanTape.Balances.builder() .due( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) @@ -249,7 +245,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .creditProductToken("credit_product_token") .date(LocalDate.parse("2019-12-27")) .dayTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -270,14 +266,14 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -287,7 +283,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -301,14 +297,10 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build() ) .paymentAllocation( - LoanTape.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .periodTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -329,7 +321,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .version(0L) .ytdTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -386,28 +378,28 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balances( LoanTape.Balances.builder() .due( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) .build() ) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() + CategoryBalances.builder() .fees(0L) .interest(0L) .principal(0L) @@ -420,7 +412,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .creditProductToken("credit_product_token") .date(LocalDate.parse("2019-12-27")) .dayTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -441,14 +433,14 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -458,7 +450,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -472,14 +464,10 @@ internal class FinancialAccountLoanTapeListPageResponseTest { LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build() ) .paymentAllocation( - LoanTape.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .periodTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -500,7 +488,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .version(0L) .ytdTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialEventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialEventTest.kt new file mode 100644 index 000000000..8aa4b5a21 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialEventTest.kt @@ -0,0 +1,53 @@ +// 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 FinancialEventTest { + + @Test + fun create() { + val financialEvent = + FinancialEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + .build() + + assertThat(financialEvent.token()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(financialEvent.amount()).contains(0L) + assertThat(financialEvent.created()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(financialEvent.result()).contains(FinancialEvent.Result.APPROVED) + assertThat(financialEvent.type()) + .contains(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val financialEvent = + FinancialEvent.builder() + .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .amount(0L) + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + .build() + + val roundtrippedFinancialEvent = + jsonMapper.readValue( + jsonMapper.writeValueAsString(financialEvent), + jacksonTypeRef(), + ) + + assertThat(roundtrippedFinancialEvent).isEqualTo(financialEvent) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionListPageResponseTest.kt index 19f0bc003..e5273048e 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionListPageResponseTest.kt @@ -22,15 +22,12 @@ internal class FinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) @@ -52,15 +49,12 @@ internal class FinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) @@ -86,15 +80,12 @@ internal class FinancialTransactionListPageResponseTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt index e9c583509..4cea6543d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialTransactionTest.kt @@ -20,15 +20,12 @@ internal class FinancialTransactionTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) @@ -46,15 +43,12 @@ internal class FinancialTransactionTest { assertThat(financialTransaction.descriptor()).isEqualTo("descriptor") assertThat(financialTransaction.events()) .containsExactly( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) assertThat(financialTransaction.pendingAmount()).isEqualTo(0L) @@ -76,15 +70,12 @@ internal class FinancialTransactionTest { .currency("currency") .descriptor("descriptor") .addEvent( - FinancialTransaction.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(FinancialTransaction.FinancialEvent.Result.APPROVED) - .type( - FinancialTransaction.FinancialEvent.FinancialEventType - .ACH_ORIGINATION_CANCELLED - ) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .pendingAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/LoanTapeTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/LoanTapeTest.kt index 668819e6c..77f5be2f4 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/LoanTapeTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/LoanTapeTest.kt @@ -45,33 +45,15 @@ internal class LoanTapeTest { .availableCredit(0L) .balances( LoanTape.Balances.builder() - .due( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() - ) + .due(CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build()) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .pastDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .build() ) @@ -80,7 +62,7 @@ internal class LoanTapeTest { .creditProductToken("credit_product_token") .date(LocalDate.parse("2019-12-27")) .dayTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -101,14 +83,14 @@ internal class LoanTapeTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -118,7 +100,7 @@ internal class LoanTapeTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -132,10 +114,10 @@ internal class LoanTapeTest { LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build() ) .paymentAllocation( - LoanTape.CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .periodTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -156,7 +138,7 @@ internal class LoanTapeTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .version(0L) .ytdTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -204,33 +186,13 @@ internal class LoanTapeTest { assertThat(loanTape.balances()) .isEqualTo( LoanTape.Balances.builder() - .due( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() - ) + .due(CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build()) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() - ) - .pastDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) + .pastDue(CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build()) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .build() ) @@ -240,7 +202,7 @@ internal class LoanTapeTest { assertThat(loanTape.date()).isEqualTo(LocalDate.parse("2019-12-27")) assertThat(loanTape.dayTotals()) .isEqualTo( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -263,14 +225,14 @@ internal class LoanTapeTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -280,7 +242,7 @@ internal class LoanTapeTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -293,12 +255,10 @@ internal class LoanTapeTest { assertThat(loanTape.minimumPaymentBalance()) .isEqualTo(LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build()) assertThat(loanTape.paymentAllocation()) - .isEqualTo( - LoanTape.CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() - ) + .isEqualTo(CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build()) assertThat(loanTape.periodTotals()) .isEqualTo( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -319,7 +279,7 @@ internal class LoanTapeTest { assertThat(loanTape.version()).isEqualTo(0L) assertThat(loanTape.ytdTotals()) .isEqualTo( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -370,33 +330,15 @@ internal class LoanTapeTest { .availableCredit(0L) .balances( LoanTape.Balances.builder() - .due( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() - ) + .due(CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build()) .nextStatementDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .pastDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .pastStatementsDue( - LoanTape.Balances.CategoryBalances.builder() - .fees(0L) - .interest(0L) - .principal(0L) - .build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .build() ) @@ -405,7 +347,7 @@ internal class LoanTapeTest { .creditProductToken("credit_product_token") .date(LocalDate.parse("2019-12-27")) .dayTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -426,14 +368,14 @@ internal class LoanTapeTest { LoanTape.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -443,7 +385,7 @@ internal class LoanTapeTest { LoanTape.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - LoanTape.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -457,10 +399,10 @@ internal class LoanTapeTest { LoanTape.BalanceDetails.builder().amount(0L).remaining(0L).build() ) .paymentAllocation( - LoanTape.CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() + CategoryBalances.builder().fees(0L).interest(0L).principal(0L).build() ) .periodTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -481,7 +423,7 @@ internal class LoanTapeTest { .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .version(0L) .ytdTotals( - LoanTape.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/MerchantTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/MerchantTest.kt new file mode 100644 index 000000000..b7db0826e --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/MerchantTest.kt @@ -0,0 +1,56 @@ +// 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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class MerchantTest { + + @Test + fun create() { + val merchant = + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + + assertThat(merchant.acceptorId()).isEqualTo("333301802529120") + assertThat(merchant.acquiringInstitutionId()).isEqualTo("191231") + assertThat(merchant.city()).isEqualTo("NEW YORK") + assertThat(merchant.country()).isEqualTo("USA") + assertThat(merchant.descriptor()).isEqualTo("COFFEE SHOP") + assertThat(merchant.mcc()).isEqualTo("5812") + assertThat(merchant.state()).isEqualTo("NY") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val merchant = + Merchant.builder() + .acceptorId("333301802529120") + .acquiringInstitutionId("191231") + .city("NEW YORK") + .country("USA") + .descriptor("COFFEE SHOP") + .mcc("5812") + .state("NY") + .build() + + val roundtrippedMerchant = + jsonMapper.readValue( + jsonMapper.writeValueAsString(merchant), + jacksonTypeRef(), + ) + + assertThat(roundtrippedMerchant).isEqualTo(merchant) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt index aa7463819..371dc40ad 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentCreateResponseTest.kt @@ -14,16 +14,16 @@ internal class PaymentCreateResponseTest { fun create() { val paymentCreateResponse = PaymentCreateResponse.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -31,16 +31,16 @@ internal class PaymentCreateResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -53,22 +53,22 @@ internal class PaymentCreateResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .balance( Balance.builder() @@ -86,26 +86,26 @@ internal class PaymentCreateResponseTest { ) .build() - assertThat(paymentCreateResponse.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") + assertThat(paymentCreateResponse.token()).isEqualTo("bd4efddb-771b-49e3-9af9-49b077ab5eb8") assertThat(paymentCreateResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentCreateResponse.created()) - .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - assertThat(paymentCreateResponse.descriptor()).isEqualTo("ach_origination_debit") - assertThat(paymentCreateResponse.direction()).isEqualTo(Payment.Direction.DEBIT) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + assertThat(paymentCreateResponse.descriptor()).isEqualTo("ach_origination_credit") + assertThat(paymentCreateResponse.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(paymentCreateResponse.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build(), Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -113,7 +113,7 @@ internal class PaymentCreateResponseTest { ) assertThat(paymentCreateResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentCreateResponse.financialAccountToken()) - .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") + .isEqualTo("35b0c466-a3e3-519a-9549-ead6a6a2277d") assertThat(paymentCreateResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentCreateResponse.methodAttributes()) .isEqualTo( @@ -129,12 +129,12 @@ internal class PaymentCreateResponseTest { .build() ) ) - assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(1588L) + assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(-1588L) assertThat(paymentCreateResponse.relatedAccountTokens()) - .isEqualTo( + .contains( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) assertThat(paymentCreateResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) @@ -142,12 +142,12 @@ internal class PaymentCreateResponseTest { assertThat(paymentCreateResponse.source()).isEqualTo(Payment.Source.LITHIC) assertThat(paymentCreateResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentCreateResponse.updated()) - .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:25Z")) assertThat(paymentCreateResponse.currency()).contains("USD") assertThat(paymentCreateResponse.expectedReleaseDate()).isEmpty assertThat(paymentCreateResponse.externalBankAccountToken()) .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - assertThat(paymentCreateResponse.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(paymentCreateResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) assertThat(paymentCreateResponse.userDefinedId()).isEmpty assertThat(paymentCreateResponse.balance()) .contains( @@ -171,16 +171,16 @@ internal class PaymentCreateResponseTest { val jsonMapper = jsonMapper() val paymentCreateResponse = PaymentCreateResponse.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -188,16 +188,16 @@ internal class PaymentCreateResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -210,22 +210,22 @@ internal class PaymentCreateResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .balance( Balance.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt index 87abc859e..1a5c6ac84 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentListPageResponseTest.kt @@ -16,16 +16,16 @@ internal class PaymentListPageResponseTest { PaymentListPageResponse.builder() .addData( Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED @@ -35,9 +35,9 @@ internal class PaymentListPageResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED @@ -46,7 +46,7 @@ internal class PaymentListPageResponseTest { .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -59,22 +59,22 @@ internal class PaymentListPageResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() ) @@ -84,16 +84,16 @@ internal class PaymentListPageResponseTest { assertThat(paymentListPageResponse.data()) .containsExactly( Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -101,16 +101,16 @@ internal class PaymentListPageResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -123,22 +123,22 @@ internal class PaymentListPageResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() ) @@ -152,16 +152,16 @@ internal class PaymentListPageResponseTest { PaymentListPageResponse.builder() .addData( Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED @@ -171,9 +171,9 @@ internal class PaymentListPageResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED @@ -182,7 +182,7 @@ internal class PaymentListPageResponseTest { .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -195,22 +195,22 @@ internal class PaymentListPageResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt index ffbbe6982..2b8b37ee6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentRetryResponseTest.kt @@ -14,16 +14,16 @@ internal class PaymentRetryResponseTest { fun create() { val paymentRetryResponse = PaymentRetryResponse.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -31,16 +31,16 @@ internal class PaymentRetryResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -53,22 +53,22 @@ internal class PaymentRetryResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .balance( Balance.builder() @@ -86,26 +86,26 @@ internal class PaymentRetryResponseTest { ) .build() - assertThat(paymentRetryResponse.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") + assertThat(paymentRetryResponse.token()).isEqualTo("bd4efddb-771b-49e3-9af9-49b077ab5eb8") assertThat(paymentRetryResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentRetryResponse.created()) - .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - assertThat(paymentRetryResponse.descriptor()).isEqualTo("ach_origination_debit") - assertThat(paymentRetryResponse.direction()).isEqualTo(Payment.Direction.DEBIT) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + assertThat(paymentRetryResponse.descriptor()).isEqualTo("ach_origination_credit") + assertThat(paymentRetryResponse.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(paymentRetryResponse.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build(), Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -113,7 +113,7 @@ internal class PaymentRetryResponseTest { ) assertThat(paymentRetryResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentRetryResponse.financialAccountToken()) - .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") + .isEqualTo("35b0c466-a3e3-519a-9549-ead6a6a2277d") assertThat(paymentRetryResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentRetryResponse.methodAttributes()) .isEqualTo( @@ -129,12 +129,12 @@ internal class PaymentRetryResponseTest { .build() ) ) - assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(1588L) + assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(-1588L) assertThat(paymentRetryResponse.relatedAccountTokens()) - .isEqualTo( + .contains( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) assertThat(paymentRetryResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) @@ -142,12 +142,12 @@ internal class PaymentRetryResponseTest { assertThat(paymentRetryResponse.source()).isEqualTo(Payment.Source.LITHIC) assertThat(paymentRetryResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentRetryResponse.updated()) - .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:25Z")) assertThat(paymentRetryResponse.currency()).contains("USD") assertThat(paymentRetryResponse.expectedReleaseDate()).isEmpty assertThat(paymentRetryResponse.externalBankAccountToken()) .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - assertThat(paymentRetryResponse.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(paymentRetryResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) assertThat(paymentRetryResponse.userDefinedId()).isEmpty assertThat(paymentRetryResponse.balance()) .contains( @@ -171,16 +171,16 @@ internal class PaymentRetryResponseTest { val jsonMapper = jsonMapper() val paymentRetryResponse = PaymentRetryResponse.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -188,16 +188,16 @@ internal class PaymentRetryResponseTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -210,22 +210,22 @@ internal class PaymentRetryResponseTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .balance( Balance.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnParamsTest.kt new file mode 100644 index 000000000..5a50510e0 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnParamsTest.kt @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import java.time.LocalDate +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PaymentReturnParamsTest { + + @Test + fun create() { + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .addenda("addenda") + .dateOfDeath(LocalDate.parse("2025-01-15")) + .memo("memo") + .build() + } + + @Test + fun pathParams() { + val params = + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .build() + + assertThat(params._pathParam(0)).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + // out-of-bound path param + assertThat(params._pathParam(1)).isEqualTo("") + } + + @Test + fun body() { + val params = + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .addenda("addenda") + .dateOfDeath(LocalDate.parse("2025-01-15")) + .memo("memo") + .build() + + val body = params._body() + + assertThat(body.financialAccountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.returnReasonCode()).isEqualTo("R01") + assertThat(body.addenda()).contains("addenda") + assertThat(body.dateOfDeath()).contains(LocalDate.parse("2025-01-15")) + assertThat(body.memo()).contains("memo") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .build() + + val body = params._body() + + assertThat(body.financialAccountToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(body.returnReasonCode()).isEqualTo("R01") + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnResponseTest.kt new file mode 100644 index 000000000..83227c16c --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentReturnResponseTest.kt @@ -0,0 +1,47 @@ +// 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 org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class PaymentReturnResponseTest { + + @Test + fun create() { + val paymentReturnResponse = + PaymentReturnResponse.builder() + .result(PaymentReturnResponse.TransactionResult.APPROVED) + .transactionGroupUuid("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionUuid("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + assertThat(paymentReturnResponse.result()) + .isEqualTo(PaymentReturnResponse.TransactionResult.APPROVED) + assertThat(paymentReturnResponse.transactionGroupUuid()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentReturnResponse.transactionUuid()) + .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val paymentReturnResponse = + PaymentReturnResponse.builder() + .result(PaymentReturnResponse.TransactionResult.APPROVED) + .transactionGroupUuid("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .transactionUuid("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + + val roundtrippedPaymentReturnResponse = + jsonMapper.readValue( + jsonMapper.writeValueAsString(paymentReturnResponse), + jacksonTypeRef(), + ) + + assertThat(roundtrippedPaymentReturnResponse).isEqualTo(paymentReturnResponse) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt index 016a1c062..4bc0c6ddc 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentTest.kt @@ -14,16 +14,16 @@ internal class PaymentTest { fun create() { val payment = Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -31,16 +31,16 @@ internal class PaymentTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -53,44 +53,44 @@ internal class PaymentTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() - assertThat(payment.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") + assertThat(payment.token()).isEqualTo("bd4efddb-771b-49e3-9af9-49b077ab5eb8") assertThat(payment.category()).isEqualTo(Payment.TransactionCategory.ACH) - assertThat(payment.created()).isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - assertThat(payment.descriptor()).isEqualTo("ach_origination_debit") - assertThat(payment.direction()).isEqualTo(Payment.Direction.DEBIT) + assertThat(payment.created()).isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + assertThat(payment.descriptor()).isEqualTo("ach_origination_credit") + assertThat(payment.direction()).isEqualTo(Payment.Direction.CREDIT) assertThat(payment.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build(), Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -98,7 +98,7 @@ internal class PaymentTest { ) assertThat(payment.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(payment.financialAccountToken()) - .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") + .isEqualTo("35b0c466-a3e3-519a-9549-ead6a6a2277d") assertThat(payment.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(payment.methodAttributes()) .isEqualTo( @@ -114,24 +114,24 @@ internal class PaymentTest { .build() ) ) - assertThat(payment.pendingAmount()).isEqualTo(1588L) + assertThat(payment.pendingAmount()).isEqualTo(-1588L) assertThat(payment.relatedAccountTokens()) - .isEqualTo( + .contains( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) assertThat(payment.result()).isEqualTo(Payment.TransactionResult.APPROVED) assertThat(payment.settledAmount()).isEqualTo(0L) assertThat(payment.source()).isEqualTo(Payment.Source.LITHIC) assertThat(payment.status()).isEqualTo(Payment.TransactionStatus.PENDING) - assertThat(payment.updated()).isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + assertThat(payment.updated()).isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:25Z")) assertThat(payment.currency()).contains("USD") assertThat(payment.expectedReleaseDate()).isEmpty assertThat(payment.externalBankAccountToken()) .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - assertThat(payment.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(payment.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) assertThat(payment.userDefinedId()).isEmpty } @@ -140,16 +140,16 @@ internal class PaymentTest { val jsonMapper = jsonMapper() val payment = Payment.builder() - .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") + .token("bd4efddb-771b-49e3-9af9-49b077ab5eb8") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) - .descriptor("ach_origination_debit") - .direction(Payment.Direction.DEBIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) + .descriptor("ach_origination_credit") + .direction(Payment.Direction.CREDIT) .addEvent( Payment.PaymentEvent.builder() - .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .token("327dccc3-fe42-54d2-962c-7f8135805464") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:22Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) @@ -157,16 +157,16 @@ internal class PaymentTest { ) .addEvent( Payment.PaymentEvent.builder() - .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") - .amount(1588L) - .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .token("f9165477-7cfc-53c6-98f1-84e9ec856a60") + .amount(-1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") + .financialAccountToken("35b0c466-a3e3-519a-9549-ead6a6a2277d") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() @@ -179,22 +179,22 @@ internal class PaymentTest { .addTraceNumber("string") .build() ) - .pendingAmount(1588L) + .pendingAmount(-1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") - .businessAccountToken(null) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) .result(Payment.TransactionResult.APPROVED) .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:25Z")) .currency("USD") .expectedReleaseDate(null) .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") - .type(Payment.TransferType.ORIGINATION_DEBIT) + .type(Payment.TransferType.ORIGINATION_CREDIT) .userDefinedId(null) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTest.kt index 812bcab7f..ee3f699f1 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTest.kt @@ -52,7 +52,7 @@ internal class StatementTest { .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentDueDate(LocalDate.parse("2019-12-27")) .periodTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -72,7 +72,7 @@ internal class StatementTest { .statementType(Statement.StatementType.INITIAL) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .ytdTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -90,14 +90,14 @@ internal class StatementTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -107,7 +107,7 @@ internal class StatementTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -161,7 +161,7 @@ internal class StatementTest { assertThat(statement.paymentDueDate()).contains(LocalDate.parse("2019-12-27")) assertThat(statement.periodTotals()) .isEqualTo( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -182,7 +182,7 @@ internal class StatementTest { assertThat(statement.updated()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) assertThat(statement.ytdTotals()) .isEqualTo( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -201,14 +201,14 @@ internal class StatementTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -218,7 +218,7 @@ internal class StatementTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -273,7 +273,7 @@ internal class StatementTest { .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentDueDate(LocalDate.parse("2019-12-27")) .periodTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -293,7 +293,7 @@ internal class StatementTest { .statementType(Statement.StatementType.INITIAL) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .ytdTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -311,14 +311,14 @@ internal class StatementTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -328,7 +328,7 @@ internal class StatementTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTotalsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTotalsTest.kt new file mode 100644 index 000000000..a89dd1a4f --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementTotalsTest.kt @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue +import com.lithic.api.core.jsonMapper +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class StatementTotalsTest { + + @Test + fun create() { + val statementTotals = + StatementTotals.builder() + .balanceTransfers(0L) + .cashAdvances(0L) + .credits(0L) + .debits(0L) + .fees(0L) + .interest(0L) + .payments(0L) + .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) + .build() + + assertThat(statementTotals.balanceTransfers()).isEqualTo(0L) + assertThat(statementTotals.cashAdvances()).isEqualTo(0L) + assertThat(statementTotals.credits()).isEqualTo(0L) + assertThat(statementTotals.debits()).isEqualTo(0L) + assertThat(statementTotals.fees()).isEqualTo(0L) + assertThat(statementTotals.interest()).isEqualTo(0L) + assertThat(statementTotals.payments()).isEqualTo(0L) + assertThat(statementTotals.purchases()).isEqualTo(0L) + assertThat(statementTotals._creditDetails()).isEqualTo(JsonValue.from(mapOf())) + assertThat(statementTotals._debitDetails()).isEqualTo(JsonValue.from(mapOf())) + assertThat(statementTotals._paymentDetails()) + .isEqualTo(JsonValue.from(mapOf())) + } + + @Test + fun roundtrip() { + val jsonMapper = jsonMapper() + val statementTotals = + StatementTotals.builder() + .balanceTransfers(0L) + .cashAdvances(0L) + .credits(0L) + .debits(0L) + .fees(0L) + .interest(0L) + .payments(0L) + .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) + .build() + + val roundtrippedStatementTotals = + jsonMapper.readValue( + jsonMapper.writeValueAsString(statementTotals), + jacksonTypeRef(), + ) + + assertThat(roundtrippedStatementTotals).isEqualTo(statementTotals) + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementsTest.kt index 26b2338a1..04c2aff8b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/StatementsTest.kt @@ -54,7 +54,7 @@ internal class StatementsTest { .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentDueDate(LocalDate.parse("2019-12-27")) .periodTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -74,7 +74,7 @@ internal class StatementsTest { .statementType(Statement.StatementType.INITIAL) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .ytdTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -92,14 +92,14 @@ internal class StatementsTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -109,7 +109,7 @@ internal class StatementsTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -165,7 +165,7 @@ internal class StatementsTest { .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentDueDate(LocalDate.parse("2019-12-27")) .periodTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -185,7 +185,7 @@ internal class StatementsTest { .statementType(Statement.StatementType.INITIAL) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .ytdTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -203,14 +203,14 @@ internal class StatementsTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -220,7 +220,7 @@ internal class StatementsTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -280,7 +280,7 @@ internal class StatementsTest { .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .paymentDueDate(LocalDate.parse("2019-12-27")) .periodTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -300,7 +300,7 @@ internal class StatementsTest { .statementType(Statement.StatementType.INITIAL) .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .ytdTotals( - Statement.StatementTotals.builder() + StatementTotals.builder() .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) @@ -318,14 +318,14 @@ internal class StatementsTest { Statement.InterestDetails.builder() .actualInterestCharged(0L) .dailyBalanceAmounts( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") .build() ) .effectiveApr( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") @@ -335,7 +335,7 @@ internal class StatementsTest { Statement.InterestDetails.InterestCalculationMethod.DAILY ) .interestForPeriod( - Statement.InterestDetails.CategoryDetails.builder() + CategoryDetails.builder() .balanceTransfers("balance_transfers") .cashAdvances("cash_advances") .purchases("purchases") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt index 79fd48f86..c45f7ac63 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionListPageResponseTest.kt @@ -17,46 +17,49 @@ internal class TransactionListPageResponseTest { TransactionListPageResponse.builder() .addData( Transaction.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .token("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") + .authorizationAmount(1800L) + .authorizationCode("071471") .avs( - Transaction.Avs.builder().address("address").zipcode("zipcode").build() + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() ) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -68,83 +71,81 @@ internal class TransactionListPageResponseTest { .SUCCESS ) .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES + Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK ) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift ._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING + Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator( - Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE - ) - .partialApprovalCapable(true) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) .pinCapability( - Transaction.Pos.PosTerminal.PinCapability.CAPABLE + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE ) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) - .status(Transaction.Status.SETTLED) + .settledAmount(0L) + .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - .updated(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .updated(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts .Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -153,7 +154,7 @@ internal class TransactionListPageResponseTest { Transaction.TransactionEvent.TransactionEventAmounts .Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -168,7 +169,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult( Transaction.TransactionEvent.DetailedResult.APPROVED ) @@ -180,12 +181,8 @@ internal class TransactionListPageResponseTest { .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer .builder() - .acquirerReferenceNumber( - "acquirer_reference_number" - ) - .retrievalReferenceNumber( - "retrieval_reference_number" - ) + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -197,14 +194,10 @@ internal class TransactionListPageResponseTest { .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard .builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber( - "original_switch_serial_number" - ) - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -227,7 +220,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -262,50 +255,55 @@ internal class TransactionListPageResponseTest { ) .build() ) - .hasMore(true) + .hasMore(false) .build() assertThat(transactionListPageResponse.data().getOrNull()) .containsExactly( Transaction.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .token("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -316,81 +314,79 @@ internal class TransactionListPageResponseTest { Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES + Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK ) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift ._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) .pinCapability( - Transaction.Pos.PosTerminal.PinCapability.CAPABLE + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE ) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) - .status(Transaction.Status.SETTLED) + .settledAmount(0L) + .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - .updated(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .updated(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts .Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -399,7 +395,7 @@ internal class TransactionListPageResponseTest { Transaction.TransactionEvent.TransactionEventAmounts .Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -414,15 +410,15 @@ internal class TransactionListPageResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -434,14 +430,10 @@ internal class TransactionListPageResponseTest { .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard .builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber( - "original_switch_serial_number" - ) - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -464,7 +456,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -499,7 +491,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - assertThat(transactionListPageResponse.hasMore()).contains(true) + assertThat(transactionListPageResponse.hasMore()).contains(false) } @Test @@ -509,46 +501,49 @@ internal class TransactionListPageResponseTest { TransactionListPageResponse.builder() .addData( Transaction.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .token("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") + .authorizationAmount(1800L) + .authorizationCode("071471") .avs( - Transaction.Avs.builder().address("address").zipcode("zipcode").build() + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() ) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -560,83 +555,81 @@ internal class TransactionListPageResponseTest { .SUCCESS ) .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES + Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK ) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift ._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING + Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator( - Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE - ) - .partialApprovalCapable(true) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) .pinCapability( - Transaction.Pos.PosTerminal.PinCapability.CAPABLE + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE ) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) - .status(Transaction.Status.SETTLED) + .settledAmount(0L) + .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - .updated(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .updated(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts .Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -645,7 +638,7 @@ internal class TransactionListPageResponseTest { Transaction.TransactionEvent.TransactionEventAmounts .Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -660,7 +653,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult( Transaction.TransactionEvent.DetailedResult.APPROVED ) @@ -672,12 +665,8 @@ internal class TransactionListPageResponseTest { .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer .builder() - .acquirerReferenceNumber( - "acquirer_reference_number" - ) - .retrievalReferenceNumber( - "retrieval_reference_number" - ) + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -689,14 +678,10 @@ internal class TransactionListPageResponseTest { .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard .builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber( - "original_switch_serial_number" - ) - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -719,7 +704,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -754,7 +739,7 @@ internal class TransactionListPageResponseTest { ) .build() ) - .hasMore(true) + .hasMore(false) .build() val roundtrippedTransactionListPageResponse = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt index 6e9f94807..5f7d563a5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransactionTest.kt @@ -15,44 +15,49 @@ internal class TransactionTest { fun create() { val transaction = Transaction.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .token("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -61,78 +66,76 @@ internal class TransactionTest { .authenticationResult( Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) - .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES - ) + .decisionMadeBy(Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) - .pinCapability(Transaction.Pos.PosTerminal.PinCapability.CAPABLE) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) + .pinCapability( + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE + ) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) - .status(Transaction.Status.SETTLED) + .settledAmount(0L) + .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - .updated(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .updated(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts.Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -140,7 +143,7 @@ internal class TransactionTest { .merchant( Transaction.TransactionEvent.TransactionEventAmounts.Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -154,15 +157,15 @@ internal class TransactionTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -173,12 +176,10 @@ internal class TransactionTest { ) .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard.builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber("original_switch_serial_number") - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -200,7 +201,7 @@ internal class TransactionTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -235,46 +236,48 @@ internal class TransactionTest { ) .build() - assertThat(transaction.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(transaction.accountToken()).isEqualTo("bd5e5649-1be8-4117-9bc5-3268258d1417") + assertThat(transaction.token()).isEqualTo("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + assertThat(transaction.accountToken()).isEqualTo("db3942f0-0627-4887-a190-1ea83b46d091") assertThat(transaction.acquirerFee()).contains(0L) - assertThat(transaction.acquirerReferenceNumber()).contains("12345678987654321234567") - assertThat(transaction.amount()).isEqualTo(1000L) + assertThat(transaction.acquirerReferenceNumber()).isEmpty + assertThat(transaction.amount()).isEqualTo(1800L) assertThat(transaction.amounts()) .isEqualTo( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - assertThat(transaction.authorizationAmount()).contains(1000L) - assertThat(transaction.authorizationCode()).contains("123456") + assertThat(transaction.authorizationAmount()).contains(1800L) + assertThat(transaction.authorizationCode()).contains("071471") assertThat(transaction.avs()) - .contains(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - assertThat(transaction.cardToken()).isEqualTo("19c22c47-7a75-43ee-9891-595419830f7e") + .contains( + Transaction.Avs.builder().address("123 Evergreen Terrace").zipcode("95006").build() + ) + assertThat(transaction.cardToken()).isEqualTo("aac502f9-aecc-458a-954e-4bcf6edb6123") assertThat(transaction.cardholderAuthentication()) .contains( Transaction.CardholderAuthentication.builder() @@ -284,83 +287,79 @@ internal class TransactionTest { .authenticationResult( Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) - .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES - ) + .decisionMadeBy(Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - assertThat(transaction.created()) - .isEqualTo(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + assertThat(transaction.created()).isEqualTo(OffsetDateTime.parse("2023-08-03T18:42:30Z")) assertThat(transaction.financialAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .contains("a3b113e8-01fe-42d3-b900-b9adf3f15496") assertThat(transaction.merchant()) .isEqualTo( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - assertThat(transaction.merchantAmount()).contains(1000L) - assertThat(transaction.merchantAuthorizationAmount()).contains(1000L) + assertThat(transaction.merchantAmount()).contains(1800L) + assertThat(transaction.merchantAuthorizationAmount()).contains(1800L) assertThat(transaction.merchantCurrency()).isEqualTo("USD") assertThat(transaction.network()).contains(Transaction.Network.MASTERCARD) - assertThat(transaction.networkRiskScore()).contains(0L) + assertThat(transaction.networkRiskScore()).contains(5L) assertThat(transaction.pos()) .isEqualTo( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder(Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) - .pinCapability(Transaction.Pos.PosTerminal.PinCapability.CAPABLE) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) + .pinCapability(Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) assertThat(transaction.result()).isEqualTo(Transaction.DeclineResult.APPROVED) - assertThat(transaction.settledAmount()).isEqualTo(1000L) - assertThat(transaction.status()).isEqualTo(Transaction.Status.SETTLED) + assertThat(transaction.settledAmount()).isEqualTo(0L) + assertThat(transaction.status()).isEqualTo(Transaction.Status.PENDING) assertThat(transaction.tokenInfo()) .contains( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - assertThat(transaction.updated()) - .isEqualTo(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + assertThat(transaction.updated()).isEqualTo(OffsetDateTime.parse("2023-08-03T18:42:30Z")) assertThat(transaction.events().getOrNull()) .containsExactly( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts.Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -368,7 +367,7 @@ internal class TransactionTest { .merchant( Transaction.TransactionEvent.TransactionEventAmounts.Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -382,15 +381,15 @@ internal class TransactionTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -401,12 +400,10 @@ internal class TransactionTest { ) .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard.builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber("original_switch_serial_number") - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -426,7 +423,7 @@ internal class TransactionTest { .result(Transaction.TransactionEvent.RuleResult.DetailedResult.APPROVED) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() @@ -466,44 +463,49 @@ internal class TransactionTest { val jsonMapper = jsonMapper() val transaction = Transaction.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountToken("bd5e5649-1be8-4117-9bc5-3268258d1417") + .token("c30c2182-1e69-4e0d-b40f-eec0d2a19123") + .accountToken("db3942f0-0627-4887-a190-1ea83b46d091") .acquirerFee(0L) - .acquirerReferenceNumber("12345678987654321234567") - .amount(1000L) + .acquirerReferenceNumber(null) + .amount(1800L) .amounts( Transaction.TransactionAmounts.builder() .cardholder( Transaction.TransactionAmounts.Cardholder.builder() - .amount(-1000L) + .amount(0L) .conversionRate("1.000000") .currency("USD") .build() ) .hold( Transaction.TransactionAmounts.Hold.builder() - .amount(0L) + .amount(-1800L) .currency("USD") .build() ) .merchant( Transaction.TransactionAmounts.Merchant.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .settlement( Transaction.TransactionAmounts.Settlement.builder() - .amount(-1000L) + .amount(0L) .currency("USD") .build() ) .build() ) - .authorizationAmount(1000L) - .authorizationCode("123456") - .avs(Transaction.Avs.builder().address("address").zipcode("zipcode").build()) - .cardToken("19c22c47-7a75-43ee-9891-595419830f7e") + .authorizationAmount(1800L) + .authorizationCode("071471") + .avs( + Transaction.Avs.builder() + .address("123 Evergreen Terrace") + .zipcode("95006") + .build() + ) + .cardToken("aac502f9-aecc-458a-954e-4bcf6edb6123") .cardholderAuthentication( Transaction.CardholderAuthentication.builder() .authenticationMethod( @@ -512,78 +514,76 @@ internal class TransactionTest { .authenticationResult( Transaction.CardholderAuthentication.AuthenticationResult.SUCCESS ) - .decisionMadeBy( - Transaction.CardholderAuthentication.DecisionMadeBy.LITHIC_RULES - ) + .decisionMadeBy(Transaction.CardholderAuthentication.DecisionMadeBy.NETWORK) .liabilityShift( Transaction.CardholderAuthentication.LiabilityShift._3DS_AUTHENTICATED ) - .threeDSAuthenticationToken("a6e372d0-b40a-43eb-b0d1-4e1aebef5875") + .threeDSAuthenticationToken("fc60d37d-95f7-419c-b628-dd9fbf9d80d0") .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) + .financialAccountToken("a3b113e8-01fe-42d3-b900-b9adf3f15496") .merchant( - Transaction.Merchant.builder() - .acceptorId("333301802529120") - .acquiringInstitutionId("191231") - .city("NEW YORK") + Merchant.builder() + .acceptorId("452322000053360") + .acquiringInstitutionId("333301802529120") + .city("gosq.com") .country("USA") - .descriptor("COFFEE SHOP") + .descriptor("SQ *SOMA EATS") .mcc("5812") - .state("NY") + .state("CA") .build() ) - .merchantAmount(1000L) - .merchantAuthorizationAmount(1000L) + .merchantAmount(1800L) + .merchantAuthorizationAmount(1800L) .merchantCurrency("USD") .network(Transaction.Network.MASTERCARD) - .networkRiskScore(0L) + .networkRiskScore(5L) .pos( Transaction.Pos.builder() .entryMode( Transaction.Pos.PosEntryMode.builder() .card(Transaction.Pos.PosEntryMode.Card.NOT_PRESENT) - .cardholder( - Transaction.Pos.PosEntryMode.Cardholder.DEFERRED_BILLING - ) - .pan(Transaction.Pos.PosEntryMode.Pan.AUTO_ENTRY) - .pinEntered(true) + .cardholder(Transaction.Pos.PosEntryMode.Cardholder.NOT_PRESENT) + .pan(Transaction.Pos.PosEntryMode.Pan.ECOMMERCE) + .pinEntered(false) .build() ) .terminal( Transaction.Pos.PosTerminal.builder() - .attended(true) - .cardRetentionCapable(true) - .onPremise(true) - .operator(Transaction.Pos.PosTerminal.Operator.ADMINISTRATIVE) - .partialApprovalCapable(true) - .pinCapability(Transaction.Pos.PosTerminal.PinCapability.CAPABLE) - .type(Transaction.Pos.PosTerminal.Type.ADMINISTRATIVE) + .attended(false) + .cardRetentionCapable(false) + .onPremise(false) + .operator(Transaction.Pos.PosTerminal.Operator.UNKNOWN) + .partialApprovalCapable(false) + .pinCapability( + Transaction.Pos.PosTerminal.PinCapability.NOT_CAPABLE + ) + .type(Transaction.Pos.PosTerminal.Type.UNKNOWN) .acceptorTerminalId("acceptor_terminal_id") .build() ) .build() ) .result(Transaction.DeclineResult.APPROVED) - .settledAmount(1000L) - .status(Transaction.Status.SETTLED) + .settledAmount(0L) + .status(Transaction.Status.PENDING) .tokenInfo( Transaction.TokenInfo.builder() .walletType(Transaction.TokenInfo.WalletType.APPLE_PAY) .build() ) - .updated(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .updated(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addEvent( Transaction.TransactionEvent.builder() - .token("0c2adae9-f535-4505-8c35-421dad9bd0b6") - .amount(1000L) + .token("bbbf1e86-322d-11ee-9779-00505685a123") + .amount(1800L) .amounts( Transaction.TransactionEvent.TransactionEventAmounts.builder() .cardholder( Transaction.TransactionEvent.TransactionEventAmounts.Cardholder .builder() - .amount(1000L) + .amount(1800L) .conversionRate("1.000000") .currency("USD") .build() @@ -591,7 +591,7 @@ internal class TransactionTest { .merchant( Transaction.TransactionEvent.TransactionEventAmounts.Merchant .builder() - .amount(1000L) + .amount(1800L) .currency("USD") .build() ) @@ -605,15 +605,15 @@ internal class TransactionTest { ) .build() ) - .created(OffsetDateTime.parse("2023-09-26T21:14:28.637Z")) + .created(OffsetDateTime.parse("2023-08-03T18:42:30Z")) .addDetailedResult(Transaction.TransactionEvent.DetailedResult.APPROVED) .effectivePolarity(Transaction.TransactionEvent.EffectivePolarity.DEBIT) .networkInfo( Transaction.TransactionEvent.NetworkInfo.builder() .acquirer( Transaction.TransactionEvent.NetworkInfo.Acquirer.builder() - .acquirerReferenceNumber("acquirer_reference_number") - .retrievalReferenceNumber("retrieval_reference_number") + .acquirerReferenceNumber(null) + .retrievalReferenceNumber("064386558597") .build() ) .amex( @@ -624,12 +624,10 @@ internal class TransactionTest { ) .mastercard( Transaction.TransactionEvent.NetworkInfo.Mastercard.builder() - .banknetReferenceNumber("banknet_reference_number") - .originalBanknetReferenceNumber( - "original_banknet_reference_number" - ) - .originalSwitchSerialNumber("original_switch_serial_number") - .switchSerialNumber("switch_serial_number") + .banknetReferenceNumber("U1HSCJ") + .originalBanknetReferenceNumber(null) + .originalSwitchSerialNumber(null) + .switchSerialNumber(null) .build() ) .visa( @@ -651,7 +649,7 @@ internal class TransactionTest { ) .build() ) - .type(Transaction.TransactionEvent.Type.CLEARING) + .type(Transaction.TransactionEvent.Type.AUTHORIZATION) .accountType(Transaction.TransactionEvent.AccountType.CHECKING) .networkSpecificData( Transaction.TransactionEvent.NetworkSpecificData.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt index 0ccaa543a..e2e033db9 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TransferTest.kt @@ -21,12 +21,12 @@ internal class TransferTest { .currency("currency") .descriptor("descriptor") .addEvent( - Transfer.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Transfer.FinancialEvent.Result.APPROVED) - .type(Transfer.FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .addFromBalance( @@ -71,12 +71,12 @@ internal class TransferTest { assertThat(transfer.descriptor()).contains("descriptor") assertThat(transfer.events().getOrNull()) .containsExactly( - Transfer.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Transfer.FinancialEvent.Result.APPROVED) - .type(Transfer.FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) assertThat(transfer.fromBalance().getOrNull()) @@ -127,12 +127,12 @@ internal class TransferTest { .currency("currency") .descriptor("descriptor") .addEvent( - Transfer.FinancialEvent.builder() + FinancialEvent.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .result(Transfer.FinancialEvent.Result.APPROVED) - .type(Transfer.FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) + .result(FinancialEvent.Result.APPROVED) + .type(FinancialEvent.FinancialEventType.ACH_ORIGINATION_CANCELLED) .build() ) .addFromBalance( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2CreateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2CreateResponseTest.kt index 09c55bae6..0480432b8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2CreateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2CreateResponseTest.kt @@ -25,7 +25,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -128,7 +128,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -144,7 +144,7 @@ internal class V2CreateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2DraftResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2DraftResponseTest.kt index c0110fe5e..a05541e5a 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2DraftResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2DraftResponseTest.kt @@ -25,7 +25,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -127,7 +127,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -143,7 +143,7 @@ internal class V2DraftResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResponseTest.kt index 1e493b163..a1ba25050 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ListResponseTest.kt @@ -25,7 +25,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -126,7 +126,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -142,7 +142,7 @@ internal class V2ListResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2PromoteResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2PromoteResponseTest.kt index d4d75e6f5..2ed88c3a5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2PromoteResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2PromoteResponseTest.kt @@ -25,7 +25,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -128,7 +128,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -144,7 +144,7 @@ internal class V2PromoteResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveResponseTest.kt index c39e741c6..e373da9c6 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveResponseTest.kt @@ -25,7 +25,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -128,7 +128,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -144,7 +144,7 @@ internal class V2RetrieveResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2UpdateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2UpdateResponseTest.kt index ea8faae31..7c9bcd271 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2UpdateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2UpdateResponseTest.kt @@ -25,7 +25,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -41,7 +41,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -74,7 +74,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -91,7 +91,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -128,7 +128,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -144,7 +144,7 @@ internal class V2UpdateResponseTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncTest.kt new file mode 100644 index 000000000..5c911e9bc --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/DisputesV2ServiceAsyncTest.kt @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.async + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClientAsync +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class DisputesV2ServiceAsyncTest { + + @Test + fun retrieve() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val disputesV2ServiceAsync = client.disputesV2() + + val disputeV2Future = + disputesV2ServiceAsync.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val disputeV2 = disputeV2Future.get() + disputeV2.validate() + } + + @Test + fun list() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val disputesV2ServiceAsync = client.disputesV2() + + val pageFuture = disputesV2ServiceAsync.list() + + val page = pageFuture.get() + page.response().validate() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncTest.kt index 0635a39c4..b98e3850d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncTest.kt @@ -183,4 +183,20 @@ internal class ExternalBankAccountServiceAsyncTest { val response = responseFuture.get() response.validate() } + + @Test + fun unpause() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val externalBankAccountServiceAsync = client.externalBankAccounts() + + val responseFuture = + externalBankAccountServiceAsync.unpause("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + val response = responseFuture.get() + response.validate() + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt index 5d1931d6a..7088c1c80 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/PaymentServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.lithic.api.services.async import com.lithic.api.TestServerExtension import com.lithic.api.client.okhttp.LithicOkHttpClientAsync import com.lithic.api.models.PaymentCreateParams +import com.lithic.api.models.PaymentReturnParams import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateReceiptParams import com.lithic.api.models.PaymentSimulateReleaseParams @@ -94,6 +95,31 @@ internal class PaymentServiceAsyncTest { response.validate() } + @Test + fun return_() { + val client = + LithicOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val paymentServiceAsync = client.payments() + + val responseFuture = + paymentServiceAsync.return_( + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .addenda("addenda") + .dateOfDeath(LocalDate.parse("2025-01-15")) + .memo("memo") + .build() + ) + + val response = responseFuture.get() + response.validate() + } + @Test fun simulateAction() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt index dd15a3896..26f9afcb5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncTest.kt @@ -12,6 +12,7 @@ import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.ConditionalAttribute import com.lithic.api.models.ConditionalBlockParameters +import com.lithic.api.models.ConditionalOperation import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -38,7 +39,7 @@ internal class V2ServiceAsyncTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -154,7 +155,7 @@ internal class V2ServiceAsyncTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceTest.kt new file mode 100644 index 000000000..f8923de2b --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/DisputesV2ServiceTest.kt @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.services.blocking + +import com.lithic.api.TestServerExtension +import com.lithic.api.client.okhttp.LithicOkHttpClient +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class DisputesV2ServiceTest { + + @Test + fun retrieve() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val disputesV2Service = client.disputesV2() + + val disputeV2 = disputesV2Service.retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + disputeV2.validate() + } + + @Test + fun list() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val disputesV2Service = client.disputesV2() + + val page = disputesV2Service.list() + + page.response().validate() + } +} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceTest.kt index d196c77e5..a1657b133 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/ExternalBankAccountServiceTest.kt @@ -177,4 +177,18 @@ internal class ExternalBankAccountServiceTest { response.validate() } + + @Test + fun unpause() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val externalBankAccountService = client.externalBankAccounts() + + val response = externalBankAccountService.unpause("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + + response.validate() + } } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt index 98223c548..e6b421c11 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt @@ -5,6 +5,7 @@ package com.lithic.api.services.blocking import com.lithic.api.TestServerExtension import com.lithic.api.client.okhttp.LithicOkHttpClient import com.lithic.api.models.PaymentCreateParams +import com.lithic.api.models.PaymentReturnParams import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateReceiptParams import com.lithic.api.models.PaymentSimulateReleaseParams @@ -90,6 +91,30 @@ internal class PaymentServiceTest { response.validate() } + @Test + fun return_() { + val client = + LithicOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My Lithic API Key") + .build() + val paymentService = client.payments() + + val response = + paymentService.return_( + PaymentReturnParams.builder() + .paymentToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .returnReasonCode("R01") + .addenda("addenda") + .dateOfDeath(LocalDate.parse("2025-01-15")) + .memo("memo") + .build() + ) + + response.validate() + } + @Test fun simulateAction() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt index 0bb661a3a..9ddbd7f05 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceTest.kt @@ -12,6 +12,7 @@ import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams import com.lithic.api.models.ConditionalAttribute import com.lithic.api.models.ConditionalBlockParameters +import com.lithic.api.models.ConditionalOperation import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -38,7 +39,7 @@ internal class V2ServiceTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) @@ -148,7 +149,7 @@ internal class V2ServiceTest { .addCondition( AuthRuleCondition.builder() .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) + .operation(ConditionalOperation.IS_ONE_OF) .value("string") .build() ) diff --git a/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt b/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt index 613a57bd8..cd6e5f2db 100644 --- a/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt +++ b/lithic-java-proguard-test/src/test/kotlin/com/lithic/api/proguard/ProGuardCompatibilityTest.kt @@ -62,6 +62,7 @@ internal class ProGuardCompatibilityTest { assertThat(client.balances()).isNotNull() assertThat(client.aggregateBalances()).isNotNull() assertThat(client.disputes()).isNotNull() + assertThat(client.disputesV2()).isNotNull() assertThat(client.events()).isNotNull() assertThat(client.transfers()).isNotNull() assertThat(client.financialAccounts()).isNotNull()