From a2bbd1301f29e85cdec582a799ef91255f35ddfa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 29 Oct 2025 21:54:25 +0000 Subject: [PATCH 1/6] chore(api): adds support for new ACH_RECEIPT_RELEASED event --- .stats.yml | 4 +- .../api/models/AccountActivityListResponse.kt | 6 + ...ountActivityRetrieveTransactionResponse.kt | 6 + .../lithic/api/models/FinancialTransaction.kt | 6 + .../kotlin/com/lithic/api/models/Payment.kt | 110 ++++++++++++------ .../lithic/api/models/StatementLineItems.kt | 6 + .../kotlin/com/lithic/api/models/Transfer.kt | 6 + .../models/AccountActivityListResponseTest.kt | 4 +- ...ActivityRetrieveTransactionResponseTest.kt | 4 +- .../api/models/PaymentCreateResponseTest.kt | 6 +- .../api/models/PaymentListPageResponseTest.kt | 10 +- .../api/models/PaymentRetryResponseTest.kt | 6 +- .../com/lithic/api/models/PaymentTest.kt | 6 +- 13 files changed, 126 insertions(+), 54 deletions(-) diff --git a/.stats.yml b/.stats.yml index f728fc48..1c59375b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 169 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-6432801dcf017d9234739b9f6153a8cfecd91255af4765f24ba5209f3e320b5c.yml -openapi_spec_hash: c2cfee2f044ba15d15b5bfdbd37280c0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-461a5622f5cf2e4e38fab8b899fa619cfa1bff349e3a485b8e4396c3d5b1282f.yml +openapi_spec_hash: 5314a4458e7ebfc7b374bca71966a6e4 config_hash: 8ac73ccdb428816c89c84802c794a3f8 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 5175793d..cb3b40b2 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 @@ -1679,6 +1679,8 @@ private constructor( @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") @@ -1817,6 +1819,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1901,6 +1904,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1987,6 +1991,7 @@ private constructor( 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 @@ -2071,6 +2076,7 @@ private constructor( 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 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 ebf79985..9535a0c5 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 @@ -1701,6 +1701,8 @@ private constructor( @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") @@ -1839,6 +1841,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1923,6 +1926,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -2009,6 +2013,7 @@ private constructor( 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 @@ -2093,6 +2098,7 @@ private constructor( 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 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 3b197901..2a7e97dc 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 @@ -1193,6 +1193,8 @@ private constructor( @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") @@ -1330,6 +1332,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1414,6 +1417,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1500,6 +1504,7 @@ private constructor( 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 @@ -1584,6 +1589,7 @@ private constructor( 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 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 d2a96521..9fdb0664 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 @@ -1421,7 +1421,7 @@ private constructor( private val amount: JsonField, private val created: JsonField, private val result: JsonField, - private val type: JsonField, + private val type: JsonField, private val detailedResults: JsonField>, private val additionalProperties: MutableMap, ) { @@ -1434,7 +1434,9 @@ private constructor( @ExcludeMissing created: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), + @JsonProperty("type") + @ExcludeMissing + type: JsonField = JsonMissing.of(), @JsonProperty("detailed_results") @ExcludeMissing detailedResults: JsonField> = JsonMissing.of(), @@ -1485,19 +1487,23 @@ private constructor( * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial - * Institution. + * * `ACH_ORIGINATION_REJECTED` - ACH origination was rejected and not sent to the Federal + * Reserve. * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository Financial + * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. + * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_SETTLED` - ACH return settled by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * 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 type(): Type = type.getRequired("type") + fun type(): PaymentEventType = type.getRequired("type") /** * More detailed reasons for the event @@ -1541,7 +1547,7 @@ private constructor( * * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [detailedResults]. @@ -1589,7 +1595,7 @@ private constructor( private var amount: JsonField? = null private var created: JsonField? = null private var result: JsonField? = null - private var type: JsonField? = null + private var type: JsonField? = null private var detailedResults: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @@ -1669,25 +1675,29 @@ private constructor( * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository - * Financial Institution. + * * `ACH_ORIGINATION_REJECTED` - ACH origination was rejected and not sent to the + * Federal Reserve. * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository + * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. + * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_SETTLED` - ACH return settled by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository * Financial Institution. */ - fun type(type: Type) = type(JsonField.of(type)) + fun type(type: PaymentEventType) = 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. + * You should usually call [Builder.type] with a well-typed [PaymentEventType] 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 type(type: JsonField) = apply { this.type = type } /** More detailed reasons for the event */ fun detailedResults(detailedResults: List) = @@ -1946,16 +1956,22 @@ private constructor( * * `ACH_ORIGINATION_SETTLED` - ACH origination has settled. * * `ACH_ORIGINATION_RELEASED` - ACH origination released from pending to available * balance. - * * `ACH_RETURN_PROCESSED` - ACH origination returned by the Receiving Depository Financial - * Institution. + * * `ACH_ORIGINATION_REJECTED` - ACH origination was rejected and not sent to the Federal + * Reserve. * * `ACH_RECEIPT_PROCESSED` - ACH receipt pending release from an ACH holder. - * * `ACH_RETURN_INITIATED` - ACH initiated return for a ACH receipt. * * `ACH_RECEIPT_SETTLED` - ACH receipt funds have settled. * * `ACH_RECEIPT_RELEASED` - ACH receipt released from pending to available balance. - * * `ACH_RETURN_SETTLED` - ACH receipt return settled by the Receiving Depository Financial + * * `ACH_RETURN_INITIATED` - ACH initiated return for an ACH receipt. + * * `ACH_RETURN_PROCESSED` - ACH receipt returned by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_SETTLED` - ACH return settled by the Receiving Depository Financial + * Institution. + * * `ACH_RETURN_REJECTED` - ACH return was rejected by the Receiving Depository Financial * Institution. */ - class Type @JsonCreator private constructor(private val value: JsonField) : Enum { + class PaymentEventType + @JsonCreator + private constructor(private val value: JsonField) : Enum { /** * Returns this class instance's raw value. @@ -1975,44 +1991,54 @@ private constructor( @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED") - @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED") + @JvmField val ACH_ORIGINATION_REJECTED = of("ACH_ORIGINATION_REJECTED") @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED") @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") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) + @JvmStatic fun of(value: String) = PaymentEventType(JsonField.of(value)) } - /** An enum containing [Type]'s known values. */ + /** An enum containing [PaymentEventType]'s known values. */ enum class Known { ACH_ORIGINATION_CANCELLED, ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, + ACH_ORIGINATION_REJECTED, ACH_ORIGINATION_RELEASED, 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, } /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [PaymentEventType]'s known values, as well as an [_UNKNOWN] + * member. * - * An instance of [Type] can contain an unknown value in a couple of cases: + * An instance of [PaymentEventType] 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. @@ -2022,15 +2048,21 @@ private constructor( ACH_ORIGINATION_CANCELLED, ACH_ORIGINATION_INITIATED, ACH_ORIGINATION_PROCESSED, - ACH_ORIGINATION_SETTLED, + ACH_ORIGINATION_REJECTED, ACH_ORIGINATION_RELEASED, 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, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ + /** + * An enum member indicating that [PaymentEventType] was instantiated with an + * unknown value. + */ _UNKNOWN, } @@ -2046,13 +2078,16 @@ private constructor( ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED + ACH_ORIGINATION_REJECTED -> Value.ACH_ORIGINATION_REJECTED ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED 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 else -> Value._UNKNOWN } @@ -2071,15 +2106,18 @@ private constructor( ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED - ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED + ACH_ORIGINATION_REJECTED -> Known.ACH_ORIGINATION_REJECTED ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED 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 - else -> throw LithicInvalidDataException("Unknown Type: $value") + else -> throw LithicInvalidDataException("Unknown PaymentEventType: $value") } /** @@ -2098,7 +2136,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Type = apply { + fun validate(): PaymentEventType = apply { if (validated) { return@apply } @@ -2128,7 +2166,7 @@ private constructor( return true } - return other is Type && value == other.value + return other is PaymentEventType && value == other.value } override fun hashCode() = value.hashCode() diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt index 6e0106d1..c09ed53a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt @@ -1072,6 +1072,8 @@ private constructor( @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") @@ -1209,6 +1211,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1293,6 +1296,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1379,6 +1383,7 @@ private constructor( 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 @@ -1463,6 +1468,7 @@ private constructor( 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 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 efba3688..18f5cee2 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 @@ -1232,6 +1232,8 @@ private constructor( @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") @@ -1369,6 +1371,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1453,6 +1456,7 @@ private constructor( ACH_ORIGINATION_REVIEWED, ACH_ORIGINATION_SETTLED, ACH_RECEIPT_PROCESSED, + ACH_RECEIPT_RELEASED, ACH_RECEIPT_SETTLED, ACH_RETURN_INITIATED, ACH_RETURN_PROCESSED, @@ -1539,6 +1543,7 @@ private constructor( 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 @@ -1623,6 +1628,7 @@ private constructor( 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 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 cd0f7246..7829a003 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 @@ -755,7 +755,7 @@ internal class AccountActivityListResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -819,7 +819,7 @@ internal class AccountActivityListResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .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 8ac38f28..4ce4db20 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 @@ -792,7 +792,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -857,7 +857,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) 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 c083391b..6d7482cb 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 @@ -26,7 +26,7 @@ internal class PaymentCreateResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -90,7 +90,7 @@ internal class PaymentCreateResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -166,7 +166,7 @@ internal class PaymentCreateResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) 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 17fa1c26..ece31b4c 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 @@ -28,7 +28,9 @@ internal class PaymentListPageResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type( + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED + ) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -82,7 +84,7 @@ internal class PaymentListPageResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -140,7 +142,9 @@ internal class PaymentListPageResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type( + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED + ) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .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 428d80cc..5ff6173a 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 @@ -26,7 +26,7 @@ internal class PaymentRetryResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -90,7 +90,7 @@ internal class PaymentRetryResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -166,7 +166,7 @@ internal class PaymentRetryResponseTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) 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 c781f31b..a6bf50ba 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 @@ -26,7 +26,7 @@ internal class PaymentTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -75,7 +75,7 @@ internal class PaymentTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) @@ -134,7 +134,7 @@ internal class PaymentTest { .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.Type.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) From 77574272ea9690f4822524663854b13be0b4a5f1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 02:32:24 +0000 Subject: [PATCH 2/6] docs(client): update readme timeout snippet --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 55f8ed5a..d3900198 100644 --- a/README.md +++ b/README.md @@ -416,11 +416,9 @@ Requests time out after 1 minute by default. To set a custom timeout, configure the method call using the `timeout` method: ```java -import com.lithic.api.models.Card; +import com.lithic.api.models.CardListPage; -Card card = client.cards().create( - params, RequestOptions.builder().timeout(Duration.ofSeconds(30)).build() -); +CardListPage page = client.cards().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build()); ``` Or configure the default for all method calls at the client level: From b21d55ce251d33366456db9f99bb4c4ac2cbc9fc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Nov 2025 05:19:05 +0000 Subject: [PATCH 3/6] feat(api): deprecate auth rule apply endpoint and fix several schemas --- .stats.yml | 8 +- ...tHolderSimulateEnrollmentReviewResponse.kt | 11 +- .../api/models/AccountHolderUpdateResponse.kt | 22 +- .../api/models/AuthRuleV2ApplyParams.kt | 1179 ---- .../lithic/api/models/BookTransferResponse.kt | 41 +- .../kotlin/com/lithic/api/models/Dispute.kt | 4957 +++++++++++++--- .../api/models/DisputeCreateResponse.kt | 1737 ++++++ .../api/models/DisputeDeleteResponse.kt | 1737 ++++++ .../com/lithic/api/models/DisputeListPage.kt | 9 +- .../lithic/api/models/DisputeListPageAsync.kt | 10 +- .../api/models/DisputeListPageResponse.kt | 26 +- .../lithic/api/models/DisputeListResponse.kt | 1737 ++++++ .../api/models/DisputeRetrieveResponse.kt | 1737 ++++++ .../api/models/DisputeUpdateResponse.kt | 1737 ++++++ .../kotlin/com/lithic/api/models/Event.kt | 457 +- .../com/lithic/api/models/EventListParams.kt | 203 +- .../lithic/api/models/EventSubscription.kt | 203 +- .../models/EventSubscriptionCreateParams.kt | 203 +- ...tSubscriptionSendSimulatedExampleParams.kt | 117 +- .../models/EventSubscriptionUpdateParams.kt | 203 +- .../com/lithic/api/models/FinancialAccount.kt | 450 +- .../models/FinancialAccountCreditConfig.kt | 430 +- .../kotlin/com/lithic/api/models/Payment.kt | 98 +- .../api/models/PaymentSimulateActionParams.kt | 163 +- .../com/lithic/api/models/V2ApplyResponse.kt | 5233 ----------------- .../api/models/V2RetrieveFeaturesResponse.kt | 25 +- .../lithic/api/models/VelocityLimitParams.kt | 23 +- .../models/VelocityLimitParamsPeriodWindow.kt | 611 +- .../api/services/async/DisputeServiceAsync.kt | 111 +- .../services/async/DisputeServiceAsyncImpl.kt | 34 +- .../async/authRules/V2ServiceAsync.kt | 68 - .../async/authRules/V2ServiceAsyncImpl.kt | 45 - .../api/services/blocking/DisputeService.kt | 103 +- .../services/blocking/DisputeServiceImpl.kt | 46 +- .../services/blocking/authRules/V2Service.kt | 66 - .../blocking/authRules/V2ServiceImpl.kt | 42 - .../models/AccountActivityListResponseTest.kt | 112 +- ...ActivityRetrieveTransactionResponseTest.kt | 112 +- .../AccountHolderListDocumentsResponseTest.kt | 58 +- ...ulateEnrollmentDocumentReviewParamsTest.kt | 10 +- .../api/models/AuthRuleV2ApplyParamsTest.kt | 83 - .../api/models/AuthRuleV2ListParamsTest.kt | 12 +- .../BookTransferListPageResponseTest.kt | 6 +- .../api/models/BookTransferResponseTest.kt | 6 +- .../api/models/DisputeCreateResponseTest.kt | 102 + .../api/models/DisputeDeleteResponseTest.kt | 102 + .../api/models/DisputeListPageResponseTest.kt | 24 +- .../api/models/DisputeListResponseTest.kt | 101 + .../api/models/DisputeRetrieveResponseTest.kt | 103 + .../com/lithic/api/models/DisputeTest.kt | 212 +- .../api/models/DisputeUpdateResponseTest.kt | 102 + .../com/lithic/api/models/DocumentTest.kt | 54 +- .../api/models/EventListPageResponseTest.kt | 6 +- .../lithic/api/models/EventListParamsTest.kt | 6 +- .../EventSubscriptionCreateParamsTest.kt | 10 +- .../EventSubscriptionListPageResponseTest.kt | 6 +- ...scriptionSendSimulatedExampleParamsTest.kt | 13 +- .../api/models/EventSubscriptionTest.kt | 6 +- .../EventSubscriptionUpdateParamsTest.kt | 10 +- .../kotlin/com/lithic/api/models/EventTest.kt | 6 +- .../ExternalBankAccountCreateParamsTest.kt | 78 +- .../FinancialAccountCreditConfigTest.kt | 11 - .../FinancialAccountListPageResponseTest.kt | 29 - .../lithic/api/models/FinancialAccountTest.kt | 25 - .../FinancialAccountUpdateStatusParamsTest.kt | 16 +- .../api/models/PaymentCreateResponseTest.kt | 164 +- .../api/models/PaymentListPageResponseTest.kt | 167 +- .../api/models/PaymentRetryResponseTest.kt | 164 +- .../models/PaymentSimulateActionParamsTest.kt | 7 + .../com/lithic/api/models/PaymentTest.kt | 163 +- ...tlementNetworkTotalListPageResponseTest.kt | 289 +- .../lithic/api/models/V2ApplyResponseTest.kt | 172 - .../models/V2RetrieveFeaturesResponseTest.kt | 25 +- .../VelocityLimitParamsPeriodWindowTest.kt | 102 +- .../api/models/VelocityLimitParamsTest.kt | 23 +- .../async/AccountHolderServiceAsyncTest.kt | 2 +- .../ExternalBankAccountServiceAsyncTest.kt | 26 +- .../async/FinancialAccountServiceAsyncTest.kt | 4 +- .../services/async/PaymentServiceAsyncTest.kt | 3 + .../async/authRules/V2ServiceAsyncTest.kt | 27 - .../events/SubscriptionServiceAsyncTest.kt | 11 +- .../blocking/AccountHolderServiceTest.kt | 2 +- .../ExternalBankAccountServiceTest.kt | 26 +- .../blocking/FinancialAccountServiceTest.kt | 4 +- .../services/blocking/PaymentServiceTest.kt | 3 + .../blocking/authRules/V2ServiceTest.kt | 26 - .../events/SubscriptionServiceTest.kt | 11 +- 87 files changed, 16184 insertions(+), 10540 deletions(-) delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateResponse.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteResponse.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListResponse.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveResponse.kt create mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateResponse.kt delete mode 100644 lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ApplyParamsTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeCreateResponseTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeDeleteResponseTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListResponseTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeRetrieveResponseTest.kt create mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeUpdateResponseTest.kt delete mode 100644 lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ApplyResponseTest.kt diff --git a/.stats.yml b/.stats.yml index 1c59375b..b4f9cef2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 169 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-461a5622f5cf2e4e38fab8b899fa619cfa1bff349e3a485b8e4396c3d5b1282f.yml -openapi_spec_hash: 5314a4458e7ebfc7b374bca71966a6e4 -config_hash: 8ac73ccdb428816c89c84802c794a3f8 +configured_endpoints: 168 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-c10c01eac94b422808bb16cc1044c67c980791b6d1360b01628d13c5a745dfeb.yml +openapi_spec_hash: 9e6642fdb875a6aa6037c107917ebff4 +config_hash: 0b45ea129fca7c4755ef61eb97baa096 diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt index f1a26683..2a9e0c44 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentReviewResponse.kt @@ -678,8 +678,15 @@ private constructor( * businesses. Pass the account_token of the enrolled business associated with the * AUTHORIZED_USER in this field. */ - fun businessAccountToken(businessAccountToken: String) = - businessAccountToken(JsonField.of(businessAccountToken)) + fun businessAccountToken(businessAccountToken: String?) = + businessAccountToken(JsonField.ofNullable(businessAccountToken)) + + /** + * Alias for calling [Builder.businessAccountToken] with + * `businessAccountToken.orElse(null)`. + */ + fun businessAccountToken(businessAccountToken: Optional) = + businessAccountToken(businessAccountToken.getOrNull()) /** * Sets [Builder.businessAccountToken] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt index 68ca9170..9178f9da 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateResponse.kt @@ -866,8 +866,15 @@ private constructor( * users of businesses. Pass the account_token of the enrolled business associated with * the AUTHORIZED_USER in this field. */ - fun businessAccountToken(businessAccountToken: String) = - businessAccountToken(JsonField.of(businessAccountToken)) + fun businessAccountToken(businessAccountToken: String?) = + businessAccountToken(JsonField.ofNullable(businessAccountToken)) + + /** + * Alias for calling [Builder.businessAccountToken] with + * `businessAccountToken.orElse(null)`. + */ + fun businessAccountToken(businessAccountToken: Optional) = + businessAccountToken(businessAccountToken.getOrNull()) /** * Sets [Builder.businessAccountToken] to an arbitrary JSON value. @@ -3994,8 +4001,15 @@ private constructor( fun address(address: JsonField
) = apply { this.address = address } /** The token for the business account that the account holder is associated with */ - fun businessAccountToken(businessAccountToken: String) = - businessAccountToken(JsonField.of(businessAccountToken)) + fun businessAccountToken(businessAccountToken: String?) = + businessAccountToken(JsonField.ofNullable(businessAccountToken)) + + /** + * Alias for calling [Builder.businessAccountToken] with + * `businessAccountToken.orElse(null)`. + */ + fun businessAccountToken(businessAccountToken: Optional) = + businessAccountToken(businessAccountToken.getOrNull()) /** * Sets [Builder.businessAccountToken] to an arbitrary JSON value. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt deleted file mode 100644 index a20c0cc7..00000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ApplyParams.kt +++ /dev/null @@ -1,1179 +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.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.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.allMaxBy -import com.lithic.api.core.checkKnown -import com.lithic.api.core.checkRequired -import com.lithic.api.core.getOrThrow -import com.lithic.api.core.http.Headers -import com.lithic.api.core.http.QueryParams -import com.lithic.api.core.toImmutable -import com.lithic.api.errors.LithicInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Associates a V2 Auth rule with a card program, the provided account(s) or card(s). - * - * Prefer using the `PATCH` method for this operation. - */ -@Deprecated("deprecated") -class AuthRuleV2ApplyParams -private constructor( - private val authRuleToken: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun authRuleToken(): Optional = Optional.ofNullable(authRuleToken) - - fun body(): Body = body - - /** 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 [AuthRuleV2ApplyParams]. - * - * The following fields are required: - * ```java - * .body() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AuthRuleV2ApplyParams]. */ - class Builder internal constructor() { - - private var authRuleToken: String? = null - private var body: Body? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(authRuleV2ApplyParams: AuthRuleV2ApplyParams) = apply { - authRuleToken = authRuleV2ApplyParams.authRuleToken - body = authRuleV2ApplyParams.body - additionalHeaders = authRuleV2ApplyParams.additionalHeaders.toBuilder() - additionalQueryParams = authRuleV2ApplyParams.additionalQueryParams.toBuilder() - } - - fun authRuleToken(authRuleToken: String?) = apply { this.authRuleToken = authRuleToken } - - /** Alias for calling [Builder.authRuleToken] with `authRuleToken.orElse(null)`. */ - fun authRuleToken(authRuleToken: Optional) = - authRuleToken(authRuleToken.getOrNull()) - - fun body(body: Body) = apply { this.body = body } - - /** - * Alias for calling [body] with - * `Body.ofApplyAuthRuleRequestAccountTokens(applyAuthRuleRequestAccountTokens)`. - */ - fun body(applyAuthRuleRequestAccountTokens: Body.ApplyAuthRuleRequestAccountTokens) = - body(Body.ofApplyAuthRuleRequestAccountTokens(applyAuthRuleRequestAccountTokens)) - - /** - * Alias for calling [body] with - * `Body.ofApplyAuthRuleRequestCardTokens(applyAuthRuleRequestCardTokens)`. - */ - fun body(applyAuthRuleRequestCardTokens: Body.ApplyAuthRuleRequestCardTokens) = - body(Body.ofApplyAuthRuleRequestCardTokens(applyAuthRuleRequestCardTokens)) - - /** - * Alias for calling [body] with - * `Body.ofApplyAuthRuleRequestProgramLevel(applyAuthRuleRequestProgramLevel)`. - */ - fun body(applyAuthRuleRequestProgramLevel: Body.ApplyAuthRuleRequestProgramLevel) = - body(Body.ofApplyAuthRuleRequestProgramLevel(applyAuthRuleRequestProgramLevel)) - - 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 [AuthRuleV2ApplyParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .body() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): AuthRuleV2ApplyParams = - AuthRuleV2ApplyParams( - authRuleToken, - checkRequired("body", body), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> authRuleToken ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - @JsonDeserialize(using = Body.Deserializer::class) - @JsonSerialize(using = Body.Serializer::class) - class Body - private constructor( - private val applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens? = null, - private val applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens? = null, - private val applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel? = null, - private val _json: JsonValue? = null, - ) { - - fun applyAuthRuleRequestAccountTokens(): Optional = - Optional.ofNullable(applyAuthRuleRequestAccountTokens) - - fun applyAuthRuleRequestCardTokens(): Optional = - Optional.ofNullable(applyAuthRuleRequestCardTokens) - - fun applyAuthRuleRequestProgramLevel(): Optional = - Optional.ofNullable(applyAuthRuleRequestProgramLevel) - - fun isApplyAuthRuleRequestAccountTokens(): Boolean = - applyAuthRuleRequestAccountTokens != null - - fun isApplyAuthRuleRequestCardTokens(): Boolean = applyAuthRuleRequestCardTokens != null - - fun isApplyAuthRuleRequestProgramLevel(): Boolean = applyAuthRuleRequestProgramLevel != null - - fun asApplyAuthRuleRequestAccountTokens(): ApplyAuthRuleRequestAccountTokens = - applyAuthRuleRequestAccountTokens.getOrThrow("applyAuthRuleRequestAccountTokens") - - fun asApplyAuthRuleRequestCardTokens(): ApplyAuthRuleRequestCardTokens = - applyAuthRuleRequestCardTokens.getOrThrow("applyAuthRuleRequestCardTokens") - - fun asApplyAuthRuleRequestProgramLevel(): ApplyAuthRuleRequestProgramLevel = - applyAuthRuleRequestProgramLevel.getOrThrow("applyAuthRuleRequestProgramLevel") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - applyAuthRuleRequestAccountTokens != null -> - visitor.visitApplyAuthRuleRequestAccountTokens( - applyAuthRuleRequestAccountTokens - ) - applyAuthRuleRequestCardTokens != null -> - visitor.visitApplyAuthRuleRequestCardTokens(applyAuthRuleRequestCardTokens) - applyAuthRuleRequestProgramLevel != null -> - visitor.visitApplyAuthRuleRequestProgramLevel(applyAuthRuleRequestProgramLevel) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitApplyAuthRuleRequestAccountTokens( - applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens - ) { - applyAuthRuleRequestAccountTokens.validate() - } - - override fun visitApplyAuthRuleRequestCardTokens( - applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens - ) { - applyAuthRuleRequestCardTokens.validate() - } - - override fun visitApplyAuthRuleRequestProgramLevel( - applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel - ) { - applyAuthRuleRequestProgramLevel.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 visitApplyAuthRuleRequestAccountTokens( - applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens - ) = applyAuthRuleRequestAccountTokens.validity() - - override fun visitApplyAuthRuleRequestCardTokens( - applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens - ) = applyAuthRuleRequestCardTokens.validity() - - override fun visitApplyAuthRuleRequestProgramLevel( - applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel - ) = applyAuthRuleRequestProgramLevel.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - applyAuthRuleRequestAccountTokens == other.applyAuthRuleRequestAccountTokens && - applyAuthRuleRequestCardTokens == other.applyAuthRuleRequestCardTokens && - applyAuthRuleRequestProgramLevel == other.applyAuthRuleRequestProgramLevel - } - - override fun hashCode(): Int = - Objects.hash( - applyAuthRuleRequestAccountTokens, - applyAuthRuleRequestCardTokens, - applyAuthRuleRequestProgramLevel, - ) - - override fun toString(): String = - when { - applyAuthRuleRequestAccountTokens != null -> - "Body{applyAuthRuleRequestAccountTokens=$applyAuthRuleRequestAccountTokens}" - applyAuthRuleRequestCardTokens != null -> - "Body{applyAuthRuleRequestCardTokens=$applyAuthRuleRequestCardTokens}" - applyAuthRuleRequestProgramLevel != null -> - "Body{applyAuthRuleRequestProgramLevel=$applyAuthRuleRequestProgramLevel}" - _json != null -> "Body{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Body") - } - - companion object { - - @JvmStatic - fun ofApplyAuthRuleRequestAccountTokens( - applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens - ) = Body(applyAuthRuleRequestAccountTokens = applyAuthRuleRequestAccountTokens) - - @JvmStatic - fun ofApplyAuthRuleRequestCardTokens( - applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens - ) = Body(applyAuthRuleRequestCardTokens = applyAuthRuleRequestCardTokens) - - @JvmStatic - fun ofApplyAuthRuleRequestProgramLevel( - applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel - ) = Body(applyAuthRuleRequestProgramLevel = applyAuthRuleRequestProgramLevel) - } - - /** An interface that defines how to map each variant of [Body] to a value of type [T]. */ - interface Visitor { - - fun visitApplyAuthRuleRequestAccountTokens( - applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens - ): T - - fun visitApplyAuthRuleRequestCardTokens( - applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens - ): T - - fun visitApplyAuthRuleRequestProgramLevel( - applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel - ): T - - /** - * Maps an unknown variant of [Body] to a value of type [T]. - * - * An instance of [Body] 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 Body: $json") - } - } - - internal class Deserializer : BaseDeserializer(Body::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Body { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Body(applyAuthRuleRequestAccountTokens = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(applyAuthRuleRequestCardTokens = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Body(applyAuthRuleRequestProgramLevel = 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 -> Body(_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(Body::class) { - - override fun serialize( - value: Body, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.applyAuthRuleRequestAccountTokens != null -> - generator.writeObject(value.applyAuthRuleRequestAccountTokens) - value.applyAuthRuleRequestCardTokens != null -> - generator.writeObject(value.applyAuthRuleRequestCardTokens) - value.applyAuthRuleRequestProgramLevel != null -> - generator.writeObject(value.applyAuthRuleRequestProgramLevel) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Body") - } - } - } - - class ApplyAuthRuleRequestAccountTokens - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val accountTokens: JsonField>, - private val businessAccountTokens: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("account_tokens") - @ExcludeMissing - accountTokens: JsonField> = JsonMissing.of(), - @JsonProperty("business_account_tokens") - @ExcludeMissing - businessAccountTokens: JsonField> = JsonMissing.of(), - ) : this(accountTokens, businessAccountTokens, mutableMapOf()) - - /** - * Account tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun accountTokens(): Optional> = - accountTokens.getOptional("account_tokens") - - /** - * Business Account tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun businessAccountTokens(): Optional> = - businessAccountTokens.getOptional("business_account_tokens") - - /** - * Returns the raw JSON value of [accountTokens]. - * - * Unlike [accountTokens], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("account_tokens") - @ExcludeMissing - fun _accountTokens(): JsonField> = accountTokens - - /** - * Returns the raw JSON value of [businessAccountTokens]. - * - * Unlike [businessAccountTokens], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("business_account_tokens") - @ExcludeMissing - fun _businessAccountTokens(): JsonField> = businessAccountTokens - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of - * [ApplyAuthRuleRequestAccountTokens]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ApplyAuthRuleRequestAccountTokens]. */ - class Builder internal constructor() { - - private var accountTokens: JsonField>? = null - private var businessAccountTokens: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - applyAuthRuleRequestAccountTokens: ApplyAuthRuleRequestAccountTokens - ) = apply { - accountTokens = - applyAuthRuleRequestAccountTokens.accountTokens.map { it.toMutableList() } - businessAccountTokens = - applyAuthRuleRequestAccountTokens.businessAccountTokens.map { - it.toMutableList() - } - additionalProperties = - applyAuthRuleRequestAccountTokens.additionalProperties.toMutableMap() - } - - /** Account tokens to which the Auth Rule applies. */ - fun accountTokens(accountTokens: List) = - accountTokens(JsonField.of(accountTokens)) - - /** - * Sets [Builder.accountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.accountTokens] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun accountTokens(accountTokens: JsonField>) = apply { - this.accountTokens = accountTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [accountTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addAccountToken(accountToken: String) = apply { - accountTokens = - (accountTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("accountTokens", it).add(accountToken) - } - } - - /** Business Account tokens to which the Auth Rule applies. */ - fun businessAccountTokens(businessAccountTokens: List) = - businessAccountTokens(JsonField.of(businessAccountTokens)) - - /** - * Sets [Builder.businessAccountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.businessAccountTokens] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun businessAccountTokens(businessAccountTokens: JsonField>) = apply { - this.businessAccountTokens = businessAccountTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [businessAccountTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addBusinessAccountToken(businessAccountToken: String) = apply { - businessAccountTokens = - (businessAccountTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("businessAccountTokens", it).add(businessAccountToken) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - 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 [ApplyAuthRuleRequestAccountTokens]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): ApplyAuthRuleRequestAccountTokens = - ApplyAuthRuleRequestAccountTokens( - (accountTokens ?: JsonMissing.of()).map { it.toImmutable() }, - (businessAccountTokens ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ApplyAuthRuleRequestAccountTokens = apply { - if (validated) { - return@apply - } - - accountTokens() - businessAccountTokens() - 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 = - (accountTokens.asKnown().getOrNull()?.size ?: 0) + - (businessAccountTokens.asKnown().getOrNull()?.size ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ApplyAuthRuleRequestAccountTokens && - accountTokens == other.accountTokens && - businessAccountTokens == other.businessAccountTokens && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(accountTokens, businessAccountTokens, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ApplyAuthRuleRequestAccountTokens{accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, additionalProperties=$additionalProperties}" - } - - class ApplyAuthRuleRequestCardTokens - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val cardTokens: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_tokens") - @ExcludeMissing - cardTokens: JsonField> = JsonMissing.of() - ) : this(cardTokens, mutableMapOf()) - - /** - * Card tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardTokens(): List = cardTokens.getRequired("card_tokens") - - /** - * Returns the raw JSON value of [cardTokens]. - * - * Unlike [cardTokens], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_tokens") - @ExcludeMissing - fun _cardTokens(): JsonField> = cardTokens - - @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 - * [ApplyAuthRuleRequestCardTokens]. - * - * The following fields are required: - * ```java - * .cardTokens() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ApplyAuthRuleRequestCardTokens]. */ - class Builder internal constructor() { - - private var cardTokens: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(applyAuthRuleRequestCardTokens: ApplyAuthRuleRequestCardTokens) = - apply { - cardTokens = - applyAuthRuleRequestCardTokens.cardTokens.map { it.toMutableList() } - additionalProperties = - applyAuthRuleRequestCardTokens.additionalProperties.toMutableMap() - } - - /** Card tokens to which the Auth Rule applies. */ - fun cardTokens(cardTokens: List) = cardTokens(JsonField.of(cardTokens)) - - /** - * Sets [Builder.cardTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.cardTokens] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun cardTokens(cardTokens: JsonField>) = apply { - this.cardTokens = cardTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [cardTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCardToken(cardToken: String) = apply { - cardTokens = - (cardTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("cardTokens", it).add(cardToken) - } - } - - 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 [ApplyAuthRuleRequestCardTokens]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .cardTokens() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ApplyAuthRuleRequestCardTokens = - ApplyAuthRuleRequestCardTokens( - checkRequired("cardTokens", cardTokens).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ApplyAuthRuleRequestCardTokens = apply { - if (validated) { - return@apply - } - - cardTokens() - 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 = (cardTokens.asKnown().getOrNull()?.size ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ApplyAuthRuleRequestCardTokens && - cardTokens == other.cardTokens && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(cardTokens, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ApplyAuthRuleRequestCardTokens{cardTokens=$cardTokens, additionalProperties=$additionalProperties}" - } - - class ApplyAuthRuleRequestProgramLevel - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val programLevel: JsonField, - private val excludedCardTokens: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("program_level") - @ExcludeMissing - programLevel: JsonField = JsonMissing.of(), - @JsonProperty("excluded_card_tokens") - @ExcludeMissing - excludedCardTokens: JsonField> = JsonMissing.of(), - ) : this(programLevel, excludedCardTokens, mutableMapOf()) - - /** - * Whether the Auth Rule applies to all authorizations on the card program. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun programLevel(): Boolean = programLevel.getRequired("program_level") - - /** - * Card tokens to which the Auth Rule does not apply. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun excludedCardTokens(): Optional> = - excludedCardTokens.getOptional("excluded_card_tokens") - - /** - * Returns the raw JSON value of [programLevel]. - * - * Unlike [programLevel], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("program_level") - @ExcludeMissing - fun _programLevel(): JsonField = programLevel - - /** - * Returns the raw JSON value of [excludedCardTokens]. - * - * Unlike [excludedCardTokens], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("excluded_card_tokens") - @ExcludeMissing - fun _excludedCardTokens(): JsonField> = excludedCardTokens - - @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 - * [ApplyAuthRuleRequestProgramLevel]. - * - * The following fields are required: - * ```java - * .programLevel() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ApplyAuthRuleRequestProgramLevel]. */ - class Builder internal constructor() { - - private var programLevel: JsonField? = null - private var excludedCardTokens: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - applyAuthRuleRequestProgramLevel: ApplyAuthRuleRequestProgramLevel - ) = apply { - programLevel = applyAuthRuleRequestProgramLevel.programLevel - excludedCardTokens = - applyAuthRuleRequestProgramLevel.excludedCardTokens.map { - it.toMutableList() - } - additionalProperties = - applyAuthRuleRequestProgramLevel.additionalProperties.toMutableMap() - } - - /** Whether the Auth Rule applies to all authorizations on the card program. */ - fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel)) - - /** - * Sets [Builder.programLevel] to an arbitrary JSON value. - * - * You should usually call [Builder.programLevel] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun programLevel(programLevel: JsonField) = apply { - this.programLevel = programLevel - } - - /** Card tokens to which the Auth Rule does not apply. */ - fun excludedCardTokens(excludedCardTokens: List) = - excludedCardTokens(JsonField.of(excludedCardTokens)) - - /** - * Sets [Builder.excludedCardTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.excludedCardTokens] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun excludedCardTokens(excludedCardTokens: JsonField>) = apply { - this.excludedCardTokens = excludedCardTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludedCardTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludedCardToken(excludedCardToken: String) = apply { - excludedCardTokens = - (excludedCardTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("excludedCardTokens", it).add(excludedCardToken) - } - } - - 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 [ApplyAuthRuleRequestProgramLevel]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .programLevel() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ApplyAuthRuleRequestProgramLevel = - ApplyAuthRuleRequestProgramLevel( - checkRequired("programLevel", programLevel), - (excludedCardTokens ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ApplyAuthRuleRequestProgramLevel = apply { - if (validated) { - return@apply - } - - programLevel() - excludedCardTokens() - 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 (programLevel.asKnown().isPresent) 1 else 0) + - (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ApplyAuthRuleRequestProgramLevel && - programLevel == other.programLevel && - excludedCardTokens == other.excludedCardTokens && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(programLevel, excludedCardTokens, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ApplyAuthRuleRequestProgramLevel{programLevel=$programLevel, excludedCardTokens=$excludedCardTokens, additionalProperties=$additionalProperties}" - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is AuthRuleV2ApplyParams && - authRuleToken == other.authRuleToken && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(authRuleToken, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "AuthRuleV2ApplyParams{authRuleToken=$authRuleToken, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} 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 d261530e..e3b8e21b 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 @@ -998,7 +998,7 @@ private constructor( private val token: JsonField, private val amount: JsonField, private val created: JsonField, - private val detailedResults: JsonField, + private val detailedResults: JsonField>, private val memo: JsonField, private val result: JsonField, private val subtype: JsonField, @@ -1015,7 +1015,7 @@ private constructor( created: JsonField = JsonMissing.of(), @JsonProperty("detailed_results") @ExcludeMissing - detailedResults: JsonField = JsonMissing.of(), + detailedResults: JsonField> = JsonMissing.of(), @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), @JsonProperty("result") @ExcludeMissing result: JsonField = JsonMissing.of(), @JsonProperty("subtype") @ExcludeMissing subtype: JsonField = JsonMissing.of(), @@ -1063,7 +1063,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 detailedResults(): BookTransferDetailedResults = + fun detailedResults(): List = detailedResults.getRequired("detailed_results") /** @@ -1128,7 +1128,7 @@ private constructor( */ @JsonProperty("detailed_results") @ExcludeMissing - fun _detailedResults(): JsonField = detailedResults + fun _detailedResults(): JsonField> = detailedResults /** * Returns the raw JSON value of [memo]. @@ -1196,7 +1196,7 @@ private constructor( private var token: JsonField? = null private var amount: JsonField? = null private var created: JsonField? = null - private var detailedResults: JsonField? = null + private var detailedResults: JsonField>? = null private var memo: JsonField? = null private var result: JsonField? = null private var subtype: JsonField? = null @@ -1208,7 +1208,7 @@ private constructor( token = bookTransferEvent.token amount = bookTransferEvent.amount created = bookTransferEvent.created - detailedResults = bookTransferEvent.detailedResults + detailedResults = bookTransferEvent.detailedResults.map { it.toMutableList() } memo = bookTransferEvent.memo result = bookTransferEvent.result subtype = bookTransferEvent.subtype @@ -1255,18 +1255,31 @@ private constructor( */ fun created(created: JsonField) = apply { this.created = created } - fun detailedResults(detailedResults: BookTransferDetailedResults) = + fun detailedResults(detailedResults: List) = detailedResults(JsonField.of(detailedResults)) /** * Sets [Builder.detailedResults] to an arbitrary JSON value. * * You should usually call [Builder.detailedResults] with a well-typed - * [BookTransferDetailedResults] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. */ - fun detailedResults(detailedResults: JsonField) = apply { - this.detailedResults = detailedResults + fun detailedResults(detailedResults: JsonField>) = + apply { + this.detailedResults = detailedResults.map { it.toMutableList() } + } + + /** + * Adds a single [BookTransferDetailedResults] to [detailedResults]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addDetailedResult(detailedResult: BookTransferDetailedResults) = apply { + detailedResults = + (detailedResults ?: JsonField.of(mutableListOf())).also { + checkKnown("detailedResults", it).add(detailedResult) + } } /** Memo for the transfer. */ @@ -1363,7 +1376,7 @@ private constructor( checkRequired("token", token), checkRequired("amount", amount), checkRequired("created", created), - checkRequired("detailedResults", detailedResults), + checkRequired("detailedResults", detailedResults).map { it.toImmutable() }, checkRequired("memo", memo), checkRequired("result", result), checkRequired("subtype", subtype), @@ -1382,7 +1395,7 @@ private constructor( token() amount() created() - detailedResults().validate() + detailedResults().forEach { it.validate() } memo() result().validate() subtype() @@ -1409,7 +1422,7 @@ private constructor( (if (token.asKnown().isPresent) 1 else 0) + (if (amount.asKnown().isPresent) 1 else 0) + (if (created.asKnown().isPresent) 1 else 0) + - (detailedResults.asKnown().getOrNull()?.validity() ?: 0) + + (detailedResults.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (memo.asKnown().isPresent) 1 else 0) + (result.asKnown().getOrNull()?.validity() ?: 0) + (if (subtype.asKnown().isPresent) 1 else 0) + 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 d98b3826..e331a51d 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,13 +6,24 @@ 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 @@ -21,103 +32,75 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Dispute. */ +/** The Dispute object tracks the progression of a dispute throughout its lifecycle. */ class Dispute @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val token: JsonField, - private val amount: JsonField, - private val arbitrationDate: JsonField, + private val accountToken: JsonField, + private val cardToken: JsonField, + private val caseId: 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 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 transactionToken: JsonField, + private val transactionSeries: JsonField, + private val updated: 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") + @JsonProperty("account_token") @ExcludeMissing - arbitrationDate: JsonField = JsonMissing.of(), + 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("customer_filed_date") + @JsonProperty("currency") @ExcludeMissing currency: JsonField = JsonMissing.of(), + @JsonProperty("disposition") @ExcludeMissing - customerFiledDate: JsonField = JsonMissing.of(), - @JsonProperty("customer_note") + disposition: JsonField = JsonMissing.of(), + @JsonProperty("events") @ExcludeMissing events: JsonField> = JsonMissing.of(), + @JsonProperty("liability_allocation") @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(), + 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_token") + @JsonProperty("transaction_series") + @ExcludeMissing + transactionSeries: JsonField = JsonMissing.of(), + @JsonProperty("updated") @ExcludeMissing - transactionToken: JsonField = JsonMissing.of(), + updated: JsonField = JsonMissing.of(), ) : this( token, - amount, - arbitrationDate, + accountToken, + cardToken, + caseId, created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, + currency, + disposition, + events, + liabilityAllocation, + merchant, + network, status, - transactionToken, + transactionSeries, + updated, mutableMapOf(), ) /** - * Globally unique identifier. + * 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). @@ -125,187 +108,109 @@ private constructor( fun token(): String = token.getRequired("token") /** - * Amount under dispute. May be different from the original transaction amount. + * 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 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") + fun accountToken(): String = accountToken.getRequired("account_token") /** - * Timestamp of when first Dispute was reported. + * 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 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") + fun cardToken(): String = cardToken.getRequired("card_token") /** - * Unique identifiers for the dispute from the network. + * 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 networkClaimIds(): Optional> = networkClaimIds.getOptional("network_claim_ids") + fun caseId(): Optional = caseId.getOptional("case_id") /** - * Date that the dispute was submitted to the network. + * When the dispute was created. * - * @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 networkFiledDate(): Optional = - networkFiledDate.getOptional("network_filed_date") + fun created(): OffsetDateTime = created.getRequired("created") /** - * Network reason code used to file the dispute. + * Three-letter ISO 4217 currency code. * - * @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 networkReasonCode(): Optional = networkReasonCode.getOptional("network_reason_code") + fun currency(): String = currency.getRequired("currency") /** - * Date dispute entered pre-arbitration. + * Dispute resolution outcome * * @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") + fun disposition(): Optional = disposition.getOptional("disposition") /** - * Unique identifier for the dispute from the network. If there are multiple, this will be the - * first claim id set by the network + * Chronological list of events that have occurred in the dispute lifecycle * - * @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 primaryClaimId(): Optional = primaryClaimId.getOptional("primary_claim_id") + fun events(): List = events.getRequired("events") /** - * 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. + * 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 reason(): Reason = reason.getRequired("reason") + fun liabilityAllocation(): LiabilityAllocation = + liabilityAllocation.getRequired("liability_allocation") /** - * 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). + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - fun representmentDate(): Optional = - representmentDate.getOptional("representment_date") + fun merchant(): Merchant = merchant.getRequired("merchant") /** - * Date that the dispute was resolved. + * Card network handling the dispute. * - * @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 resolutionDate(): Optional = resolutionDate.getOptional("resolution_date") + fun network(): Network = network.getRequired("network") /** - * Note by Dispute team on the case resolution. + * 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 resolutionNote(): Optional = resolutionNote.getOptional("resolution_note") + fun status(): Optional = status.getOptional("status") /** - * 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. + * 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 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") + fun transactionSeries(): Optional = + transactionSeries.getOptional("transaction_series") /** - * The transaction that is being disputed. A transaction can only be disputed once but may have - * multiple dispute cases. + * 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 transactionToken(): String = transactionToken.getRequired("transaction_token") + fun updated(): OffsetDateTime = updated.getRequired("updated") /** * Returns the raw JSON value of [token]. @@ -315,156 +220,105 @@ private constructor( @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]. + * Returns the raw JSON value of [accountToken]. * - * Unlike [arbitrationDate], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [accountToken], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("arbitration_date") + @JsonProperty("account_token") @ExcludeMissing - fun _arbitrationDate(): JsonField = arbitrationDate + fun _accountToken(): JsonField = accountToken /** - * Returns the raw JSON value of [created]. + * Returns the raw JSON value of [cardToken]. * - * Unlike [created], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [cardToken], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created + @JsonProperty("card_token") @ExcludeMissing fun _cardToken(): JsonField = cardToken /** - * Returns the raw JSON value of [customerFiledDate]. + * Returns the raw JSON value of [caseId]. * - * Unlike [customerFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [caseId], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("customer_filed_date") - @ExcludeMissing - fun _customerFiledDate(): JsonField = customerFiledDate + @JsonProperty("case_id") @ExcludeMissing fun _caseId(): JsonField = caseId /** - * Returns the raw JSON value of [customerNote]. + * Returns the raw JSON value of [created]. * - * Unlike [customerNote], 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("customer_note") - @ExcludeMissing - fun _customerNote(): JsonField = customerNote + @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created /** - * Returns the raw JSON value of [networkClaimIds]. + * Returns the raw JSON value of [currency]. * - * Unlike [networkClaimIds], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("network_claim_ids") - @ExcludeMissing - fun _networkClaimIds(): JsonField> = networkClaimIds + @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency /** - * Returns the raw JSON value of [networkFiledDate]. + * Returns the raw JSON value of [disposition]. * - * Unlike [networkFiledDate], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [disposition], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("network_filed_date") + @JsonProperty("disposition") @ExcludeMissing - fun _networkFiledDate(): JsonField = networkFiledDate + fun _disposition(): JsonField = disposition /** - * Returns the raw JSON value of [networkReasonCode]. + * Returns the raw JSON value of [events]. * - * Unlike [networkReasonCode], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [events], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("network_reason_code") - @ExcludeMissing - fun _networkReasonCode(): JsonField = networkReasonCode + @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events /** - * Returns the raw JSON value of [prearbitrationDate]. + * Returns the raw JSON value of [liabilityAllocation]. * - * Unlike [prearbitrationDate], this method doesn't throw if the JSON field has an unexpected + * Unlike [liabilityAllocation], 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") + @JsonProperty("liability_allocation") @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 + fun _liabilityAllocation(): JsonField = liabilityAllocation /** - * Returns the raw JSON value of [representmentDate]. + * Returns the raw JSON value of [merchant]. * - * Unlike [representmentDate], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("representment_date") - @ExcludeMissing - fun _representmentDate(): JsonField = representmentDate + @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant /** - * Returns the raw JSON value of [resolutionDate]. + * Returns the raw JSON value of [network]. * - * Unlike [resolutionDate], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [network], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("resolution_date") - @ExcludeMissing - fun _resolutionDate(): JsonField = resolutionDate + @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network /** - * Returns the raw JSON value of [resolutionNote]. + * Returns the raw JSON value of [status]. * - * Unlike [resolutionNote], this method doesn't throw if the JSON field has an unexpected type. + * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("resolution_note") - @ExcludeMissing - fun _resolutionNote(): JsonField = resolutionNote + @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status /** - * Returns the raw JSON value of [resolutionReason]. + * Returns the raw JSON value of [transactionSeries]. * - * Unlike [resolutionReason], this method doesn't throw if the JSON field has an unexpected + * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("resolution_reason") + @JsonProperty("transaction_series") @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 + fun _transactionSeries(): JsonField = transactionSeries /** - * Returns the raw JSON value of [transactionToken]. + * Returns the raw JSON value of [updated]. * - * Unlike [transactionToken], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("transaction_token") - @ExcludeMissing - fun _transactionToken(): JsonField = transactionToken + @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -486,23 +340,19 @@ private constructor( * The following fields are required: * ```java * .token() - * .amount() - * .arbitrationDate() + * .accountToken() + * .cardToken() + * .caseId() * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() + * .currency() + * .disposition() + * .events() + * .liabilityAllocation() + * .merchant() + * .network() * .status() - * .transactionToken() + * .transactionSeries() + * .updated() * ``` */ @JvmStatic fun builder() = Builder() @@ -512,49 +362,41 @@ private constructor( class Builder internal constructor() { private var token: JsonField? = null - private var amount: JsonField? = null - private var arbitrationDate: JsonField? = null + private var accountToken: JsonField? = null + private var cardToken: JsonField? = null + private var caseId: 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 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 transactionToken: JsonField? = null + private var transactionSeries: JsonField? = null + private var updated: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(dispute: Dispute) = apply { token = dispute.token - amount = dispute.amount - arbitrationDate = dispute.arbitrationDate + accountToken = dispute.accountToken + cardToken = dispute.cardToken + caseId = dispute.caseId created = dispute.created - 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 + currency = dispute.currency + disposition = dispute.disposition + events = dispute.events.map { it.toMutableList() } + liabilityAllocation = dispute.liabilityAllocation + merchant = dispute.merchant + network = dispute.network status = dispute.status - transactionToken = dispute.transactionToken + transactionSeries = dispute.transactionSeries + updated = dispute.updated additionalProperties = dispute.additionalProperties.toMutableMap() } - /** Globally unique identifier. */ + /** Token assigned by Lithic for the dispute, in UUID format. */ fun token(token: String) = token(JsonField.of(token)) /** @@ -565,37 +407,47 @@ private constructor( */ 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)) + /** Token for the account associated with the dispute, in UUID format. */ + fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken)) /** - * Sets [Builder.amount] to an arbitrary JSON value. + * Sets [Builder.accountToken] 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. + * 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 amount(amount: JsonField) = apply { this.amount = amount } + fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken } - /** Date dispute entered arbitration. */ - fun arbitrationDate(arbitrationDate: OffsetDateTime?) = - arbitrationDate(JsonField.ofNullable(arbitrationDate)) + /** Identifier assigned by the network for this dispute. */ + fun caseId(caseId: String?) = caseId(JsonField.ofNullable(caseId)) - /** Alias for calling [Builder.arbitrationDate] with `arbitrationDate.orElse(null)`. */ - fun arbitrationDate(arbitrationDate: Optional) = - arbitrationDate(arbitrationDate.getOrNull()) + /** Alias for calling [Builder.caseId] with `caseId.orElse(null)`. */ + fun caseId(caseId: Optional) = caseId(caseId.getOrNull()) /** - * Sets [Builder.arbitrationDate] to an arbitrary JSON value. + * Sets [Builder.caseId] 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. + * 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 arbitrationDate(arbitrationDate: JsonField) = apply { - this.arbitrationDate = arbitrationDate - } + fun caseId(caseId: JsonField) = apply { this.caseId = caseId } - /** Timestamp of when first Dispute was reported. */ + /** When the dispute was created. */ fun created(created: OffsetDateTime) = created(JsonField.of(created)) /** @@ -607,315 +459,144 @@ private constructor( */ 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()) + /** Three-letter ISO 4217 currency code. */ + fun currency(currency: String) = currency(JsonField.of(currency)) /** - * Sets [Builder.customerNote] to an arbitrary JSON value. + * Sets [Builder.currency] 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. + * 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 customerNote(customerNote: JsonField) = apply { - this.customerNote = customerNote - } + fun currency(currency: JsonField) = apply { this.currency = currency } - /** Unique identifiers for the dispute from the network. */ - fun networkClaimIds(networkClaimIds: List?) = - networkClaimIds(JsonField.ofNullable(networkClaimIds)) + /** Dispute resolution outcome */ + fun disposition(disposition: Disposition?) = disposition(JsonField.ofNullable(disposition)) - /** Alias for calling [Builder.networkClaimIds] with `networkClaimIds.orElse(null)`. */ - fun networkClaimIds(networkClaimIds: Optional>) = - networkClaimIds(networkClaimIds.getOrNull()) + /** Alias for calling [Builder.disposition] with `disposition.orElse(null)`. */ + fun disposition(disposition: Optional) = disposition(disposition.getOrNull()) /** - * Sets [Builder.networkClaimIds] to an arbitrary JSON value. + * Sets [Builder.disposition] to an arbitrary JSON value. * - * You should usually call [Builder.networkClaimIds] with a well-typed `List` 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 networkClaimIds(networkClaimIds: JsonField>) = apply { - this.networkClaimIds = networkClaimIds.map { it.toMutableList() } + fun disposition(disposition: JsonField) = apply { + this.disposition = disposition } - /** - * 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()) + /** Chronological list of events that have occurred in the dispute lifecycle */ + fun events(events: List) = events(JsonField.of(events)) /** - * Sets [Builder.networkFiledDate] to an arbitrary JSON value. + * Sets [Builder.events] 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. + * 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 networkFiledDate(networkFiledDate: JsonField) = apply { - this.networkFiledDate = networkFiledDate + fun events(events: JsonField>) = apply { + this.events = events.map { it.toMutableList() } } - /** 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. + * Adds a single [Event] to [events]. * - * 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. + * @throws IllegalStateException if the field was previously set to a non-list. */ - fun networkReasonCode(networkReasonCode: JsonField) = apply { - this.networkReasonCode = networkReasonCode + fun addEvent(event: Event) = apply { + events = + (events ?: JsonField.of(mutableListOf())).also { + checkKnown("events", it).add(event) + } } - /** 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()) + /** Current breakdown of how liability is allocated for the disputed amount */ + fun liabilityAllocation(liabilityAllocation: LiabilityAllocation) = + liabilityAllocation(JsonField.of(liabilityAllocation)) /** - * Sets [Builder.prearbitrationDate] to an arbitrary JSON value. + * Sets [Builder.liabilityAllocation] 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. + * 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 prearbitrationDate(prearbitrationDate: JsonField) = apply { - this.prearbitrationDate = prearbitrationDate + fun liabilityAllocation(liabilityAllocation: JsonField) = apply { + this.liabilityAllocation = liabilityAllocation } - /** - * 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()) + fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant)) /** - * Sets [Builder.primaryClaimId] to an arbitrary JSON value. + * Sets [Builder.merchant] 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. + * 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 primaryClaimId(primaryClaimId: JsonField) = apply { - this.primaryClaimId = primaryClaimId - } + fun merchant(merchant: JsonField) = apply { this.merchant = merchant } - /** - * 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)) + /** Card network handling the dispute. */ + fun network(network: Network) = network(JsonField.of(network)) /** - * Sets [Builder.reason] to an arbitrary JSON value. + * Sets [Builder.network] to an arbitrary JSON value. * - * You should usually call [Builder.reason] with a well-typed [Reason] value instead. This + * 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 reason(reason: JsonField) = apply { this.reason = reason } + fun network(network: JsonField) = apply { this.network = network } - /** Date the representment was received. */ - fun representmentDate(representmentDate: OffsetDateTime?) = - representmentDate(JsonField.ofNullable(representmentDate)) + /** Current status of the dispute. */ + fun status(status: Status?) = status(JsonField.ofNullable(status)) - /** Alias for calling [Builder.representmentDate] with `representmentDate.orElse(null)`. */ - fun representmentDate(representmentDate: Optional) = - representmentDate(representmentDate.getOrNull()) + /** Alias for calling [Builder.status] with `status.orElse(null)`. */ + fun status(status: Optional) = status(status.getOrNull()) /** - * Sets [Builder.representmentDate] to an arbitrary JSON value. + * Sets [Builder.status] 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. + * 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 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()) + fun status(status: JsonField) = apply { this.status = status } /** - * 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. + * Contains identifiers for the transaction and specific event within being disputed; null + * if no transaction can be identified */ - fun resolutionDate(resolutionDate: JsonField) = apply { - this.resolutionDate = resolutionDate - } + fun transactionSeries(transactionSeries: TransactionSeries?) = + transactionSeries(JsonField.ofNullable(transactionSeries)) - /** 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()) + /** Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`. */ + fun transactionSeries(transactionSeries: Optional) = + transactionSeries(transactionSeries.getOrNull()) /** - * Sets [Builder.resolutionNote] to an arbitrary JSON value. + * Sets [Builder.transactionSeries] 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] + * 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 resolutionReason(resolutionReason: JsonField) = apply { - this.resolutionReason = resolutionReason + fun transactionSeries(transactionSeries: JsonField) = apply { + this.transactionSeries = transactionSeries } - /** - * 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)) + /** When the dispute was last updated. */ + fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated)) /** - * Sets [Builder.transactionToken] to an arbitrary JSON value. + * Sets [Builder.updated] to an arbitrary JSON value. * - * You should usually call [Builder.transactionToken] with a well-typed [String] 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 transactionToken(transactionToken: JsonField) = apply { - this.transactionToken = transactionToken - } + fun updated(updated: JsonField) = apply { this.updated = updated } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -944,23 +625,19 @@ private constructor( * The following fields are required: * ```java * .token() - * .amount() - * .arbitrationDate() + * .accountToken() + * .cardToken() + * .caseId() * .created() - * .customerFiledDate() - * .customerNote() - * .networkClaimIds() - * .networkFiledDate() - * .networkReasonCode() - * .prearbitrationDate() - * .primaryClaimId() - * .reason() - * .representmentDate() - * .resolutionDate() - * .resolutionNote() - * .resolutionReason() + * .currency() + * .disposition() + * .events() + * .liabilityAllocation() + * .merchant() + * .network() * .status() - * .transactionToken() + * .transactionSeries() + * .updated() * ``` * * @throws IllegalStateException if any required field is unset. @@ -968,23 +645,19 @@ private constructor( fun build(): Dispute = Dispute( checkRequired("token", token), - checkRequired("amount", amount), - checkRequired("arbitrationDate", arbitrationDate), + checkRequired("accountToken", accountToken), + checkRequired("cardToken", cardToken), + checkRequired("caseId", caseId), 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("currency", currency), + checkRequired("disposition", disposition), + checkRequired("events", events).map { it.toImmutable() }, + checkRequired("liabilityAllocation", liabilityAllocation), + checkRequired("merchant", merchant), + checkRequired("network", network), checkRequired("status", status), - checkRequired("transactionToken", transactionToken), + checkRequired("transactionSeries", transactionSeries), + checkRequired("updated", updated), additionalProperties.toMutableMap(), ) } @@ -997,23 +670,19 @@ private constructor( } token() - amount() - arbitrationDate() + accountToken() + cardToken() + caseId() created() - customerFiledDate() - customerNote() - networkClaimIds() - networkFiledDate() - networkReasonCode() - prearbitrationDate() - primaryClaimId() - reason().validate() - representmentDate() - resolutionDate() - resolutionNote() - resolutionReason().ifPresent { it.validate() } - status().validate() - transactionToken() + 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 } @@ -1033,42 +702,23 @@ private constructor( @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 (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 (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) + + (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) + - (if (transactionToken.asKnown().isPresent) 1 else 0) + (transactionSeries.asKnown().getOrNull()?.validity() ?: 0) + + (if (updated.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 { + /** Dispute resolution outcome */ + class Disposition @JsonCreator private constructor(private val value: JsonField) : + Enum { /** * Returns this class instance's raw value. @@ -1082,81 +732,46 @@ private constructor( companion object { - @JvmField val ATM_CASH_MISDISPENSE = of("ATM_CASH_MISDISPENSE") - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val DUPLICATED = of("DUPLICATED") + @JvmField val WON = of("WON") - @JvmField val FRAUD_CARD_NOT_PRESENT = of("FRAUD_CARD_NOT_PRESENT") + @JvmField val LOST = of("LOST") - @JvmField val FRAUD_CARD_PRESENT = of("FRAUD_CARD_PRESENT") + @JvmField val PARTIALLY_WON = of("PARTIALLY_WON") - @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 WITHDRAWN = of("WITHDRAWN") - @JvmField val REFUND_NOT_PROCESSED = of("REFUND_NOT_PROCESSED") + @JvmField val DENIED = of("DENIED") - @JvmStatic fun of(value: String) = Reason(JsonField.of(value)) + @JvmStatic fun of(value: String) = Disposition(JsonField.of(value)) } - /** An enum containing [Reason]'s known values. */ + /** An enum containing [Disposition]'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, + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, } /** - * An enum containing [Reason]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Disposition]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Reason] can contain an unknown value in a couple of cases: + * 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 { - 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. */ + WON, + LOST, + PARTIALLY_WON, + WITHDRAWN, + DENIED, + /** + * An enum member indicating that [Disposition] was instantiated with an unknown value. + */ _UNKNOWN, } @@ -1169,20 +784,11 @@ private constructor( */ 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 + WON -> Value.WON + LOST -> Value.LOST + PARTIALLY_WON -> Value.PARTIALLY_WON + WITHDRAWN -> Value.WITHDRAWN + DENIED -> Value.DENIED else -> Value._UNKNOWN } @@ -1197,21 +803,12 @@ private constructor( */ 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") + WON -> Known.WON + LOST -> Known.LOST + PARTIALLY_WON -> Known.PARTIALLY_WON + WITHDRAWN -> Known.WITHDRAWN + DENIED -> Known.DENIED + else -> throw LithicInvalidDataException("Unknown Disposition: $value") } /** @@ -1228,7 +825,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Reason = apply { + fun validate(): Disposition = apply { if (validated) { return@apply } @@ -1258,7 +855,7 @@ private constructor( return true } - return other is Reason && value == other.value + return other is Disposition && value == other.value } override fun hashCode() = value.hashCode() @@ -1266,132 +863,3227 @@ private constructor( 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 { + /** 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()) /** - * Returns this class instance's raw value. + * Unique identifier for the event, in UUID format * - * 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. + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value + fun token(): String = token.getRequired("token") - companion object { - - @JvmField val CASE_LOST = of("CASE_LOST") + /** + * 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") - @JvmField val NETWORK_REJECTED = of("NETWORK_REJECTED") + /** + * 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 NO_DISPUTE_RIGHTS_3DS = of("NO_DISPUTE_RIGHTS_3DS") + /** + * 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 NO_DISPUTE_RIGHTS_BELOW_THRESHOLD = of("NO_DISPUTE_RIGHTS_BELOW_THRESHOLD") + /** + * 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_CONTACTLESS = of("NO_DISPUTE_RIGHTS_CONTACTLESS") + /** + * 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_HYBRID = of("NO_DISPUTE_RIGHTS_HYBRID") + /** + * 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_MAX_CHARGEBACKS = of("NO_DISPUTE_RIGHTS_MAX_CHARGEBACKS") + /** + * 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_OTHER = of("NO_DISPUTE_RIGHTS_OTHER") + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } - @JvmField val PAST_FILING_DATE = of("PAST_FILING_DATE") + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) - @JvmField val PREARBITRATION_REJECTED = of("PREARBITRATION_REJECTED") + fun toBuilder() = Builder().from(this) - @JvmField val PROCESSOR_REJECTED_OTHER = of("PROCESSOR_REJECTED_OTHER") + companion object { - @JvmField val REFUNDED = of("REFUNDED") + /** + * 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 REFUNDED_AFTER_CHARGEBACK = of("REFUNDED_AFTER_CHARGEBACK") + /** 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 WITHDRAWN = of("WITHDRAWN") + /** Unique identifier for the event, in UUID format */ + fun token(token: String) = token(JsonField.of(token)) - @JvmField val WON_ARBITRATION = of("WON_ARBITRATION") + /** + * 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}" + } - @JvmField val WON_FIRST_CHARGEBACK = of("WON_FIRST_CHARGEBACK") + /** Card network handling the dispute. */ + class Network @JsonCreator private constructor(private val value: JsonField) : Enum { - @JvmField val WON_PREARBITRATION = of("WON_PREARBITRATION") + /** + * 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") - @JvmStatic fun of(value: String) = ResolutionReason(JsonField.of(value)) + @JvmField val MASTERCARD = of("MASTERCARD") + + @JvmStatic fun of(value: String) = Network(JsonField.of(value)) } - /** An enum containing [ResolutionReason]'s known values. */ + /** An enum containing [Network]'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, + VISA, + MASTERCARD, } /** - * An enum containing [ResolutionReason]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Network]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [ResolutionReason] can contain an unknown value in a couple of cases: + * 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 { - 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. - */ + VISA, + MASTERCARD, + /** An enum member indicating that [Network] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1404,23 +4096,8 @@ private constructor( */ 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 + VISA -> Value.VISA + MASTERCARD -> Value.MASTERCARD else -> Value._UNKNOWN } @@ -1435,24 +4112,9 @@ private constructor( */ 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") + VISA -> Known.VISA + MASTERCARD -> Known.MASTERCARD + else -> throw LithicInvalidDataException("Unknown Network: $value") } /** @@ -1469,7 +4131,7 @@ private constructor( private var validated: Boolean = false - fun validate(): ResolutionReason = apply { + fun validate(): Network = apply { if (validated) { return@apply } @@ -1499,7 +4161,7 @@ private constructor( return true } - return other is ResolutionReason && value == other.value + return other is Network && value == other.value } override fun hashCode() = value.hashCode() @@ -1507,17 +4169,7 @@ private constructor( 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. - */ + /** Current status of the dispute. */ class Status @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -1532,35 +4184,17 @@ private constructor( companion object { - @JvmField val ARBITRATION = of("ARBITRATION") - - @JvmField val CASE_CLOSED = of("CASE_CLOSED") - - @JvmField val CASE_WON = of("CASE_WON") + @JvmField val OPEN = of("OPEN") - @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") + @JvmField val CLOSED = of("CLOSED") @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, + OPEN, + CLOSED, } /** @@ -1573,14 +4207,8 @@ private constructor( * - 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, + OPEN, + CLOSED, /** An enum member indicating that [Status] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1594,14 +4222,8 @@ private constructor( */ 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 + OPEN -> Value.OPEN + CLOSED -> Value.CLOSED else -> Value._UNKNOWN } @@ -1616,14 +4238,8 @@ private constructor( */ 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 + OPEN -> Known.OPEN + CLOSED -> Known.CLOSED else -> throw LithicInvalidDataException("Unknown Status: $value") } @@ -1679,6 +4295,411 @@ 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 @@ -1686,46 +4707,38 @@ private constructor( return other is Dispute && token == other.token && - amount == other.amount && - arbitrationDate == other.arbitrationDate && + accountToken == other.accountToken && + cardToken == other.cardToken && + caseId == other.caseId && 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 && + currency == other.currency && + disposition == other.disposition && + events == other.events && + liabilityAllocation == other.liabilityAllocation && + merchant == other.merchant && + network == other.network && status == other.status && - transactionToken == other.transactionToken && + transactionSeries == other.transactionSeries && + updated == other.updated && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( token, - amount, - arbitrationDate, + accountToken, + cardToken, + caseId, created, - customerFiledDate, - customerNote, - networkClaimIds, - networkFiledDate, - networkReasonCode, - prearbitrationDate, - primaryClaimId, - reason, - representmentDate, - resolutionDate, - resolutionNote, - resolutionReason, + currency, + disposition, + events, + liabilityAllocation, + merchant, + network, status, - transactionToken, + transactionSeries, + updated, additionalProperties, ) } @@ -1733,5 +4746,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "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}" + "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}" } 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 new file mode 100644 index 00000000..f2a4c74e --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeCreateResponse.kt @@ -0,0 +1,1737 @@ +// 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 new file mode 100644 index 00000000..e937fecf --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeDeleteResponse.kt @@ -0,0 +1,1737 @@ +// 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 4de6619a..926073a3 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,14 +16,15 @@ 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. @@ -32,7 +33,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() @@ -45,7 +46,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 b4ff65c7..2615283a 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,14 +19,15 @@ 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. @@ -35,7 +36,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() @@ -49,7 +50,8 @@ 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 0c62813b..5f5a4087 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,14 +21,16 @@ 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()) @@ -36,7 +38,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. @@ -51,7 +53,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]. @@ -89,7 +91,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() @@ -100,25 +102,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 [Dispute] to [Builder.data]. + * Adds a single [DisputeListResponse] to [Builder.data]. * * @throws IllegalStateException if the field was previously set to a non-list. */ - fun addData(data: Dispute) = apply { + fun addData(data: DisputeListResponse) = 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 new file mode 100644 index 00000000..5adb56ab --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeListResponse.kt @@ -0,0 +1,1737 @@ +// 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 new file mode 100644 index 00000000..632235ab --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeRetrieveResponse.kt @@ -0,0 +1,1737 @@ +// 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 new file mode 100644 index 00000000..d7218097 --- /dev/null +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/DisputeUpdateResponse.kt @@ -0,0 +1,1737 @@ +// 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/Event.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt index d009e5fa..25fd19a2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Event.kt @@ -61,34 +61,90 @@ private constructor( fun created(): OffsetDateTime = created.getRequired("created") /** - * Event types: - * * `account_holder.created` - Notification that a new account holder has been created and was - * not rejected. - * * `account_holder.updated` - Notification that an account holder was updated. - * * `account_holder.verification` - Notification than an account holder's identity verification - * is complete. - * * `card.created` - Notification that a card has been created. - * * `card.renewed` - Notification that a card has been renewed. - * * `card.reissued` - Notification that a card has been reissued. - * * `card.shipped` - Physical card shipment notification. See - * https://docs.lithic.com/docs/cards#physical-card-shipped-webhook. - * * `card.converted` - Notification that a virtual card has been converted to a physical card. - * * `card_transaction.updated` - Transaction Lifecycle webhook. See - * https://docs.lithic.com/docs/transaction-webhooks. - * * `dispute.updated` - A dispute has been updated. - * * `dispute_transaction.created` - A new dispute transaction has been created. - * * `dispute_transaction.updated` - A dispute transaction has been updated. - * * `digital_wallet.tokenization_approval_request` - Card network's request to Lithic to - * activate a digital wallet token. - * * `digital_wallet.tokenization_result` - Notification of the end result of a tokenization, - * whether successful or failed. - * * `digital_wallet.tokenization_two_factor_authentication_code` - A code to be passed to an - * end user to complete digital wallet authentication. See - * https://docs.lithic.com/docs/tokenization-control#digital-wallet-tokenization-auth-code. - * * `digital_wallet.tokenization_two_factor_authentication_code_sent` - Notification that a two - * factor authentication code for activating a digital wallet has been sent to the end user. - * * `digital_wallet.tokenization_updated` - Notification that a digital wallet tokenization's - * status has changed. + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -203,36 +259,92 @@ private constructor( fun created(created: JsonField) = apply { this.created = created } /** - * Event types: - * * `account_holder.created` - Notification that a new account holder has been created and - * was not rejected. - * * `account_holder.updated` - Notification that an account holder was updated. - * * `account_holder.verification` - Notification than an account holder's identity - * verification is complete. - * * `card.created` - Notification that a card has been created. - * * `card.renewed` - Notification that a card has been renewed. - * * `card.reissued` - Notification that a card has been reissued. - * * `card.shipped` - Physical card shipment notification. See - * https://docs.lithic.com/docs/cards#physical-card-shipped-webhook. - * * `card.converted` - Notification that a virtual card has been converted to a physical - * card. - * * `card_transaction.updated` - Transaction Lifecycle webhook. See - * https://docs.lithic.com/docs/transaction-webhooks. - * * `dispute.updated` - A dispute has been updated. - * * `dispute_transaction.created` - A new dispute transaction has been created. - * * `dispute_transaction.updated` - A dispute transaction has been updated. - * * `digital_wallet.tokenization_approval_request` - Card network's request to Lithic to - * activate a digital wallet token. - * * `digital_wallet.tokenization_result` - Notification of the end result of a - * tokenization, whether successful or failed. - * * `digital_wallet.tokenization_two_factor_authentication_code` - A code to be passed to - * an end user to complete digital wallet authentication. See - * https://docs.lithic.com/docs/tokenization-control#digital-wallet-tokenization-auth-code. - * * `digital_wallet.tokenization_two_factor_authentication_code_sent` - Notification that a - * two factor authentication code for activating a digital wallet has been sent to the end - * user. - * * `digital_wallet.tokenization_updated` - Notification that a digital wallet - * tokenization's status has changed. + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status + * has been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification + * is completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval + * request is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or + * failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a + * tokenization request 2FA code is sent to our downstream messaging providers for + * delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the + * cardholder. After a cardholder challenge is successfully completed, the Card Program + * needs to respond back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based + * purchases; Lithic recommends triggering a redirect to that URL after the cardholder + * completes an app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. + * challenge is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA + * code is sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request + * 2FA code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. */ fun eventType(eventType: EventType) = eventType(JsonField.of(eventType)) @@ -334,34 +446,90 @@ private constructor( (payload.asKnown().getOrNull()?.validity() ?: 0) /** - * Event types: - * * `account_holder.created` - Notification that a new account holder has been created and was - * not rejected. - * * `account_holder.updated` - Notification that an account holder was updated. - * * `account_holder.verification` - Notification than an account holder's identity verification - * is complete. - * * `card.created` - Notification that a card has been created. - * * `card.renewed` - Notification that a card has been renewed. - * * `card.reissued` - Notification that a card has been reissued. - * * `card.shipped` - Physical card shipment notification. See - * https://docs.lithic.com/docs/cards#physical-card-shipped-webhook. - * * `card.converted` - Notification that a virtual card has been converted to a physical card. - * * `card_transaction.updated` - Transaction Lifecycle webhook. See - * https://docs.lithic.com/docs/transaction-webhooks. - * * `dispute.updated` - A dispute has been updated. - * * `dispute_transaction.created` - A new dispute transaction has been created. - * * `dispute_transaction.updated` - A dispute transaction has been updated. - * * `digital_wallet.tokenization_approval_request` - Card network's request to Lithic to - * activate a digital wallet token. - * * `digital_wallet.tokenization_result` - Notification of the end result of a tokenization, - * whether successful or failed. - * * `digital_wallet.tokenization_two_factor_authentication_code` - A code to be passed to an - * end user to complete digital wallet authentication. See - * https://docs.lithic.com/docs/tokenization-control#digital-wallet-tokenization-auth-code. - * * `digital_wallet.tokenization_two_factor_authentication_code_sent` - Notification that a two - * factor authentication code for activating a digital wallet has been sent to the end user. - * * `digital_wallet.tokenization_updated` - Notification that a digital wallet tokenization's - * status has changed. + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. */ class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -377,28 +545,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -418,14 +602,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -440,6 +624,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -456,14 +644,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -487,26 +674,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -514,6 +706,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -522,10 +716,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -545,26 +738,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -572,6 +770,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -580,10 +780,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -606,17 +805,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -625,10 +831,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -636,6 +842,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -644,10 +852,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -671,17 +878,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -690,10 +904,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -701,6 +915,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -709,10 +925,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt index adbe806c..befbe977 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventListParams.kt @@ -318,6 +318,92 @@ private constructor( } .build() + /** + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. + */ class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -332,28 +418,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -373,14 +475,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -395,6 +497,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -411,14 +517,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -442,26 +547,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -469,6 +579,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -477,10 +589,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -500,26 +611,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -527,6 +643,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -535,10 +653,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -561,17 +678,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -580,10 +704,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -591,6 +715,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -599,10 +725,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -626,17 +751,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -645,10 +777,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -656,6 +788,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -664,10 +798,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt index dd1314d5..15bf5914 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscription.kt @@ -320,6 +320,92 @@ private constructor( (if (url.asKnown().isPresent) 1 else 0) + (eventTypes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + /** + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. + */ class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -334,28 +420,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -375,14 +477,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -397,6 +499,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -413,14 +519,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -444,26 +549,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -471,6 +581,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -479,10 +591,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -502,26 +613,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -529,6 +645,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -537,10 +655,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -563,17 +680,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -582,10 +706,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -593,6 +717,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -601,10 +727,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -628,17 +753,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -647,10 +779,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -658,6 +790,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -666,10 +800,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt index 66b2ef36..9f7a4530 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionCreateParams.kt @@ -642,6 +642,92 @@ private constructor( "Body{url=$url, description=$description, disabled=$disabled, eventTypes=$eventTypes, additionalProperties=$additionalProperties}" } + /** + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. + */ class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -656,28 +742,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -697,14 +799,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -719,6 +821,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -735,14 +841,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -766,26 +871,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -793,6 +903,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -801,10 +913,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -824,26 +935,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -851,6 +967,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -859,10 +977,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -885,17 +1002,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -904,10 +1028,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -915,6 +1039,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -923,10 +1049,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -950,17 +1075,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -969,10 +1101,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -980,6 +1112,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -988,10 +1122,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt index 3dfb9918..77147dd4 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParams.kt @@ -424,28 +424,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -465,14 +481,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -487,6 +503,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -503,14 +523,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -534,26 +553,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -561,6 +585,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -569,10 +595,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -592,26 +617,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -619,6 +649,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -627,10 +659,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -653,17 +684,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -672,10 +710,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -683,6 +721,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -691,10 +731,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -718,17 +757,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -737,10 +783,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -748,6 +794,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -756,10 +804,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt index 378c3f5b..0b45c8ae 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/EventSubscriptionUpdateParams.kt @@ -665,6 +665,92 @@ private constructor( "Body{url=$url, description=$description, disabled=$disabled, eventTypes=$eventTypes, additionalProperties=$additionalProperties}" } + /** + * The type of event that occurred. Possible values: + * - account_holder_document.updated: Occurs when an account holder's document upload status has + * been updated + * - account_holder.created: Occurs when a new account_holder is created. + * - account_holder.updated: Occurs when an account_holder is updated. + * - account_holder.verification: Occurs when an asynchronous account_holder's verification is + * completed. + * - auth_rules.backtest_report.created: Auth Rules backtest report created. + * - balance.updated: Financial Account Balance Update + * - book_transfer_transaction.created: Occurs when a book transfer transaction is created. + * - book_transfer_transaction.updated: Occurs when a book transfer transaction is updated. + * - card_transaction.enhanced_data.created: Occurs when L2/L3 enhanced commercial data is + * processed for a transaction event. + * - card_transaction.enhanced_data.updated: Occurs when L2/L3 enhanced commercial data is + * reprocessed for a transaction event. + * - card_transaction.updated: Occurs when a card transaction happens. + * - card.converted: Occurs when a card is converted from virtual to physical cards. + * - card.created: Occurs when a new card is created. + * - card.reissued: Occurs when a card is reissued. + * - card.renewed: Occurs when a card is renewed. + * - card.shipped: Occurs when a card is shipped. + * - digital_wallet.tokenization_approval_request: Occurs when a tokenization approval request + * is made. This event will be deprecated in the future. We recommend using + * `tokenization.approval_request` instead. + * - digital_wallet.tokenization_result: Occurs when a tokenization request succeeded or failed. + * + * This event will be deprecated in the future. We recommend using `tokenization.result` + * instead. + * - digital_wallet.tokenization_two_factor_authentication_code: Occurs when a tokenization + * request 2FA code is sent to the Lithic customer for self serve delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code` instead. + * - digital_wallet.tokenization_two_factor_authentication_code_sent: Occurs when a tokenization + * request 2FA code is sent to our downstream messaging providers for delivery. + * + * This event will be deprecated in the future. We recommend using + * `tokenization.two_factor_authentication_code_sent` instead. + * - digital_wallet.tokenization_updated: Occurs when a tokenization's status has changed. + * + * This event will be deprecated in the future. We recommend using `tokenization.updated` + * instead. + * - dispute_evidence.upload_failed: Occurs when a dispute evidence upload fails. + * - dispute_transaction.created: Occurs when a new dispute transaction is created + * - dispute_transaction.updated: Occurs when a dispute transaction is updated + * - dispute.updated: Occurs when a dispute is updated. + * - external_bank_account.created: Occurs when an external bank account is created. + * - external_bank_account.updated: Occurs when an external bank account is updated. + * - external_payment.created: Occurs when an external payment is created. + * - external_payment.updated: Occurs when an external payment is updated. + * - financial_account.created: Occurs when a financial account is created. + * - financial_account.updated: Occurs when a financial account is updated. + * - funding_event.created: Occurs when a funding event is created. + * - internal_transaction.created: Occurs when an internal adjustment is created. + * - internal_transaction.updated: Occurs when an internal adjustment is updated. + * - loan_tape.created: Occurs when a loan tape is created. + * - loan_tape.updated: Occurs when a loan tape is updated. + * - management_operation.created: Occurs when an management operation is created. + * - management_operation.updated: Occurs when an management operation is updated. + * - network_total.created: Occurs when a network total is created. + * - network_total.updated: Occurs when a network total is updated. + * - payment_transaction.created: Occurs when a payment transaction is created. + * - payment_transaction.updated: Occurs when a payment transaction is updated. + * - settlement_report.updated: Occurs when a settlement report is created or updated. + * - statements.created: Occurs when a statement has been created + * - three_ds_authentication.challenge: The `three_ds_authentication.challenge` event. Upon + * receiving this request, the Card Program should issue its own challenge to the cardholder. + * After a cardholder challenge is successfully completed, the Card Program needs to respond + * back to Lithic by call to + * [/v1/three_ds_decisioning/challenge_response](https://docs.lithic.com/reference/post_v1-three-ds-decisioning-challenge-response). + * Then the cardholder must navigate back to the merchant checkout flow to complete the + * transaction. Some merchants will include an `app_requestor_url` for app-based purchases; + * Lithic recommends triggering a redirect to that URL after the cardholder completes an + * app-based challenge. + * - three_ds_authentication.created: Occurs when a 3DS authentication is created. + * - three_ds_authentication.updated: Occurs when a 3DS authentication is updated (eg. challenge + * is completed). + * - tokenization.approval_request: Occurs when a tokenization approval request is made. + * - tokenization.result: Occurs when a tokenization request succeeded or failed. + * - tokenization.two_factor_authentication_code: Occurs when a tokenization request 2FA code is + * sent to the Lithic customer for self serve delivery. + * - tokenization.two_factor_authentication_code_sent: Occurs when a tokenization request 2FA + * code is sent to our downstream messaging providers for delivery. + * - tokenization.updated: Occurs when a tokenization's status has changed. + */ class EventType @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -679,28 +765,44 @@ private constructor( companion object { + @JvmField val ACCOUNT_HOLDER_DOCUMENT_UPDATED = of("account_holder_document.updated") + @JvmField val ACCOUNT_HOLDER_CREATED = of("account_holder.created") @JvmField val ACCOUNT_HOLDER_UPDATED = of("account_holder.updated") @JvmField val ACCOUNT_HOLDER_VERIFICATION = of("account_holder.verification") + @JvmField + val AUTH_RULES_BACKTEST_REPORT_CREATED = of("auth_rules.backtest_report.created") + @JvmField val BALANCE_UPDATED = of("balance.updated") @JvmField val BOOK_TRANSFER_TRANSACTION_CREATED = of("book_transfer_transaction.created") - @JvmField val CARD_CREATED = of("card.created") + @JvmField + val BOOK_TRANSFER_TRANSACTION_UPDATED = of("book_transfer_transaction.updated") - @JvmField val CARD_RENEWED = of("card.renewed") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_CREATED = + of("card_transaction.enhanced_data.created") - @JvmField val CARD_REISSUED = of("card.reissued") + @JvmField + val CARD_TRANSACTION_ENHANCED_DATA_UPDATED = + of("card_transaction.enhanced_data.updated") + + @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") @JvmField val CARD_CONVERTED = of("card.converted") - @JvmField val CARD_SHIPPED = of("card.shipped") + @JvmField val CARD_CREATED = of("card.created") - @JvmField val CARD_TRANSACTION_UPDATED = of("card_transaction.updated") + @JvmField val CARD_REISSUED = of("card.reissued") + + @JvmField val CARD_RENEWED = of("card.renewed") + + @JvmField val CARD_SHIPPED = of("card.shipped") @JvmField val DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST = @@ -720,14 +822,14 @@ private constructor( @JvmField val DIGITAL_WALLET_TOKENIZATION_UPDATED = of("digital_wallet.tokenization_updated") - @JvmField val DISPUTE_UPDATED = of("dispute.updated") - @JvmField val DISPUTE_EVIDENCE_UPLOAD_FAILED = of("dispute_evidence.upload_failed") @JvmField val DISPUTE_TRANSACTION_CREATED = of("dispute_transaction.created") @JvmField val DISPUTE_TRANSACTION_UPDATED = of("dispute_transaction.updated") + @JvmField val DISPUTE_UPDATED = of("dispute.updated") + @JvmField val EXTERNAL_BANK_ACCOUNT_CREATED = of("external_bank_account.created") @JvmField val EXTERNAL_BANK_ACCOUNT_UPDATED = of("external_bank_account.updated") @@ -742,6 +844,10 @@ private constructor( @JvmField val FUNDING_EVENT_CREATED = of("funding_event.created") + @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") + + @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") + @JvmField val LOAN_TAPE_CREATED = of("loan_tape.created") @JvmField val LOAN_TAPE_UPDATED = of("loan_tape.updated") @@ -758,14 +864,13 @@ private constructor( @JvmField val PAYMENT_TRANSACTION_UPDATED = of("payment_transaction.updated") - @JvmField val INTERNAL_TRANSACTION_CREATED = of("internal_transaction.created") - - @JvmField val INTERNAL_TRANSACTION_UPDATED = of("internal_transaction.updated") - @JvmField val SETTLEMENT_REPORT_UPDATED = of("settlement_report.updated") @JvmField val STATEMENTS_CREATED = of("statements.created") + @JvmField + val THREE_DS_AUTHENTICATION_CHALLENGE = of("three_ds_authentication.challenge") + @JvmField val THREE_DS_AUTHENTICATION_CREATED = of("three_ds_authentication.created") @JvmField val THREE_DS_AUTHENTICATION_UPDATED = of("three_ds_authentication.updated") @@ -789,26 +894,31 @@ private constructor( /** An enum containing [EventType]'s known values. */ enum class Known { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -816,6 +926,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -824,10 +936,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -847,26 +958,31 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { + ACCOUNT_HOLDER_DOCUMENT_UPDATED, ACCOUNT_HOLDER_CREATED, ACCOUNT_HOLDER_UPDATED, ACCOUNT_HOLDER_VERIFICATION, + AUTH_RULES_BACKTEST_REPORT_CREATED, BALANCE_UPDATED, BOOK_TRANSFER_TRANSACTION_CREATED, + BOOK_TRANSFER_TRANSACTION_UPDATED, + CARD_TRANSACTION_ENHANCED_DATA_CREATED, + CARD_TRANSACTION_ENHANCED_DATA_UPDATED, + CARD_TRANSACTION_UPDATED, + CARD_CONVERTED, CARD_CREATED, - CARD_RENEWED, CARD_REISSUED, - CARD_CONVERTED, + CARD_RENEWED, CARD_SHIPPED, - CARD_TRANSACTION_UPDATED, DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST, DIGITAL_WALLET_TOKENIZATION_RESULT, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE, DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT, DIGITAL_WALLET_TOKENIZATION_UPDATED, - DISPUTE_UPDATED, DISPUTE_EVIDENCE_UPLOAD_FAILED, DISPUTE_TRANSACTION_CREATED, DISPUTE_TRANSACTION_UPDATED, + DISPUTE_UPDATED, EXTERNAL_BANK_ACCOUNT_CREATED, EXTERNAL_BANK_ACCOUNT_UPDATED, EXTERNAL_PAYMENT_CREATED, @@ -874,6 +990,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED, FINANCIAL_ACCOUNT_UPDATED, FUNDING_EVENT_CREATED, + INTERNAL_TRANSACTION_CREATED, + INTERNAL_TRANSACTION_UPDATED, LOAN_TAPE_CREATED, LOAN_TAPE_UPDATED, MANAGEMENT_OPERATION_CREATED, @@ -882,10 +1000,9 @@ private constructor( NETWORK_TOTAL_UPDATED, PAYMENT_TRANSACTION_CREATED, PAYMENT_TRANSACTION_UPDATED, - INTERNAL_TRANSACTION_CREATED, - INTERNAL_TRANSACTION_UPDATED, SETTLEMENT_REPORT_UPDATED, STATEMENTS_CREATED, + THREE_DS_AUTHENTICATION_CHALLENGE, THREE_DS_AUTHENTICATION_CREATED, THREE_DS_AUTHENTICATION_UPDATED, TOKENIZATION_APPROVAL_REQUEST, @@ -908,17 +1025,24 @@ private constructor( */ fun value(): Value = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Value.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Value.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Value.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Value.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Value.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Value.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Value.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Value.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Value.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Value.CARD_CONVERTED CARD_CREATED -> Value.CARD_CREATED - CARD_RENEWED -> Value.CARD_RENEWED CARD_REISSUED -> Value.CARD_REISSUED - CARD_CONVERTED -> Value.CARD_CONVERTED + CARD_RENEWED -> Value.CARD_RENEWED CARD_SHIPPED -> Value.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Value.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Value.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Value.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -927,10 +1051,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Value.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Value.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Value.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Value.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Value.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Value.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Value.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Value.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Value.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Value.EXTERNAL_PAYMENT_CREATED @@ -938,6 +1062,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Value.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Value.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Value.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Value.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Value.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Value.MANAGEMENT_OPERATION_CREATED @@ -946,10 +1072,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Value.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Value.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Value.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Value.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Value.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Value.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Value.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Value.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Value.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Value.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Value.TOKENIZATION_APPROVAL_REQUEST @@ -973,17 +1098,24 @@ private constructor( */ fun known(): Known = when (this) { + ACCOUNT_HOLDER_DOCUMENT_UPDATED -> Known.ACCOUNT_HOLDER_DOCUMENT_UPDATED ACCOUNT_HOLDER_CREATED -> Known.ACCOUNT_HOLDER_CREATED ACCOUNT_HOLDER_UPDATED -> Known.ACCOUNT_HOLDER_UPDATED ACCOUNT_HOLDER_VERIFICATION -> Known.ACCOUNT_HOLDER_VERIFICATION + AUTH_RULES_BACKTEST_REPORT_CREATED -> Known.AUTH_RULES_BACKTEST_REPORT_CREATED BALANCE_UPDATED -> Known.BALANCE_UPDATED BOOK_TRANSFER_TRANSACTION_CREATED -> Known.BOOK_TRANSFER_TRANSACTION_CREATED + BOOK_TRANSFER_TRANSACTION_UPDATED -> Known.BOOK_TRANSFER_TRANSACTION_UPDATED + CARD_TRANSACTION_ENHANCED_DATA_CREATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_CREATED + CARD_TRANSACTION_ENHANCED_DATA_UPDATED -> + Known.CARD_TRANSACTION_ENHANCED_DATA_UPDATED + CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED + CARD_CONVERTED -> Known.CARD_CONVERTED CARD_CREATED -> Known.CARD_CREATED - CARD_RENEWED -> Known.CARD_RENEWED CARD_REISSUED -> Known.CARD_REISSUED - CARD_CONVERTED -> Known.CARD_CONVERTED + CARD_RENEWED -> Known.CARD_RENEWED CARD_SHIPPED -> Known.CARD_SHIPPED - CARD_TRANSACTION_UPDATED -> Known.CARD_TRANSACTION_UPDATED DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST -> Known.DIGITAL_WALLET_TOKENIZATION_APPROVAL_REQUEST DIGITAL_WALLET_TOKENIZATION_RESULT -> Known.DIGITAL_WALLET_TOKENIZATION_RESULT @@ -992,10 +1124,10 @@ private constructor( DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT -> Known.DIGITAL_WALLET_TOKENIZATION_TWO_FACTOR_AUTHENTICATION_CODE_SENT DIGITAL_WALLET_TOKENIZATION_UPDATED -> Known.DIGITAL_WALLET_TOKENIZATION_UPDATED - DISPUTE_UPDATED -> Known.DISPUTE_UPDATED DISPUTE_EVIDENCE_UPLOAD_FAILED -> Known.DISPUTE_EVIDENCE_UPLOAD_FAILED DISPUTE_TRANSACTION_CREATED -> Known.DISPUTE_TRANSACTION_CREATED DISPUTE_TRANSACTION_UPDATED -> Known.DISPUTE_TRANSACTION_UPDATED + DISPUTE_UPDATED -> Known.DISPUTE_UPDATED EXTERNAL_BANK_ACCOUNT_CREATED -> Known.EXTERNAL_BANK_ACCOUNT_CREATED EXTERNAL_BANK_ACCOUNT_UPDATED -> Known.EXTERNAL_BANK_ACCOUNT_UPDATED EXTERNAL_PAYMENT_CREATED -> Known.EXTERNAL_PAYMENT_CREATED @@ -1003,6 +1135,8 @@ private constructor( FINANCIAL_ACCOUNT_CREATED -> Known.FINANCIAL_ACCOUNT_CREATED FINANCIAL_ACCOUNT_UPDATED -> Known.FINANCIAL_ACCOUNT_UPDATED FUNDING_EVENT_CREATED -> Known.FUNDING_EVENT_CREATED + INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED + INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED LOAN_TAPE_CREATED -> Known.LOAN_TAPE_CREATED LOAN_TAPE_UPDATED -> Known.LOAN_TAPE_UPDATED MANAGEMENT_OPERATION_CREATED -> Known.MANAGEMENT_OPERATION_CREATED @@ -1011,10 +1145,9 @@ private constructor( NETWORK_TOTAL_UPDATED -> Known.NETWORK_TOTAL_UPDATED PAYMENT_TRANSACTION_CREATED -> Known.PAYMENT_TRANSACTION_CREATED PAYMENT_TRANSACTION_UPDATED -> Known.PAYMENT_TRANSACTION_UPDATED - INTERNAL_TRANSACTION_CREATED -> Known.INTERNAL_TRANSACTION_CREATED - INTERNAL_TRANSACTION_UPDATED -> Known.INTERNAL_TRANSACTION_UPDATED SETTLEMENT_REPORT_UPDATED -> Known.SETTLEMENT_REPORT_UPDATED STATEMENTS_CREATED -> Known.STATEMENTS_CREATED + THREE_DS_AUTHENTICATION_CHALLENGE -> Known.THREE_DS_AUTHENTICATION_CHALLENGE THREE_DS_AUTHENTICATION_CREATED -> Known.THREE_DS_AUTHENTICATION_CREATED THREE_DS_AUTHENTICATION_UPDATED -> Known.THREE_DS_AUTHENTICATION_UPDATED TOKENIZATION_APPROVAL_REQUEST -> Known.TOKENIZATION_APPROVAL_REQUEST 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 8baafa20..5a39523a 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 @@ -621,9 +621,6 @@ private constructor( private val creditProductToken: JsonField, private val externalBankAccountToken: JsonField, private val tier: JsonField, - private val chargedOffReason: JsonField, - private val financialAccountState: JsonField, - private val isSpendBlocked: JsonField, private val additionalProperties: MutableMap, ) { @@ -643,24 +640,12 @@ private constructor( @ExcludeMissing externalBankAccountToken: JsonField = JsonMissing.of(), @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), - @JsonProperty("charged_off_reason") - @ExcludeMissing - chargedOffReason: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_state") - @ExcludeMissing - financialAccountState: JsonField = JsonMissing.of(), - @JsonProperty("is_spend_blocked") - @ExcludeMissing - isSpendBlocked: JsonField = JsonMissing.of(), ) : this( autoCollectionConfiguration, creditLimit, creditProductToken, externalBankAccountToken, tier, - chargedOffReason, - financialAccountState, - isSpendBlocked, mutableMapOf(), ) @@ -701,33 +686,6 @@ private constructor( */ fun tier(): Optional = tier.getOptional("tier") - /** - * Reason for the financial account being marked as Charged Off - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun chargedOffReason(): Optional = - chargedOffReason.getOptional("charged_off_reason") - - /** - * State of the financial account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun financialAccountState(): Optional = - financialAccountState.getOptional("financial_account_state") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun isSpendBlocked(): Optional = isSpendBlocked.getOptional("is_spend_blocked") - /** * Returns the raw JSON value of [autoCollectionConfiguration]. * @@ -775,39 +733,6 @@ private constructor( */ @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier - /** - * Returns the raw JSON value of [chargedOffReason]. - * - * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("charged_off_reason") - @ExcludeMissing - fun _chargedOffReason(): JsonField = chargedOffReason - - /** - * Returns the raw JSON value of [financialAccountState]. - * - * Unlike [financialAccountState], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("financial_account_state") - @ExcludeMissing - fun _financialAccountState(): JsonField = financialAccountState - - /** - * Returns the raw JSON value of [isSpendBlocked]. - * - * Unlike [isSpendBlocked], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("is_spend_blocked") - @ExcludeMissing - fun _isSpendBlocked(): JsonField = isSpendBlocked - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -848,9 +773,6 @@ private constructor( private var creditProductToken: JsonField? = null private var externalBankAccountToken: JsonField? = null private var tier: JsonField? = null - private var chargedOffReason: JsonField = JsonMissing.of() - private var financialAccountState: JsonField = JsonMissing.of() - private var isSpendBlocked: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -861,9 +783,6 @@ private constructor( creditProductToken = financialAccountCreditConfig.creditProductToken externalBankAccountToken = financialAccountCreditConfig.externalBankAccountToken tier = financialAccountCreditConfig.tier - chargedOffReason = financialAccountCreditConfig.chargedOffReason - financialAccountState = financialAccountCreditConfig.financialAccountState - isSpendBlocked = financialAccountCreditConfig.isSpendBlocked additionalProperties = financialAccountCreditConfig.additionalProperties.toMutableMap() } @@ -962,72 +881,6 @@ private constructor( */ fun tier(tier: JsonField) = apply { this.tier = tier } - /** Reason for the financial account being marked as Charged Off */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: ChargedOffReason?) = - chargedOffReason(JsonField.ofNullable(chargedOffReason)) - - /** - * Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. - */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: Optional) = - chargedOffReason(chargedOffReason.getOrNull()) - - /** - * Sets [Builder.chargedOffReason] to an arbitrary JSON value. - * - * You should usually call [Builder.chargedOffReason] with a well-typed - * [ChargedOffReason] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: JsonField) = apply { - this.chargedOffReason = chargedOffReason - } - - /** State of the financial account */ - @Deprecated("deprecated") - fun financialAccountState(financialAccountState: FinancialAccountState?) = - financialAccountState(JsonField.ofNullable(financialAccountState)) - - /** - * Alias for calling [Builder.financialAccountState] with - * `financialAccountState.orElse(null)`. - */ - @Deprecated("deprecated") - fun financialAccountState(financialAccountState: Optional) = - financialAccountState(financialAccountState.getOrNull()) - - /** - * Sets [Builder.financialAccountState] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountState] with a well-typed - * [FinancialAccountState] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun financialAccountState(financialAccountState: JsonField) = - apply { - this.financialAccountState = financialAccountState - } - - @Deprecated("deprecated") - fun isSpendBlocked(isSpendBlocked: Boolean) = - isSpendBlocked(JsonField.of(isSpendBlocked)) - - /** - * Sets [Builder.isSpendBlocked] to an arbitrary JSON value. - * - * You should usually call [Builder.isSpendBlocked] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun isSpendBlocked(isSpendBlocked: JsonField) = apply { - this.isSpendBlocked = isSpendBlocked - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1070,9 +923,6 @@ private constructor( checkRequired("creditProductToken", creditProductToken), checkRequired("externalBankAccountToken", externalBankAccountToken), checkRequired("tier", tier), - chargedOffReason, - financialAccountState, - isSpendBlocked, additionalProperties.toMutableMap(), ) } @@ -1089,9 +939,6 @@ private constructor( creditProductToken() externalBankAccountToken() tier() - chargedOffReason().ifPresent { it.validate() } - financialAccountState().ifPresent { it.validate() } - isSpendBlocked() validated = true } @@ -1115,10 +962,7 @@ private constructor( (if (creditLimit.asKnown().isPresent) 1 else 0) + (if (creditProductToken.asKnown().isPresent) 1 else 0) + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + - (if (tier.asKnown().isPresent) 1 else 0) + - (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + - (financialAccountState.asKnown().getOrNull()?.validity() ?: 0) + - (if (isSpendBlocked.asKnown().isPresent) 1 else 0) + (if (tier.asKnown().isPresent) 1 else 0) class AutoCollectionConfigurationResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -1300,290 +1144,6 @@ private constructor( "AutoCollectionConfigurationResponse{autoCollectionEnabled=$autoCollectionEnabled, additionalProperties=$additionalProperties}" } - /** Reason for the financial account being marked as Charged Off */ - @Deprecated("deprecated") - class ChargedOffReason - @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 DELINQUENT = of("DELINQUENT") - - @JvmField val FRAUD = of("FRAUD") - - @JvmStatic fun of(value: String) = ChargedOffReason(JsonField.of(value)) - } - - /** An enum containing [ChargedOffReason]'s known values. */ - enum class Known { - DELINQUENT, - FRAUD, - } - - /** - * An enum containing [ChargedOffReason]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [ChargedOffReason] 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 { - DELINQUENT, - FRAUD, - /** - * An enum member indicating that [ChargedOffReason] 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) { - DELINQUENT -> Value.DELINQUENT - FRAUD -> Value.FRAUD - 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) { - DELINQUENT -> Known.DELINQUENT - FRAUD -> Known.FRAUD - else -> throw LithicInvalidDataException("Unknown ChargedOffReason: $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(): ChargedOffReason = 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 ChargedOffReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** State of the financial account */ - @Deprecated("deprecated") - class FinancialAccountState - @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 CURRENT = of("CURRENT") - - @JvmField val DELINQUENT = of("DELINQUENT") - - @JvmField val CHARGED_OFF = of("CHARGED_OFF") - - @JvmStatic fun of(value: String) = FinancialAccountState(JsonField.of(value)) - } - - /** An enum containing [FinancialAccountState]'s known values. */ - enum class Known { - PENDING, - CURRENT, - DELINQUENT, - CHARGED_OFF, - } - - /** - * An enum containing [FinancialAccountState]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialAccountState] 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, - CURRENT, - DELINQUENT, - CHARGED_OFF, - /** - * An enum member indicating that [FinancialAccountState] 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 - CURRENT -> Value.CURRENT - DELINQUENT -> Value.DELINQUENT - CHARGED_OFF -> Value.CHARGED_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) { - PENDING -> Known.PENDING - CURRENT -> Known.CURRENT - DELINQUENT -> Known.DELINQUENT - CHARGED_OFF -> Known.CHARGED_OFF - else -> - throw LithicInvalidDataException("Unknown FinancialAccountState: $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(): FinancialAccountState = 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 FinancialAccountState && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1595,9 +1155,6 @@ private constructor( creditProductToken == other.creditProductToken && externalBankAccountToken == other.externalBankAccountToken && tier == other.tier && - chargedOffReason == other.chargedOffReason && - financialAccountState == other.financialAccountState && - isSpendBlocked == other.isSpendBlocked && additionalProperties == other.additionalProperties } @@ -1608,9 +1165,6 @@ private constructor( creditProductToken, externalBankAccountToken, tier, - chargedOffReason, - financialAccountState, - isSpendBlocked, additionalProperties, ) } @@ -1618,7 +1172,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "FinancialAccountCreditConfig{autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, chargedOffReason=$chargedOffReason, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, additionalProperties=$additionalProperties}" + "FinancialAccountCreditConfig{autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, additionalProperties=$additionalProperties}" } /** Status of the financial account */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt index 3a7d0327..b9414ab1 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialAccountCreditConfig.kt @@ -6,7 +6,6 @@ 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 @@ -27,9 +26,6 @@ private constructor( private val creditProductToken: JsonField, private val externalBankAccountToken: JsonField, private val tier: JsonField, - private val chargedOffReason: JsonField, - private val financialAccountState: JsonField, - private val isSpendBlocked: JsonField, private val additionalProperties: MutableMap, ) { @@ -52,15 +48,6 @@ private constructor( @ExcludeMissing externalBankAccountToken: JsonField = JsonMissing.of(), @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), - @JsonProperty("charged_off_reason") - @ExcludeMissing - chargedOffReason: JsonField = JsonMissing.of(), - @JsonProperty("financial_account_state") - @ExcludeMissing - financialAccountState: JsonField = JsonMissing.of(), - @JsonProperty("is_spend_blocked") - @ExcludeMissing - isSpendBlocked: JsonField = JsonMissing.of(), ) : this( accountToken, autoCollectionConfiguration, @@ -68,9 +55,6 @@ private constructor( creditProductToken, externalBankAccountToken, tier, - chargedOffReason, - financialAccountState, - isSpendBlocked, mutableMapOf(), ) @@ -119,33 +103,6 @@ private constructor( */ fun tier(): Optional = tier.getOptional("tier") - /** - * Reason for the financial account being marked as Charged Off - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun chargedOffReason(): Optional = - chargedOffReason.getOptional("charged_off_reason") - - /** - * State of the financial account - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun financialAccountState(): Optional = - financialAccountState.getOptional("financial_account_state") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun isSpendBlocked(): Optional = isSpendBlocked.getOptional("is_spend_blocked") - /** * Returns the raw JSON value of [accountToken]. * @@ -200,38 +157,6 @@ private constructor( */ @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier - /** - * Returns the raw JSON value of [chargedOffReason]. - * - * Unlike [chargedOffReason], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("charged_off_reason") - @ExcludeMissing - fun _chargedOffReason(): JsonField = chargedOffReason - - /** - * Returns the raw JSON value of [financialAccountState]. - * - * Unlike [financialAccountState], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @Deprecated("deprecated") - @JsonProperty("financial_account_state") - @ExcludeMissing - fun _financialAccountState(): JsonField = financialAccountState - - /** - * Returns the raw JSON value of [isSpendBlocked]. - * - * Unlike [isSpendBlocked], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("is_spend_blocked") - @ExcludeMissing - fun _isSpendBlocked(): JsonField = isSpendBlocked - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -272,9 +197,6 @@ private constructor( private var creditProductToken: JsonField? = null private var externalBankAccountToken: JsonField? = null private var tier: JsonField? = null - private var chargedOffReason: JsonField = JsonMissing.of() - private var financialAccountState: JsonField = JsonMissing.of() - private var isSpendBlocked: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -285,9 +207,6 @@ private constructor( creditProductToken = financialAccountCreditConfig.creditProductToken externalBankAccountToken = financialAccountCreditConfig.externalBankAccountToken tier = financialAccountCreditConfig.tier - chargedOffReason = financialAccountCreditConfig.chargedOffReason - financialAccountState = financialAccountCreditConfig.financialAccountState - isSpendBlocked = financialAccountCreditConfig.isSpendBlocked additionalProperties = financialAccountCreditConfig.additionalProperties.toMutableMap() } @@ -397,60 +316,6 @@ private constructor( */ fun tier(tier: JsonField) = apply { this.tier = tier } - /** Reason for the financial account being marked as Charged Off */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: ChargedOffReason?) = - chargedOffReason(JsonField.ofNullable(chargedOffReason)) - - /** Alias for calling [Builder.chargedOffReason] with `chargedOffReason.orElse(null)`. */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: Optional) = - chargedOffReason(chargedOffReason.getOrNull()) - - /** - * Sets [Builder.chargedOffReason] to an arbitrary JSON value. - * - * You should usually call [Builder.chargedOffReason] with a well-typed [ChargedOffReason] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - @Deprecated("deprecated") - fun chargedOffReason(chargedOffReason: JsonField) = apply { - this.chargedOffReason = chargedOffReason - } - - /** State of the financial account */ - @Deprecated("deprecated") - fun financialAccountState(financialAccountState: FinancialAccountState) = - financialAccountState(JsonField.of(financialAccountState)) - - /** - * Sets [Builder.financialAccountState] to an arbitrary JSON value. - * - * You should usually call [Builder.financialAccountState] with a well-typed - * [FinancialAccountState] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - @Deprecated("deprecated") - fun financialAccountState(financialAccountState: JsonField) = apply { - this.financialAccountState = financialAccountState - } - - @Deprecated("deprecated") - fun isSpendBlocked(isSpendBlocked: Boolean) = isSpendBlocked(JsonField.of(isSpendBlocked)) - - /** - * Sets [Builder.isSpendBlocked] to an arbitrary JSON value. - * - * You should usually call [Builder.isSpendBlocked] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun isSpendBlocked(isSpendBlocked: JsonField) = apply { - this.isSpendBlocked = isSpendBlocked - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -495,9 +360,6 @@ private constructor( checkRequired("creditProductToken", creditProductToken), checkRequired("externalBankAccountToken", externalBankAccountToken), checkRequired("tier", tier), - chargedOffReason, - financialAccountState, - isSpendBlocked, additionalProperties.toMutableMap(), ) } @@ -515,9 +377,6 @@ private constructor( creditProductToken() externalBankAccountToken() tier() - chargedOffReason().ifPresent { it.validate() } - financialAccountState().ifPresent { it.validate() } - isSpendBlocked() validated = true } @@ -541,10 +400,7 @@ private constructor( (if (creditLimit.asKnown().isPresent) 1 else 0) + (if (creditProductToken.asKnown().isPresent) 1 else 0) + (if (externalBankAccountToken.asKnown().isPresent) 1 else 0) + - (if (tier.asKnown().isPresent) 1 else 0) + - (chargedOffReason.asKnown().getOrNull()?.validity() ?: 0) + - (financialAccountState.asKnown().getOrNull()?.validity() ?: 0) + - (if (isSpendBlocked.asKnown().isPresent) 1 else 0) + (if (tier.asKnown().isPresent) 1 else 0) class AutoCollectionConfigurationResponse @JsonCreator(mode = JsonCreator.Mode.DISABLED) @@ -721,282 +577,6 @@ private constructor( "AutoCollectionConfigurationResponse{autoCollectionEnabled=$autoCollectionEnabled, additionalProperties=$additionalProperties}" } - /** Reason for the financial account being marked as Charged Off */ - @Deprecated("deprecated") - class ChargedOffReason @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 DELINQUENT = of("DELINQUENT") - - @JvmField val FRAUD = of("FRAUD") - - @JvmStatic fun of(value: String) = ChargedOffReason(JsonField.of(value)) - } - - /** An enum containing [ChargedOffReason]'s known values. */ - enum class Known { - DELINQUENT, - FRAUD, - } - - /** - * An enum containing [ChargedOffReason]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [ChargedOffReason] 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 { - DELINQUENT, - FRAUD, - /** - * An enum member indicating that [ChargedOffReason] 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) { - DELINQUENT -> Value.DELINQUENT - FRAUD -> Value.FRAUD - 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) { - DELINQUENT -> Known.DELINQUENT - FRAUD -> Known.FRAUD - else -> throw LithicInvalidDataException("Unknown ChargedOffReason: $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(): ChargedOffReason = 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 ChargedOffReason && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** State of the financial account */ - @Deprecated("deprecated") - class FinancialAccountState - @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 CURRENT = of("CURRENT") - - @JvmField val DELINQUENT = of("DELINQUENT") - - @JvmField val CHARGED_OFF = of("CHARGED_OFF") - - @JvmStatic fun of(value: String) = FinancialAccountState(JsonField.of(value)) - } - - /** An enum containing [FinancialAccountState]'s known values. */ - enum class Known { - PENDING, - CURRENT, - DELINQUENT, - CHARGED_OFF, - } - - /** - * An enum containing [FinancialAccountState]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [FinancialAccountState] 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, - CURRENT, - DELINQUENT, - CHARGED_OFF, - /** - * An enum member indicating that [FinancialAccountState] 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 - CURRENT -> Value.CURRENT - DELINQUENT -> Value.DELINQUENT - CHARGED_OFF -> Value.CHARGED_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) { - PENDING -> Known.PENDING - CURRENT -> Known.CURRENT - DELINQUENT -> Known.DELINQUENT - CHARGED_OFF -> Known.CHARGED_OFF - else -> throw LithicInvalidDataException("Unknown FinancialAccountState: $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(): FinancialAccountState = 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 FinancialAccountState && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -1009,9 +589,6 @@ private constructor( creditProductToken == other.creditProductToken && externalBankAccountToken == other.externalBankAccountToken && tier == other.tier && - chargedOffReason == other.chargedOffReason && - financialAccountState == other.financialAccountState && - isSpendBlocked == other.isSpendBlocked && additionalProperties == other.additionalProperties } @@ -1023,9 +600,6 @@ private constructor( creditProductToken, externalBankAccountToken, tier, - chargedOffReason, - financialAccountState, - isSpendBlocked, additionalProperties, ) } @@ -1033,5 +607,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "FinancialAccountCreditConfig{accountToken=$accountToken, autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, chargedOffReason=$chargedOffReason, financialAccountState=$financialAccountState, isSpendBlocked=$isSpendBlocked, additionalProperties=$additionalProperties}" + "FinancialAccountCreditConfig{accountToken=$accountToken, autoCollectionConfiguration=$autoCollectionConfiguration, creditLimit=$creditLimit, creditProductToken=$creditProductToken, externalBankAccountToken=$externalBankAccountToken, tier=$tier, additionalProperties=$additionalProperties}" } 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 9fdb0664..dc8f4779 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 @@ -3423,17 +3423,20 @@ private constructor( class WireMethodAttributes @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val wireMessageType: JsonField, private val wireNetwork: JsonField, private val creditor: JsonField, private val debtor: JsonField, private val messageId: JsonField, private val remittanceInformation: JsonField, - private val wireMessageType: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("wire_message_type") + @ExcludeMissing + wireMessageType: JsonField = JsonMissing.of(), @JsonProperty("wire_network") @ExcludeMissing wireNetwork: JsonField = JsonMissing.of(), @@ -3449,19 +3452,25 @@ private constructor( @JsonProperty("remittance_information") @ExcludeMissing remittanceInformation: JsonField = JsonMissing.of(), - @JsonProperty("wire_message_type") - @ExcludeMissing - wireMessageType: JsonField = JsonMissing.of(), ) : this( + wireMessageType, wireNetwork, creditor, debtor, messageId, remittanceInformation, - wireMessageType, mutableMapOf(), ) + /** + * Type of wire message + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun wireMessageType(): Optional = + wireMessageType.getOptional("wire_message_type") + /** * Type of wire transfer * @@ -3502,13 +3511,14 @@ private constructor( remittanceInformation.getOptional("remittance_information") /** - * Type of wire message + * Returns the raw JSON value of [wireMessageType]. * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). + * Unlike [wireMessageType], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun wireMessageType(): Optional = - wireMessageType.getOptional("wire_message_type") + @JsonProperty("wire_message_type") + @ExcludeMissing + fun _wireMessageType(): JsonField = wireMessageType /** * Returns the raw JSON value of [wireNetwork]. @@ -3559,16 +3569,6 @@ private constructor( @ExcludeMissing fun _remittanceInformation(): JsonField = remittanceInformation - /** - * Returns the raw JSON value of [wireMessageType]. - * - * Unlike [wireMessageType], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("wire_message_type") - @ExcludeMissing - fun _wireMessageType(): JsonField = wireMessageType - @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -3588,6 +3588,7 @@ private constructor( * * The following fields are required: * ```java + * .wireMessageType() * .wireNetwork() * ``` */ @@ -3597,25 +3598,46 @@ private constructor( /** A builder for [WireMethodAttributes]. */ class Builder internal constructor() { + private var wireMessageType: JsonField? = null private var wireNetwork: JsonField? = null private var creditor: JsonField = JsonMissing.of() private var debtor: JsonField = JsonMissing.of() private var messageId: JsonField = JsonMissing.of() private var remittanceInformation: JsonField = JsonMissing.of() - private var wireMessageType: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(wireMethodAttributes: WireMethodAttributes) = apply { + wireMessageType = wireMethodAttributes.wireMessageType wireNetwork = wireMethodAttributes.wireNetwork creditor = wireMethodAttributes.creditor debtor = wireMethodAttributes.debtor messageId = wireMethodAttributes.messageId remittanceInformation = wireMethodAttributes.remittanceInformation - wireMessageType = wireMethodAttributes.wireMessageType additionalProperties = wireMethodAttributes.additionalProperties.toMutableMap() } + /** Type of wire message */ + fun wireMessageType(wireMessageType: String?) = + wireMessageType(JsonField.ofNullable(wireMessageType)) + + /** + * Alias for calling [Builder.wireMessageType] with `wireMessageType.orElse(null)`. + */ + fun wireMessageType(wireMessageType: Optional) = + wireMessageType(wireMessageType.getOrNull()) + + /** + * Sets [Builder.wireMessageType] to an arbitrary JSON value. + * + * You should usually call [Builder.wireMessageType] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun wireMessageType(wireMessageType: JsonField) = apply { + this.wireMessageType = wireMessageType + } + /** Type of wire transfer */ fun wireNetwork(wireNetwork: WireNetwork) = wireNetwork(JsonField.of(wireNetwork)) @@ -3694,21 +3716,6 @@ private constructor( this.remittanceInformation = remittanceInformation } - /** Type of wire message */ - fun wireMessageType(wireMessageType: String) = - wireMessageType(JsonField.of(wireMessageType)) - - /** - * Sets [Builder.wireMessageType] to an arbitrary JSON value. - * - * You should usually call [Builder.wireMessageType] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun wireMessageType(wireMessageType: JsonField) = apply { - this.wireMessageType = wireMessageType - } - fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3738,6 +3745,7 @@ private constructor( * * The following fields are required: * ```java + * .wireMessageType() * .wireNetwork() * ``` * @@ -3745,12 +3753,12 @@ private constructor( */ fun build(): WireMethodAttributes = WireMethodAttributes( + checkRequired("wireMessageType", wireMessageType), checkRequired("wireNetwork", wireNetwork), creditor, debtor, messageId, remittanceInformation, - wireMessageType, additionalProperties.toMutableMap(), ) } @@ -3762,12 +3770,12 @@ private constructor( return@apply } + wireMessageType() wireNetwork().validate() creditor().ifPresent { it.validate() } debtor().ifPresent { it.validate() } messageId() remittanceInformation() - wireMessageType() validated = true } @@ -3787,12 +3795,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + + (if (wireMessageType.asKnown().isPresent) 1 else 0) + + (wireNetwork.asKnown().getOrNull()?.validity() ?: 0) + (creditor.asKnown().getOrNull()?.validity() ?: 0) + (debtor.asKnown().getOrNull()?.validity() ?: 0) + (if (messageId.asKnown().isPresent) 1 else 0) + - (if (remittanceInformation.asKnown().isPresent) 1 else 0) + - (if (wireMessageType.asKnown().isPresent) 1 else 0) + (if (remittanceInformation.asKnown().isPresent) 1 else 0) /** Type of wire transfer */ class WireNetwork @@ -3933,23 +3941,23 @@ private constructor( } return other is WireMethodAttributes && + wireMessageType == other.wireMessageType && wireNetwork == other.wireNetwork && creditor == other.creditor && debtor == other.debtor && messageId == other.messageId && remittanceInformation == other.remittanceInformation && - wireMessageType == other.wireMessageType && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( + wireMessageType, wireNetwork, creditor, debtor, messageId, remittanceInformation, - wireMessageType, additionalProperties, ) } @@ -3957,7 +3965,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "WireMethodAttributes{wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, wireMessageType=$wireMessageType, additionalProperties=$additionalProperties}" + "WireMethodAttributes{wireMessageType=$wireMessageType, wireNetwork=$wireNetwork, creditor=$creditor, debtor=$debtor, messageId=$messageId, remittanceInformation=$remittanceInformation, additionalProperties=$additionalProperties}" } } diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt index 3804256c..2773a6b0 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/PaymentSimulateActionParams.kt @@ -16,6 +16,7 @@ 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 @@ -40,6 +41,14 @@ private constructor( */ fun eventType(): SupportedSimulationTypes = body.eventType() + /** + * Date of Death for ACH Return + * + * @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() + /** * Decline reason * @@ -48,6 +57,14 @@ private constructor( */ fun declineReason(): Optional = body.declineReason() + /** + * Return Addenda + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun returnAddenda(): Optional = body.returnAddenda() + /** * Return Reason Code * @@ -63,6 +80,13 @@ private constructor( */ fun _eventType(): JsonField = body._eventType() + /** + * 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 [declineReason]. * @@ -70,6 +94,13 @@ private constructor( */ fun _declineReason(): JsonField = body._declineReason() + /** + * Returns the raw JSON value of [returnAddenda]. + * + * Unlike [returnAddenda], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _returnAddenda(): JsonField = body._returnAddenda() + /** * Returns the raw JSON value of [returnReasonCode]. * @@ -128,8 +159,11 @@ private constructor( * 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: * - [eventType] + * - [dateOfDeath] * - [declineReason] + * - [returnAddenda] * - [returnReasonCode] + * - etc. */ fun body(body: SimulateActionRequest) = apply { this.body = body.toBuilder() } @@ -147,6 +181,18 @@ private constructor( body.eventType(eventType) } + /** Date of Death for ACH Return */ + fun dateOfDeath(dateOfDeath: LocalDate) = apply { body.dateOfDeath(dateOfDeath) } + + /** + * 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) } + /** Decline reason */ fun declineReason(declineReason: SupportedSimulationDeclineReasons) = apply { body.declineReason(declineReason) @@ -163,6 +209,20 @@ private constructor( body.declineReason(declineReason) } + /** Return Addenda */ + fun returnAddenda(returnAddenda: String) = apply { body.returnAddenda(returnAddenda) } + + /** + * Sets [Builder.returnAddenda] to an arbitrary JSON value. + * + * You should usually call [Builder.returnAddenda] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun returnAddenda(returnAddenda: JsonField) = apply { + body.returnAddenda(returnAddenda) + } + /** Return Reason Code */ fun returnReasonCode(returnReasonCode: String) = apply { body.returnReasonCode(returnReasonCode) @@ -333,7 +393,9 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val eventType: JsonField, + private val dateOfDeath: JsonField, private val declineReason: JsonField, + private val returnAddenda: JsonField, private val returnReasonCode: JsonField, private val additionalProperties: MutableMap, ) { @@ -343,13 +405,26 @@ private constructor( @JsonProperty("event_type") @ExcludeMissing eventType: JsonField = JsonMissing.of(), + @JsonProperty("date_of_death") + @ExcludeMissing + dateOfDeath: JsonField = JsonMissing.of(), @JsonProperty("decline_reason") @ExcludeMissing declineReason: JsonField = JsonMissing.of(), + @JsonProperty("return_addenda") + @ExcludeMissing + returnAddenda: JsonField = JsonMissing.of(), @JsonProperty("return_reason_code") @ExcludeMissing returnReasonCode: JsonField = JsonMissing.of(), - ) : this(eventType, declineReason, returnReasonCode, mutableMapOf()) + ) : this( + eventType, + dateOfDeath, + declineReason, + returnAddenda, + returnReasonCode, + mutableMapOf(), + ) /** * Event Type @@ -359,6 +434,14 @@ private constructor( */ fun eventType(): SupportedSimulationTypes = eventType.getRequired("event_type") + /** + * Date of Death for ACH Return + * + * @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") + /** * Decline reason * @@ -368,6 +451,14 @@ private constructor( fun declineReason(): Optional = declineReason.getOptional("decline_reason") + /** + * Return Addenda + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun returnAddenda(): Optional = returnAddenda.getOptional("return_addenda") + /** * Return Reason Code * @@ -386,6 +477,15 @@ private constructor( @ExcludeMissing fun _eventType(): JsonField = eventType + /** + * 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 [declineReason]. * @@ -396,6 +496,16 @@ private constructor( @ExcludeMissing fun _declineReason(): JsonField = declineReason + /** + * Returns the raw JSON value of [returnAddenda]. + * + * Unlike [returnAddenda], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("return_addenda") + @ExcludeMissing + fun _returnAddenda(): JsonField = returnAddenda + /** * Returns the raw JSON value of [returnReasonCode]. * @@ -435,15 +545,19 @@ private constructor( class Builder internal constructor() { private var eventType: JsonField? = null + private var dateOfDeath: JsonField = JsonMissing.of() private var declineReason: JsonField = JsonMissing.of() + private var returnAddenda: JsonField = JsonMissing.of() private var returnReasonCode: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(simulateActionRequest: SimulateActionRequest) = apply { eventType = simulateActionRequest.eventType + dateOfDeath = simulateActionRequest.dateOfDeath declineReason = simulateActionRequest.declineReason + returnAddenda = simulateActionRequest.returnAddenda returnReasonCode = simulateActionRequest.returnReasonCode additionalProperties = simulateActionRequest.additionalProperties.toMutableMap() } @@ -462,6 +576,20 @@ private constructor( this.eventType = eventType } + /** Date of Death for ACH Return */ + fun dateOfDeath(dateOfDeath: LocalDate) = dateOfDeath(JsonField.of(dateOfDeath)) + + /** + * 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 + } + /** Decline reason */ fun declineReason(declineReason: SupportedSimulationDeclineReasons) = declineReason(JsonField.of(declineReason)) @@ -477,6 +605,20 @@ private constructor( this.declineReason = declineReason } + /** Return Addenda */ + fun returnAddenda(returnAddenda: String) = returnAddenda(JsonField.of(returnAddenda)) + + /** + * Sets [Builder.returnAddenda] to an arbitrary JSON value. + * + * You should usually call [Builder.returnAddenda] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun returnAddenda(returnAddenda: JsonField) = apply { + this.returnAddenda = returnAddenda + } + /** Return Reason Code */ fun returnReasonCode(returnReasonCode: String) = returnReasonCode(JsonField.of(returnReasonCode)) @@ -526,7 +668,9 @@ private constructor( fun build(): SimulateActionRequest = SimulateActionRequest( checkRequired("eventType", eventType), + dateOfDeath, declineReason, + returnAddenda, returnReasonCode, additionalProperties.toMutableMap(), ) @@ -540,7 +684,9 @@ private constructor( } eventType().validate() + dateOfDeath() declineReason().ifPresent { it.validate() } + returnAddenda() returnReasonCode() validated = true } @@ -562,7 +708,9 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (eventType.asKnown().getOrNull()?.validity() ?: 0) + + (if (dateOfDeath.asKnown().isPresent) 1 else 0) + (declineReason.asKnown().getOrNull()?.validity() ?: 0) + + (if (returnAddenda.asKnown().isPresent) 1 else 0) + (if (returnReasonCode.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -572,19 +720,28 @@ private constructor( return other is SimulateActionRequest && eventType == other.eventType && + dateOfDeath == other.dateOfDeath && declineReason == other.declineReason && + returnAddenda == other.returnAddenda && returnReasonCode == other.returnReasonCode && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(eventType, declineReason, returnReasonCode, additionalProperties) + Objects.hash( + eventType, + dateOfDeath, + declineReason, + returnAddenda, + returnReasonCode, + additionalProperties, + ) } override fun hashCode(): Int = hashCode override fun toString() = - "SimulateActionRequest{eventType=$eventType, declineReason=$declineReason, returnReasonCode=$returnReasonCode, additionalProperties=$additionalProperties}" + "SimulateActionRequest{eventType=$eventType, dateOfDeath=$dateOfDeath, declineReason=$declineReason, returnAddenda=$returnAddenda, returnReasonCode=$returnReasonCode, additionalProperties=$additionalProperties}" } /** Event Type */ diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt deleted file mode 100644 index 730b5287..00000000 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt +++ /dev/null @@ -1,5233 +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.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 V2ApplyResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val token: JsonField, - private val accountTokens: JsonField>, - private val businessAccountTokens: JsonField>, - private val cardTokens: JsonField>, - private val currentVersion: JsonField, - private val draftVersion: JsonField, - private val eventStream: JsonField, - private val lithicManaged: JsonField, - private val name: JsonField, - private val programLevel: JsonField, - private val state: JsonField, - private val type: JsonField, - private val excludedCardTokens: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), - @JsonProperty("account_tokens") - @ExcludeMissing - accountTokens: JsonField> = JsonMissing.of(), - @JsonProperty("business_account_tokens") - @ExcludeMissing - businessAccountTokens: JsonField> = JsonMissing.of(), - @JsonProperty("card_tokens") - @ExcludeMissing - cardTokens: JsonField> = JsonMissing.of(), - @JsonProperty("current_version") - @ExcludeMissing - currentVersion: JsonField = JsonMissing.of(), - @JsonProperty("draft_version") - @ExcludeMissing - draftVersion: JsonField = JsonMissing.of(), - @JsonProperty("event_stream") - @ExcludeMissing - eventStream: JsonField = JsonMissing.of(), - @JsonProperty("lithic_managed") - @ExcludeMissing - lithicManaged: JsonField = JsonMissing.of(), - @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(), - @JsonProperty("program_level") - @ExcludeMissing - programLevel: JsonField = JsonMissing.of(), - @JsonProperty("state") @ExcludeMissing state: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("excluded_card_tokens") - @ExcludeMissing - excludedCardTokens: JsonField> = JsonMissing.of(), - ) : this( - token, - accountTokens, - businessAccountTokens, - cardTokens, - currentVersion, - draftVersion, - eventStream, - lithicManaged, - name, - programLevel, - state, - type, - excludedCardTokens, - mutableMapOf(), - ) - - /** - * Auth Rule 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 token(): String = token.getRequired("token") - - /** - * Account tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun accountTokens(): List = accountTokens.getRequired("account_tokens") - - /** - * Business Account tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun businessAccountTokens(): List = - businessAccountTokens.getRequired("business_account_tokens") - - /** - * Card tokens to which the Auth Rule applies. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardTokens(): List = cardTokens.getRequired("card_tokens") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun currentVersion(): Optional = currentVersion.getOptional("current_version") - - /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun draftVersion(): Optional = draftVersion.getOptional("draft_version") - - /** - * The event stream during which the rule will be evaluated. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun eventStream(): EventStream = eventStream.getRequired("event_stream") - - /** - * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot be modified - * or deleted by the user - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun lithicManaged(): Boolean = lithicManaged.getRequired("lithic_managed") - - /** - * Auth Rule Name - * - * @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") - - /** - * Whether the Auth Rule applies to all authorizations on the card program. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun programLevel(): Boolean = programLevel.getRequired("program_level") - - /** - * The state of the Auth Rule - * - * @throws LithicInvalidDataException if 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(): AuthRuleState = state.getRequired("state") - - /** - * The type of Auth Rule. For certain rule types, this determines the event stream during which - * it will be evaluated. For rules that can be applied to one of several event streams, the - * effective one is defined by the separate `event_stream` field. - * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. - * - * @throws LithicInvalidDataException if 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(): AuthRuleType = type.getRequired("type") - - /** - * Card tokens to which the Auth Rule does not apply. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun excludedCardTokens(): Optional> = - excludedCardTokens.getOptional("excluded_card_tokens") - - /** - * 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 [accountTokens]. - * - * Unlike [accountTokens], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("account_tokens") - @ExcludeMissing - fun _accountTokens(): JsonField> = accountTokens - - /** - * Returns the raw JSON value of [businessAccountTokens]. - * - * Unlike [businessAccountTokens], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("business_account_tokens") - @ExcludeMissing - fun _businessAccountTokens(): JsonField> = businessAccountTokens - - /** - * Returns the raw JSON value of [cardTokens]. - * - * Unlike [cardTokens], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("card_tokens") - @ExcludeMissing - fun _cardTokens(): JsonField> = cardTokens - - /** - * Returns the raw JSON value of [currentVersion]. - * - * Unlike [currentVersion], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("current_version") - @ExcludeMissing - fun _currentVersion(): JsonField = currentVersion - - /** - * Returns the raw JSON value of [draftVersion]. - * - * Unlike [draftVersion], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("draft_version") - @ExcludeMissing - fun _draftVersion(): JsonField = draftVersion - - /** - * Returns the raw JSON value of [eventStream]. - * - * Unlike [eventStream], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("event_stream") - @ExcludeMissing - fun _eventStream(): JsonField = eventStream - - /** - * Returns the raw JSON value of [lithicManaged]. - * - * Unlike [lithicManaged], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("lithic_managed") - @ExcludeMissing - fun _lithicManaged(): JsonField = lithicManaged - - /** - * 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 [programLevel]. - * - * Unlike [programLevel], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("program_level") - @ExcludeMissing - fun _programLevel(): JsonField = programLevel - - /** - * 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 [excludedCardTokens]. - * - * Unlike [excludedCardTokens], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("excluded_card_tokens") - @ExcludeMissing - fun _excludedCardTokens(): JsonField> = excludedCardTokens - - @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 [V2ApplyResponse]. - * - * The following fields are required: - * ```java - * .token() - * .accountTokens() - * .businessAccountTokens() - * .cardTokens() - * .currentVersion() - * .draftVersion() - * .eventStream() - * .lithicManaged() - * .name() - * .programLevel() - * .state() - * .type() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [V2ApplyResponse]. */ - class Builder internal constructor() { - - private var token: JsonField? = null - private var accountTokens: JsonField>? = null - private var businessAccountTokens: JsonField>? = null - private var cardTokens: JsonField>? = null - private var currentVersion: JsonField? = null - private var draftVersion: JsonField? = null - private var eventStream: JsonField? = null - private var lithicManaged: JsonField? = null - private var name: JsonField? = null - private var programLevel: JsonField? = null - private var state: JsonField? = null - private var type: JsonField? = null - private var excludedCardTokens: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(v2ApplyResponse: V2ApplyResponse) = apply { - token = v2ApplyResponse.token - accountTokens = v2ApplyResponse.accountTokens.map { it.toMutableList() } - businessAccountTokens = v2ApplyResponse.businessAccountTokens.map { it.toMutableList() } - cardTokens = v2ApplyResponse.cardTokens.map { it.toMutableList() } - currentVersion = v2ApplyResponse.currentVersion - draftVersion = v2ApplyResponse.draftVersion - eventStream = v2ApplyResponse.eventStream - lithicManaged = v2ApplyResponse.lithicManaged - name = v2ApplyResponse.name - programLevel = v2ApplyResponse.programLevel - state = v2ApplyResponse.state - type = v2ApplyResponse.type - excludedCardTokens = v2ApplyResponse.excludedCardTokens.map { it.toMutableList() } - additionalProperties = v2ApplyResponse.additionalProperties.toMutableMap() - } - - /** Auth Rule Token */ - 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 } - - /** Account tokens to which the Auth Rule applies. */ - fun accountTokens(accountTokens: List) = accountTokens(JsonField.of(accountTokens)) - - /** - * Sets [Builder.accountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.accountTokens] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun accountTokens(accountTokens: JsonField>) = apply { - this.accountTokens = accountTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [accountTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addAccountToken(accountToken: String) = apply { - accountTokens = - (accountTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("accountTokens", it).add(accountToken) - } - } - - /** Business Account tokens to which the Auth Rule applies. */ - fun businessAccountTokens(businessAccountTokens: List) = - businessAccountTokens(JsonField.of(businessAccountTokens)) - - /** - * Sets [Builder.businessAccountTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.businessAccountTokens] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun businessAccountTokens(businessAccountTokens: JsonField>) = apply { - this.businessAccountTokens = businessAccountTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [businessAccountTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addBusinessAccountToken(businessAccountToken: String) = apply { - businessAccountTokens = - (businessAccountTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("businessAccountTokens", it).add(businessAccountToken) - } - } - - /** Card tokens to which the Auth Rule applies. */ - fun cardTokens(cardTokens: List) = cardTokens(JsonField.of(cardTokens)) - - /** - * Sets [Builder.cardTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.cardTokens] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardTokens(cardTokens: JsonField>) = apply { - this.cardTokens = cardTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [cardTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCardToken(cardToken: String) = apply { - cardTokens = - (cardTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("cardTokens", it).add(cardToken) - } - } - - fun currentVersion(currentVersion: CurrentVersion?) = - currentVersion(JsonField.ofNullable(currentVersion)) - - /** Alias for calling [Builder.currentVersion] with `currentVersion.orElse(null)`. */ - fun currentVersion(currentVersion: Optional) = - currentVersion(currentVersion.getOrNull()) - - /** - * Sets [Builder.currentVersion] to an arbitrary JSON value. - * - * You should usually call [Builder.currentVersion] with a well-typed [CurrentVersion] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun currentVersion(currentVersion: JsonField) = apply { - this.currentVersion = currentVersion - } - - fun draftVersion(draftVersion: DraftVersion?) = - draftVersion(JsonField.ofNullable(draftVersion)) - - /** Alias for calling [Builder.draftVersion] with `draftVersion.orElse(null)`. */ - fun draftVersion(draftVersion: Optional) = - draftVersion(draftVersion.getOrNull()) - - /** - * Sets [Builder.draftVersion] to an arbitrary JSON value. - * - * You should usually call [Builder.draftVersion] with a well-typed [DraftVersion] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun draftVersion(draftVersion: JsonField) = apply { - this.draftVersion = draftVersion - } - - /** The event stream during which the rule will be evaluated. */ - fun eventStream(eventStream: EventStream) = eventStream(JsonField.of(eventStream)) - - /** - * Sets [Builder.eventStream] to an arbitrary JSON value. - * - * You should usually call [Builder.eventStream] with a well-typed [EventStream] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun eventStream(eventStream: JsonField) = apply { - this.eventStream = eventStream - } - - /** - * Indicates whether this auth rule is managed by Lithic. If true, the rule cannot be - * modified or deleted by the user - */ - fun lithicManaged(lithicManaged: Boolean) = lithicManaged(JsonField.of(lithicManaged)) - - /** - * Sets [Builder.lithicManaged] to an arbitrary JSON value. - * - * You should usually call [Builder.lithicManaged] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lithicManaged(lithicManaged: JsonField) = apply { - this.lithicManaged = lithicManaged - } - - /** Auth Rule 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. - * - * 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 } - - /** Whether the Auth Rule applies to all authorizations on the card program. */ - fun programLevel(programLevel: Boolean) = programLevel(JsonField.of(programLevel)) - - /** - * Sets [Builder.programLevel] to an arbitrary JSON value. - * - * You should usually call [Builder.programLevel] with a well-typed [Boolean] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun programLevel(programLevel: JsonField) = apply { - this.programLevel = programLevel - } - - /** The state of the Auth Rule */ - fun state(state: AuthRuleState) = state(JsonField.of(state)) - - /** - * Sets [Builder.state] to an arbitrary JSON value. - * - * You should usually call [Builder.state] with a well-typed [AuthRuleState] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun state(state: JsonField) = apply { this.state = state } - - /** - * The type of Auth Rule. For certain rule types, this determines the event stream during - * which it will be evaluated. For rules that can be applied to one of several event - * streams, the effective one is defined by the separate `event_stream` field. - * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. - */ - fun type(type: AuthRuleType) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [AuthRuleType] 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 } - - /** Card tokens to which the Auth Rule does not apply. */ - fun excludedCardTokens(excludedCardTokens: List) = - excludedCardTokens(JsonField.of(excludedCardTokens)) - - /** - * Sets [Builder.excludedCardTokens] to an arbitrary JSON value. - * - * You should usually call [Builder.excludedCardTokens] with a well-typed `List` - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun excludedCardTokens(excludedCardTokens: JsonField>) = apply { - this.excludedCardTokens = excludedCardTokens.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [excludedCardTokens]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExcludedCardToken(excludedCardToken: String) = apply { - excludedCardTokens = - (excludedCardTokens ?: JsonField.of(mutableListOf())).also { - checkKnown("excludedCardTokens", it).add(excludedCardToken) - } - } - - 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 [V2ApplyResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .token() - * .accountTokens() - * .businessAccountTokens() - * .cardTokens() - * .currentVersion() - * .draftVersion() - * .eventStream() - * .lithicManaged() - * .name() - * .programLevel() - * .state() - * .type() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): V2ApplyResponse = - V2ApplyResponse( - checkRequired("token", token), - checkRequired("accountTokens", accountTokens).map { it.toImmutable() }, - checkRequired("businessAccountTokens", businessAccountTokens).map { - it.toImmutable() - }, - checkRequired("cardTokens", cardTokens).map { it.toImmutable() }, - checkRequired("currentVersion", currentVersion), - checkRequired("draftVersion", draftVersion), - checkRequired("eventStream", eventStream), - checkRequired("lithicManaged", lithicManaged), - checkRequired("name", name), - checkRequired("programLevel", programLevel), - checkRequired("state", state), - checkRequired("type", type), - (excludedCardTokens ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): V2ApplyResponse = apply { - if (validated) { - return@apply - } - - token() - accountTokens() - businessAccountTokens() - cardTokens() - currentVersion().ifPresent { it.validate() } - draftVersion().ifPresent { it.validate() } - eventStream().validate() - lithicManaged() - name() - programLevel() - state().validate() - type().validate() - excludedCardTokens() - 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) + - (accountTokens.asKnown().getOrNull()?.size ?: 0) + - (businessAccountTokens.asKnown().getOrNull()?.size ?: 0) + - (cardTokens.asKnown().getOrNull()?.size ?: 0) + - (currentVersion.asKnown().getOrNull()?.validity() ?: 0) + - (draftVersion.asKnown().getOrNull()?.validity() ?: 0) + - (eventStream.asKnown().getOrNull()?.validity() ?: 0) + - (if (lithicManaged.asKnown().isPresent) 1 else 0) + - (if (name.asKnown().isPresent) 1 else 0) + - (if (programLevel.asKnown().isPresent) 1 else 0) + - (state.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (excludedCardTokens.asKnown().getOrNull()?.size ?: 0) - - class CurrentVersion - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val parameters: JsonField, - private val version: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("parameters") - @ExcludeMissing - parameters: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(parameters, version, mutableMapOf()) - - /** - * Parameters for the Auth Rule - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun parameters(): Parameters = parameters.getRequired("parameters") - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun version(): Long = version.getRequired("version") - - /** - * Returns the raw JSON value of [parameters]. - * - * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("parameters") - @ExcludeMissing - fun _parameters(): JsonField = parameters - - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - - @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 [CurrentVersion]. - * - * The following fields are required: - * ```java - * .parameters() - * .version() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CurrentVersion]. */ - class Builder internal constructor() { - - private var parameters: JsonField? = null - private var version: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(currentVersion: CurrentVersion) = apply { - parameters = currentVersion.parameters - version = currentVersion.version - additionalProperties = currentVersion.additionalProperties.toMutableMap() - } - - /** Parameters for the Auth Rule */ - fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) - - /** - * Sets [Builder.parameters] to an arbitrary JSON value. - * - * You should usually call [Builder.parameters] with a well-typed [Parameters] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun parameters(parameters: JsonField) = apply { - this.parameters = parameters - } - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalBlock(conditionalBlock)`. - */ - fun parameters(conditionalBlock: ConditionalBlockParameters) = - parameters(Parameters.ofConditionalBlock(conditionalBlock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofVelocityLimitParams(velocityLimitParams)`. - */ - fun parameters(velocityLimitParams: VelocityLimitParams) = - parameters(Parameters.ofVelocityLimitParams(velocityLimitParams)) - - /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */ - fun parameters(merchantLock: MerchantLockParameters) = - parameters(Parameters.ofMerchantLock(merchantLock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditional3dsAction(conditional3dsAction)`. - */ - fun parameters(conditional3dsAction: Conditional3dsActionParameters) = - parameters(Parameters.ofConditional3dsAction(conditional3dsAction)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`. - */ - fun parameters( - conditionalAuthorizationAction: Parameters.ConditionalAuthorizationActionParameters - ) = - parameters( - Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) - ) - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - */ - fun version(version: Long) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - - 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 [CurrentVersion]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .parameters() - * .version() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CurrentVersion = - CurrentVersion( - checkRequired("parameters", parameters), - checkRequired("version", version), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CurrentVersion = apply { - if (validated) { - return@apply - } - - parameters().validate() - version() - 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 = - (parameters.asKnown().getOrNull()?.validity() ?: 0) + - (if (version.asKnown().isPresent) 1 else 0) - - /** Parameters for the Auth Rule */ - @JsonDeserialize(using = Parameters.Deserializer::class) - @JsonSerialize(using = Parameters.Serializer::class) - class Parameters - private constructor( - private val conditionalBlock: ConditionalBlockParameters? = null, - private val velocityLimitParams: VelocityLimitParams? = null, - private val merchantLock: MerchantLockParameters? = null, - private val conditional3dsAction: Conditional3dsActionParameters? = null, - private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = - null, - private val _json: JsonValue? = null, - ) { - - fun conditionalBlock(): Optional = - Optional.ofNullable(conditionalBlock) - - fun velocityLimitParams(): Optional = - Optional.ofNullable(velocityLimitParams) - - fun merchantLock(): Optional = Optional.ofNullable(merchantLock) - - fun conditional3dsAction(): Optional = - Optional.ofNullable(conditional3dsAction) - - fun conditionalAuthorizationAction(): - Optional = - Optional.ofNullable(conditionalAuthorizationAction) - - fun isConditionalBlock(): Boolean = conditionalBlock != null - - fun isVelocityLimitParams(): Boolean = velocityLimitParams != null - - fun isMerchantLock(): Boolean = merchantLock != null - - fun isConditional3dsAction(): Boolean = conditional3dsAction != null - - fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null - - fun asConditionalBlock(): ConditionalBlockParameters = - conditionalBlock.getOrThrow("conditionalBlock") - - fun asVelocityLimitParams(): VelocityLimitParams = - velocityLimitParams.getOrThrow("velocityLimitParams") - - fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock") - - fun asConditional3dsAction(): Conditional3dsActionParameters = - conditional3dsAction.getOrThrow("conditional3dsAction") - - fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = - conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock) - velocityLimitParams != null -> - visitor.visitVelocityLimitParams(velocityLimitParams) - merchantLock != null -> visitor.visitMerchantLock(merchantLock) - conditional3dsAction != null -> - visitor.visitConditional3dsAction(conditional3dsAction) - conditionalAuthorizationAction != null -> - visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Parameters = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) { - conditionalBlock.validate() - } - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) { - velocityLimitParams.validate() - } - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) { - merchantLock.validate() - } - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) { - conditional3dsAction.validate() - } - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) { - conditionalAuthorizationAction.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 visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) = conditionalBlock.validity() - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) = velocityLimitParams.validity() - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) = - merchantLock.validity() - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) = conditional3dsAction.validity() - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = conditionalAuthorizationAction.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Parameters && - conditionalBlock == other.conditionalBlock && - velocityLimitParams == other.velocityLimitParams && - merchantLock == other.merchantLock && - conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction - } - - override fun hashCode(): Int = - Objects.hash( - conditionalBlock, - velocityLimitParams, - merchantLock, - conditional3dsAction, - conditionalAuthorizationAction, - ) - - override fun toString(): String = - when { - conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}" - velocityLimitParams != null -> - "Parameters{velocityLimitParams=$velocityLimitParams}" - merchantLock != null -> "Parameters{merchantLock=$merchantLock}" - conditional3dsAction != null -> - "Parameters{conditional3dsAction=$conditional3dsAction}" - conditionalAuthorizationAction != null -> - "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" - _json != null -> "Parameters{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Parameters") - } - - companion object { - - @JvmStatic - fun ofConditionalBlock(conditionalBlock: ConditionalBlockParameters) = - Parameters(conditionalBlock = conditionalBlock) - - @JvmStatic - fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) = - Parameters(velocityLimitParams = velocityLimitParams) - - @JvmStatic - fun ofMerchantLock(merchantLock: MerchantLockParameters) = - Parameters(merchantLock = merchantLock) - - @JvmStatic - fun ofConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters) = - Parameters(conditional3dsAction = conditional3dsAction) - - @JvmStatic - fun ofConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) - } - - /** - * An interface that defines how to map each variant of [Parameters] to a value of type - * [T]. - */ - interface Visitor { - - fun visitConditionalBlock(conditionalBlock: ConditionalBlockParameters): T - - fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T - - fun visitMerchantLock(merchantLock: MerchantLockParameters): T - - fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ): T - - fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ): T - - /** - * Maps an unknown variant of [Parameters] to a value of type [T]. - * - * An instance of [Parameters] 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 Parameters: $json") - } - } - - internal class Deserializer : BaseDeserializer(Parameters::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Parameters { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(conditionalBlock = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - Parameters(velocityLimitParams = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(merchantLock = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Parameters(conditional3dsAction = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Parameters( - conditionalAuthorizationAction = 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 -> Parameters(_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(Parameters::class) { - - override fun serialize( - value: Parameters, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.conditionalBlock != null -> - generator.writeObject(value.conditionalBlock) - value.velocityLimitParams != null -> - generator.writeObject(value.velocityLimitParams) - value.merchantLock != null -> generator.writeObject(value.merchantLock) - value.conditional3dsAction != null -> - generator.writeObject(value.conditional3dsAction) - value.conditionalAuthorizationAction != null -> - generator.writeObject(value.conditionalAuthorizationAction) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Parameters") - } - } - } - - class ConditionalAuthorizationActionParameters - @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 - * [ConditionalAuthorizationActionParameters]. - * - * The following fields are required: - * ```java - * .action() - * .conditions() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ConditionalAuthorizationActionParameters]. */ - class Builder internal constructor() { - - private var action: JsonField? = null - private var conditions: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - conditionalAuthorizationActionParameters: - ConditionalAuthorizationActionParameters - ) = apply { - action = conditionalAuthorizationActionParameters.action - conditions = - conditionalAuthorizationActionParameters.conditions.map { - it.toMutableList() - } - additionalProperties = - conditionalAuthorizationActionParameters.additionalProperties - .toMutableMap() - } - - /** The action to take if the conditions are met. */ - fun action(action: Action) = action(JsonField.of(action)) - - /** - * Sets [Builder.action] to an arbitrary JSON value. - * - * You should usually call [Builder.action] with a well-typed [Action] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun action(action: JsonField) = apply { this.action = action } - - fun conditions(conditions: List) = - conditions(JsonField.of(conditions)) - - /** - * Sets [Builder.conditions] to an arbitrary JSON value. - * - * You should usually call [Builder.conditions] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun conditions(conditions: JsonField>) = apply { - this.conditions = conditions.map { it.toMutableList() } - } - - /** - * Adds a single [Condition] to [conditions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCondition(condition: Condition) = apply { - conditions = - (conditions ?: JsonField.of(mutableListOf())).also { - checkKnown("conditions", it).add(condition) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ConditionalAuthorizationActionParameters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .action() - * .conditions() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ConditionalAuthorizationActionParameters = - ConditionalAuthorizationActionParameters( - checkRequired("action", action), - checkRequired("conditions", conditions).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ConditionalAuthorizationActionParameters = apply { - if (validated) { - return@apply - } - - action().validate() - conditions().forEach { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (action.asKnown().getOrNull()?.validity() ?: 0) + - (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** The action to take if the conditions are met. */ - class Action - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val DECLINE = of("DECLINE") - - @JvmField val CHALLENGE = of("CHALLENGE") - - @JvmStatic fun of(value: String) = Action(JsonField.of(value)) - } - - /** An enum containing [Action]'s known values. */ - enum class Known { - DECLINE, - CHALLENGE, - } - - /** - * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Action] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECLINE, - CHALLENGE, - /** - * An enum member indicating that [Action] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECLINE -> Value.DECLINE - CHALLENGE -> Value.CHALLENGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - DECLINE -> Known.DECLINE - CHALLENGE -> Known.CHALLENGE - else -> throw LithicInvalidDataException("Unknown Action: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Action = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Action && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class Condition - @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: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify - * a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - * ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - * Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency - * of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - * (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, - * `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, - * `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This is - * the amount the issuer should authorize against unless the issuer is paying - * the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). - * This represents the amount of cash being withdrawn or advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated with a - * given authorization. Scores are on a range of 0-999, with 0 representing - * the lowest risk and 999 representing the highest risk. For Visa - * transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - * trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - * trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - * trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - * Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - * `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - * source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - * data with 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). - */ - fun attribute(): Optional = attribute.getOptional("attribute") - - /** - * The operation to apply to the attribute - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun operation(): Optional = operation.getOptional("operation") - - /** - * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun value(): Optional = value.getOptional("value") - - /** - * Returns the raw JSON value of [attribute]. - * - * Unlike [attribute], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("attribute") - @ExcludeMissing - fun _attribute(): JsonField = attribute - - /** - * Returns the raw JSON value of [operation]. - * - * Unlike [operation], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("operation") - @ExcludeMissing - fun _operation(): JsonField = operation - - /** - * Returns the raw JSON value of [value]. - * - * Unlike [value], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Condition]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Condition]. */ - class Builder internal constructor() { - - private var attribute: JsonField = JsonMissing.of() - private var operation: JsonField = JsonMissing.of() - private var value: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(condition: Condition) = apply { - attribute = condition.attribute - operation = condition.operation - value = condition.value - additionalProperties = condition.additionalProperties.toMutableMap() - } - - /** - * The attribute to target. - * - * The following attributes may be targeted: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to - * classify a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) - * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT - * for Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant - * currency of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card - * acceptor (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, - * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, - * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or - * `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This - * is the amount the issuer should authorize against unless the issuer is - * paying the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units - * (cents). This represents the amount of cash being withdrawn or - * advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated - * with a given authorization. Scores are on a range of 0-999, with 0 - * representing the lowest risk and 999 representing the highest risk. For - * Visa transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in - * the trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in - * the trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in - * the trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the - * transaction. Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are - * `NOT_SET`, `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates - * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's - * address data with the cardholder KYC data if it exists. Valid values - * are `MATCH`, `MATCH_ADDRESS_ONLY`, - * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - */ - fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) - - /** - * Sets [Builder.attribute] to an arbitrary JSON value. - * - * You should usually call [Builder.attribute] with a well-typed [Attribute] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun attribute(attribute: JsonField) = apply { - this.attribute = attribute - } - - /** The operation to apply to the attribute */ - fun operation(operation: Operation) = operation(JsonField.of(operation)) - - /** - * Sets [Builder.operation] to an arbitrary JSON value. - * - * You should usually call [Builder.operation] with a well-typed [Operation] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun operation(operation: JsonField) = apply { - this.operation = operation - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun value(value: Value) = value(JsonField.of(value)) - - /** - * Sets [Builder.value] to an arbitrary JSON value. - * - * You should usually call [Builder.value] with a well-typed [Value] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun value(value: JsonField) = apply { this.value = value } - - /** Alias for calling [value] with `Value.ofRegex(regex)`. */ - fun value(regex: String) = value(Value.ofRegex(regex)) - - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun value(number: Long) = value(Value.ofNumber(number)) - - /** - * Alias for calling [value] with `Value.ofListOfStrings(listOfStrings)`. - */ - fun valueOfListOfStrings(listOfStrings: List) = - value(Value.ofListOfStrings(listOfStrings)) - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Condition]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Condition = - Condition( - attribute, - operation, - value, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Condition = apply { - if (validated) { - return@apply - } - - attribute().ifPresent { it.validate() } - operation().ifPresent { it.validate() } - value().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (attribute.asKnown().getOrNull()?.validity() ?: 0) + - (operation.asKnown().getOrNull()?.validity() ?: 0) + - (value.asKnown().getOrNull()?.validity() ?: 0) - - /** - * The attribute to target. - * - * The following attributes may be targeted: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify - * a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - * ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - * Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency - * of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - * (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, - * `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, - * `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This is - * the amount the issuer should authorize against unless the issuer is paying - * the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). - * This represents the amount of cash being withdrawn or advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated with a - * given authorization. Scores are on a range of 0-999, with 0 representing - * the lowest risk and 999 representing the highest risk. For Visa - * transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - * trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - * trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - * trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - * Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - * `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - * source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - * data with the cardholder KYC data if it exists. Valid values are `MATCH`, - * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - */ - class Attribute - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MCC = of("MCC") - - @JvmField val COUNTRY = of("COUNTRY") - - @JvmField val CURRENCY = of("CURRENCY") - - @JvmField val MERCHANT_ID = of("MERCHANT_ID") - - @JvmField val DESCRIPTOR = of("DESCRIPTOR") - - @JvmField val LIABILITY_SHIFT = of("LIABILITY_SHIFT") - - @JvmField val PAN_ENTRY_MODE = of("PAN_ENTRY_MODE") - - @JvmField val TRANSACTION_AMOUNT = of("TRANSACTION_AMOUNT") - - @JvmField val CASH_AMOUNT = of("CASH_AMOUNT") - - @JvmField val RISK_SCORE = of("RISK_SCORE") - - @JvmField - val CARD_TRANSACTION_COUNT_15_M = of("CARD_TRANSACTION_COUNT_15M") - - @JvmField - val CARD_TRANSACTION_COUNT_1_H = of("CARD_TRANSACTION_COUNT_1H") - - @JvmField - val CARD_TRANSACTION_COUNT_24_H = of("CARD_TRANSACTION_COUNT_24H") - - @JvmField val CARD_STATE = of("CARD_STATE") - - @JvmField val PIN_ENTERED = of("PIN_ENTERED") - - @JvmField val PIN_STATUS = of("PIN_STATUS") - - @JvmField val WALLET_TYPE = of("WALLET_TYPE") - - @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") - - @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") - - @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) - } - - /** An enum containing [Attribute]'s known values. */ - enum class Known { - MCC, - COUNTRY, - CURRENCY, - MERCHANT_ID, - DESCRIPTOR, - LIABILITY_SHIFT, - PAN_ENTRY_MODE, - TRANSACTION_AMOUNT, - CASH_AMOUNT, - RISK_SCORE, - CARD_TRANSACTION_COUNT_15_M, - CARD_TRANSACTION_COUNT_1_H, - CARD_TRANSACTION_COUNT_24_H, - CARD_STATE, - PIN_ENTERED, - PIN_STATUS, - WALLET_TYPE, - TRANSACTION_INITIATOR, - ADDRESS_MATCH, - } - - /** - * An enum containing [Attribute]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Attribute] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MCC, - COUNTRY, - CURRENCY, - MERCHANT_ID, - DESCRIPTOR, - LIABILITY_SHIFT, - PAN_ENTRY_MODE, - TRANSACTION_AMOUNT, - CASH_AMOUNT, - RISK_SCORE, - CARD_TRANSACTION_COUNT_15_M, - CARD_TRANSACTION_COUNT_1_H, - CARD_TRANSACTION_COUNT_24_H, - CARD_STATE, - PIN_ENTERED, - PIN_STATUS, - WALLET_TYPE, - TRANSACTION_INITIATOR, - ADDRESS_MATCH, - /** - * An enum member indicating that [Attribute] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MCC -> Value.MCC - COUNTRY -> Value.COUNTRY - CURRENCY -> Value.CURRENCY - MERCHANT_ID -> Value.MERCHANT_ID - DESCRIPTOR -> Value.DESCRIPTOR - LIABILITY_SHIFT -> Value.LIABILITY_SHIFT - PAN_ENTRY_MODE -> Value.PAN_ENTRY_MODE - TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT - CASH_AMOUNT -> Value.CASH_AMOUNT - RISK_SCORE -> Value.RISK_SCORE - CARD_TRANSACTION_COUNT_15_M -> Value.CARD_TRANSACTION_COUNT_15_M - CARD_TRANSACTION_COUNT_1_H -> Value.CARD_TRANSACTION_COUNT_1_H - CARD_TRANSACTION_COUNT_24_H -> Value.CARD_TRANSACTION_COUNT_24_H - CARD_STATE -> Value.CARD_STATE - PIN_ENTERED -> Value.PIN_ENTERED - PIN_STATUS -> Value.PIN_STATUS - WALLET_TYPE -> Value.WALLET_TYPE - TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR - ADDRESS_MATCH -> Value.ADDRESS_MATCH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - MCC -> Known.MCC - COUNTRY -> Known.COUNTRY - CURRENCY -> Known.CURRENCY - MERCHANT_ID -> Known.MERCHANT_ID - DESCRIPTOR -> Known.DESCRIPTOR - LIABILITY_SHIFT -> Known.LIABILITY_SHIFT - PAN_ENTRY_MODE -> Known.PAN_ENTRY_MODE - TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT - CASH_AMOUNT -> Known.CASH_AMOUNT - RISK_SCORE -> Known.RISK_SCORE - CARD_TRANSACTION_COUNT_15_M -> Known.CARD_TRANSACTION_COUNT_15_M - CARD_TRANSACTION_COUNT_1_H -> Known.CARD_TRANSACTION_COUNT_1_H - CARD_TRANSACTION_COUNT_24_H -> Known.CARD_TRANSACTION_COUNT_24_H - CARD_STATE -> Known.CARD_STATE - PIN_ENTERED -> Known.PIN_ENTERED - PIN_STATUS -> Known.PIN_STATUS - WALLET_TYPE -> Known.WALLET_TYPE - TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR - ADDRESS_MATCH -> Known.ADDRESS_MATCH - else -> - throw LithicInvalidDataException("Unknown Attribute: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Attribute = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Attribute && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The operation to apply to the attribute */ - class Operation - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val IS_ONE_OF = of("IS_ONE_OF") - - @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") - - @JvmField val MATCHES = of("MATCHES") - - @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") - - @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") - - @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") - - @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") - - @JvmField - val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") - - @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") - - @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") - - @JvmStatic fun of(value: String) = Operation(JsonField.of(value)) - } - - /** An enum containing [Operation]'s known values. */ - enum class Known { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - } - - /** - * An enum containing [Operation]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Operation] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - /** - * An enum member indicating that [Operation] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - IS_ONE_OF -> Value.IS_ONE_OF - IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF - MATCHES -> Value.MATCHES - DOES_NOT_MATCH -> Value.DOES_NOT_MATCH - IS_EQUAL_TO -> Value.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Value.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Value.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - IS_ONE_OF -> Known.IS_ONE_OF - IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF - MATCHES -> Known.MATCHES - DOES_NOT_MATCH -> Known.DOES_NOT_MATCH - IS_EQUAL_TO -> Known.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Known.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Known.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO - else -> - throw LithicInvalidDataException("Unknown Operation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Operation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Operation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val regex: String? = null, - private val number: Long? = null, - private val listOfStrings: List? = null, - private val _json: JsonValue? = null, - ) { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun regex(): Optional = Optional.ofNullable(regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun number(): Optional = Optional.ofNullable(number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun listOfStrings(): Optional> = - Optional.ofNullable(listOfStrings) - - fun isRegex(): Boolean = regex != null - - fun isNumber(): Boolean = number != null - - fun isListOfStrings(): Boolean = listOfStrings != null - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun asRegex(): String = regex.getOrThrow("regex") - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun asNumber(): Long = number.getOrThrow("number") - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun asListOfStrings(): List = - listOfStrings.getOrThrow("listOfStrings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - regex != null -> visitor.visitRegex(regex) - number != null -> visitor.visitNumber(number) - listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Value = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitRegex(regex: String) {} - - override fun visitNumber(number: Long) {} - - override fun visitListOfStrings(listOfStrings: List) {} - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitRegex(regex: String) = 1 - - override fun visitNumber(number: Long) = 1 - - override fun visitListOfStrings(listOfStrings: List) = - listOfStrings.size - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - regex == other.regex && - number == other.number && - listOfStrings == other.listOfStrings - } - - override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) - - override fun toString(): String = - when { - regex != null -> "Value{regex=$regex}" - number != null -> "Value{number=$number}" - listOfStrings != null -> "Value{listOfStrings=$listOfStrings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - - companion object { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JvmStatic fun ofRegex(regex: String) = Value(regex = regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - @JvmStatic fun ofNumber(number: Long) = Value(number = number) - - /** - * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` - */ - @JvmStatic - fun ofListOfStrings(listOfStrings: List) = - Value(listOfStrings = listOfStrings.toImmutable()) - } - - /** - * An interface that defines how to map each variant of [Value] to a value - * of type [T]. - */ - interface Visitor { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun visitRegex(regex: String): T - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun visitNumber(number: Long): T - - /** - * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` - */ - fun visitListOfStrings(listOfStrings: List): T - - /** - * Maps an unknown variant of [Value] to a value of type [T]. - * - * An instance of [Value] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new variants that the SDK is unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Value: $json") - } - } - - internal class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Value(regex = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Value(number = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef>()) - ?.let { Value(listOfStrings = it, _json = json) }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely - // incompatible with all the possible variants (e.g. - // deserializing from object). - 0 -> Value(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, - // then use the first completely valid match, or simply the - // first match if none are completely valid. - else -> - bestMatches.firstOrNull { it.isValid() } - ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.regex != null -> generator.writeObject(value.regex) - value.number != null -> generator.writeObject(value.number) - value.listOfStrings != null -> - generator.writeObject(value.listOfStrings) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Value") - } - } - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Condition && - attribute == other.attribute && - operation == other.operation && - value == other.value && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(attribute, operation, value, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ConditionalAuthorizationActionParameters && - action == other.action && - conditions == other.conditions && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(action, conditions, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ConditionalAuthorizationActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}" - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CurrentVersion && - parameters == other.parameters && - version == other.version && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(parameters, version, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CurrentVersion{parameters=$parameters, version=$version, additionalProperties=$additionalProperties}" - } - - class DraftVersion - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val parameters: JsonField, - private val version: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("parameters") - @ExcludeMissing - parameters: JsonField = JsonMissing.of(), - @JsonProperty("version") @ExcludeMissing version: JsonField = JsonMissing.of(), - ) : this(parameters, version, mutableMapOf()) - - /** - * Parameters for the Auth Rule - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun parameters(): Parameters = parameters.getRequired("parameters") - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun version(): Long = version.getRequired("version") - - /** - * Returns the raw JSON value of [parameters]. - * - * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("parameters") - @ExcludeMissing - fun _parameters(): JsonField = parameters - - /** - * Returns the raw JSON value of [version]. - * - * Unlike [version], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("version") @ExcludeMissing fun _version(): JsonField = version - - @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 [DraftVersion]. - * - * The following fields are required: - * ```java - * .parameters() - * .version() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [DraftVersion]. */ - class Builder internal constructor() { - - private var parameters: JsonField? = null - private var version: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(draftVersion: DraftVersion) = apply { - parameters = draftVersion.parameters - version = draftVersion.version - additionalProperties = draftVersion.additionalProperties.toMutableMap() - } - - /** Parameters for the Auth Rule */ - fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) - - /** - * Sets [Builder.parameters] to an arbitrary JSON value. - * - * You should usually call [Builder.parameters] with a well-typed [Parameters] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun parameters(parameters: JsonField) = apply { - this.parameters = parameters - } - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalBlock(conditionalBlock)`. - */ - fun parameters(conditionalBlock: ConditionalBlockParameters) = - parameters(Parameters.ofConditionalBlock(conditionalBlock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofVelocityLimitParams(velocityLimitParams)`. - */ - fun parameters(velocityLimitParams: VelocityLimitParams) = - parameters(Parameters.ofVelocityLimitParams(velocityLimitParams)) - - /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */ - fun parameters(merchantLock: MerchantLockParameters) = - parameters(Parameters.ofMerchantLock(merchantLock)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditional3dsAction(conditional3dsAction)`. - */ - fun parameters(conditional3dsAction: Conditional3dsActionParameters) = - parameters(Parameters.ofConditional3dsAction(conditional3dsAction)) - - /** - * Alias for calling [parameters] with - * `Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction)`. - */ - fun parameters( - conditionalAuthorizationAction: Parameters.ConditionalAuthorizationActionParameters - ) = - parameters( - Parameters.ofConditionalAuthorizationAction(conditionalAuthorizationAction) - ) - - /** - * The version of the rule, this is incremented whenever the rule's parameters change. - */ - fun version(version: Long) = version(JsonField.of(version)) - - /** - * Sets [Builder.version] to an arbitrary JSON value. - * - * You should usually call [Builder.version] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun version(version: JsonField) = apply { this.version = version } - - 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 [DraftVersion]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .parameters() - * .version() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): DraftVersion = - DraftVersion( - checkRequired("parameters", parameters), - checkRequired("version", version), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): DraftVersion = apply { - if (validated) { - return@apply - } - - parameters().validate() - version() - 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 = - (parameters.asKnown().getOrNull()?.validity() ?: 0) + - (if (version.asKnown().isPresent) 1 else 0) - - /** Parameters for the Auth Rule */ - @JsonDeserialize(using = Parameters.Deserializer::class) - @JsonSerialize(using = Parameters.Serializer::class) - class Parameters - private constructor( - private val conditionalBlock: ConditionalBlockParameters? = null, - private val velocityLimitParams: VelocityLimitParams? = null, - private val merchantLock: MerchantLockParameters? = null, - private val conditional3dsAction: Conditional3dsActionParameters? = null, - private val conditionalAuthorizationAction: ConditionalAuthorizationActionParameters? = - null, - private val _json: JsonValue? = null, - ) { - - fun conditionalBlock(): Optional = - Optional.ofNullable(conditionalBlock) - - fun velocityLimitParams(): Optional = - Optional.ofNullable(velocityLimitParams) - - fun merchantLock(): Optional = Optional.ofNullable(merchantLock) - - fun conditional3dsAction(): Optional = - Optional.ofNullable(conditional3dsAction) - - fun conditionalAuthorizationAction(): - Optional = - Optional.ofNullable(conditionalAuthorizationAction) - - fun isConditionalBlock(): Boolean = conditionalBlock != null - - fun isVelocityLimitParams(): Boolean = velocityLimitParams != null - - fun isMerchantLock(): Boolean = merchantLock != null - - fun isConditional3dsAction(): Boolean = conditional3dsAction != null - - fun isConditionalAuthorizationAction(): Boolean = conditionalAuthorizationAction != null - - fun asConditionalBlock(): ConditionalBlockParameters = - conditionalBlock.getOrThrow("conditionalBlock") - - fun asVelocityLimitParams(): VelocityLimitParams = - velocityLimitParams.getOrThrow("velocityLimitParams") - - fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock") - - fun asConditional3dsAction(): Conditional3dsActionParameters = - conditional3dsAction.getOrThrow("conditional3dsAction") - - fun asConditionalAuthorizationAction(): ConditionalAuthorizationActionParameters = - conditionalAuthorizationAction.getOrThrow("conditionalAuthorizationAction") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock) - velocityLimitParams != null -> - visitor.visitVelocityLimitParams(velocityLimitParams) - merchantLock != null -> visitor.visitMerchantLock(merchantLock) - conditional3dsAction != null -> - visitor.visitConditional3dsAction(conditional3dsAction) - conditionalAuthorizationAction != null -> - visitor.visitConditionalAuthorizationAction(conditionalAuthorizationAction) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Parameters = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) { - conditionalBlock.validate() - } - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) { - velocityLimitParams.validate() - } - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) { - merchantLock.validate() - } - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) { - conditional3dsAction.validate() - } - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) { - conditionalAuthorizationAction.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 visitConditionalBlock( - conditionalBlock: ConditionalBlockParameters - ) = conditionalBlock.validity() - - override fun visitVelocityLimitParams( - velocityLimitParams: VelocityLimitParams - ) = velocityLimitParams.validity() - - override fun visitMerchantLock(merchantLock: MerchantLockParameters) = - merchantLock.validity() - - override fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ) = conditional3dsAction.validity() - - override fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = conditionalAuthorizationAction.validity() - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Parameters && - conditionalBlock == other.conditionalBlock && - velocityLimitParams == other.velocityLimitParams && - merchantLock == other.merchantLock && - conditional3dsAction == other.conditional3dsAction && - conditionalAuthorizationAction == other.conditionalAuthorizationAction - } - - override fun hashCode(): Int = - Objects.hash( - conditionalBlock, - velocityLimitParams, - merchantLock, - conditional3dsAction, - conditionalAuthorizationAction, - ) - - override fun toString(): String = - when { - conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}" - velocityLimitParams != null -> - "Parameters{velocityLimitParams=$velocityLimitParams}" - merchantLock != null -> "Parameters{merchantLock=$merchantLock}" - conditional3dsAction != null -> - "Parameters{conditional3dsAction=$conditional3dsAction}" - conditionalAuthorizationAction != null -> - "Parameters{conditionalAuthorizationAction=$conditionalAuthorizationAction}" - _json != null -> "Parameters{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Parameters") - } - - companion object { - - @JvmStatic - fun ofConditionalBlock(conditionalBlock: ConditionalBlockParameters) = - Parameters(conditionalBlock = conditionalBlock) - - @JvmStatic - fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) = - Parameters(velocityLimitParams = velocityLimitParams) - - @JvmStatic - fun ofMerchantLock(merchantLock: MerchantLockParameters) = - Parameters(merchantLock = merchantLock) - - @JvmStatic - fun ofConditional3dsAction(conditional3dsAction: Conditional3dsActionParameters) = - Parameters(conditional3dsAction = conditional3dsAction) - - @JvmStatic - fun ofConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ) = Parameters(conditionalAuthorizationAction = conditionalAuthorizationAction) - } - - /** - * An interface that defines how to map each variant of [Parameters] to a value of type - * [T]. - */ - interface Visitor { - - fun visitConditionalBlock(conditionalBlock: ConditionalBlockParameters): T - - fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T - - fun visitMerchantLock(merchantLock: MerchantLockParameters): T - - fun visitConditional3dsAction( - conditional3dsAction: Conditional3dsActionParameters - ): T - - fun visitConditionalAuthorizationAction( - conditionalAuthorizationAction: ConditionalAuthorizationActionParameters - ): T - - /** - * Maps an unknown variant of [Parameters] to a value of type [T]. - * - * An instance of [Parameters] 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 Parameters: $json") - } - } - - internal class Deserializer : BaseDeserializer(Parameters::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Parameters { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(conditionalBlock = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - Parameters(velocityLimitParams = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef()) - ?.let { Parameters(merchantLock = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { Parameters(conditional3dsAction = it, _json = json) }, - tryDeserialize( - node, - jacksonTypeRef(), - ) - ?.let { - Parameters( - conditionalAuthorizationAction = 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 -> Parameters(_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(Parameters::class) { - - override fun serialize( - value: Parameters, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.conditionalBlock != null -> - generator.writeObject(value.conditionalBlock) - value.velocityLimitParams != null -> - generator.writeObject(value.velocityLimitParams) - value.merchantLock != null -> generator.writeObject(value.merchantLock) - value.conditional3dsAction != null -> - generator.writeObject(value.conditional3dsAction) - value.conditionalAuthorizationAction != null -> - generator.writeObject(value.conditionalAuthorizationAction) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Parameters") - } - } - } - - class ConditionalAuthorizationActionParameters - @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 - * [ConditionalAuthorizationActionParameters]. - * - * The following fields are required: - * ```java - * .action() - * .conditions() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [ConditionalAuthorizationActionParameters]. */ - class Builder internal constructor() { - - private var action: JsonField? = null - private var conditions: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from( - conditionalAuthorizationActionParameters: - ConditionalAuthorizationActionParameters - ) = apply { - action = conditionalAuthorizationActionParameters.action - conditions = - conditionalAuthorizationActionParameters.conditions.map { - it.toMutableList() - } - additionalProperties = - conditionalAuthorizationActionParameters.additionalProperties - .toMutableMap() - } - - /** The action to take if the conditions are met. */ - fun action(action: Action) = action(JsonField.of(action)) - - /** - * Sets [Builder.action] to an arbitrary JSON value. - * - * You should usually call [Builder.action] with a well-typed [Action] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun action(action: JsonField) = apply { this.action = action } - - fun conditions(conditions: List) = - conditions(JsonField.of(conditions)) - - /** - * Sets [Builder.conditions] to an arbitrary JSON value. - * - * You should usually call [Builder.conditions] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun conditions(conditions: JsonField>) = apply { - this.conditions = conditions.map { it.toMutableList() } - } - - /** - * Adds a single [Condition] to [conditions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addCondition(condition: Condition) = apply { - conditions = - (conditions ?: JsonField.of(mutableListOf())).also { - checkKnown("conditions", it).add(condition) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [ConditionalAuthorizationActionParameters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .action() - * .conditions() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): ConditionalAuthorizationActionParameters = - ConditionalAuthorizationActionParameters( - checkRequired("action", action), - checkRequired("conditions", conditions).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): ConditionalAuthorizationActionParameters = apply { - if (validated) { - return@apply - } - - action().validate() - conditions().forEach { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (action.asKnown().getOrNull()?.validity() ?: 0) + - (conditions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** The action to take if the conditions are met. */ - class Action - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val DECLINE = of("DECLINE") - - @JvmField val CHALLENGE = of("CHALLENGE") - - @JvmStatic fun of(value: String) = Action(JsonField.of(value)) - } - - /** An enum containing [Action]'s known values. */ - enum class Known { - DECLINE, - CHALLENGE, - } - - /** - * An enum containing [Action]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Action] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - DECLINE, - CHALLENGE, - /** - * An enum member indicating that [Action] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or - * if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - DECLINE -> Value.DECLINE - CHALLENGE -> Value.CHALLENGE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known - * and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - DECLINE -> Known.DECLINE - CHALLENGE -> Known.CHALLENGE - else -> throw LithicInvalidDataException("Unknown Action: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Action = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Action && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - class Condition - @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: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify - * a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - * ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - * Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency - * of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - * (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, - * `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, - * `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This is - * the amount the issuer should authorize against unless the issuer is paying - * the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). - * This represents the amount of cash being withdrawn or advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated with a - * given authorization. Scores are on a range of 0-999, with 0 representing - * the lowest risk and 999 representing the highest risk. For Visa - * transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - * trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - * trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - * trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - * Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - * `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - * source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - * data with 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). - */ - fun attribute(): Optional = attribute.getOptional("attribute") - - /** - * The operation to apply to the attribute - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun operation(): Optional = operation.getOptional("operation") - - /** - * A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type - * (e.g. if the server responded with an unexpected value). - */ - fun value(): Optional = value.getOptional("value") - - /** - * Returns the raw JSON value of [attribute]. - * - * Unlike [attribute], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("attribute") - @ExcludeMissing - fun _attribute(): JsonField = attribute - - /** - * Returns the raw JSON value of [operation]. - * - * Unlike [operation], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("operation") - @ExcludeMissing - fun _operation(): JsonField = operation - - /** - * Returns the raw JSON value of [value]. - * - * Unlike [value], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Condition]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Condition]. */ - class Builder internal constructor() { - - private var attribute: JsonField = JsonMissing.of() - private var operation: JsonField = JsonMissing.of() - private var value: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = - mutableMapOf() - - @JvmSynthetic - internal fun from(condition: Condition) = apply { - attribute = condition.attribute - operation = condition.operation - value = condition.value - additionalProperties = condition.additionalProperties.toMutableMap() - } - - /** - * The attribute to target. - * - * The following attributes may be targeted: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to - * classify a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) - * all ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT - * for Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant - * currency of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card - * acceptor (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, - * `ICC`, `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, - * `SECURE_CARDLESS`, `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or - * `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This - * is the amount the issuer should authorize against unless the issuer is - * paying the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units - * (cents). This represents the amount of cash being withdrawn or - * advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated - * with a given authorization. Scores are on a range of 0-999, with 0 - * representing the lowest risk and 999 representing the highest risk. For - * Visa transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in - * the trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in - * the trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in - * the trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the - * transaction. Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are - * `NOT_SET`, `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates - * the source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's - * address data with the cardholder KYC data if it exists. Valid values - * are `MATCH`, `MATCH_ADDRESS_ONLY`, - * `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - */ - fun attribute(attribute: Attribute) = attribute(JsonField.of(attribute)) - - /** - * Sets [Builder.attribute] to an arbitrary JSON value. - * - * You should usually call [Builder.attribute] with a well-typed [Attribute] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun attribute(attribute: JsonField) = apply { - this.attribute = attribute - } - - /** The operation to apply to the attribute */ - fun operation(operation: Operation) = operation(JsonField.of(operation)) - - /** - * Sets [Builder.operation] to an arbitrary JSON value. - * - * You should usually call [Builder.operation] with a well-typed [Operation] - * value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun operation(operation: JsonField) = apply { - this.operation = operation - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun value(value: Value) = value(JsonField.of(value)) - - /** - * Sets [Builder.value] to an arbitrary JSON value. - * - * You should usually call [Builder.value] with a well-typed [Value] value - * instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun value(value: JsonField) = apply { this.value = value } - - /** Alias for calling [value] with `Value.ofRegex(regex)`. */ - fun value(regex: String) = value(Value.ofRegex(regex)) - - /** Alias for calling [value] with `Value.ofNumber(number)`. */ - fun value(number: Long) = value(Value.ofNumber(number)) - - /** - * Alias for calling [value] with `Value.ofListOfStrings(listOfStrings)`. - */ - fun valueOfListOfStrings(listOfStrings: List) = - value(Value.ofListOfStrings(listOfStrings)) - - fun additionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties( - additionalProperties: Map - ) = apply { this.additionalProperties.putAll(additionalProperties) } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Condition]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Condition = - Condition( - attribute, - operation, - value, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Condition = apply { - if (validated) { - return@apply - } - - attribute().ifPresent { it.validate() } - operation().ifPresent { it.validate() } - value().ifPresent { it.validate() } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (attribute.asKnown().getOrNull()?.validity() ?: 0) + - (operation.asKnown().getOrNull()?.validity() ?: 0) + - (value.asKnown().getOrNull()?.validity() ?: 0) - - /** - * The attribute to target. - * - * The following attributes may be targeted: - * * `MCC`: A four-digit number listed in ISO 18245. An MCC is used to classify - * a business by the types of goods or services it provides. - * * `COUNTRY`: Country of entity of card acceptor. Possible values are: (1) all - * ISO 3166-1 alpha-3 country codes, (2) QZZ for Kosovo, and (3) ANT for - * Netherlands Antilles. - * * `CURRENCY`: 3-character alphabetic ISO 4217 code for the merchant currency - * of the transaction. - * * `MERCHANT_ID`: Unique alphanumeric identifier for the payment card acceptor - * (merchant). - * * `DESCRIPTOR`: Short description of card acceptor. - * * `LIABILITY_SHIFT`: Indicates whether chargeback liability shift to the - * issuer applies to the transaction. Valid values are `NONE`, - * `3DS_AUTHENTICATED`, or `TOKEN_AUTHENTICATED`. - * * `PAN_ENTRY_MODE`: The method by which the cardholder's primary account - * number (PAN) was entered. Valid values are `AUTO_ENTRY`, `BAR_CODE`, - * `CONTACTLESS`, `ECOMMERCE`, `ERROR_KEYED`, `ERROR_MAGNETIC_STRIPE`, `ICC`, - * `KEY_ENTERED`, `MAGNETIC_STRIPE`, `MANUAL`, `OCR`, `SECURE_CARDLESS`, - * `UNSPECIFIED`, `UNKNOWN`, `CREDENTIAL_ON_FILE`, or `ECOMMERCE`. - * * `TRANSACTION_AMOUNT`: The base transaction amount (in cents) plus the - * acquirer fee field in the settlement/cardholder billing currency. This is - * the amount the issuer should authorize against unless the issuer is paying - * the acquirer fee on behalf of the cardholder. - * * `CASH_AMOUNT`: The cash amount of the transaction in minor units (cents). - * This represents the amount of cash being withdrawn or advanced. - * * `RISK_SCORE`: Network-provided score assessing risk level associated with a - * given authorization. Scores are on a range of 0-999, with 0 representing - * the lowest risk and 999 representing the highest risk. For Visa - * transactions, where the raw score has a range of 0-99, Lithic will - * normalize the score by multiplying the raw score by 10x. - * * `CARD_TRANSACTION_COUNT_15M`: The number of transactions on the card in the - * trailing 15 minutes before the authorization. - * * `CARD_TRANSACTION_COUNT_1H`: The number of transactions on the card in the - * trailing hour up and until the authorization. - * * `CARD_TRANSACTION_COUNT_24H`: The number of transactions on the card in the - * trailing 24 hours up and until the authorization. - * * `CARD_STATE`: The current state of the card associated with the - * transaction. Valid values are `CLOSED`, `OPEN`, `PAUSED`, - * `PENDING_ACTIVATION`, `PENDING_FULFILLMENT`. - * * `PIN_ENTERED`: Indicates whether a PIN was entered during the transaction. - * Valid values are `TRUE`, `FALSE`. - * * `PIN_STATUS`: The current state of card's PIN. Valid values are `NOT_SET`, - * `OK`, `BLOCKED`. - * * `WALLET_TYPE`: For transactions using a digital wallet token, indicates the - * source of the token. Valid values are `APPLE_PAY`, `GOOGLE_PAY`, - * `SAMSUNG_PAY`, `MASTERPASS`, `MERCHANT`, `OTHER`, `NONE`. - * * `TRANSACTION_INITIATOR`: The entity that initiated the transaction - * indicates the source of the token. Valid values are `CARDHOLDER`, - * `MERCHANT`, `UNKNOWN`. - * * `ADDRESS_MATCH`: Lithic's evaluation result comparing transaction's address - * data with the cardholder KYC data if it exists. Valid values are `MATCH`, - * `MATCH_ADDRESS_ONLY`, `MATCH_ZIP_ONLY`,`MISMATCH`,`NOT_PRESENT`. - */ - class Attribute - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val MCC = of("MCC") - - @JvmField val COUNTRY = of("COUNTRY") - - @JvmField val CURRENCY = of("CURRENCY") - - @JvmField val MERCHANT_ID = of("MERCHANT_ID") - - @JvmField val DESCRIPTOR = of("DESCRIPTOR") - - @JvmField val LIABILITY_SHIFT = of("LIABILITY_SHIFT") - - @JvmField val PAN_ENTRY_MODE = of("PAN_ENTRY_MODE") - - @JvmField val TRANSACTION_AMOUNT = of("TRANSACTION_AMOUNT") - - @JvmField val CASH_AMOUNT = of("CASH_AMOUNT") - - @JvmField val RISK_SCORE = of("RISK_SCORE") - - @JvmField - val CARD_TRANSACTION_COUNT_15_M = of("CARD_TRANSACTION_COUNT_15M") - - @JvmField - val CARD_TRANSACTION_COUNT_1_H = of("CARD_TRANSACTION_COUNT_1H") - - @JvmField - val CARD_TRANSACTION_COUNT_24_H = of("CARD_TRANSACTION_COUNT_24H") - - @JvmField val CARD_STATE = of("CARD_STATE") - - @JvmField val PIN_ENTERED = of("PIN_ENTERED") - - @JvmField val PIN_STATUS = of("PIN_STATUS") - - @JvmField val WALLET_TYPE = of("WALLET_TYPE") - - @JvmField val TRANSACTION_INITIATOR = of("TRANSACTION_INITIATOR") - - @JvmField val ADDRESS_MATCH = of("ADDRESS_MATCH") - - @JvmStatic fun of(value: String) = Attribute(JsonField.of(value)) - } - - /** An enum containing [Attribute]'s known values. */ - enum class Known { - MCC, - COUNTRY, - CURRENCY, - MERCHANT_ID, - DESCRIPTOR, - LIABILITY_SHIFT, - PAN_ENTRY_MODE, - TRANSACTION_AMOUNT, - CASH_AMOUNT, - RISK_SCORE, - CARD_TRANSACTION_COUNT_15_M, - CARD_TRANSACTION_COUNT_1_H, - CARD_TRANSACTION_COUNT_24_H, - CARD_STATE, - PIN_ENTERED, - PIN_STATUS, - WALLET_TYPE, - TRANSACTION_INITIATOR, - ADDRESS_MATCH, - } - - /** - * An enum containing [Attribute]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Attribute] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - MCC, - COUNTRY, - CURRENCY, - MERCHANT_ID, - DESCRIPTOR, - LIABILITY_SHIFT, - PAN_ENTRY_MODE, - TRANSACTION_AMOUNT, - CASH_AMOUNT, - RISK_SCORE, - CARD_TRANSACTION_COUNT_15_M, - CARD_TRANSACTION_COUNT_1_H, - CARD_TRANSACTION_COUNT_24_H, - CARD_STATE, - PIN_ENTERED, - PIN_STATUS, - WALLET_TYPE, - TRANSACTION_INITIATOR, - ADDRESS_MATCH, - /** - * An enum member indicating that [Attribute] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - MCC -> Value.MCC - COUNTRY -> Value.COUNTRY - CURRENCY -> Value.CURRENCY - MERCHANT_ID -> Value.MERCHANT_ID - DESCRIPTOR -> Value.DESCRIPTOR - LIABILITY_SHIFT -> Value.LIABILITY_SHIFT - PAN_ENTRY_MODE -> Value.PAN_ENTRY_MODE - TRANSACTION_AMOUNT -> Value.TRANSACTION_AMOUNT - CASH_AMOUNT -> Value.CASH_AMOUNT - RISK_SCORE -> Value.RISK_SCORE - CARD_TRANSACTION_COUNT_15_M -> Value.CARD_TRANSACTION_COUNT_15_M - CARD_TRANSACTION_COUNT_1_H -> Value.CARD_TRANSACTION_COUNT_1_H - CARD_TRANSACTION_COUNT_24_H -> Value.CARD_TRANSACTION_COUNT_24_H - CARD_STATE -> Value.CARD_STATE - PIN_ENTERED -> Value.PIN_ENTERED - PIN_STATUS -> Value.PIN_STATUS - WALLET_TYPE -> Value.WALLET_TYPE - TRANSACTION_INITIATOR -> Value.TRANSACTION_INITIATOR - ADDRESS_MATCH -> Value.ADDRESS_MATCH - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - MCC -> Known.MCC - COUNTRY -> Known.COUNTRY - CURRENCY -> Known.CURRENCY - MERCHANT_ID -> Known.MERCHANT_ID - DESCRIPTOR -> Known.DESCRIPTOR - LIABILITY_SHIFT -> Known.LIABILITY_SHIFT - PAN_ENTRY_MODE -> Known.PAN_ENTRY_MODE - TRANSACTION_AMOUNT -> Known.TRANSACTION_AMOUNT - CASH_AMOUNT -> Known.CASH_AMOUNT - RISK_SCORE -> Known.RISK_SCORE - CARD_TRANSACTION_COUNT_15_M -> Known.CARD_TRANSACTION_COUNT_15_M - CARD_TRANSACTION_COUNT_1_H -> Known.CARD_TRANSACTION_COUNT_1_H - CARD_TRANSACTION_COUNT_24_H -> Known.CARD_TRANSACTION_COUNT_24_H - CARD_STATE -> Known.CARD_STATE - PIN_ENTERED -> Known.PIN_ENTERED - PIN_STATUS -> Known.PIN_STATUS - WALLET_TYPE -> Known.WALLET_TYPE - TRANSACTION_INITIATOR -> Known.TRANSACTION_INITIATOR - ADDRESS_MATCH -> Known.ADDRESS_MATCH - else -> - throw LithicInvalidDataException("Unknown Attribute: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Attribute = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Attribute && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The operation to apply to the attribute */ - class Operation - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data - * that doesn't match any known member, and you want to know that value. For - * example, if the SDK is on an older version than the API, then the API may - * respond with new members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue - fun _value(): JsonField = value - - companion object { - - @JvmField val IS_ONE_OF = of("IS_ONE_OF") - - @JvmField val IS_NOT_ONE_OF = of("IS_NOT_ONE_OF") - - @JvmField val MATCHES = of("MATCHES") - - @JvmField val DOES_NOT_MATCH = of("DOES_NOT_MATCH") - - @JvmField val IS_EQUAL_TO = of("IS_EQUAL_TO") - - @JvmField val IS_NOT_EQUAL_TO = of("IS_NOT_EQUAL_TO") - - @JvmField val IS_GREATER_THAN = of("IS_GREATER_THAN") - - @JvmField - val IS_GREATER_THAN_OR_EQUAL_TO = of("IS_GREATER_THAN_OR_EQUAL_TO") - - @JvmField val IS_LESS_THAN = of("IS_LESS_THAN") - - @JvmField val IS_LESS_THAN_OR_EQUAL_TO = of("IS_LESS_THAN_OR_EQUAL_TO") - - @JvmStatic fun of(value: String) = Operation(JsonField.of(value)) - } - - /** An enum containing [Operation]'s known values. */ - enum class Known { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - } - - /** - * An enum containing [Operation]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [Operation] can contain an unknown value in a couple of - * cases: - * - It was deserialized from data that doesn't match any known member. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - IS_ONE_OF, - IS_NOT_ONE_OF, - MATCHES, - DOES_NOT_MATCH, - IS_EQUAL_TO, - IS_NOT_EQUAL_TO, - IS_GREATER_THAN, - IS_GREATER_THAN_OR_EQUAL_TO, - IS_LESS_THAN, - IS_LESS_THAN_OR_EQUAL_TO, - /** - * An enum member indicating that [Operation] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always - * known or if you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - IS_ONE_OF -> Value.IS_ONE_OF - IS_NOT_ONE_OF -> Value.IS_NOT_ONE_OF - MATCHES -> Value.MATCHES - DOES_NOT_MATCH -> Value.DOES_NOT_MATCH - IS_EQUAL_TO -> Value.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Value.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Value.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Value.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Value.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Value.IS_LESS_THAN_OR_EQUAL_TO - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always - * known and don't want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a - * not a known member. - */ - fun known(): Known = - when (this) { - IS_ONE_OF -> Known.IS_ONE_OF - IS_NOT_ONE_OF -> Known.IS_NOT_ONE_OF - MATCHES -> Known.MATCHES - DOES_NOT_MATCH -> Known.DOES_NOT_MATCH - IS_EQUAL_TO -> Known.IS_EQUAL_TO - IS_NOT_EQUAL_TO -> Known.IS_NOT_EQUAL_TO - IS_GREATER_THAN -> Known.IS_GREATER_THAN - IS_GREATER_THAN_OR_EQUAL_TO -> Known.IS_GREATER_THAN_OR_EQUAL_TO - IS_LESS_THAN -> Known.IS_LESS_THAN - IS_LESS_THAN_OR_EQUAL_TO -> Known.IS_LESS_THAN_OR_EQUAL_TO - else -> - throw LithicInvalidDataException("Unknown Operation: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily - * for debugging and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does - * not have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LithicInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Operation = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Operation && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JsonDeserialize(using = Value.Deserializer::class) - @JsonSerialize(using = Value.Serializer::class) - class Value - private constructor( - private val regex: String? = null, - private val number: Long? = null, - private val listOfStrings: List? = null, - private val _json: JsonValue? = null, - ) { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun regex(): Optional = Optional.ofNullable(regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun number(): Optional = Optional.ofNullable(number) - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun listOfStrings(): Optional> = - Optional.ofNullable(listOfStrings) - - fun isRegex(): Boolean = regex != null - - fun isNumber(): Boolean = number != null - - fun isListOfStrings(): Boolean = listOfStrings != null - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun asRegex(): String = regex.getOrThrow("regex") - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun asNumber(): Long = number.getOrThrow("number") - - /** An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` */ - fun asListOfStrings(): List = - listOfStrings.getOrThrow("listOfStrings") - - fun _json(): Optional = Optional.ofNullable(_json) - - fun accept(visitor: Visitor): T = - when { - regex != null -> visitor.visitRegex(regex) - number != null -> visitor.visitNumber(number) - listOfStrings != null -> visitor.visitListOfStrings(listOfStrings) - else -> visitor.unknown(_json) - } - - private var validated: Boolean = false - - fun validate(): Value = apply { - if (validated) { - return@apply - } - - accept( - object : Visitor { - override fun visitRegex(regex: String) {} - - override fun visitNumber(number: Long) {} - - override fun visitListOfStrings(listOfStrings: List) {} - } - ) - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this - * object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - accept( - object : Visitor { - override fun visitRegex(regex: String) = 1 - - override fun visitNumber(number: Long) = 1 - - override fun visitListOfStrings(listOfStrings: List) = - listOfStrings.size - - override fun unknown(json: JsonValue?) = 0 - } - ) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Value && - regex == other.regex && - number == other.number && - listOfStrings == other.listOfStrings - } - - override fun hashCode(): Int = Objects.hash(regex, number, listOfStrings) - - override fun toString(): String = - when { - regex != null -> "Value{regex=$regex}" - number != null -> "Value{number=$number}" - listOfStrings != null -> "Value{listOfStrings=$listOfStrings}" - _json != null -> "Value{_unknown=$_json}" - else -> throw IllegalStateException("Invalid Value") - } - - companion object { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - @JvmStatic fun ofRegex(regex: String) = Value(regex = regex) - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - @JvmStatic fun ofNumber(number: Long) = Value(number = number) - - /** - * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` - */ - @JvmStatic - fun ofListOfStrings(listOfStrings: List) = - Value(listOfStrings = listOfStrings.toImmutable()) - } - - /** - * An interface that defines how to map each variant of [Value] to a value - * of type [T]. - */ - interface Visitor { - - /** A regex string, to be used with `MATCHES` or `DOES_NOT_MATCH` */ - fun visitRegex(regex: String): T - - /** - * A number, to be used with `IS_GREATER_THAN`, - * `IS_GREATER_THAN_OR_EQUAL_TO`, `IS_LESS_THAN`, - * `IS_LESS_THAN_OR_EQUAL_TO`, `IS_EQUAL_TO`, or `IS_NOT_EQUAL_TO` - */ - fun visitNumber(number: Long): T - - /** - * An array of strings, to be used with `IS_ONE_OF` or `IS_NOT_ONE_OF` - */ - fun visitListOfStrings(listOfStrings: List): T - - /** - * Maps an unknown variant of [Value] to a value of type [T]. - * - * An instance of [Value] can contain an unknown variant if it was - * deserialized from data that doesn't match any known variant. For - * example, if the SDK is on an older version than the API, then the API - * may respond with new variants that the SDK is unaware of. - * - * @throws LithicInvalidDataException in the default implementation. - */ - fun unknown(json: JsonValue?): T { - throw LithicInvalidDataException("Unknown Value: $json") - } - } - - internal class Deserializer : BaseDeserializer(Value::class) { - - override fun ObjectCodec.deserialize(node: JsonNode): Value { - val json = JsonValue.fromJsonNode(node) - - val bestMatches = - sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - Value(regex = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef())?.let { - Value(number = it, _json = json) - }, - tryDeserialize(node, jacksonTypeRef>()) - ?.let { Value(listOfStrings = it, _json = json) }, - ) - .filterNotNull() - .allMaxBy { it.validity() } - .toList() - return when (bestMatches.size) { - // This can happen if what we're deserializing is completely - // incompatible with all the possible variants (e.g. - // deserializing from object). - 0 -> Value(_json = json) - 1 -> bestMatches.single() - // If there's more than one match with the highest validity, - // then use the first completely valid match, or simply the - // first match if none are completely valid. - else -> - bestMatches.firstOrNull { it.isValid() } - ?: bestMatches.first() - } - } - } - - internal class Serializer : BaseSerializer(Value::class) { - - override fun serialize( - value: Value, - generator: JsonGenerator, - provider: SerializerProvider, - ) { - when { - value.regex != null -> generator.writeObject(value.regex) - value.number != null -> generator.writeObject(value.number) - value.listOfStrings != null -> - generator.writeObject(value.listOfStrings) - value._json != null -> generator.writeObject(value._json) - else -> throw IllegalStateException("Invalid Value") - } - } - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Condition && - attribute == other.attribute && - operation == other.operation && - value == other.value && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(attribute, operation, value, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Condition{attribute=$attribute, operation=$operation, value=$value, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is ConditionalAuthorizationActionParameters && - action == other.action && - conditions == other.conditions && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(action, conditions, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "ConditionalAuthorizationActionParameters{action=$action, conditions=$conditions, additionalProperties=$additionalProperties}" - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is DraftVersion && - parameters == other.parameters && - version == other.version && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(parameters, version, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "DraftVersion{parameters=$parameters, version=$version, additionalProperties=$additionalProperties}" - } - - /** The event stream during which the rule will be evaluated. */ - class EventStream @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AUTHORIZATION = of("AUTHORIZATION") - - @JvmField val THREE_DS_AUTHENTICATION = of("THREE_DS_AUTHENTICATION") - - @JvmStatic fun of(value: String) = EventStream(JsonField.of(value)) - } - - /** An enum containing [EventStream]'s known values. */ - enum class Known { - AUTHORIZATION, - THREE_DS_AUTHENTICATION, - } - - /** - * An enum containing [EventStream]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [EventStream] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AUTHORIZATION, - THREE_DS_AUTHENTICATION, - /** - * An enum member indicating that [EventStream] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AUTHORIZATION -> Value.AUTHORIZATION - THREE_DS_AUTHENTICATION -> Value.THREE_DS_AUTHENTICATION - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LithicInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AUTHORIZATION -> Known.AUTHORIZATION - THREE_DS_AUTHENTICATION -> Known.THREE_DS_AUTHENTICATION - else -> throw LithicInvalidDataException("Unknown EventStream: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LithicInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") } - - private var validated: Boolean = false - - fun validate(): EventStream = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LithicInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is EventStream && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** The state of the Auth Rule */ - class AuthRuleState @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 ACTIVE = of("ACTIVE") - - @JvmField val INACTIVE = of("INACTIVE") - - @JvmStatic fun of(value: String) = AuthRuleState(JsonField.of(value)) - } - - /** An enum containing [AuthRuleState]'s known values. */ - enum class Known { - ACTIVE, - INACTIVE, - } - - /** - * An enum containing [AuthRuleState]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [AuthRuleState] 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 { - ACTIVE, - INACTIVE, - /** - * An enum member indicating that [AuthRuleState] 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) { - ACTIVE -> Value.ACTIVE - INACTIVE -> Value.INACTIVE - 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) { - ACTIVE -> Known.ACTIVE - INACTIVE -> Known.INACTIVE - else -> throw LithicInvalidDataException("Unknown AuthRuleState: $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(): AuthRuleState = 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 AuthRuleState && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * The type of Auth Rule. For certain rule types, this determines the event stream during which - * it will be evaluated. For rules that can be applied to one of several event streams, the - * effective one is defined by the separate `event_stream` field. - * - `CONDITIONAL_BLOCK`: AUTHORIZATION event stream. - * - `VELOCITY_LIMIT`: AUTHORIZATION event stream. - * - `MERCHANT_LOCK`: AUTHORIZATION event stream. - * - `CONDITIONAL_ACTION`: AUTHORIZATION or THREE_DS_AUTHENTICATION event stream. - */ - class AuthRuleType @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CONDITIONAL_BLOCK = of("CONDITIONAL_BLOCK") - - @JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT") - - @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK") - - @JvmField val CONDITIONAL_ACTION = of("CONDITIONAL_ACTION") - - @JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value)) - } - - /** An enum containing [AuthRuleType]'s known values. */ - enum class Known { - CONDITIONAL_BLOCK, - VELOCITY_LIMIT, - MERCHANT_LOCK, - CONDITIONAL_ACTION, - } - - /** - * An enum containing [AuthRuleType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [AuthRuleType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CONDITIONAL_BLOCK, - VELOCITY_LIMIT, - MERCHANT_LOCK, - CONDITIONAL_ACTION, - /** - * An enum member indicating that [AuthRuleType] 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) { - CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK - VELOCITY_LIMIT -> Value.VELOCITY_LIMIT - MERCHANT_LOCK -> Value.MERCHANT_LOCK - CONDITIONAL_ACTION -> Value.CONDITIONAL_ACTION - 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) { - CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK - VELOCITY_LIMIT -> Known.VELOCITY_LIMIT - MERCHANT_LOCK -> Known.MERCHANT_LOCK - CONDITIONAL_ACTION -> Known.CONDITIONAL_ACTION - else -> throw LithicInvalidDataException("Unknown AuthRuleType: $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(): AuthRuleType = 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 AuthRuleType && 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 V2ApplyResponse && - token == other.token && - accountTokens == other.accountTokens && - businessAccountTokens == other.businessAccountTokens && - cardTokens == other.cardTokens && - currentVersion == other.currentVersion && - draftVersion == other.draftVersion && - eventStream == other.eventStream && - lithicManaged == other.lithicManaged && - name == other.name && - programLevel == other.programLevel && - state == other.state && - type == other.type && - excludedCardTokens == other.excludedCardTokens && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - token, - accountTokens, - businessAccountTokens, - cardTokens, - currentVersion, - draftVersion, - eventStream, - lithicManaged, - name, - programLevel, - state, - type, - excludedCardTokens, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "V2ApplyResponse{token=$token, accountTokens=$accountTokens, businessAccountTokens=$businessAccountTokens, cardTokens=$cardTokens, currentVersion=$currentVersion, draftVersion=$draftVersion, eventStream=$eventStream, lithicManaged=$lithicManaged, name=$name, programLevel=$programLevel, state=$state, type=$type, excludedCardTokens=$excludedCardTokens, additionalProperties=$additionalProperties}" -} diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt index 56f5eecd..9be25d3a 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponse.kt @@ -252,10 +252,7 @@ private constructor( fun filters(): VelocityLimitFilters = filters.getRequired("filters") /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). + * Velocity over the current day since 00:00 / 12 AM in Eastern Time * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -365,12 +362,7 @@ private constructor( */ fun filters(filters: JsonField) = apply { this.filters = filters } - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The - * minimum value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ + /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ fun period(period: VelocityLimitParamsPeriodWindow) = period(JsonField.of(period)) /** @@ -384,19 +376,6 @@ private constructor( this.period = period } - /** - * Alias for calling [period] with - * `VelocityLimitParamsPeriodWindow.ofTrailing(trailing)`. - */ - @Deprecated("deprecated") - fun period(trailing: Long) = - period(VelocityLimitParamsPeriodWindow.ofTrailing(trailing)) - - /** Alias for calling [period] with `VelocityLimitParamsPeriodWindow.ofFixed(fixed)`. */ - @Deprecated("deprecated") - fun period(fixed: VelocityLimitParamsPeriodWindow.FixedWindow) = - period(VelocityLimitParamsPeriodWindow.ofFixed(fixed)) - /** * Alias for calling [period] with * `VelocityLimitParamsPeriodWindow.ofTrailingWindowObject(trailingWindowObject)`. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt index b3192fc4..f43b3d5d 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParams.kt @@ -53,10 +53,7 @@ private constructor( fun filters(): VelocityLimitFilters = filters.getRequired("filters") /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). + * Velocity over the current day since 00:00 / 12 AM in Eastern Time * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -188,12 +185,7 @@ private constructor( */ fun filters(filters: JsonField) = apply { this.filters = filters } - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ + /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ fun period(period: VelocityLimitParamsPeriodWindow) = period(JsonField.of(period)) /** @@ -207,17 +199,6 @@ private constructor( this.period = period } - /** - * Alias for calling [period] with `VelocityLimitParamsPeriodWindow.ofTrailing(trailing)`. - */ - @Deprecated("deprecated") - fun period(trailing: Long) = period(VelocityLimitParamsPeriodWindow.ofTrailing(trailing)) - - /** Alias for calling [period] with `VelocityLimitParamsPeriodWindow.ofFixed(fixed)`. */ - @Deprecated("deprecated") - fun period(fixed: VelocityLimitParamsPeriodWindow.FixedWindow) = - period(VelocityLimitParamsPeriodWindow.ofFixed(fixed)) - /** * Alias for calling [period] with * `VelocityLimitParamsPeriodWindow.ofTrailingWindowObject(trailingWindowObject)`. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindow.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindow.kt index 3ca469a5..7fa0cfab 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindow.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindow.kt @@ -21,6 +21,7 @@ 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.checkRequired import com.lithic.api.core.getOrThrow import com.lithic.api.errors.LithicInvalidDataException import java.util.Collections @@ -28,18 +29,11 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum value is - * 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ +/** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ @JsonDeserialize(using = VelocityLimitParamsPeriodWindow.Deserializer::class) @JsonSerialize(using = VelocityLimitParamsPeriodWindow.Serializer::class) class VelocityLimitParamsPeriodWindow private constructor( - private val trailing: Long? = null, - private val fixed: FixedWindow? = null, private val trailingWindowObject: TrailingWindowObject? = null, private val fixedWindowDay: FixedWindowDay? = null, private val fixedWindowWeek: FixedWindowWeek? = null, @@ -48,26 +42,6 @@ private constructor( private val _json: JsonValue? = null, ) { - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ - @Deprecated("deprecated") fun trailing(): Optional = Optional.ofNullable(trailing) - - /** - * DEPRECATED: This has been deprecated in favor of the other Fixed Window Objects - * - * The window of time to calculate Spend Velocity over. - * * `DAY`: Velocity over the current day since midnight Eastern Time. - * * `WEEK`: Velocity over the current week since 00:00 / 12 AM on Monday in Eastern Time. - * * `MONTH`: Velocity over the current month since 00:00 / 12 AM on the first of the month in - * Eastern Time. - * * `YEAR`: Velocity over the current year since 00:00 / 12 AM on January 1st in Eastern Time. - */ - @Deprecated("deprecated") fun fixed(): Optional = Optional.ofNullable(fixed) - fun trailingWindowObject(): Optional = Optional.ofNullable(trailingWindowObject) @@ -93,10 +67,6 @@ private constructor( */ fun fixedWindowYear(): Optional = Optional.ofNullable(fixedWindowYear) - @Deprecated("deprecated") fun isTrailing(): Boolean = trailing != null - - @Deprecated("deprecated") fun isFixed(): Boolean = fixed != null - fun isTrailingWindowObject(): Boolean = trailingWindowObject != null fun isFixedWindowDay(): Boolean = fixedWindowDay != null @@ -107,26 +77,6 @@ private constructor( fun isFixedWindowYear(): Boolean = fixedWindowYear != null - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ - @Deprecated("deprecated") fun asTrailing(): Long = trailing.getOrThrow("trailing") - - /** - * DEPRECATED: This has been deprecated in favor of the other Fixed Window Objects - * - * The window of time to calculate Spend Velocity over. - * * `DAY`: Velocity over the current day since midnight Eastern Time. - * * `WEEK`: Velocity over the current week since 00:00 / 12 AM on Monday in Eastern Time. - * * `MONTH`: Velocity over the current month since 00:00 / 12 AM on the first of the month in - * Eastern Time. - * * `YEAR`: Velocity over the current year since 00:00 / 12 AM on January 1st in Eastern Time. - */ - @Deprecated("deprecated") fun asFixed(): FixedWindow = fixed.getOrThrow("fixed") - fun asTrailingWindowObject(): TrailingWindowObject = trailingWindowObject.getOrThrow("trailingWindowObject") @@ -156,8 +106,6 @@ private constructor( fun accept(visitor: Visitor): T = when { - trailing != null -> visitor.visitTrailing(trailing) - fixed != null -> visitor.visitFixed(fixed) trailingWindowObject != null -> visitor.visitTrailingWindowObject(trailingWindowObject) fixedWindowDay != null -> visitor.visitFixedWindowDay(fixedWindowDay) fixedWindowWeek != null -> visitor.visitFixedWindowWeek(fixedWindowWeek) @@ -175,12 +123,6 @@ private constructor( accept( object : Visitor { - override fun visitTrailing(trailing: Long) {} - - override fun visitFixed(fixed: FixedWindow) { - fixed.validate() - } - override fun visitTrailingWindowObject(trailingWindowObject: TrailingWindowObject) { trailingWindowObject.validate() } @@ -222,10 +164,6 @@ private constructor( internal fun validity(): Int = accept( object : Visitor { - override fun visitTrailing(trailing: Long) = 1 - - override fun visitFixed(fixed: FixedWindow) = fixed.validity() - override fun visitTrailingWindowObject(trailingWindowObject: TrailingWindowObject) = trailingWindowObject.validity() @@ -251,8 +189,6 @@ private constructor( } return other is VelocityLimitParamsPeriodWindow && - trailing == other.trailing && - fixed == other.fixed && trailingWindowObject == other.trailingWindowObject && fixedWindowDay == other.fixedWindowDay && fixedWindowWeek == other.fixedWindowWeek && @@ -262,8 +198,6 @@ private constructor( override fun hashCode(): Int = Objects.hash( - trailing, - fixed, trailingWindowObject, fixedWindowDay, fixedWindowWeek, @@ -273,8 +207,6 @@ private constructor( override fun toString(): String = when { - trailing != null -> "VelocityLimitParamsPeriodWindow{trailing=$trailing}" - fixed != null -> "VelocityLimitParamsPeriodWindow{fixed=$fixed}" trailingWindowObject != null -> "VelocityLimitParamsPeriodWindow{trailingWindowObject=$trailingWindowObject}" fixedWindowDay != null -> @@ -291,31 +223,6 @@ private constructor( companion object { - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ - @Deprecated("deprecated") - @JvmStatic - fun ofTrailing(trailing: Long) = VelocityLimitParamsPeriodWindow(trailing = trailing) - - /** - * DEPRECATED: This has been deprecated in favor of the other Fixed Window Objects - * - * The window of time to calculate Spend Velocity over. - * * `DAY`: Velocity over the current day since midnight Eastern Time. - * * `WEEK`: Velocity over the current week since 00:00 / 12 AM on Monday in Eastern Time. - * * `MONTH`: Velocity over the current month since 00:00 / 12 AM on the first of the month - * in Eastern Time. - * * `YEAR`: Velocity over the current year since 00:00 / 12 AM on January 1st in Eastern - * Time. - */ - @Deprecated("deprecated") - @JvmStatic - fun ofFixed(fixed: FixedWindow) = VelocityLimitParamsPeriodWindow(fixed = fixed) - @JvmStatic fun ofTrailingWindowObject(trailingWindowObject: TrailingWindowObject) = VelocityLimitParamsPeriodWindow(trailingWindowObject = trailingWindowObject) @@ -358,27 +265,6 @@ private constructor( */ interface Visitor { - /** - * DEPRECATED: This has been deprecated in favor of the Trailing Window Objects - * - * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum - * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). - */ - @Deprecated("deprecated") fun visitTrailing(trailing: Long): T - - /** - * DEPRECATED: This has been deprecated in favor of the other Fixed Window Objects - * - * The window of time to calculate Spend Velocity over. - * * `DAY`: Velocity over the current day since midnight Eastern Time. - * * `WEEK`: Velocity over the current week since 00:00 / 12 AM on Monday in Eastern Time. - * * `MONTH`: Velocity over the current month since 00:00 / 12 AM on the first of the month - * in Eastern Time. - * * `YEAR`: Velocity over the current year since 00:00 / 12 AM on January 1st in Eastern - * Time. - */ - @Deprecated("deprecated") fun visitFixed(fixed: FixedWindow): T - fun visitTrailingWindowObject(trailingWindowObject: TrailingWindowObject): T /** Velocity over the current day since 00:00 / 12 AM in Eastern Time */ @@ -427,9 +313,6 @@ private constructor( val bestMatches = sequenceOf( - tryDeserialize(node, jacksonTypeRef())?.let { - VelocityLimitParamsPeriodWindow(fixed = it, _json = json) - }, tryDeserialize(node, jacksonTypeRef())?.let { VelocityLimitParamsPeriodWindow(trailingWindowObject = it, _json = json) }, @@ -445,16 +328,13 @@ private constructor( tryDeserialize(node, jacksonTypeRef())?.let { VelocityLimitParamsPeriodWindow(fixedWindowYear = it, _json = json) }, - tryDeserialize(node, jacksonTypeRef())?.let { - VelocityLimitParamsPeriodWindow(trailing = 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 array). + // the possible variants (e.g. deserializing from boolean). 0 -> VelocityLimitParamsPeriodWindow(_json = json) 1 -> bestMatches.single() // If there's more than one match with the highest validity, then use the first @@ -473,8 +353,6 @@ private constructor( provider: SerializerProvider, ) { when { - value.trailing != null -> generator.writeObject(value.trailing) - value.fixed != null -> generator.writeObject(value.fixed) value.trailingWindowObject != null -> generator.writeObject(value.trailingWindowObject) value.fixedWindowDay != null -> generator.writeObject(value.fixedWindowDay) @@ -487,157 +365,6 @@ private constructor( } } - /** - * DEPRECATED: This has been deprecated in favor of the other Fixed Window Objects - * - * The window of time to calculate Spend Velocity over. - * * `DAY`: Velocity over the current day since midnight Eastern Time. - * * `WEEK`: Velocity over the current week since 00:00 / 12 AM on Monday in Eastern Time. - * * `MONTH`: Velocity over the current month since 00:00 / 12 AM on the first of the month in - * Eastern Time. - * * `YEAR`: Velocity over the current year since 00:00 / 12 AM on January 1st in Eastern Time. - */ - @Deprecated("deprecated") - class FixedWindow @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 DAY = of("DAY") - - @JvmField val WEEK = of("WEEK") - - @JvmField val MONTH = of("MONTH") - - @JvmField val YEAR = of("YEAR") - - @JvmStatic fun of(value: String) = FixedWindow(JsonField.of(value)) - } - - /** An enum containing [FixedWindow]'s known values. */ - enum class Known { - DAY, - WEEK, - MONTH, - YEAR, - } - - /** - * An enum containing [FixedWindow]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [FixedWindow] 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 { - DAY, - WEEK, - MONTH, - YEAR, - /** - * An enum member indicating that [FixedWindow] 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) { - DAY -> Value.DAY - WEEK -> Value.WEEK - MONTH -> Value.MONTH - YEAR -> Value.YEAR - 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) { - DAY -> Known.DAY - WEEK -> Known.WEEK - MONTH -> Known.MONTH - YEAR -> Known.YEAR - else -> throw LithicInvalidDataException("Unknown FixedWindow: $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(): FixedWindow = 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 FixedWindow && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - class TrailingWindowObject @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( @@ -656,16 +383,16 @@ private constructor( * The size of the trailing window to calculate Spend Velocity over in seconds. The minimum * value is 10 seconds, and the maximum value is 2678400 seconds (31 days). * - * @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 duration(): Optional = duration.getOptional("duration") + fun duration(): Long = duration.getRequired("duration") /** - * @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 type(): Optional = type.getOptional("type") + fun type(): Type = type.getRequired("type") /** * Returns the raw JSON value of [duration]. @@ -695,15 +422,23 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [TrailingWindowObject]. */ + /** + * Returns a mutable builder for constructing an instance of [TrailingWindowObject]. + * + * The following fields are required: + * ```java + * .duration() + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [TrailingWindowObject]. */ class Builder internal constructor() { - private var duration: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() + private var duration: JsonField? = null + private var type: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -762,9 +497,21 @@ private constructor( * Returns an immutable instance of [TrailingWindowObject]. * * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .duration() + * .type() + * ``` + * + * @throws IllegalStateException if any required field is unset. */ fun build(): TrailingWindowObject = - TrailingWindowObject(duration, type, additionalProperties.toMutableMap()) + TrailingWindowObject( + checkRequired("duration", duration), + checkRequired("type", type), + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -775,7 +522,7 @@ private constructor( } duration() - type().ifPresent { it.validate() } + type().validate() validated = true } @@ -952,10 +699,10 @@ private constructor( ) : this(type, mutableMapOf()) /** - * @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 type(): Optional = type.getOptional("type") + fun type(): Type = type.getRequired("type") /** * Returns the raw JSON value of [type]. @@ -978,14 +725,21 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [FixedWindowDay]. */ + /** + * Returns a mutable builder for constructing an instance of [FixedWindowDay]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [FixedWindowDay]. */ class Builder internal constructor() { - private var type: JsonField = JsonMissing.of() + private var type: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1028,8 +782,16 @@ private constructor( * Returns an immutable instance of [FixedWindowDay]. * * 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(): FixedWindowDay = FixedWindowDay(type, additionalProperties.toMutableMap()) + fun build(): FixedWindowDay = + FixedWindowDay(checkRequired("type", type), additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -1039,7 +801,7 @@ private constructor( return@apply } - type().ifPresent { it.validate() } + type().validate() validated = true } @@ -1204,18 +966,24 @@ private constructor( class FixedWindowWeek @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val dayOfWeek: JsonField, private val type: JsonField, + private val dayOfWeek: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("day_of_week") @ExcludeMissing dayOfWeek: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(dayOfWeek, type, mutableMapOf()) + ) : this(type, dayOfWeek, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") /** * The day of the week to start the week from. Following ISO-8601, 1 is Monday and 7 is @@ -1227,10 +995,11 @@ private constructor( fun dayOfWeek(): Optional = dayOfWeek.getOptional("day_of_week") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - fun type(): Optional = type.getOptional("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [dayOfWeek]. @@ -1239,13 +1008,6 @@ private constructor( */ @JsonProperty("day_of_week") @ExcludeMissing fun _dayOfWeek(): JsonField = dayOfWeek - /** - * 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) @@ -1260,24 +1022,42 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [FixedWindowWeek]. */ + /** + * Returns a mutable builder for constructing an instance of [FixedWindowWeek]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [FixedWindowWeek]. */ class Builder internal constructor() { + private var type: JsonField? = null private var dayOfWeek: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedWindowWeek: FixedWindowWeek) = apply { - dayOfWeek = fixedWindowWeek.dayOfWeek type = fixedWindowWeek.type + dayOfWeek = fixedWindowWeek.dayOfWeek additionalProperties = fixedWindowWeek.additionalProperties.toMutableMap() } + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + /** * The day of the week to start the week from. Following ISO-8601, 1 is Monday and 7 is * Sunday. Defaults to Monday if not specified. @@ -1293,17 +1073,6 @@ private constructor( */ fun dayOfWeek(dayOfWeek: JsonField) = apply { this.dayOfWeek = dayOfWeek } - 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) @@ -1327,9 +1096,20 @@ private constructor( * Returns an immutable instance of [FixedWindowWeek]. * * 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(): FixedWindowWeek = - FixedWindowWeek(dayOfWeek, type, additionalProperties.toMutableMap()) + FixedWindowWeek( + checkRequired("type", type), + dayOfWeek, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -1339,8 +1119,8 @@ private constructor( return@apply } + type().validate() dayOfWeek() - type().ifPresent { it.validate() } validated = true } @@ -1360,8 +1140,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (dayOfWeek.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (dayOfWeek.asKnown().isPresent) 1 else 0) class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1490,17 +1270,17 @@ private constructor( } return other is FixedWindowWeek && - dayOfWeek == other.dayOfWeek && type == other.type && + dayOfWeek == other.dayOfWeek && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(dayOfWeek, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(type, dayOfWeek, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "FixedWindowWeek{dayOfWeek=$dayOfWeek, type=$type, additionalProperties=$additionalProperties}" + "FixedWindowWeek{type=$type, dayOfWeek=$dayOfWeek, additionalProperties=$additionalProperties}" } /** @@ -1510,18 +1290,24 @@ private constructor( class FixedWindowMonth @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val dayOfMonth: JsonField, private val type: JsonField, + private val dayOfMonth: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("day_of_month") @ExcludeMissing dayOfMonth: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(dayOfMonth, type, mutableMapOf()) + ) : this(type, dayOfMonth, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") /** * The day of the month to start from. Accepts values from 1 to 31, and will reset at the @@ -1534,10 +1320,11 @@ private constructor( fun dayOfMonth(): Optional = dayOfMonth.getOptional("day_of_month") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - fun type(): Optional = type.getOptional("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [dayOfMonth]. @@ -1548,13 +1335,6 @@ private constructor( @ExcludeMissing fun _dayOfMonth(): JsonField = dayOfMonth - /** - * 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) @@ -1569,24 +1349,42 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [FixedWindowMonth]. */ + /** + * Returns a mutable builder for constructing an instance of [FixedWindowMonth]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [FixedWindowMonth]. */ class Builder internal constructor() { + private var type: JsonField? = null private var dayOfMonth: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedWindowMonth: FixedWindowMonth) = apply { - dayOfMonth = fixedWindowMonth.dayOfMonth type = fixedWindowMonth.type + dayOfMonth = fixedWindowMonth.dayOfMonth additionalProperties = fixedWindowMonth.additionalProperties.toMutableMap() } + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + /** * The day of the month to start from. Accepts values from 1 to 31, and will reset at * the end of the month if the day exceeds the number of days in the month. Defaults to @@ -1603,17 +1401,6 @@ private constructor( */ fun dayOfMonth(dayOfMonth: JsonField) = apply { this.dayOfMonth = dayOfMonth } - 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) @@ -1637,9 +1424,20 @@ private constructor( * Returns an immutable instance of [FixedWindowMonth]. * * 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(): FixedWindowMonth = - FixedWindowMonth(dayOfMonth, type, additionalProperties.toMutableMap()) + FixedWindowMonth( + checkRequired("type", type), + dayOfMonth, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -1649,8 +1447,8 @@ private constructor( return@apply } + type().validate() dayOfMonth() - type().ifPresent { it.validate() } validated = true } @@ -1670,8 +1468,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (dayOfMonth.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (dayOfMonth.asKnown().isPresent) 1 else 0) class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1800,17 +1598,17 @@ private constructor( } return other is FixedWindowMonth && - dayOfMonth == other.dayOfMonth && type == other.type && + dayOfMonth == other.dayOfMonth && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(dayOfMonth, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(type, dayOfMonth, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "FixedWindowMonth{dayOfMonth=$dayOfMonth, type=$type, additionalProperties=$additionalProperties}" + "FixedWindowMonth{type=$type, dayOfMonth=$dayOfMonth, additionalProperties=$additionalProperties}" } /** @@ -1822,20 +1620,26 @@ private constructor( class FixedWindowYear @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val type: JsonField, private val dayOfMonth: JsonField, private val month: JsonField, - private val type: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("day_of_month") @ExcludeMissing dayOfMonth: JsonField = JsonMissing.of(), @JsonProperty("month") @ExcludeMissing month: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - ) : this(dayOfMonth, month, type, mutableMapOf()) + ) : this(type, dayOfMonth, month, mutableMapOf()) + + /** + * @throws LithicInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun type(): Type = type.getRequired("type") /** * The day of the month to start from. Defaults to the 1st of the month if not specified. @@ -1855,10 +1659,11 @@ private constructor( fun month(): Optional = month.getOptional("month") /** - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). + * Returns the raw JSON value of [type]. + * + * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. */ - fun type(): Optional = type.getOptional("type") + @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type /** * Returns the raw JSON value of [dayOfMonth]. @@ -1876,13 +1681,6 @@ private constructor( */ @JsonProperty("month") @ExcludeMissing fun _month(): JsonField = month - /** - * 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) @@ -1897,26 +1695,44 @@ private constructor( companion object { - /** Returns a mutable builder for constructing an instance of [FixedWindowYear]. */ + /** + * Returns a mutable builder for constructing an instance of [FixedWindowYear]. + * + * The following fields are required: + * ```java + * .type() + * ``` + */ @JvmStatic fun builder() = Builder() } /** A builder for [FixedWindowYear]. */ class Builder internal constructor() { + private var type: JsonField? = null private var dayOfMonth: JsonField = JsonMissing.of() private var month: JsonField = JsonMissing.of() - private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(fixedWindowYear: FixedWindowYear) = apply { + type = fixedWindowYear.type dayOfMonth = fixedWindowYear.dayOfMonth month = fixedWindowYear.month - type = fixedWindowYear.type additionalProperties = fixedWindowYear.additionalProperties.toMutableMap() } + fun type(type: Type) = type(JsonField.of(type)) + + /** + * Sets [Builder.type] to an arbitrary JSON value. + * + * You should usually call [Builder.type] with a well-typed [Type] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun type(type: JsonField) = apply { this.type = type } + /** * The day of the month to start from. Defaults to the 1st of the month if not * specified. @@ -1947,17 +1763,6 @@ private constructor( */ fun month(month: JsonField) = apply { this.month = month } - 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) @@ -1981,9 +1786,21 @@ private constructor( * Returns an immutable instance of [FixedWindowYear]. * * 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(): FixedWindowYear = - FixedWindowYear(dayOfMonth, month, type, additionalProperties.toMutableMap()) + FixedWindowYear( + checkRequired("type", type), + dayOfMonth, + month, + additionalProperties.toMutableMap(), + ) } private var validated: Boolean = false @@ -1993,9 +1810,9 @@ private constructor( return@apply } + type().validate() dayOfMonth() month() - type().ifPresent { it.validate() } validated = true } @@ -2015,9 +1832,9 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (dayOfMonth.asKnown().isPresent) 1 else 0) + - (if (month.asKnown().isPresent) 1 else 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + (type.asKnown().getOrNull()?.validity() ?: 0) + + (if (dayOfMonth.asKnown().isPresent) 1 else 0) + + (if (month.asKnown().isPresent) 1 else 0) class Type @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -2146,19 +1963,19 @@ private constructor( } return other is FixedWindowYear && + type == other.type && dayOfMonth == other.dayOfMonth && month == other.month && - type == other.type && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(dayOfMonth, month, type, additionalProperties) + Objects.hash(type, dayOfMonth, month, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "FixedWindowYear{dayOfMonth=$dayOfMonth, month=$month, type=$type, additionalProperties=$additionalProperties}" + "FixedWindowYear{type=$type, dayOfMonth=$dayOfMonth, month=$month, additionalProperties=$additionalProperties}" } } 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 c8e21360..1d22ad6f 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,10 +5,11 @@ 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 @@ -17,7 +18,9 @@ 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 @@ -36,17 +39,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 */ @@ -54,31 +57,35 @@ 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 */ @@ -86,27 +93,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 = 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. */ @@ -128,7 +139,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 */ @@ -136,27 +147,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 = 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) /** @@ -321,20 +336,24 @@ 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 */ @@ -342,38 +361,42 @@ 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 */ @@ -381,31 +404,33 @@ 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) /** @@ -437,7 +462,9 @@ 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 */ @@ -445,31 +472,33 @@ 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 2150207e..b3d8c2fa 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,10 +20,11 @@ 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 @@ -34,7 +35,9 @@ 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 @@ -54,21 +57,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() } @@ -82,7 +85,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() } @@ -127,12 +130,13 @@ 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) @@ -157,13 +161,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()) @@ -190,12 +194,13 @@ 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()) @@ -261,12 +266,13 @@ 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/authRules/V2ServiceAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt index 000e1f86..d4e7ba2e 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsync.kt @@ -6,7 +6,6 @@ import com.lithic.api.core.ClientOptions import com.lithic.api.core.RequestOptions import com.lithic.api.core.http.HttpResponse import com.lithic.api.core.http.HttpResponseFor -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DeleteParams import com.lithic.api.models.AuthRuleV2DraftParams @@ -17,7 +16,6 @@ import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse @@ -170,38 +168,6 @@ interface V2ServiceAsync { fun delete(authRuleToken: String, requestOptions: RequestOptions): CompletableFuture = delete(authRuleToken, AuthRuleV2DeleteParams.none(), requestOptions) - /** - * Associates a V2 Auth rule with a card program, the provided account(s) or card(s). - * - * Prefer using the `PATCH` method for this operation. - */ - @Deprecated("deprecated") - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - ): CompletableFuture = apply(authRuleToken, params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - apply(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see apply */ - @Deprecated("deprecated") - fun apply(params: AuthRuleV2ApplyParams): CompletableFuture = - apply(params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - /** * Creates a new draft version of a rule that will be ran in shadow mode. * @@ -527,40 +493,6 @@ interface V2ServiceAsync { ): CompletableFuture = delete(authRuleToken, AuthRuleV2DeleteParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/apply`, but is - * otherwise the same as [V2ServiceAsync.apply]. - */ - @Deprecated("deprecated") - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - ): CompletableFuture> = - apply(authRuleToken, params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - apply(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - params: AuthRuleV2ApplyParams - ): CompletableFuture> = - apply(params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/draft`, but is * otherwise the same as [V2ServiceAsync.draft]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt index 1204cef8..7cd57cb2 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/authRules/V2ServiceAsyncImpl.kt @@ -17,7 +17,6 @@ import com.lithic.api.core.http.HttpResponseFor import com.lithic.api.core.http.json import com.lithic.api.core.http.parseable import com.lithic.api.core.prepareAsync -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DeleteParams import com.lithic.api.models.AuthRuleV2DraftParams @@ -29,7 +28,6 @@ import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse @@ -94,14 +92,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO // delete /v2/auth_rules/{auth_rule_token} withRawResponse().delete(params, requestOptions).thenAccept {} - @Deprecated("deprecated") - override fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /v2/auth_rules/{auth_rule_token}/apply - withRawResponse().apply(params, requestOptions).thenApply { it.parse() } - override fun draft( params: AuthRuleV2DraftParams, requestOptions: RequestOptions, @@ -312,41 +302,6 @@ class V2ServiceAsyncImpl internal constructor(private val clientOptions: ClientO } } - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("authRuleToken", params.authRuleToken().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "apply") - .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 { applyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - private val draftHandler: 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 6a3513de..8b059bc4 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,10 +6,11 @@ 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 @@ -18,7 +19,9 @@ 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 { @@ -36,16 +39,17 @@ interface DisputeService { fun withOptions(modifier: Consumer): DisputeService /** Initiate a dispute. */ - fun create(params: DisputeCreateParams): Dispute = create(params, RequestOptions.none()) + fun create(params: DisputeCreateParams): DisputeCreateResponse = + create(params, RequestOptions.none()) /** @see create */ fun create( params: DisputeCreateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute + ): DisputeCreateResponse /** Get dispute. */ - fun retrieve(disputeToken: String): Dispute = + fun retrieve(disputeToken: String): DisputeRetrieveResponse = retrieve(disputeToken, DisputeRetrieveParams.none()) /** @see retrieve */ @@ -53,54 +57,59 @@ interface DisputeService { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): DisputeRetrieveResponse = + retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ fun retrieve( disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), - ): Dispute = retrieve(disputeToken, params, RequestOptions.none()) + ): DisputeRetrieveResponse = retrieve(disputeToken, params, RequestOptions.none()) /** @see retrieve */ fun retrieve( params: DisputeRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute + ): DisputeRetrieveResponse /** @see retrieve */ - fun retrieve(params: DisputeRetrieveParams): Dispute = retrieve(params, RequestOptions.none()) + fun retrieve(params: DisputeRetrieveParams): DisputeRetrieveResponse = + retrieve(params, RequestOptions.none()) /** @see retrieve */ - fun retrieve(disputeToken: String, requestOptions: RequestOptions): Dispute = + fun retrieve(disputeToken: String, requestOptions: RequestOptions): DisputeRetrieveResponse = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** Update dispute. Can only be modified if status is `NEW`. */ - fun update(disputeToken: String): Dispute = update(disputeToken, DisputeUpdateParams.none()) + fun update(disputeToken: String): DisputeUpdateResponse = + update(disputeToken, DisputeUpdateParams.none()) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): DisputeUpdateResponse = + update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ fun update( disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), - ): Dispute = update(disputeToken, params, RequestOptions.none()) + ): DisputeUpdateResponse = update(disputeToken, params, RequestOptions.none()) /** @see update */ fun update( params: DisputeUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute + ): DisputeUpdateResponse /** @see update */ - fun update(params: DisputeUpdateParams): Dispute = update(params, RequestOptions.none()) + fun update(params: DisputeUpdateParams): DisputeUpdateResponse = + update(params, RequestOptions.none()) /** @see update */ - fun update(disputeToken: String, requestOptions: RequestOptions): Dispute = + fun update(disputeToken: String, requestOptions: RequestOptions): DisputeUpdateResponse = update(disputeToken, DisputeUpdateParams.none(), requestOptions) /** List disputes. */ @@ -121,32 +130,35 @@ interface DisputeService { list(DisputeListParams.none(), requestOptions) /** Withdraw dispute. */ - fun delete(disputeToken: String): Dispute = delete(disputeToken, DisputeDeleteParams.none()) + fun delete(disputeToken: String): DisputeDeleteResponse = + delete(disputeToken, DisputeDeleteParams.none()) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) + ): DisputeDeleteResponse = + delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ fun delete( disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), - ): Dispute = delete(disputeToken, params, RequestOptions.none()) + ): DisputeDeleteResponse = delete(disputeToken, params, RequestOptions.none()) /** @see delete */ fun delete( params: DisputeDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), - ): Dispute + ): DisputeDeleteResponse /** @see delete */ - fun delete(params: DisputeDeleteParams): Dispute = delete(params, RequestOptions.none()) + fun delete(params: DisputeDeleteParams): DisputeDeleteResponse = + delete(params, RequestOptions.none()) /** @see delete */ - fun delete(disputeToken: String, requestOptions: RequestOptions): Dispute = + fun delete(disputeToken: String, requestOptions: RequestOptions): DisputeDeleteResponse = delete(disputeToken, DisputeDeleteParams.none(), requestOptions) /** @@ -300,7 +312,7 @@ interface DisputeService { * [DisputeService.create]. */ @MustBeClosed - fun create(params: DisputeCreateParams): HttpResponseFor = + fun create(params: DisputeCreateParams): HttpResponseFor = create(params, RequestOptions.none()) /** @see create */ @@ -308,14 +320,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 */ @@ -324,7 +336,7 @@ interface DisputeService { disputeToken: String, params: DisputeRetrieveParams = DisputeRetrieveParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = retrieve(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see retrieve */ @@ -332,18 +344,19 @@ 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 */ @@ -351,7 +364,7 @@ interface DisputeService { fun retrieve( disputeToken: String, requestOptions: RequestOptions, - ): HttpResponseFor = + ): HttpResponseFor = retrieve(disputeToken, DisputeRetrieveParams.none(), requestOptions) /** @@ -359,7 +372,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 */ @@ -368,7 +381,7 @@ interface DisputeService { disputeToken: String, params: DisputeUpdateParams = DisputeUpdateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = update(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see update */ @@ -376,23 +389,27 @@ 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) /** @@ -424,7 +441,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 */ @@ -433,7 +450,7 @@ interface DisputeService { disputeToken: String, params: DisputeDeleteParams = DisputeDeleteParams.none(), requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = + ): HttpResponseFor = delete(params.toBuilder().disputeToken(disputeToken).build(), requestOptions) /** @see delete */ @@ -441,23 +458,27 @@ 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 47cb5439..6064587d 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,10 +20,11 @@ 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 @@ -34,7 +35,9 @@ 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 @@ -50,15 +53,24 @@ 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): Dispute = + override fun create( + params: DisputeCreateParams, + requestOptions: RequestOptions, + ): DisputeCreateResponse = // post /v1/disputes withRawResponse().create(params, requestOptions).parse() - override fun retrieve(params: DisputeRetrieveParams, requestOptions: RequestOptions): Dispute = + override fun retrieve( + params: DisputeRetrieveParams, + requestOptions: RequestOptions, + ): DisputeRetrieveResponse = // get /v1/disputes/{dispute_token} withRawResponse().retrieve(params, requestOptions).parse() - override fun update(params: DisputeUpdateParams, requestOptions: RequestOptions): Dispute = + override fun update( + params: DisputeUpdateParams, + requestOptions: RequestOptions, + ): DisputeUpdateResponse = // patch /v1/disputes/{dispute_token} withRawResponse().update(params, requestOptions).parse() @@ -66,7 +78,10 @@ class DisputeServiceImpl internal constructor(private val clientOptions: ClientO // get /v1/disputes withRawResponse().list(params, requestOptions).parse() - override fun delete(params: DisputeDeleteParams, requestOptions: RequestOptions): Dispute = + override fun delete( + params: DisputeDeleteParams, + requestOptions: RequestOptions, + ): DisputeDeleteResponse = // delete /v1/disputes/{dispute_token} withRawResponse().delete(params, requestOptions).parse() @@ -111,12 +126,13 @@ 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) @@ -138,13 +154,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()) @@ -168,12 +184,13 @@ 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()) @@ -232,12 +249,13 @@ 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/authRules/V2Service.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt index f1cd9050..b14d6ca5 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2Service.kt @@ -7,7 +7,6 @@ import com.lithic.api.core.ClientOptions import com.lithic.api.core.RequestOptions import com.lithic.api.core.http.HttpResponse import com.lithic.api.core.http.HttpResponseFor -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DeleteParams import com.lithic.api.models.AuthRuleV2DraftParams @@ -18,7 +17,6 @@ import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse @@ -160,35 +158,6 @@ interface V2Service { fun delete(authRuleToken: String, requestOptions: RequestOptions) = delete(authRuleToken, AuthRuleV2DeleteParams.none(), requestOptions) - /** - * Associates a V2 Auth rule with a card program, the provided account(s) or card(s). - * - * Prefer using the `PATCH` method for this operation. - */ - @Deprecated("deprecated") - fun apply(authRuleToken: String, params: AuthRuleV2ApplyParams): V2ApplyResponse = - apply(authRuleToken, params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ApplyResponse = - apply(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see apply */ - @Deprecated("deprecated") - fun apply(params: AuthRuleV2ApplyParams): V2ApplyResponse = apply(params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): V2ApplyResponse - /** * Creates a new draft version of a rule that will be ran in shadow mode. * @@ -508,41 +477,6 @@ interface V2Service { fun delete(authRuleToken: String, requestOptions: RequestOptions): HttpResponse = delete(authRuleToken, AuthRuleV2DeleteParams.none(), requestOptions) - /** - * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/apply`, but is - * otherwise the same as [V2Service.apply]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - ): HttpResponseFor = apply(authRuleToken, params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - @MustBeClosed - fun apply( - authRuleToken: String, - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - apply(params.toBuilder().authRuleToken(authRuleToken).build(), requestOptions) - - /** @see apply */ - @Deprecated("deprecated") - @MustBeClosed - fun apply(params: AuthRuleV2ApplyParams): HttpResponseFor = - apply(params, RequestOptions.none()) - - /** @see apply */ - @Deprecated("deprecated") - @MustBeClosed - fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - /** * Returns a raw HTTP response for `post /v2/auth_rules/{auth_rule_token}/draft`, but is * otherwise the same as [V2Service.draft]. diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt index 3175bb2b..209c9e28 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/blocking/authRules/V2ServiceImpl.kt @@ -17,7 +17,6 @@ import com.lithic.api.core.http.HttpResponseFor import com.lithic.api.core.http.json import com.lithic.api.core.http.parseable import com.lithic.api.core.prepare -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DeleteParams import com.lithic.api.models.AuthRuleV2DraftParams @@ -29,7 +28,6 @@ import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams import com.lithic.api.models.AuthRuleV2RetrieveParams import com.lithic.api.models.AuthRuleV2RetrieveReportParams import com.lithic.api.models.AuthRuleV2UpdateParams -import com.lithic.api.models.V2ApplyResponse import com.lithic.api.models.V2CreateResponse import com.lithic.api.models.V2DraftResponse import com.lithic.api.models.V2PromoteResponse @@ -90,14 +88,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption withRawResponse().delete(params, requestOptions) } - @Deprecated("deprecated") - override fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions, - ): V2ApplyResponse = - // post /v2/auth_rules/{auth_rule_token}/apply - withRawResponse().apply(params, requestOptions).parse() - override fun draft( params: AuthRuleV2DraftParams, requestOptions: RequestOptions, @@ -292,38 +282,6 @@ class V2ServiceImpl internal constructor(private val clientOptions: ClientOption } } - private val applyHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun apply( - params: AuthRuleV2ApplyParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("authRuleToken", params.authRuleToken().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("v2", "auth_rules", params._pathParam(0), "apply") - .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 { applyHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - private val draftHandler: Handler = jsonHandler(clientOptions.jsonMapper) 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 7829a003..97237392 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 @@ -126,7 +126,7 @@ internal class AccountActivityListResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -189,7 +189,7 @@ internal class AccountActivityListResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -744,52 +744,62 @@ internal class AccountActivityListResponseTest { fun ofPayment() { val payment = Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() val accountActivityListResponse = AccountActivityListResponse.ofPayment(payment) @@ -808,52 +818,62 @@ internal class AccountActivityListResponseTest { val accountActivityListResponse = AccountActivityListResponse.ofPayment( Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .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 4ce4db20..bb9c51e6 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 @@ -159,7 +159,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -223,7 +223,7 @@ internal class AccountActivityRetrieveTransactionResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -781,52 +781,62 @@ internal class AccountActivityRetrieveTransactionResponseTest { fun ofPayment() { val payment = Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() val accountActivityRetrieveTransactionResponse = @@ -846,52 +856,62 @@ internal class AccountActivityRetrieveTransactionResponseTest { val accountActivityRetrieveTransactionResponse = AccountActivityRetrieveTransactionResponse.ofPayment( Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListDocumentsResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListDocumentsResponseTest.kt index 07163d5b..83f32766 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListDocumentsResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderListDocumentsResponseTest.kt @@ -17,26 +17,27 @@ internal class AccountHolderListDocumentsResponseTest { AccountHolderListDocumentsResponse.builder() .addData( Document.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .documentType(Document.DocumentType.DRIVERS_LICENSE) - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + .accountHolderToken("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + .documentType(Document.DocumentType.EIN_LETTER) + .entityToken("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") .addRequiredDocumentUpload( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") .status( - Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED + Document.RequiredDocumentUpload.DocumentUploadStatus + .PENDING_UPLOAD ) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) .build() @@ -46,24 +47,26 @@ internal class AccountHolderListDocumentsResponseTest { assertThat(accountHolderListDocumentsResponse.data().getOrNull()) .containsExactly( Document.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .documentType(Document.DocumentType.DRIVERS_LICENSE) - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + .accountHolderToken("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + .documentType(Document.DocumentType.EIN_LETTER) + .entityToken("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") .addRequiredDocumentUpload( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") - .status(Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED) + .status( + Document.RequiredDocumentUpload.DocumentUploadStatus.PENDING_UPLOAD + ) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) .build() @@ -77,26 +80,27 @@ internal class AccountHolderListDocumentsResponseTest { AccountHolderListDocumentsResponse.builder() .addData( Document.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .documentType(Document.DocumentType.DRIVERS_LICENSE) - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + .accountHolderToken("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + .documentType(Document.DocumentType.EIN_LETTER) + .entityToken("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") .addRequiredDocumentUpload( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") .status( - Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED + Document.RequiredDocumentUpload.DocumentUploadStatus + .PENDING_UPLOAD ) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentDocumentReviewParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentDocumentReviewParamsTest.kt index 75e7141f..4c33a2f4 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentDocumentReviewParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderSimulateEnrollmentDocumentReviewParamsTest.kt @@ -11,7 +11,7 @@ internal class AccountHolderSimulateEnrollmentDocumentReviewParamsTest { @Test fun create() { AccountHolderSimulateEnrollmentDocumentReviewParams.builder() - .documentUploadToken("document_upload_token") + .documentUploadToken("b11cd67b-0a52-4180-8365-314f3def5426") .status(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) .addAcceptedEntityStatusReason("string") .statusReason( @@ -25,7 +25,7 @@ internal class AccountHolderSimulateEnrollmentDocumentReviewParamsTest { fun body() { val params = AccountHolderSimulateEnrollmentDocumentReviewParams.builder() - .documentUploadToken("document_upload_token") + .documentUploadToken("b11cd67b-0a52-4180-8365-314f3def5426") .status(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) .addAcceptedEntityStatusReason("string") .statusReason( @@ -36,7 +36,7 @@ internal class AccountHolderSimulateEnrollmentDocumentReviewParamsTest { val body = params._body() - assertThat(body.documentUploadToken()).isEqualTo("document_upload_token") + assertThat(body.documentUploadToken()).isEqualTo("b11cd67b-0a52-4180-8365-314f3def5426") assertThat(body.status()) .isEqualTo(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) assertThat(body.acceptedEntityStatusReasons().getOrNull()).containsExactly("string") @@ -51,13 +51,13 @@ internal class AccountHolderSimulateEnrollmentDocumentReviewParamsTest { fun bodyWithoutOptionalFields() { val params = AccountHolderSimulateEnrollmentDocumentReviewParams.builder() - .documentUploadToken("document_upload_token") + .documentUploadToken("b11cd67b-0a52-4180-8365-314f3def5426") .status(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) .build() val body = params._body() - assertThat(body.documentUploadToken()).isEqualTo("document_upload_token") + assertThat(body.documentUploadToken()).isEqualTo("b11cd67b-0a52-4180-8365-314f3def5426") assertThat(body.status()) .isEqualTo(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ApplyParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ApplyParamsTest.kt deleted file mode 100644 index bfc91d9f..00000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ApplyParamsTest.kt +++ /dev/null @@ -1,83 +0,0 @@ -// 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 AuthRuleV2ApplyParamsTest { - - @Test - fun create() { - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder() - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - .build() - } - - @Test - fun pathParams() { - val params = - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder().build() - ) - .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 = - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder() - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - .build() - - val body = params._body() - - assertThat(body) - .isEqualTo( - AuthRuleV2ApplyParams.Body.ofApplyAuthRuleRequestAccountTokens( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder() - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder().build() - ) - .build() - - val body = params._body() - - assertThat(body) - .isEqualTo( - AuthRuleV2ApplyParams.Body.ofApplyAuthRuleRequestAccountTokens( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder().build() - ) - ) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListParamsTest.kt index 2585b8d0..3fc3d9ef 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AuthRuleV2ListParamsTest.kt @@ -14,11 +14,11 @@ internal class AuthRuleV2ListParamsTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .endingBefore("ending_before") + .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .eventStream(AuthRuleV2ListParams.EventStream.AUTHORIZATION) .pageSize(1L) .scope(AuthRuleV2ListParams.Scope.PROGRAM) - .startingAfter("starting_after") + .startingAfter("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() } @@ -29,11 +29,11 @@ internal class AuthRuleV2ListParamsTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .endingBefore("ending_before") + .endingBefore("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .eventStream(AuthRuleV2ListParams.EventStream.AUTHORIZATION) .pageSize(1L) .scope(AuthRuleV2ListParams.Scope.PROGRAM) - .startingAfter("starting_after") + .startingAfter("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() val queryParams = params._queryParams() @@ -44,11 +44,11 @@ internal class AuthRuleV2ListParamsTest { .put("account_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .put("business_account_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .put("card_token", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("ending_before", "ending_before") + .put("ending_before", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .put("event_stream", "AUTHORIZATION") .put("page_size", "1") .put("scope", "PROGRAM") - .put("starting_after", "starting_after") + .put("starting_after", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt index 8fb37fba..8269a3ae 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferListPageResponseTest.kt @@ -25,7 +25,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent .BookTransferDetailedResults .APPROVED @@ -81,7 +81,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -138,7 +138,7 @@ internal class BookTransferListPageResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent .BookTransferDetailedResults .APPROVED diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt index b873733f..a4129dd5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/BookTransferResponseTest.kt @@ -23,7 +23,7 @@ internal class BookTransferResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) @@ -73,7 +73,7 @@ internal class BookTransferResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults.APPROVED ) .memo("memo") @@ -130,7 +130,7 @@ internal class BookTransferResponseTest { .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .amount(0L) .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .detailedResults( + .addDetailedResult( BookTransferResponse.BookTransferEvent.BookTransferDetailedResults .APPROVED ) 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 new file mode 100644 index 00000000..a96b1666 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeCreateResponseTest.kt @@ -0,0 +1,102 @@ +// 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 new file mode 100644 index 00000000..b880d2a6 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeDeleteResponseTest.kt @@ -0,0 +1,102 @@ +// 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 293e7dad..a2405cd3 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( - Dispute.builder() + DisputeListResponse.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(Dispute.Reason.ATM_CASH_MISDISPENSE) + .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(Dispute.ResolutionReason.CASE_LOST) - .status(Dispute.Status.ARBITRATION) + .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) + .status(DisputeListResponse.Status.ARBITRATION) .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -41,7 +41,7 @@ internal class DisputeListPageResponseTest { assertThat(disputeListPageResponse.data()) .containsExactly( - Dispute.builder() + DisputeListResponse.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(Dispute.Reason.ATM_CASH_MISDISPENSE) + .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(Dispute.ResolutionReason.CASE_LOST) - .status(Dispute.Status.ARBITRATION) + .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) + .status(DisputeListResponse.Status.ARBITRATION) .transactionToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) @@ -71,7 +71,7 @@ internal class DisputeListPageResponseTest { val disputeListPageResponse = DisputeListPageResponse.builder() .addData( - Dispute.builder() + DisputeListResponse.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(Dispute.Reason.ATM_CASH_MISDISPENSE) + .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(Dispute.ResolutionReason.CASE_LOST) - .status(Dispute.Status.ARBITRATION) + .resolutionReason(DisputeListResponse.ResolutionReason.CASE_LOST) + .status(DisputeListResponse.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 new file mode 100644 index 00000000..b50cd00c --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeListResponseTest.kt @@ -0,0 +1,101 @@ +// 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 new file mode 100644 index 00000000..0ea0cd65 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeRetrieveResponseTest.kt @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.lithic.api.models + +import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.jsonMapper +import java.time.OffsetDateTime +import 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 df4031fb..23299e75 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,7 +5,6 @@ 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 @@ -16,49 +15,117 @@ internal class DisputeTest { val dispute = Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") .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(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") + .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")) .build() assertThat(dispute.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(dispute.amount()).isEqualTo(0L) - assertThat(dispute.arbitrationDate()) - .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + 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.created()).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") + 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")) } @Test @@ -67,23 +134,58 @@ internal class DisputeTest { val dispute = Dispute.builder() .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .arbitrationDate(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .caseId("case_id") .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(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") + .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")) .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 new file mode 100644 index 00000000..38373e65 --- /dev/null +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DisputeUpdateResponseTest.kt @@ -0,0 +1,102 @@ +// 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/DocumentTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DocumentTest.kt index eb4919d8..66ccc9c8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/DocumentTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/DocumentTest.kt @@ -14,47 +14,47 @@ internal class DocumentTest { fun create() { val document = Document.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .documentType(Document.DocumentType.DRIVERS_LICENSE) - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + .accountHolderToken("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + .documentType(Document.DocumentType.EIN_LETTER) + .entityToken("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") .addRequiredDocumentUpload( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") - .status(Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED) + .status(Document.RequiredDocumentUpload.DocumentUploadStatus.PENDING_UPLOAD) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) .build() - assertThat(document.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(document.accountHolderToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(document.documentType()).isEqualTo(Document.DocumentType.DRIVERS_LICENSE) - assertThat(document.entityToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(document.token()).isEqualTo("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + assertThat(document.accountHolderToken()).isEqualTo("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + assertThat(document.documentType()).isEqualTo(Document.DocumentType.EIN_LETTER) + assertThat(document.entityToken()).isEqualTo("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") assertThat(document.requiredDocumentUploads()) .containsExactly( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") - .status(Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED) + .status(Document.RequiredDocumentUpload.DocumentUploadStatus.PENDING_UPLOAD) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) } @@ -64,24 +64,24 @@ internal class DocumentTest { val jsonMapper = jsonMapper() val document = Document.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .documentType(Document.DocumentType.DRIVERS_LICENSE) - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("f41c975e-cad8-4e4f-a5cb-cef92ed91083") + .accountHolderToken("aab6ad9a-3630-4cd0-bbec-1a0fa5c7e149") + .documentType(Document.DocumentType.EIN_LETTER) + .entityToken("b50a84c9-8e86-4016-b1c7-0b9f71d4bb84") .addRequiredDocumentUpload( Document.RequiredDocumentUpload.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("e254beee-67db-4d8c-b610-306ee07de886") .addAcceptedEntityStatusReason("string") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .created(OffsetDateTime.parse("2024-09-18T12:34:56Z")) .imageType(Document.RequiredDocumentUpload.ImageType.FRONT) .addRejectedEntityStatusReason("string") - .status(Document.RequiredDocumentUpload.DocumentUploadStatus.ACCEPTED) + .status(Document.RequiredDocumentUpload.DocumentUploadStatus.PENDING_UPLOAD) .addStatusReason( Document.RequiredDocumentUpload.DocumentUploadStatusReasons .DOCUMENT_MISSING_REQUIRED_DATA ) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .uploadUrl("upload_url") + .updated(OffsetDateTime.parse("2024-09-18T12:34:56Z")) + .uploadUrl("https://lithic-document-verification-uploads.com") .build() ) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListPageResponseTest.kt index 2ff027ca..73df4c92 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListPageResponseTest.kt @@ -18,7 +18,7 @@ internal class EventListPageResponseTest { Event.builder() .token("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .eventType(Event.EventType.ACCOUNT_HOLDER_CREATED) + .eventType(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .payload(Event.Payload.builder().build()) .build() ) @@ -30,7 +30,7 @@ internal class EventListPageResponseTest { Event.builder() .token("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .eventType(Event.EventType.ACCOUNT_HOLDER_CREATED) + .eventType(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .payload(Event.Payload.builder().build()) .build() ) @@ -46,7 +46,7 @@ internal class EventListPageResponseTest { Event.builder() .token("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .eventType(Event.EventType.ACCOUNT_HOLDER_CREATED) + .eventType(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .payload(Event.Payload.builder().build()) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListParamsTest.kt index 316aada6..9e7da427 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventListParamsTest.kt @@ -15,7 +15,7 @@ internal class EventListParamsTest { .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endingBefore("ending_before") - .addEventType(EventListParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventListParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .pageSize(1L) .startingAfter("starting_after") .withContent(true) @@ -29,7 +29,7 @@ internal class EventListParamsTest { .begin(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .end(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .endingBefore("ending_before") - .addEventType(EventListParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventListParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .pageSize(1L) .startingAfter("starting_after") .withContent(true) @@ -43,7 +43,7 @@ internal class EventListParamsTest { .put("begin", "2019-12-27T18:11:19.117Z") .put("end", "2019-12-27T18:11:19.117Z") .put("ending_before", "ending_before") - .put("event_types", listOf("account_holder.created").joinToString(",")) + .put("event_types", listOf("account_holder_document.updated").joinToString(",")) .put("page_size", "1") .put("starting_after", "starting_after") .put("with_content", "true") diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionCreateParamsTest.kt index efe7e123..e9b8bf9b 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionCreateParamsTest.kt @@ -14,7 +14,7 @@ internal class EventSubscriptionCreateParamsTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() } @@ -25,7 +25,9 @@ internal class EventSubscriptionCreateParamsTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() val body = params._body() @@ -34,7 +36,9 @@ internal class EventSubscriptionCreateParamsTest { assertThat(body.description()).contains("description") assertThat(body.disabled()).contains(true) assertThat(body.eventTypes().getOrNull()) - .containsExactly(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_CREATED) + .containsExactly( + EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) } @Test diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionListPageResponseTest.kt index c50e613f..30996e64 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionListPageResponseTest.kt @@ -19,7 +19,7 @@ internal class EventSubscriptionListPageResponseTest { .description("description") .disabled(true) .url("https://example.com") - .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() ) .hasMore(true) @@ -32,7 +32,7 @@ internal class EventSubscriptionListPageResponseTest { .description("description") .disabled(true) .url("https://example.com") - .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() ) assertThat(eventSubscriptionListPageResponse.hasMore()).isEqualTo(true) @@ -49,7 +49,7 @@ internal class EventSubscriptionListPageResponseTest { .description("description") .disabled(true) .url("https://example.com") - .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() ) .hasMore(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt index 557df1d2..7d0f519d 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionSendSimulatedExampleParamsTest.kt @@ -11,7 +11,10 @@ internal class EventSubscriptionSendSimulatedExampleParamsTest { fun create() { EventSubscriptionSendSimulatedExampleParams.builder() .eventSubscriptionToken("event_subscription_token") - .eventType(EventSubscriptionSendSimulatedExampleParams.EventType.ACCOUNT_HOLDER_CREATED) + .eventType( + EventSubscriptionSendSimulatedExampleParams.EventType + .ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() } @@ -33,14 +36,18 @@ internal class EventSubscriptionSendSimulatedExampleParamsTest { EventSubscriptionSendSimulatedExampleParams.builder() .eventSubscriptionToken("event_subscription_token") .eventType( - EventSubscriptionSendSimulatedExampleParams.EventType.ACCOUNT_HOLDER_CREATED + EventSubscriptionSendSimulatedExampleParams.EventType + .ACCOUNT_HOLDER_DOCUMENT_UPDATED ) .build() val body = params._body() assertThat(body.eventType()) - .contains(EventSubscriptionSendSimulatedExampleParams.EventType.ACCOUNT_HOLDER_CREATED) + .contains( + EventSubscriptionSendSimulatedExampleParams.EventType + .ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) } @Test diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionTest.kt index b784ef2b..d65baaaf 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionTest.kt @@ -18,7 +18,7 @@ internal class EventSubscriptionTest { .description("description") .disabled(true) .url("https://example.com") - .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() assertThat(eventSubscription.token()).isEqualTo("ep_1srOrx2ZWZBpBUvZwXKQmoEYga1") @@ -26,7 +26,7 @@ internal class EventSubscriptionTest { assertThat(eventSubscription.disabled()).isEqualTo(true) assertThat(eventSubscription.url()).isEqualTo("https://example.com") assertThat(eventSubscription.eventTypes().getOrNull()) - .containsExactly(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .containsExactly(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) } @Test @@ -38,7 +38,7 @@ internal class EventSubscriptionTest { .description("description") .disabled(true) .url("https://example.com") - .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscription.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() val roundtrippedEventSubscription = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionUpdateParamsTest.kt index a7b4c198..6ba9acf8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventSubscriptionUpdateParamsTest.kt @@ -15,7 +15,7 @@ internal class EventSubscriptionUpdateParamsTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .build() } @@ -40,7 +40,9 @@ internal class EventSubscriptionUpdateParamsTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() val body = params._body() @@ -49,7 +51,9 @@ internal class EventSubscriptionUpdateParamsTest { assertThat(body.description()).contains("description") assertThat(body.disabled()).contains(true) assertThat(body.eventTypes().getOrNull()) - .containsExactly(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_CREATED) + .containsExactly( + EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) } @Test diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventTest.kt index f58fcf52..7367920f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EventTest.kt @@ -16,13 +16,13 @@ internal class EventTest { Event.builder() .token("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .eventType(Event.EventType.ACCOUNT_HOLDER_CREATED) + .eventType(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .payload(Event.Payload.builder().build()) .build() assertThat(event.token()).isEqualTo("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") assertThat(event.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(event.eventType()).isEqualTo(Event.EventType.ACCOUNT_HOLDER_CREATED) + assertThat(event.eventType()).isEqualTo(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) assertThat(event.payload()).isEqualTo(Event.Payload.builder().build()) } @@ -33,7 +33,7 @@ internal class EventTest { Event.builder() .token("msg_1srOrx2ZWZBpBUvZwXKQmoEYga1") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .eventType(Event.EventType.ACCOUNT_HOLDER_CREATED) + .eventType(Event.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED) .payload(Event.Payload.builder().build()) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountCreateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountCreateParamsTest.kt index 5c86bcae..6e66283a 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountCreateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ExternalBankAccountCreateParamsTest.kt @@ -15,34 +15,34 @@ internal class ExternalBankAccountCreateParamsTest { .body( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .builder() - .accountNumber("12345678901234567") - .country("USD") + .accountNumber("13719713158835300") + .country("USA") .currency("USD") - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .owner("owner") - .ownerType(OwnerType.INDIVIDUAL) - .routingNumber("123456789") + .financialAccountToken("dabadb3b-700c-41e3-8801-d5dfc84ebea0") + .owner("John Doe") + .ownerType(OwnerType.BUSINESS) + .routingNumber("011103093") .type( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .AccountType .CHECKING ) - .verificationMethod(VerificationMethod.MANUAL) + .verificationMethod(VerificationMethod.PRENOTE) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .address( ExternalBankAccountAddress.builder() - .address1("x") - .city("x") - .country("USD") - .postalCode("11201") - .state("xx") + .address1("5 Broad Street") + .city("New York") + .country("USA") + .postalCode("10001") + .state("NY") .address2("x") .build() ) .companyId("sq") .dob(LocalDate.parse("2019-12-27")) .doingBusinessAs("x") - .name("name") + .name("John Does Checking") .userDefinedId("x") .verificationEnforcement(true) .build() @@ -57,35 +57,35 @@ internal class ExternalBankAccountCreateParamsTest { .body( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .builder() - .accountNumber("12345678901234567") - .country("USD") + .accountNumber("13719713158835300") + .country("USA") .currency("USD") - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .owner("owner") - .ownerType(OwnerType.INDIVIDUAL) - .routingNumber("123456789") + .financialAccountToken("dabadb3b-700c-41e3-8801-d5dfc84ebea0") + .owner("John Doe") + .ownerType(OwnerType.BUSINESS) + .routingNumber("011103093") .type( ExternalBankAccountCreateParams.Body .BankVerifiedCreateBankAccountApiRequest .AccountType .CHECKING ) - .verificationMethod(VerificationMethod.MANUAL) + .verificationMethod(VerificationMethod.PRENOTE) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .address( ExternalBankAccountAddress.builder() - .address1("x") - .city("x") - .country("USD") - .postalCode("11201") - .state("xx") + .address1("5 Broad Street") + .city("New York") + .country("USA") + .postalCode("10001") + .state("NY") .address2("x") .build() ) .companyId("sq") .dob(LocalDate.parse("2019-12-27")) .doingBusinessAs("x") - .name("name") + .name("John Does Checking") .userDefinedId("x") .verificationEnforcement(true) .build() @@ -99,35 +99,35 @@ internal class ExternalBankAccountCreateParamsTest { ExternalBankAccountCreateParams.Body.ofBankVerifiedCreateBankAccountApiRequest( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .builder() - .accountNumber("12345678901234567") - .country("USD") + .accountNumber("13719713158835300") + .country("USA") .currency("USD") - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .owner("owner") - .ownerType(OwnerType.INDIVIDUAL) - .routingNumber("123456789") + .financialAccountToken("dabadb3b-700c-41e3-8801-d5dfc84ebea0") + .owner("John Doe") + .ownerType(OwnerType.BUSINESS) + .routingNumber("011103093") .type( ExternalBankAccountCreateParams.Body .BankVerifiedCreateBankAccountApiRequest .AccountType .CHECKING ) - .verificationMethod(VerificationMethod.MANUAL) + .verificationMethod(VerificationMethod.PRENOTE) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .address( ExternalBankAccountAddress.builder() - .address1("x") - .city("x") - .country("USD") - .postalCode("11201") - .state("xx") + .address1("5 Broad Street") + .city("New York") + .country("USA") + .postalCode("10001") + .state("NY") .address2("x") .build() ) .companyId("sq") .dob(LocalDate.parse("2019-12-27")) .doingBusinessAs("x") - .name("name") + .name("John Does Checking") .userDefinedId("x") .verificationEnforcement(true) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt index 7997a31f..2c065df4 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountCreditConfigTest.kt @@ -23,9 +23,6 @@ internal class FinancialAccountCreditConfigTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) - .financialAccountState(FinancialAccountCreditConfig.FinancialAccountState.PENDING) - .isSpendBlocked(true) .build() assertThat(financialAccountCreditConfig.accountToken()) @@ -42,11 +39,6 @@ internal class FinancialAccountCreditConfigTest { assertThat(financialAccountCreditConfig.externalBankAccountToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(financialAccountCreditConfig.tier()).contains("tier") - assertThat(financialAccountCreditConfig.chargedOffReason()) - .contains(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) - assertThat(financialAccountCreditConfig.financialAccountState()) - .contains(FinancialAccountCreditConfig.FinancialAccountState.PENDING) - assertThat(financialAccountCreditConfig.isSpendBlocked()).contains(true) } @Test @@ -64,9 +56,6 @@ internal class FinancialAccountCreditConfigTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason(FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT) - .financialAccountState(FinancialAccountCreditConfig.FinancialAccountState.PENDING) - .isSpendBlocked(true) .build() val roundtrippedFinancialAccountCreditConfig = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt index 3fb5e036..7fe594e4 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountListPageResponseTest.kt @@ -32,16 +32,6 @@ internal class FinancialAccountListPageResponseTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig - .FinancialAccountState - .PENDING - ) - .isSpendBlocked(true) .build() ) .isForBenefitOf(true) @@ -78,15 +68,6 @@ internal class FinancialAccountListPageResponseTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState - .PENDING - ) - .isSpendBlocked(true) .build() ) .isForBenefitOf(true) @@ -125,16 +106,6 @@ internal class FinancialAccountListPageResponseTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig - .FinancialAccountState - .PENDING - ) - .isSpendBlocked(true) .build() ) .isForBenefitOf(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt index 0b10da07..ce3627a7 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountTest.kt @@ -30,15 +30,6 @@ internal class FinancialAccountTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState - .PENDING - ) - .isSpendBlocked(true) .build() ) .isForBenefitOf(true) @@ -69,13 +60,6 @@ internal class FinancialAccountTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason.DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState.PENDING - ) - .isSpendBlocked(true) .build() ) assertThat(financialAccount.isForBenefitOf()).isEqualTo(true) @@ -112,15 +96,6 @@ internal class FinancialAccountTest { .creditProductToken("credit_product_token") .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .tier("tier") - .chargedOffReason( - FinancialAccount.FinancialAccountCreditConfig.ChargedOffReason - .DELINQUENT - ) - .financialAccountState( - FinancialAccount.FinancialAccountCreditConfig.FinancialAccountState - .PENDING - ) - .isSpendBlocked(true) .build() ) .isForBenefitOf(true) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountUpdateStatusParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountUpdateStatusParamsTest.kt index 9b7bde5c..e4976efc 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountUpdateStatusParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/FinancialAccountUpdateStatusParamsTest.kt @@ -11,9 +11,9 @@ internal class FinancialAccountUpdateStatusParamsTest { fun create() { FinancialAccountUpdateStatusParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) .substatus( - FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus.CHARGED_OFF_FRAUD + FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus.END_USER_REQUEST ) .build() } @@ -23,10 +23,10 @@ internal class FinancialAccountUpdateStatusParamsTest { val params = FinancialAccountUpdateStatusParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) .substatus( FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus - .CHARGED_OFF_FRAUD + .END_USER_REQUEST ) .build() @@ -40,20 +40,20 @@ internal class FinancialAccountUpdateStatusParamsTest { val params = FinancialAccountUpdateStatusParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) .substatus( FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus - .CHARGED_OFF_FRAUD + .END_USER_REQUEST ) .build() val body = params._body() assertThat(body.status()) - .isEqualTo(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .isEqualTo(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) assertThat(body.substatus()) .contains( - FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus.CHARGED_OFF_FRAUD + FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus.END_USER_REQUEST ) } } 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 6d7482cb..aa746381 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 @@ -4,7 +4,6 @@ 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 @@ -15,52 +14,62 @@ internal class PaymentCreateResponseTest { fun create() { val paymentCreateResponse = PaymentCreateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .balance( Balance.builder() .availableAmount(0L) @@ -77,62 +86,69 @@ internal class PaymentCreateResponseTest { ) .build() - assertThat(paymentCreateResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentCreateResponse.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") assertThat(paymentCreateResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentCreateResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentCreateResponse.descriptor()).isEqualTo("descriptor") - assertThat(paymentCreateResponse.direction()).isEqualTo(Payment.Direction.CREDIT) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + assertThat(paymentCreateResponse.descriptor()).isEqualTo("ach_origination_debit") + assertThat(paymentCreateResponse.direction()).isEqualTo(Payment.Direction.DEBIT) assertThat(paymentCreateResponse.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) - .build() + .build(), + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build(), ) assertThat(paymentCreateResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentCreateResponse.financialAccountToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") assertThat(paymentCreateResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentCreateResponse.methodAttributes()) .isEqualTo( Payment.MethodAttributes.ofAch( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) ) - assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(200L) + assertThat(paymentCreateResponse.pendingAmount()).isEqualTo(1588L) assertThat(paymentCreateResponse.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) assertThat(paymentCreateResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) - assertThat(paymentCreateResponse.settledAmount()).isEqualTo(500L) + assertThat(paymentCreateResponse.settledAmount()).isEqualTo(0L) assertThat(paymentCreateResponse.source()).isEqualTo(Payment.Source.LITHIC) assertThat(paymentCreateResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentCreateResponse.updated()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) assertThat(paymentCreateResponse.currency()).contains("USD") - assertThat(paymentCreateResponse.expectedReleaseDate()) - .contains(LocalDate.parse("2019-12-27")) + assertThat(paymentCreateResponse.expectedReleaseDate()).isEmpty assertThat(paymentCreateResponse.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(paymentCreateResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) - assertThat(paymentCreateResponse.userDefinedId()).contains("user_defined_id") + .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + assertThat(paymentCreateResponse.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(paymentCreateResponse.userDefinedId()).isEmpty assertThat(paymentCreateResponse.balance()) .contains( Balance.builder() @@ -155,52 +171,62 @@ internal class PaymentCreateResponseTest { val jsonMapper = jsonMapper() val paymentCreateResponse = PaymentCreateResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .balance( Balance.builder() .availableAmount(0L) 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 ece31b4c..87abc859 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 @@ -4,7 +4,6 @@ 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 @@ -17,54 +16,66 @@ internal class PaymentListPageResponseTest { PaymentListPageResponse.builder() .addData( Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( - Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED + ) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type( + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED ) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() ) .hasMore(true) @@ -73,52 +84,62 @@ internal class PaymentListPageResponseTest { assertThat(paymentListPageResponse.data()) .containsExactly( Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) + .addEvent( + Payment.PaymentEvent.builder() + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() ) assertThat(paymentListPageResponse.hasMore()).isEqualTo(true) @@ -131,54 +152,66 @@ internal class PaymentListPageResponseTest { PaymentListPageResponse.builder() .addData( Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) + .addEvent( + Payment.PaymentEvent.builder() + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type( + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED + ) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) .type( - Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED + Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED ) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() ) .hasMore(true) 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 5ff6173a..ffbbe698 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 @@ -4,7 +4,6 @@ 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 @@ -15,52 +14,62 @@ internal class PaymentRetryResponseTest { fun create() { val paymentRetryResponse = PaymentRetryResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .balance( Balance.builder() .availableAmount(0L) @@ -77,62 +86,69 @@ internal class PaymentRetryResponseTest { ) .build() - assertThat(paymentRetryResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(paymentRetryResponse.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") assertThat(paymentRetryResponse.category()).isEqualTo(Payment.TransactionCategory.ACH) assertThat(paymentRetryResponse.created()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(paymentRetryResponse.descriptor()).isEqualTo("descriptor") - assertThat(paymentRetryResponse.direction()).isEqualTo(Payment.Direction.CREDIT) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + assertThat(paymentRetryResponse.descriptor()).isEqualTo("ach_origination_debit") + assertThat(paymentRetryResponse.direction()).isEqualTo(Payment.Direction.DEBIT) assertThat(paymentRetryResponse.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) - .build() + .build(), + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build(), ) assertThat(paymentRetryResponse.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(paymentRetryResponse.financialAccountToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") assertThat(paymentRetryResponse.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(paymentRetryResponse.methodAttributes()) .isEqualTo( Payment.MethodAttributes.ofAch( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) ) - assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(200L) + assertThat(paymentRetryResponse.pendingAmount()).isEqualTo(1588L) assertThat(paymentRetryResponse.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) assertThat(paymentRetryResponse.result()).isEqualTo(Payment.TransactionResult.APPROVED) - assertThat(paymentRetryResponse.settledAmount()).isEqualTo(500L) + assertThat(paymentRetryResponse.settledAmount()).isEqualTo(0L) assertThat(paymentRetryResponse.source()).isEqualTo(Payment.Source.LITHIC) assertThat(paymentRetryResponse.status()).isEqualTo(Payment.TransactionStatus.PENDING) assertThat(paymentRetryResponse.updated()) - .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) assertThat(paymentRetryResponse.currency()).contains("USD") - assertThat(paymentRetryResponse.expectedReleaseDate()) - .contains(LocalDate.parse("2019-12-27")) + assertThat(paymentRetryResponse.expectedReleaseDate()).isEmpty assertThat(paymentRetryResponse.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(paymentRetryResponse.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) - assertThat(paymentRetryResponse.userDefinedId()).contains("user_defined_id") + .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + assertThat(paymentRetryResponse.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(paymentRetryResponse.userDefinedId()).isEmpty assertThat(paymentRetryResponse.balance()) .contains( Balance.builder() @@ -155,52 +171,62 @@ internal class PaymentRetryResponseTest { val jsonMapper = jsonMapper() val paymentRetryResponse = PaymentRetryResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .balance( Balance.builder() .availableAmount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt index f31b421a..7833920f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/PaymentSimulateActionParamsTest.kt @@ -2,6 +2,7 @@ package com.lithic.api.models +import java.time.LocalDate import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,10 +15,12 @@ internal class PaymentSimulateActionParamsTest { .eventType( PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED ) + .dateOfDeath(LocalDate.parse("2019-12-27")) .declineReason( PaymentSimulateActionParams.SupportedSimulationDeclineReasons .PROGRAM_TRANSACTION_LIMIT_EXCEEDED ) + .returnAddenda("return_addenda") .returnReasonCode("return_reason_code") .build() } @@ -45,10 +48,12 @@ internal class PaymentSimulateActionParamsTest { .eventType( PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED ) + .dateOfDeath(LocalDate.parse("2019-12-27")) .declineReason( PaymentSimulateActionParams.SupportedSimulationDeclineReasons .PROGRAM_TRANSACTION_LIMIT_EXCEEDED ) + .returnAddenda("return_addenda") .returnReasonCode("return_reason_code") .build() @@ -58,11 +63,13 @@ internal class PaymentSimulateActionParamsTest { .isEqualTo( PaymentSimulateActionParams.SupportedSimulationTypes.ACH_ORIGINATION_REVIEWED ) + assertThat(body.dateOfDeath()).contains(LocalDate.parse("2019-12-27")) assertThat(body.declineReason()) .contains( PaymentSimulateActionParams.SupportedSimulationDeclineReasons .PROGRAM_TRANSACTION_LIMIT_EXCEEDED ) + assertThat(body.returnAddenda()).contains("return_addenda") assertThat(body.returnReasonCode()).contains("return_reason_code") } 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 a6bf50ba..016a1c06 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 @@ -4,7 +4,6 @@ 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 @@ -15,107 +14,125 @@ internal class PaymentTest { fun create() { val payment = Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) + .addEvent( + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() - assertThat(payment.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(payment.token()).isEqualTo("cb35759d-8c18-4b7f-bb91-7c37936662c2") assertThat(payment.category()).isEqualTo(Payment.TransactionCategory.ACH) - assertThat(payment.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(payment.descriptor()).isEqualTo("descriptor") - assertThat(payment.direction()).isEqualTo(Payment.Direction.CREDIT) + 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.events()) .containsExactly( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) - .build() + .build(), + Payment.PaymentEvent.builder() + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build(), ) assertThat(payment.family()).isEqualTo(Payment.Family.PAYMENT) assertThat(payment.financialAccountToken()) - .isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .isEqualTo("f012262b-d18f-5c26-ad63-a09a11e633a6") assertThat(payment.method()).isEqualTo(Payment.Method.ACH_NEXT_DAY) assertThat(payment.methodAttributes()) .isEqualTo( Payment.MethodAttributes.ofAch( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) ) - assertThat(payment.pendingAmount()).isEqualTo(200L) + assertThat(payment.pendingAmount()).isEqualTo(1588L) assertThat(payment.relatedAccountTokens()) .isEqualTo( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) assertThat(payment.result()).isEqualTo(Payment.TransactionResult.APPROVED) - assertThat(payment.settledAmount()).isEqualTo(500L) + 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("2019-12-27T18:11:19.117Z")) + assertThat(payment.updated()).isEqualTo(OffsetDateTime.parse("2025-10-27T20:12:18Z")) assertThat(payment.currency()).contains("USD") - assertThat(payment.expectedReleaseDate()).contains(LocalDate.parse("2019-12-27")) + assertThat(payment.expectedReleaseDate()).isEmpty assertThat(payment.externalBankAccountToken()) - .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(payment.type()).contains(Payment.TransferType.ORIGINATION_CREDIT) - assertThat(payment.userDefinedId()).contains("user_defined_id") + .contains("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + assertThat(payment.type()).contains(Payment.TransferType.ORIGINATION_DEBIT) + assertThat(payment.userDefinedId()).isEmpty } @Test @@ -123,52 +140,62 @@ internal class PaymentTest { val jsonMapper = jsonMapper() val payment = Payment.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .token("cb35759d-8c18-4b7f-bb91-7c37936662c2") .category(Payment.TransactionCategory.ACH) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .descriptor("descriptor") - .direction(Payment.Direction.CREDIT) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .descriptor("ach_origination_debit") + .direction(Payment.Direction.DEBIT) + .addEvent( + Payment.PaymentEvent.builder() + .token("38dc6bc5-d18f-594e-9ab9-ef1cfdcfbf82") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:15Z")) + .result(Payment.PaymentEvent.Result.APPROVED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_INITIATED) + .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) + .build() + ) .addEvent( Payment.PaymentEvent.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .amount(0L) - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .token("e466f34a-d648-5a8f-8bc7-1d4d1e703db3") + .amount(1588L) + .created(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .result(Payment.PaymentEvent.Result.APPROVED) - .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_CANCELLED) + .type(Payment.PaymentEvent.PaymentEventType.ACH_ORIGINATION_REVIEWED) .addDetailedResult(Payment.PaymentEvent.DetailedResult.APPROVED) .build() ) .family(Payment.Family.PAYMENT) - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .financialAccountToken("f012262b-d18f-5c26-ad63-a09a11e633a6") .method(Payment.Method.ACH_NEXT_DAY) .methodAttributes( Payment.MethodAttributes.AchMethodAttributes.builder() .secCode(Payment.MethodAttributes.AchMethodAttributes.SecCode.CCD) - .addenda("addenda") - .companyId("company_id") - .receiptRoutingNumber("receipt_routing_number") + .addenda(null) + .companyId("1111111111") + .receiptRoutingNumber(null) .retries(0L) - .returnReasonCode("return_reason_code") + .returnReasonCode(null) .addTraceNumber("string") .build() ) - .pendingAmount(200L) + .pendingAmount(1588L) .relatedAccountTokens( Payment.RelatedAccountTokens.builder() - .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .businessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .accountToken("d11bca22-39e2-475c-bbb3-6ba21e38b0d3") + .businessAccountToken(null) .build() ) .result(Payment.TransactionResult.APPROVED) - .settledAmount(500L) + .settledAmount(0L) .source(Payment.Source.LITHIC) .status(Payment.TransactionStatus.PENDING) - .updated(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .updated(OffsetDateTime.parse("2025-10-27T20:12:18Z")) .currency("USD") - .expectedReleaseDate(LocalDate.parse("2019-12-27")) - .externalBankAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .type(Payment.TransferType.ORIGINATION_CREDIT) - .userDefinedId("user_defined_id") + .expectedReleaseDate(null) + .externalBankAccountToken("feb4fee1-2414-4c38-a5f6-9deac293c8f4") + .type(Payment.TransferType.ORIGINATION_DEBIT) + .userDefinedId(null) .build() val roundtrippedPayment = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportSettlementNetworkTotalListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportSettlementNetworkTotalListPageResponseTest.kt index 3716902f..37e894b8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportSettlementNetworkTotalListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/ReportSettlementNetworkTotalListPageResponseTest.kt @@ -15,30 +15,95 @@ internal class ReportSettlementNetworkTotalListPageResponseTest { fun create() { val reportSettlementNetworkTotalListPageResponse = ReportSettlementNetworkTotalListPageResponse.builder() - .addData( - NetworkTotalListResponse.builder() - .token("12cf7505-06a8-435e-b1c7-4c430d02f6c3") - .amounts( - NetworkTotalListResponse.Amounts.builder() - .grossSettlement(100L) - .interchangeFees(-25L) - .netSettlement(85L) - .visaCharges(10L) - .build() - ) - .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) - .currency("CAD") - .institutionId("1000000000") - .isComplete(true) - .network(NetworkTotalListResponse.Network.VISA) - .reportDate(LocalDate.parse("2025-02-25")) - .settlementInstitutionId("1000000001") - .settlementService("015") - .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) - .cycle(0L) - .build() + .data( + listOf( + NetworkTotalListResponse.builder() + .token("12cf7505-06a8-435e-b1c7-4c430d02f6c3") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(85L) + .visaCharges(10L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("CAD") + .institutionId("1000000000") + .isComplete(true) + .network(NetworkTotalListResponse.Network.VISA) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("1000000001") + .settlementService("015") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(0L) + .build(), + NetworkTotalListResponse.builder() + .token("0604c316-17f0-456d-9ac7-7d94252acb1a") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(200L) + .interchangeFees(-50L) + .netSettlement(160L) + .visaCharges(10L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("1000000000") + .isComplete(true) + .network(NetworkTotalListResponse.Network.INTERLINK) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("1000000001") + .settlementService("001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(0L) + .build(), + NetworkTotalListResponse.builder() + .token("700a1c78-04ed-47e2-8160-b1e18914ec7b") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(false) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(1L) + .build(), + NetworkTotalListResponse.builder() + .token("e05d5448-210e-4cc3-bd0d-d54d3c6c9a9f") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(true) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(2L) + .build(), + ) ) - .hasMore(true) + .hasMore(false) .build() assertThat(reportSettlementNetworkTotalListPageResponse.data()) @@ -63,9 +128,72 @@ internal class ReportSettlementNetworkTotalListPageResponseTest { .settlementService("015") .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) .cycle(0L) - .build() + .build(), + NetworkTotalListResponse.builder() + .token("0604c316-17f0-456d-9ac7-7d94252acb1a") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(200L) + .interchangeFees(-50L) + .netSettlement(160L) + .visaCharges(10L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("1000000000") + .isComplete(true) + .network(NetworkTotalListResponse.Network.INTERLINK) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("1000000001") + .settlementService("001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(0L) + .build(), + NetworkTotalListResponse.builder() + .token("700a1c78-04ed-47e2-8160-b1e18914ec7b") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(false) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(1L) + .build(), + NetworkTotalListResponse.builder() + .token("e05d5448-210e-4cc3-bd0d-d54d3c6c9a9f") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(true) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(2L) + .build(), ) - assertThat(reportSettlementNetworkTotalListPageResponse.hasMore()).isEqualTo(true) + assertThat(reportSettlementNetworkTotalListPageResponse.hasMore()).isEqualTo(false) } @Test @@ -73,30 +201,95 @@ internal class ReportSettlementNetworkTotalListPageResponseTest { val jsonMapper = jsonMapper() val reportSettlementNetworkTotalListPageResponse = ReportSettlementNetworkTotalListPageResponse.builder() - .addData( - NetworkTotalListResponse.builder() - .token("12cf7505-06a8-435e-b1c7-4c430d02f6c3") - .amounts( - NetworkTotalListResponse.Amounts.builder() - .grossSettlement(100L) - .interchangeFees(-25L) - .netSettlement(85L) - .visaCharges(10L) - .build() - ) - .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) - .currency("CAD") - .institutionId("1000000000") - .isComplete(true) - .network(NetworkTotalListResponse.Network.VISA) - .reportDate(LocalDate.parse("2025-02-25")) - .settlementInstitutionId("1000000001") - .settlementService("015") - .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) - .cycle(0L) - .build() + .data( + listOf( + NetworkTotalListResponse.builder() + .token("12cf7505-06a8-435e-b1c7-4c430d02f6c3") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(85L) + .visaCharges(10L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("CAD") + .institutionId("1000000000") + .isComplete(true) + .network(NetworkTotalListResponse.Network.VISA) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("1000000001") + .settlementService("015") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(0L) + .build(), + NetworkTotalListResponse.builder() + .token("0604c316-17f0-456d-9ac7-7d94252acb1a") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(200L) + .interchangeFees(-50L) + .netSettlement(160L) + .visaCharges(10L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("1000000000") + .isComplete(true) + .network(NetworkTotalListResponse.Network.INTERLINK) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("1000000001") + .settlementService("001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(0L) + .build(), + NetworkTotalListResponse.builder() + .token("700a1c78-04ed-47e2-8160-b1e18914ec7b") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(false) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(1L) + .build(), + NetworkTotalListResponse.builder() + .token("e05d5448-210e-4cc3-bd0d-d54d3c6c9a9f") + .amounts( + NetworkTotalListResponse.Amounts.builder() + .grossSettlement(100L) + .interchangeFees(-25L) + .netSettlement(75L) + .visaCharges(0L) + .build() + ) + .created(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .currency("USD") + .institutionId("031511") + .isComplete(true) + .network(NetworkTotalListResponse.Network.MASTERCARD) + .reportDate(LocalDate.parse("2025-02-25")) + .settlementInstitutionId("031511") + .settlementService("US00000001") + .updated(OffsetDateTime.parse("2025-02-25T13:07:31.419631Z")) + .cycle(2L) + .build(), + ) ) - .hasMore(true) + .hasMore(false) .build() val roundtrippedReportSettlementNetworkTotalListPageResponse = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ApplyResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ApplyResponseTest.kt deleted file mode 100644 index d99f8061..00000000 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2ApplyResponseTest.kt +++ /dev/null @@ -1,172 +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 kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class V2ApplyResponseTest { - - @Test - fun create() { - val v2ApplyResponse = - V2ApplyResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .currentVersion( - V2ApplyResponse.CurrentVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - .draftVersion( - V2ApplyResponse.DraftVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - .eventStream(V2ApplyResponse.EventStream.AUTHORIZATION) - .lithicManaged(true) - .name("name") - .programLevel(true) - .state(V2ApplyResponse.AuthRuleState.ACTIVE) - .type(V2ApplyResponse.AuthRuleType.CONDITIONAL_BLOCK) - .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - assertThat(v2ApplyResponse.token()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(v2ApplyResponse.accountTokens()) - .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(v2ApplyResponse.businessAccountTokens()) - .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(v2ApplyResponse.cardTokens()) - .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(v2ApplyResponse.currentVersion()) - .contains( - V2ApplyResponse.CurrentVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - assertThat(v2ApplyResponse.draftVersion()) - .contains( - V2ApplyResponse.DraftVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - assertThat(v2ApplyResponse.eventStream()) - .isEqualTo(V2ApplyResponse.EventStream.AUTHORIZATION) - assertThat(v2ApplyResponse.lithicManaged()).isEqualTo(true) - assertThat(v2ApplyResponse.name()).contains("name") - assertThat(v2ApplyResponse.programLevel()).isEqualTo(true) - assertThat(v2ApplyResponse.state()).isEqualTo(V2ApplyResponse.AuthRuleState.ACTIVE) - assertThat(v2ApplyResponse.type()).isEqualTo(V2ApplyResponse.AuthRuleType.CONDITIONAL_BLOCK) - assertThat(v2ApplyResponse.excludedCardTokens().getOrNull()) - .containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val v2ApplyResponse = - V2ApplyResponse.builder() - .token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .currentVersion( - V2ApplyResponse.CurrentVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - .draftVersion( - V2ApplyResponse.DraftVersion.builder() - .parameters( - ConditionalBlockParameters.builder() - .addCondition( - AuthRuleCondition.builder() - .attribute(ConditionalAttribute.MCC) - .operation(AuthRuleCondition.Operation.IS_ONE_OF) - .value("string") - .build() - ) - .build() - ) - .version(0L) - .build() - ) - .eventStream(V2ApplyResponse.EventStream.AUTHORIZATION) - .lithicManaged(true) - .name("name") - .programLevel(true) - .state(V2ApplyResponse.AuthRuleState.ACTIVE) - .type(V2ApplyResponse.AuthRuleType.CONDITIONAL_BLOCK) - .addExcludedCardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val roundtrippedV2ApplyResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(v2ApplyResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedV2ApplyResponse).isEqualTo(v2ApplyResponse) - } -} diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt index a837c85e..6d94ead8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/V2RetrieveFeaturesResponseTest.kt @@ -32,7 +32,14 @@ internal class V2RetrieveFeaturesResponseTest { ) .build() ) - .period(10L) + .period( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM + ) + .build() + ) .scope(V2RetrieveFeaturesResponse.SpendFeatureState.VelocityScope.CARD) .value( V2RetrieveFeaturesResponse.SpendFeatureState.Value.builder() @@ -62,7 +69,12 @@ internal class V2RetrieveFeaturesResponseTest { ) .build() ) - .period(10L) + .period( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM) + .build() + ) .scope(V2RetrieveFeaturesResponse.SpendFeatureState.VelocityScope.CARD) .value( V2RetrieveFeaturesResponse.SpendFeatureState.Value.builder() @@ -97,7 +109,14 @@ internal class V2RetrieveFeaturesResponseTest { ) .build() ) - .period(10L) + .period( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM + ) + .build() + ) .scope(V2RetrieveFeaturesResponse.SpendFeatureState.VelocityScope.CARD) .value( V2RetrieveFeaturesResponse.SpendFeatureState.Value.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindowTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindowTest.kt index a0ea312b..5918389a 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindowTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsPeriodWindowTest.kt @@ -9,70 +9,11 @@ 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 +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource internal class VelocityLimitParamsPeriodWindowTest { - @Test - fun ofTrailing() { - val trailing = 10L - - val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofTrailing(trailing) - - assertThat(velocityLimitParamsPeriodWindow.trailing()).contains(trailing) - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowMonth()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowYear()).isEmpty - } - - @Test - fun ofTrailingRoundtrip() { - val jsonMapper = jsonMapper() - val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofTrailing(10L) - - val roundtrippedVelocityLimitParamsPeriodWindow = - jsonMapper.readValue( - jsonMapper.writeValueAsString(velocityLimitParamsPeriodWindow), - jacksonTypeRef(), - ) - - assertThat(roundtrippedVelocityLimitParamsPeriodWindow) - .isEqualTo(velocityLimitParamsPeriodWindow) - } - - @Test - fun ofFixed() { - val fixed = VelocityLimitParamsPeriodWindow.FixedWindow.DAY - - val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixed(fixed) - - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).contains(fixed) - assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowMonth()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixedWindowYear()).isEmpty - } - - @Test - fun ofFixedRoundtrip() { - val jsonMapper = jsonMapper() - val velocityLimitParamsPeriodWindow = - VelocityLimitParamsPeriodWindow.ofFixed(VelocityLimitParamsPeriodWindow.FixedWindow.DAY) - - val roundtrippedVelocityLimitParamsPeriodWindow = - jsonMapper.readValue( - jsonMapper.writeValueAsString(velocityLimitParamsPeriodWindow), - jacksonTypeRef(), - ) - - assertThat(roundtrippedVelocityLimitParamsPeriodWindow) - .isEqualTo(velocityLimitParamsPeriodWindow) - } - @Test fun ofTrailingWindowObject() { val trailingWindowObject = @@ -84,8 +25,6 @@ internal class VelocityLimitParamsPeriodWindowTest { val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofTrailingWindowObject(trailingWindowObject) - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()) .contains(trailingWindowObject) assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty @@ -125,8 +64,6 @@ internal class VelocityLimitParamsPeriodWindowTest { val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowDay(fixedWindowDay) - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).contains(fixedWindowDay) assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).isEmpty @@ -158,15 +95,13 @@ internal class VelocityLimitParamsPeriodWindowTest { fun ofFixedWindowWeek() { val fixedWindowWeek = VelocityLimitParamsPeriodWindow.FixedWindowWeek.builder() - .dayOfWeek(1L) .type(VelocityLimitParamsPeriodWindow.FixedWindowWeek.Type.WEEK) + .dayOfWeek(1L) .build() val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowWeek(fixedWindowWeek) - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).contains(fixedWindowWeek) @@ -180,8 +115,8 @@ internal class VelocityLimitParamsPeriodWindowTest { val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowWeek( VelocityLimitParamsPeriodWindow.FixedWindowWeek.builder() - .dayOfWeek(1L) .type(VelocityLimitParamsPeriodWindow.FixedWindowWeek.Type.WEEK) + .dayOfWeek(1L) .build() ) @@ -199,15 +134,13 @@ internal class VelocityLimitParamsPeriodWindowTest { fun ofFixedWindowMonth() { val fixedWindowMonth = VelocityLimitParamsPeriodWindow.FixedWindowMonth.builder() - .dayOfMonth(1L) .type(VelocityLimitParamsPeriodWindow.FixedWindowMonth.Type.MONTH) + .dayOfMonth(1L) .build() val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowMonth(fixedWindowMonth) - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).isEmpty @@ -221,8 +154,8 @@ internal class VelocityLimitParamsPeriodWindowTest { val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowMonth( VelocityLimitParamsPeriodWindow.FixedWindowMonth.builder() - .dayOfMonth(1L) .type(VelocityLimitParamsPeriodWindow.FixedWindowMonth.Type.MONTH) + .dayOfMonth(1L) .build() ) @@ -240,16 +173,14 @@ internal class VelocityLimitParamsPeriodWindowTest { fun ofFixedWindowYear() { val fixedWindowYear = VelocityLimitParamsPeriodWindow.FixedWindowYear.builder() + .type(VelocityLimitParamsPeriodWindow.FixedWindowYear.Type.YEAR) .dayOfMonth(1L) .month(1L) - .type(VelocityLimitParamsPeriodWindow.FixedWindowYear.Type.YEAR) .build() val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowYear(fixedWindowYear) - assertThat(velocityLimitParamsPeriodWindow.trailing()).isEmpty - assertThat(velocityLimitParamsPeriodWindow.fixed()).isEmpty assertThat(velocityLimitParamsPeriodWindow.trailingWindowObject()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowDay()).isEmpty assertThat(velocityLimitParamsPeriodWindow.fixedWindowWeek()).isEmpty @@ -263,9 +194,9 @@ internal class VelocityLimitParamsPeriodWindowTest { val velocityLimitParamsPeriodWindow = VelocityLimitParamsPeriodWindow.ofFixedWindowYear( VelocityLimitParamsPeriodWindow.FixedWindowYear.builder() + .type(VelocityLimitParamsPeriodWindow.FixedWindowYear.Type.YEAR) .dayOfMonth(1L) .month(1L) - .type(VelocityLimitParamsPeriodWindow.FixedWindowYear.Type.YEAR) .build() ) @@ -279,11 +210,20 @@ internal class VelocityLimitParamsPeriodWindowTest { .isEqualTo(velocityLimitParamsPeriodWindow) } - @Test - fun incompatibleJsonShapeDeserializesToUnknown() { - val value = JsonValue.from(listOf("invalid", "array")) + enum class IncompatibleJsonShapeTestCase(val value: JsonValue) { + BOOLEAN(JsonValue.from(false)), + STRING(JsonValue.from("invalid")), + INTEGER(JsonValue.from(-1)), + FLOAT(JsonValue.from(3.14)), + ARRAY(JsonValue.from(listOf("invalid", "array"))), + } + + @ParameterizedTest + @EnumSource + fun incompatibleJsonShapeDeserializesToUnknown(testCase: IncompatibleJsonShapeTestCase) { val velocityLimitParamsPeriodWindow = - jsonMapper().convertValue(value, jacksonTypeRef()) + jsonMapper() + .convertValue(testCase.value, jacksonTypeRef()) val e = assertThrows { velocityLimitParamsPeriodWindow.validate() } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt index 16239d0e..48b1f8b5 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/VelocityLimitParamsTest.kt @@ -24,7 +24,12 @@ internal class VelocityLimitParamsTest { ) .build() ) - .period(10L) + .period( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM) + .build() + ) .scope(VelocityLimitParams.VelocityScope.CARD) .limitAmount(10000L) .limitCount(0L) @@ -43,7 +48,14 @@ internal class VelocityLimitParamsTest { .build() ) assertThat(velocityLimitParams.period()) - .isEqualTo(VelocityLimitParamsPeriodWindow.ofTrailing(10L)) + .isEqualTo( + VelocityLimitParamsPeriodWindow.ofTrailingWindowObject( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM) + .build() + ) + ) assertThat(velocityLimitParams.scope()).isEqualTo(VelocityLimitParams.VelocityScope.CARD) assertThat(velocityLimitParams.limitAmount()).contains(10000L) assertThat(velocityLimitParams.limitCount()).contains(0L) @@ -65,7 +77,12 @@ internal class VelocityLimitParamsTest { ) .build() ) - .period(10L) + .period( + VelocityLimitParamsPeriodWindow.TrailingWindowObject.builder() + .duration(10L) + .type(VelocityLimitParamsPeriodWindow.TrailingWindowObject.Type.CUSTOM) + .build() + ) .scope(VelocityLimitParams.VelocityScope.CARD) .limitAmount(10000L) .limitCount(0L) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt index 4c342a04..5f129809 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt @@ -323,7 +323,7 @@ internal class AccountHolderServiceAsyncTest { val documentFuture = accountHolderServiceAsync.simulateEnrollmentDocumentReview( AccountHolderSimulateEnrollmentDocumentReviewParams.builder() - .documentUploadToken("document_upload_token") + .documentUploadToken("b11cd67b-0a52-4180-8365-314f3def5426") .status(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) .addAcceptedEntityStatusReason("string") .statusReason( 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 59fd9abe..0635a39c 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 @@ -33,35 +33,35 @@ internal class ExternalBankAccountServiceAsyncTest { .body( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .builder() - .accountNumber("12345678901234567") - .country("USD") + .accountNumber("13719713158835300") + .country("USA") .currency("USD") - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .owner("owner") - .ownerType(OwnerType.INDIVIDUAL) - .routingNumber("123456789") + .financialAccountToken("dabadb3b-700c-41e3-8801-d5dfc84ebea0") + .owner("John Doe") + .ownerType(OwnerType.BUSINESS) + .routingNumber("011103093") .type( ExternalBankAccountCreateParams.Body .BankVerifiedCreateBankAccountApiRequest .AccountType .CHECKING ) - .verificationMethod(VerificationMethod.MANUAL) + .verificationMethod(VerificationMethod.PRENOTE) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .address( ExternalBankAccountAddress.builder() - .address1("x") - .city("x") - .country("USD") - .postalCode("11201") - .state("xx") + .address1("5 Broad Street") + .city("New York") + .country("USA") + .postalCode("10001") + .state("NY") .address2("x") .build() ) .companyId("sq") .dob(LocalDate.parse("2019-12-27")) .doingBusinessAs("x") - .name("name") + .name("John Does Checking") .userDefinedId("x") .verificationEnforcement(true) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncTest.kt index b68b4215..4e78d2bf 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncTest.kt @@ -123,10 +123,10 @@ internal class FinancialAccountServiceAsyncTest { financialAccountServiceAsync.updateStatus( FinancialAccountUpdateStatusParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) .substatus( FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus - .CHARGED_OFF_FRAUD + .END_USER_REQUEST ) .build() ) 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 37d2e62f..5d1931d6 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 @@ -9,6 +9,7 @@ import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateReceiptParams import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReturnParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -110,10 +111,12 @@ internal class PaymentServiceAsyncTest { PaymentSimulateActionParams.SupportedSimulationTypes .ACH_ORIGINATION_REVIEWED ) + .dateOfDeath(LocalDate.parse("2019-12-27")) .declineReason( PaymentSimulateActionParams.SupportedSimulationDeclineReasons .PROGRAM_TRANSACTION_LIMIT_EXCEEDED ) + .returnAddenda("return_addenda") .returnReasonCode("return_reason_code") .build() ) 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 de8e8d6e..78a7eef8 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 @@ -5,7 +5,6 @@ package com.lithic.api.services.async.authRules import com.lithic.api.TestServerExtension import com.lithic.api.client.okhttp.LithicOkHttpClientAsync import com.lithic.api.models.AuthRuleCondition -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DraftParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams @@ -139,32 +138,6 @@ internal class V2ServiceAsyncTest { val response = future.get() } - @Test - fun apply() { - val client = - LithicOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2ServiceAsync = client.authRules().v2() - - val responseFuture = - v2ServiceAsync.apply( - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder() - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - .build() - ) - - val response = responseFuture.get() - response.validate() - } - @Test fun draft() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncTest.kt index c16817ae..e6b562df 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/events/SubscriptionServiceAsyncTest.kt @@ -32,7 +32,9 @@ internal class SubscriptionServiceAsyncTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() ) @@ -71,7 +73,9 @@ internal class SubscriptionServiceAsyncTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() ) @@ -212,7 +216,8 @@ internal class SubscriptionServiceAsyncTest { EventSubscriptionSendSimulatedExampleParams.builder() .eventSubscriptionToken("event_subscription_token") .eventType( - EventSubscriptionSendSimulatedExampleParams.EventType.ACCOUNT_HOLDER_CREATED + EventSubscriptionSendSimulatedExampleParams.EventType + .ACCOUNT_HOLDER_DOCUMENT_UPDATED ) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt index aad92753..ce20fe24 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt @@ -315,7 +315,7 @@ internal class AccountHolderServiceTest { val document = accountHolderService.simulateEnrollmentDocumentReview( AccountHolderSimulateEnrollmentDocumentReviewParams.builder() - .documentUploadToken("document_upload_token") + .documentUploadToken("b11cd67b-0a52-4180-8365-314f3def5426") .status(AccountHolderSimulateEnrollmentDocumentReviewParams.Status.UPLOADED) .addAcceptedEntityStatusReason("string") .statusReason( 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 493dac71..d196c77e 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 @@ -33,35 +33,35 @@ internal class ExternalBankAccountServiceTest { .body( ExternalBankAccountCreateParams.Body.BankVerifiedCreateBankAccountApiRequest .builder() - .accountNumber("12345678901234567") - .country("USD") + .accountNumber("13719713158835300") + .country("USA") .currency("USD") - .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .owner("owner") - .ownerType(OwnerType.INDIVIDUAL) - .routingNumber("123456789") + .financialAccountToken("dabadb3b-700c-41e3-8801-d5dfc84ebea0") + .owner("John Doe") + .ownerType(OwnerType.BUSINESS) + .routingNumber("011103093") .type( ExternalBankAccountCreateParams.Body .BankVerifiedCreateBankAccountApiRequest .AccountType .CHECKING ) - .verificationMethod(VerificationMethod.MANUAL) + .verificationMethod(VerificationMethod.PRENOTE) .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .address( ExternalBankAccountAddress.builder() - .address1("x") - .city("x") - .country("USD") - .postalCode("11201") - .state("xx") + .address1("5 Broad Street") + .city("New York") + .country("USA") + .postalCode("10001") + .state("NY") .address2("x") .build() ) .companyId("sq") .dob(LocalDate.parse("2019-12-27")) .doingBusinessAs("x") - .name("name") + .name("John Does Checking") .userDefinedId("x") .verificationEnforcement(true) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceTest.kt index a6c485f7..a4eae55f 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/FinancialAccountServiceTest.kt @@ -116,10 +116,10 @@ internal class FinancialAccountServiceTest { financialAccountService.updateStatus( FinancialAccountUpdateStatusParams.builder() .financialAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.OPEN) + .status(FinancialAccountUpdateStatusParams.FinancialAccountStatus.CLOSED) .substatus( FinancialAccountUpdateStatusParams.UpdateFinancialAccountSubstatus - .CHARGED_OFF_FRAUD + .END_USER_REQUEST ) .build() ) diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/PaymentServiceTest.kt index 52e1ecca..98223c54 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 @@ -9,6 +9,7 @@ import com.lithic.api.models.PaymentSimulateActionParams import com.lithic.api.models.PaymentSimulateReceiptParams import com.lithic.api.models.PaymentSimulateReleaseParams import com.lithic.api.models.PaymentSimulateReturnParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -106,10 +107,12 @@ internal class PaymentServiceTest { PaymentSimulateActionParams.SupportedSimulationTypes .ACH_ORIGINATION_REVIEWED ) + .dateOfDeath(LocalDate.parse("2019-12-27")) .declineReason( PaymentSimulateActionParams.SupportedSimulationDeclineReasons .PROGRAM_TRANSACTION_LIMIT_EXCEEDED ) + .returnAddenda("return_addenda") .returnReasonCode("return_reason_code") .build() ) 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 3a212100..e39bdd15 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 @@ -5,7 +5,6 @@ package com.lithic.api.services.blocking.authRules import com.lithic.api.TestServerExtension import com.lithic.api.client.okhttp.LithicOkHttpClient import com.lithic.api.models.AuthRuleCondition -import com.lithic.api.models.AuthRuleV2ApplyParams import com.lithic.api.models.AuthRuleV2CreateParams import com.lithic.api.models.AuthRuleV2DraftParams import com.lithic.api.models.AuthRuleV2RetrieveFeaturesParams @@ -133,31 +132,6 @@ internal class V2ServiceTest { v2Service.delete("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") } - @Test - fun apply() { - val client = - LithicOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My Lithic API Key") - .build() - val v2Service = client.authRules().v2() - - val response = - v2Service.apply( - AuthRuleV2ApplyParams.builder() - .authRuleToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .body( - AuthRuleV2ApplyParams.Body.ApplyAuthRuleRequestAccountTokens.builder() - .addAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .addBusinessAccountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - .build() - ) - - response.validate() - } - @Test fun draft() { val client = diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt index 1f1aa244..19eb4a95 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/events/SubscriptionServiceTest.kt @@ -32,7 +32,9 @@ internal class SubscriptionServiceTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionCreateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() ) @@ -69,7 +71,9 @@ internal class SubscriptionServiceTest { .url("https://example.com") .description("description") .disabled(true) - .addEventType(EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_CREATED) + .addEventType( + EventSubscriptionUpdateParams.EventType.ACCOUNT_HOLDER_DOCUMENT_UPDATED + ) .build() ) @@ -195,7 +199,8 @@ internal class SubscriptionServiceTest { EventSubscriptionSendSimulatedExampleParams.builder() .eventSubscriptionToken("event_subscription_token") .eventType( - EventSubscriptionSendSimulatedExampleParams.EventType.ACCOUNT_HOLDER_CREATED + EventSubscriptionSendSimulatedExampleParams.EventType + .ACCOUNT_HOLDER_DOCUMENT_UPDATED ) .build() ) From ea052742fedfd9e39df7f080d3530caf8cc3e515 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 10:07:29 +0000 Subject: [PATCH 4/6] feat(api): new fields in Statements APIs fix(api): fixing spec for Tokenizations and Enhanced data --- .stats.yml | 6 +- .../com/lithic/api/models/EnhancedData.kt | 48 +++---- .../kotlin/com/lithic/api/models/LoanTape.kt | 81 ++++++++++- .../kotlin/com/lithic/api/models/Statement.kt | 81 ++++++++++- .../com/lithic/api/models/Tokenization.kt | 127 +++++++++++------- ...ancedCommercialDataRetrieveResponseTest.kt | 18 +-- .../com/lithic/api/models/EnhancedDataTest.kt | 18 +-- ...cialAccountLoanTapeListPageResponseTest.kt | 28 ++++ .../com/lithic/api/models/LoanTapeTest.kt | 28 ++++ .../com/lithic/api/models/StatementTest.kt | 19 +++ .../com/lithic/api/models/StatementsTest.kt | 19 +++ .../TokenizationListPageResponseTest.kt | 6 +- .../TokenizationSimulateResponseTest.kt | 6 +- .../com/lithic/api/models/TokenizationTest.kt | 6 +- ...izationUpdateDigitalCardArtResponseTest.kt | 6 +- 15 files changed, 385 insertions(+), 112 deletions(-) diff --git a/.stats.yml b/.stats.yml index b4f9cef2..7d487e9f 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-c10c01eac94b422808bb16cc1044c67c980791b6d1360b01628d13c5a745dfeb.yml -openapi_spec_hash: 9e6642fdb875a6aa6037c107917ebff4 -config_hash: 0b45ea129fca7c4755ef61eb97baa096 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-fceec607fd66c8b227edc9f52ca348a906855f9aa1b0727f5eeb9f5975889e91.yml +openapi_spec_hash: 759ede618594b93833ca93a34b97a11f +config_hash: f5a16e702bac54729afed6e50b0de3ff 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 c7650ca6..6d8c9566 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 @@ -650,10 +650,10 @@ private constructor( class LineItem @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val amount: JsonField, + private val amount: JsonField, private val description: JsonField, private val productCode: JsonField, - private val quantity: JsonField, + private val quantity: JsonField, private val additionalProperties: MutableMap, ) { @@ -661,7 +661,7 @@ private constructor( private constructor( @JsonProperty("amount") @ExcludeMissing - amount: JsonField = JsonMissing.of(), + amount: JsonField = JsonMissing.of(), @JsonProperty("description") @ExcludeMissing description: JsonField = JsonMissing.of(), @@ -670,7 +670,7 @@ private constructor( productCode: JsonField = JsonMissing.of(), @JsonProperty("quantity") @ExcludeMissing - quantity: JsonField = JsonMissing.of(), + quantity: JsonField = JsonMissing.of(), ) : this(amount, description, productCode, quantity, mutableMapOf()) /** @@ -679,7 +679,7 @@ private constructor( * @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") + fun amount(): Optional = amount.getOptional("amount") /** * A human-readable description of the item. @@ -703,14 +703,14 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun quantity(): Optional = quantity.getOptional("quantity") + fun quantity(): Optional = quantity.getOptional("quantity") /** * 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 + @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount /** * Returns the raw JSON value of [description]. @@ -738,7 +738,7 @@ private constructor( * Unlike [quantity], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity + @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -761,10 +761,10 @@ private constructor( /** A builder for [LineItem]. */ class Builder internal constructor() { - private var amount: JsonField = JsonMissing.of() + private var amount: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var productCode: JsonField = JsonMissing.of() - private var quantity: JsonField = JsonMissing.of() + private var quantity: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -777,16 +777,16 @@ private constructor( } /** The price of the item purchased in merchant currency. */ - fun amount(amount: Double) = amount(JsonField.of(amount)) + fun amount(amount: String) = amount(JsonField.of(amount)) /** * Sets [Builder.amount] to an arbitrary JSON value. * - * You should usually call [Builder.amount] with a well-typed [Double] value + * You should usually call [Builder.amount] with a well-typed [String] 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 } + fun amount(amount: JsonField) = apply { this.amount = amount } /** A human-readable description of the item. */ fun description(description: String) = description(JsonField.of(description)) @@ -817,16 +817,16 @@ private constructor( } /** The quantity of the item purchased. */ - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + fun quantity(quantity: String) = quantity(JsonField.of(quantity)) /** * Sets [Builder.quantity] to an arbitrary JSON value. * - * You should usually call [Builder.quantity] with a well-typed [Double] value + * You should usually call [Builder.quantity] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1907,7 +1907,7 @@ private constructor( class FuelData @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val quantity: JsonField, + private val quantity: JsonField, private val type: JsonField, private val unitOfMeasure: JsonField, private val unitPrice: JsonField, @@ -1918,7 +1918,7 @@ private constructor( private constructor( @JsonProperty("quantity") @ExcludeMissing - quantity: JsonField = JsonMissing.of(), + quantity: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), @JsonProperty("unit_of_measure") @ExcludeMissing @@ -1934,7 +1934,7 @@ private constructor( * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun quantity(): Optional = quantity.getOptional("quantity") + fun quantity(): Optional = quantity.getOptional("quantity") /** * The type of fuel purchased. @@ -1967,7 +1967,7 @@ private constructor( * Unlike [quantity], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity + @JsonProperty("quantity") @ExcludeMissing fun _quantity(): JsonField = quantity /** * Returns the raw JSON value of [type]. @@ -2017,7 +2017,7 @@ private constructor( /** A builder for [FuelData]. */ class Builder internal constructor() { - private var quantity: JsonField = JsonMissing.of() + private var quantity: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var unitOfMeasure: JsonField = JsonMissing.of() private var unitPrice: JsonField = JsonMissing.of() @@ -2033,16 +2033,16 @@ private constructor( } /** The quantity of fuel purchased. */ - fun quantity(quantity: Double) = quantity(JsonField.of(quantity)) + fun quantity(quantity: String) = quantity(JsonField.of(quantity)) /** * Sets [Builder.quantity] to an arbitrary JSON value. * - * You should usually call [Builder.quantity] with a well-typed [Double] value + * You should usually call [Builder.quantity] with a well-typed [String] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun quantity(quantity: JsonField) = apply { this.quantity = quantity } + fun quantity(quantity: JsonField) = apply { this.quantity = quantity } /** The type of fuel purchased. */ fun type(type: FuelType) = type(JsonField.of(type)) 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 dc58e81f..eb5b01f5 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 @@ -2747,10 +2747,13 @@ 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 additionalProperties: MutableMap, ) { @@ -2763,18 +2766,30 @@ private constructor( @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("purchases") + @ExcludeMissing + purchases: JsonField = JsonMissing.of(), + @JsonProperty("credit_details") + @ExcludeMissing + creditDetails: JsonValue = JsonMissing.of(), + @JsonProperty("debit_details") + @ExcludeMissing + debitDetails: JsonValue = JsonMissing.of(), ) : this( balanceTransfers, cashAdvances, credits, + debits, fees, interest, payments, purchases, + creditDetails, + debitDetails, mutableMapOf(), ) @@ -2802,6 +2817,14 @@ private constructor( */ 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 * @@ -2834,6 +2857,14 @@ private constructor( */ 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 + /** * Returns the raw JSON value of [balanceTransfers]. * @@ -2861,6 +2892,13 @@ private constructor( */ @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]. * @@ -2911,6 +2949,7 @@ private constructor( * .balanceTransfers() * .cashAdvances() * .credits() + * .debits() * .fees() * .interest() * .payments() @@ -2926,10 +2965,13 @@ private 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 additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2937,10 +2979,13 @@ private constructor( 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 additionalProperties = statementTotals.additionalProperties.toMutableMap() } @@ -2988,6 +3033,18 @@ private constructor( */ 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)) @@ -3036,6 +3093,14 @@ private constructor( */ 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 } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -3065,6 +3130,7 @@ private constructor( * .balanceTransfers() * .cashAdvances() * .credits() + * .debits() * .fees() * .interest() * .payments() @@ -3078,10 +3144,13 @@ private constructor( 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, additionalProperties.toMutableMap(), ) } @@ -3096,6 +3165,7 @@ private constructor( balanceTransfers() cashAdvances() credits() + debits() fees() interest() payments() @@ -3122,6 +3192,7 @@ private constructor( (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) + @@ -3136,10 +3207,13 @@ private constructor( 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 && additionalProperties == other.additionalProperties } @@ -3148,10 +3222,13 @@ private constructor( balanceTransfers, cashAdvances, credits, + debits, fees, interest, payments, purchases, + creditDetails, + debitDetails, additionalProperties, ) } @@ -3159,7 +3236,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, additionalProperties=$additionalProperties}" + "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, debits=$debits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, creditDetails=$creditDetails, debitDetails=$debitDetails, additionalProperties=$additionalProperties}" } class InterestDetails 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 bc1d6d72..47479cb8 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 @@ -2392,10 +2392,13 @@ 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 additionalProperties: MutableMap, ) { @@ -2408,18 +2411,30 @@ private constructor( @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("purchases") + @ExcludeMissing + purchases: JsonField = JsonMissing.of(), + @JsonProperty("credit_details") + @ExcludeMissing + creditDetails: JsonValue = JsonMissing.of(), + @JsonProperty("debit_details") + @ExcludeMissing + debitDetails: JsonValue = JsonMissing.of(), ) : this( balanceTransfers, cashAdvances, credits, + debits, fees, interest, payments, purchases, + creditDetails, + debitDetails, mutableMapOf(), ) @@ -2447,6 +2462,14 @@ private constructor( */ 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 * @@ -2479,6 +2502,14 @@ private constructor( */ 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 + /** * Returns the raw JSON value of [balanceTransfers]. * @@ -2506,6 +2537,13 @@ private constructor( */ @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]. * @@ -2556,6 +2594,7 @@ private constructor( * .balanceTransfers() * .cashAdvances() * .credits() + * .debits() * .fees() * .interest() * .payments() @@ -2571,10 +2610,13 @@ private 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 additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -2582,10 +2624,13 @@ private constructor( 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 additionalProperties = statementTotals.additionalProperties.toMutableMap() } @@ -2633,6 +2678,18 @@ private constructor( */ 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)) @@ -2681,6 +2738,14 @@ private constructor( */ 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 } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -2710,6 +2775,7 @@ private constructor( * .balanceTransfers() * .cashAdvances() * .credits() + * .debits() * .fees() * .interest() * .payments() @@ -2723,10 +2789,13 @@ private constructor( 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, additionalProperties.toMutableMap(), ) } @@ -2741,6 +2810,7 @@ private constructor( balanceTransfers() cashAdvances() credits() + debits() fees() interest() payments() @@ -2767,6 +2837,7 @@ private constructor( (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) + @@ -2781,10 +2852,13 @@ private constructor( 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 && additionalProperties == other.additionalProperties } @@ -2793,10 +2867,13 @@ private constructor( balanceTransfers, cashAdvances, credits, + debits, fees, interest, payments, purchases, + creditDetails, + debitDetails, additionalProperties, ) } @@ -2804,7 +2881,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, additionalProperties=$additionalProperties}" + "StatementTotals{balanceTransfers=$balanceTransfers, cashAdvances=$cashAdvances, credits=$credits, debits=$debits, fees=$fees, interest=$interest, payments=$payments, purchases=$purchases, creditDetails=$creditDetails, debitDetails=$debitDetails, additionalProperties=$additionalProperties}" } class StatementType @JsonCreator private constructor(private val value: JsonField) : diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt index 0e8a840c..c0588ad5 100644 --- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt +++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Tokenization.kt @@ -28,13 +28,13 @@ private constructor( private val accountToken: JsonField, private val cardToken: JsonField, private val createdAt: JsonField, - private val deviceId: JsonField, private val dpan: JsonField, private val status: JsonField, private val tokenRequestorName: JsonField, private val tokenUniqueReference: JsonField, private val tokenizationChannel: JsonField, private val updatedAt: JsonField, + private val deviceId: JsonField, private val digitalCardArtToken: JsonField, private val events: JsonField>, private val paymentAccountReferenceId: JsonField, @@ -51,7 +51,6 @@ private constructor( @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), - @JsonProperty("device_id") @ExcludeMissing deviceId: JsonField = JsonMissing.of(), @JsonProperty("dpan") @ExcludeMissing dpan: JsonField = JsonMissing.of(), @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), @JsonProperty("token_requestor_name") @@ -66,6 +65,7 @@ private constructor( @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), + @JsonProperty("device_id") @ExcludeMissing deviceId: JsonField = JsonMissing.of(), @JsonProperty("digital_card_art_token") @ExcludeMissing digitalCardArtToken: JsonField = JsonMissing.of(), @@ -80,13 +80,13 @@ private constructor( accountToken, cardToken, createdAt, - deviceId, dpan, status, tokenRequestorName, tokenUniqueReference, tokenizationChannel, updatedAt, + deviceId, digitalCardArtToken, events, paymentAccountReferenceId, @@ -125,14 +125,6 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - /** - * The device identifier associated with the tokenization. - * - * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun deviceId(): Optional = deviceId.getOptional("device_id") - /** * The dynamic pan assigned to the token by the network. * @@ -150,7 +142,9 @@ private constructor( fun status(): Status = status.getRequired("status") /** - * The entity that requested the tokenization. Represents a Digital Wallet or merchant. + * The entity that requested the tokenization. For digital wallets, this will be one of the + * defined wallet types. For merchant tokenizations, this will be a free-form merchant name + * string. * * @throws LithicInvalidDataException if the JSON field has an unexpected type or is * unexpectedly missing or null (e.g. if the server responded with an unexpected value). @@ -184,7 +178,15 @@ private constructor( fun updatedAt(): OffsetDateTime = updatedAt.getRequired("updated_at") /** - * Specifies the digital card art displayed in the user’s digital wallet after tokenization. + * The device identifier associated with the tokenization. + * + * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun deviceId(): Optional = deviceId.getOptional("device_id") + + /** + * Specifies the digital card art displayed in the user's digital wallet after tokenization. * This will be null if the tokenization was created without an associated digital card art. See * [Flexible Card Art Guide](https://docs.lithic.com/docs/about-digital-wallets#flexible-card-art). * @@ -243,13 +245,6 @@ private constructor( @ExcludeMissing fun _createdAt(): JsonField = createdAt - /** - * Returns the raw JSON value of [deviceId]. - * - * Unlike [deviceId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("device_id") @ExcludeMissing fun _deviceId(): JsonField = deviceId - /** * Returns the raw JSON value of [dpan]. * @@ -303,6 +298,13 @@ private constructor( @ExcludeMissing fun _updatedAt(): JsonField = updatedAt + /** + * Returns the raw JSON value of [deviceId]. + * + * Unlike [deviceId], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("device_id") @ExcludeMissing fun _deviceId(): JsonField = deviceId + /** * Returns the raw JSON value of [digitalCardArtToken]. * @@ -355,7 +357,6 @@ private constructor( * .accountToken() * .cardToken() * .createdAt() - * .deviceId() * .dpan() * .status() * .tokenRequestorName() @@ -374,13 +375,13 @@ private constructor( private var accountToken: JsonField? = null private var cardToken: JsonField? = null private var createdAt: JsonField? = null - private var deviceId: JsonField? = null private var dpan: JsonField? = null private var status: JsonField? = null private var tokenRequestorName: JsonField? = null private var tokenUniqueReference: JsonField? = null private var tokenizationChannel: JsonField? = null private var updatedAt: JsonField? = null + private var deviceId: JsonField = JsonMissing.of() private var digitalCardArtToken: JsonField = JsonMissing.of() private var events: JsonField>? = null private var paymentAccountReferenceId: JsonField = JsonMissing.of() @@ -392,13 +393,13 @@ private constructor( accountToken = tokenization.accountToken cardToken = tokenization.cardToken createdAt = tokenization.createdAt - deviceId = tokenization.deviceId dpan = tokenization.dpan status = tokenization.status tokenRequestorName = tokenization.tokenRequestorName tokenUniqueReference = tokenization.tokenUniqueReference tokenizationChannel = tokenization.tokenizationChannel updatedAt = tokenization.updatedAt + deviceId = tokenization.deviceId digitalCardArtToken = tokenization.digitalCardArtToken events = tokenization.events.map { it.toMutableList() } paymentAccountReferenceId = tokenization.paymentAccountReferenceId @@ -454,20 +455,6 @@ private constructor( */ fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - /** The device identifier associated with the tokenization. */ - fun deviceId(deviceId: String?) = deviceId(JsonField.ofNullable(deviceId)) - - /** Alias for calling [Builder.deviceId] with `deviceId.orElse(null)`. */ - fun deviceId(deviceId: Optional) = deviceId(deviceId.getOrNull()) - - /** - * Sets [Builder.deviceId] to an arbitrary JSON value. - * - * You should usually call [Builder.deviceId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun deviceId(deviceId: JsonField) = apply { this.deviceId = deviceId } - /** The dynamic pan assigned to the token by the network. */ fun dpan(dpan: String?) = dpan(JsonField.ofNullable(dpan)) @@ -493,7 +480,11 @@ private constructor( */ fun status(status: JsonField) = apply { this.status = status } - /** The entity that requested the tokenization. Represents a Digital Wallet or merchant. */ + /** + * The entity that requested the tokenization. For digital wallets, this will be one of the + * defined wallet types. For merchant tokenizations, this will be a free-form merchant name + * string. + */ fun tokenRequestorName(tokenRequestorName: TokenRequestorName) = tokenRequestorName(JsonField.of(tokenRequestorName)) @@ -508,6 +499,15 @@ private constructor( this.tokenRequestorName = tokenRequestorName } + /** + * Sets [tokenRequestorName] to an arbitrary [String]. + * + * You should usually call [tokenRequestorName] with a well-typed [TokenRequestorName] + * constant instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun tokenRequestorName(value: String) = tokenRequestorName(TokenRequestorName.of(value)) + /** The network's unique reference for the tokenization. */ fun tokenUniqueReference(tokenUniqueReference: String) = tokenUniqueReference(JsonField.of(tokenUniqueReference)) @@ -550,14 +550,34 @@ private constructor( */ fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } + /** The device identifier associated with the tokenization. */ + fun deviceId(deviceId: String?) = deviceId(JsonField.ofNullable(deviceId)) + + /** Alias for calling [Builder.deviceId] with `deviceId.orElse(null)`. */ + fun deviceId(deviceId: Optional) = deviceId(deviceId.getOrNull()) + /** - * Specifies the digital card art displayed in the user’s digital wallet after tokenization. + * Sets [Builder.deviceId] to an arbitrary JSON value. + * + * You should usually call [Builder.deviceId] with a well-typed [String] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun deviceId(deviceId: JsonField) = apply { this.deviceId = deviceId } + + /** + * Specifies the digital card art displayed in the user's digital wallet after tokenization. * This will be null if the tokenization was created without an associated digital card art. * See * [Flexible Card Art Guide](https://docs.lithic.com/docs/about-digital-wallets#flexible-card-art). */ - fun digitalCardArtToken(digitalCardArtToken: String) = - digitalCardArtToken(JsonField.of(digitalCardArtToken)) + fun digitalCardArtToken(digitalCardArtToken: String?) = + digitalCardArtToken(JsonField.ofNullable(digitalCardArtToken)) + + /** + * Alias for calling [Builder.digitalCardArtToken] with `digitalCardArtToken.orElse(null)`. + */ + fun digitalCardArtToken(digitalCardArtToken: Optional) = + digitalCardArtToken(digitalCardArtToken.getOrNull()) /** * Sets [Builder.digitalCardArtToken] to an arbitrary JSON value. @@ -648,7 +668,6 @@ private constructor( * .accountToken() * .cardToken() * .createdAt() - * .deviceId() * .dpan() * .status() * .tokenRequestorName() @@ -665,13 +684,13 @@ private constructor( checkRequired("accountToken", accountToken), checkRequired("cardToken", cardToken), checkRequired("createdAt", createdAt), - checkRequired("deviceId", deviceId), checkRequired("dpan", dpan), checkRequired("status", status), checkRequired("tokenRequestorName", tokenRequestorName), checkRequired("tokenUniqueReference", tokenUniqueReference), checkRequired("tokenizationChannel", tokenizationChannel), checkRequired("updatedAt", updatedAt), + deviceId, digitalCardArtToken, (events ?: JsonMissing.of()).map { it.toImmutable() }, paymentAccountReferenceId, @@ -690,13 +709,13 @@ private constructor( accountToken() cardToken() createdAt() - deviceId() dpan() status().validate() - tokenRequestorName().validate() + tokenRequestorName() tokenUniqueReference() tokenizationChannel().validate() updatedAt() + deviceId() digitalCardArtToken() events().ifPresent { it.forEach { it.validate() } } paymentAccountReferenceId() @@ -722,13 +741,13 @@ private constructor( (if (accountToken.asKnown().isPresent) 1 else 0) + (if (cardToken.asKnown().isPresent) 1 else 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (deviceId.asKnown().isPresent) 1 else 0) + (if (dpan.asKnown().isPresent) 1 else 0) + (status.asKnown().getOrNull()?.validity() ?: 0) + - (tokenRequestorName.asKnown().getOrNull()?.validity() ?: 0) + + (if (tokenRequestorName.asKnown().isPresent) 1 else 0) + (if (tokenUniqueReference.asKnown().isPresent) 1 else 0) + (tokenizationChannel.asKnown().getOrNull()?.validity() ?: 0) + (if (updatedAt.asKnown().isPresent) 1 else 0) + + (if (deviceId.asKnown().isPresent) 1 else 0) + (if (digitalCardArtToken.asKnown().isPresent) 1 else 0) + (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (paymentAccountReferenceId.asKnown().isPresent) 1 else 0) @@ -889,7 +908,7 @@ private constructor( override fun toString() = value.toString() } - /** The entity that requested the tokenization. Represents a Digital Wallet or merchant. */ + /** Digital wallet type */ class TokenRequestorName @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -918,6 +937,8 @@ private constructor( @JvmField val GARMIN_PAY = of("GARMIN_PAY") + @JvmField val GOOGLE_PAY = of("GOOGLE_PAY") + @JvmField val MICROSOFT_PAY = of("MICROSOFT_PAY") @JvmField val NETFLIX = of("NETFLIX") @@ -939,6 +960,7 @@ private constructor( FACEBOOK, FITBIT_PAY, GARMIN_PAY, + GOOGLE_PAY, MICROSOFT_PAY, NETFLIX, SAMSUNG_PAY, @@ -962,6 +984,7 @@ private constructor( FACEBOOK, FITBIT_PAY, GARMIN_PAY, + GOOGLE_PAY, MICROSOFT_PAY, NETFLIX, SAMSUNG_PAY, @@ -989,6 +1012,7 @@ private constructor( FACEBOOK -> Value.FACEBOOK FITBIT_PAY -> Value.FITBIT_PAY GARMIN_PAY -> Value.GARMIN_PAY + GOOGLE_PAY -> Value.GOOGLE_PAY MICROSOFT_PAY -> Value.MICROSOFT_PAY NETFLIX -> Value.NETFLIX SAMSUNG_PAY -> Value.SAMSUNG_PAY @@ -1014,6 +1038,7 @@ private constructor( FACEBOOK -> Known.FACEBOOK FITBIT_PAY -> Known.FITBIT_PAY GARMIN_PAY -> Known.GARMIN_PAY + GOOGLE_PAY -> Known.GOOGLE_PAY MICROSOFT_PAY -> Known.MICROSOFT_PAY NETFLIX -> Known.NETFLIX SAMSUNG_PAY -> Known.SAMSUNG_PAY @@ -1823,13 +1848,13 @@ private constructor( accountToken == other.accountToken && cardToken == other.cardToken && createdAt == other.createdAt && - deviceId == other.deviceId && dpan == other.dpan && status == other.status && tokenRequestorName == other.tokenRequestorName && tokenUniqueReference == other.tokenUniqueReference && tokenizationChannel == other.tokenizationChannel && updatedAt == other.updatedAt && + deviceId == other.deviceId && digitalCardArtToken == other.digitalCardArtToken && events == other.events && paymentAccountReferenceId == other.paymentAccountReferenceId && @@ -1842,13 +1867,13 @@ private constructor( accountToken, cardToken, createdAt, - deviceId, dpan, status, tokenRequestorName, tokenUniqueReference, tokenizationChannel, updatedAt, + deviceId, digitalCardArtToken, events, paymentAccountReferenceId, @@ -1859,5 +1884,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Tokenization{token=$token, accountToken=$accountToken, cardToken=$cardToken, createdAt=$createdAt, deviceId=$deviceId, dpan=$dpan, status=$status, tokenRequestorName=$tokenRequestorName, tokenUniqueReference=$tokenUniqueReference, tokenizationChannel=$tokenizationChannel, updatedAt=$updatedAt, digitalCardArtToken=$digitalCardArtToken, events=$events, paymentAccountReferenceId=$paymentAccountReferenceId, additionalProperties=$additionalProperties}" + "Tokenization{token=$token, accountToken=$accountToken, cardToken=$cardToken, createdAt=$createdAt, dpan=$dpan, status=$status, tokenRequestorName=$tokenRequestorName, tokenUniqueReference=$tokenUniqueReference, tokenizationChannel=$tokenizationChannel, updatedAt=$updatedAt, deviceId=$deviceId, digitalCardArtToken=$digitalCardArtToken, events=$events, paymentAccountReferenceId=$paymentAccountReferenceId, additionalProperties=$additionalProperties}" } diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedCommercialDataRetrieveResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedCommercialDataRetrieveResponseTest.kt index 9e909aa9..c1957d44 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedCommercialDataRetrieveResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedCommercialDataRetrieveResponseTest.kt @@ -21,10 +21,10 @@ internal class EnhancedCommercialDataRetrieveResponseTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -54,7 +54,7 @@ internal class EnhancedCommercialDataRetrieveResponseTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure( EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS @@ -81,10 +81,10 @@ internal class EnhancedCommercialDataRetrieveResponseTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -114,7 +114,7 @@ internal class EnhancedCommercialDataRetrieveResponseTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure( EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS @@ -145,10 +145,10 @@ internal class EnhancedCommercialDataRetrieveResponseTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -178,7 +178,7 @@ internal class EnhancedCommercialDataRetrieveResponseTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure( EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedDataTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedDataTest.kt index 036b1850..9ed49163 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedDataTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/EnhancedDataTest.kt @@ -19,10 +19,10 @@ internal class EnhancedDataTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -51,7 +51,7 @@ internal class EnhancedDataTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure( EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS @@ -74,10 +74,10 @@ internal class EnhancedDataTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -105,7 +105,7 @@ internal class EnhancedDataTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure(EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS) .unitPrice(0L) @@ -131,10 +131,10 @@ internal class EnhancedDataTest { EnhancedData.CommonData.builder() .addLineItem( EnhancedData.CommonData.LineItem.builder() - .amount(0.0) + .amount("amount") .description("description") .productCode("product_code") - .quantity(0.0) + .quantity("quantity") .build() ) .tax( @@ -163,7 +163,7 @@ internal class EnhancedDataTest { ) .fuel( EnhancedData.Fleet.FuelData.builder() - .quantity(0.0) + .quantity("quantity") .type(EnhancedData.Fleet.FuelData.FuelType.UNKNOWN) .unitOfMeasure( EnhancedData.Fleet.FuelData.FuelUnitOfMeasure.GALLONS 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 a695266a..42b8ee05 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 @@ -3,6 +3,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue import com.lithic.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime @@ -85,10 +86,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -140,10 +144,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -157,10 +164,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -240,10 +250,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -295,10 +308,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -312,10 +328,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -399,10 +418,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -454,10 +476,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -471,10 +496,13 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") 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 e83cb80d..7a38026f 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 @@ -3,6 +3,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue import com.lithic.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime @@ -83,10 +84,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -134,10 +138,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -151,10 +158,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -231,10 +241,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.endingBalance()).isEqualTo(0L) @@ -285,10 +298,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.previousStatementBalance()) @@ -302,10 +318,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.tier()).contains("tier") @@ -384,10 +403,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -435,10 +457,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -452,10 +477,13 @@ internal class LoanTapeTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") 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 6a0ba3c4..fbc5b047 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 @@ -3,6 +3,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue import com.lithic.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime @@ -55,10 +56,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -71,10 +75,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -156,10 +163,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) assertThat(statement.startingBalance()).isEqualTo(0L) @@ -173,10 +183,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) assertThat(statement.interestDetails()) @@ -260,10 +273,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -276,10 +292,13 @@ internal class StatementTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( 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 af9d6713..896ce43f 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 @@ -3,6 +3,7 @@ package com.lithic.api.models import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.lithic.api.core.JsonValue import com.lithic.api.core.jsonMapper import java.time.LocalDate import java.time.OffsetDateTime @@ -57,10 +58,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -73,10 +77,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -160,10 +167,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -176,10 +186,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -267,10 +280,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -283,10 +299,13 @@ internal class StatementsTest { .balanceTransfers(0L) .cashAdvances(0L) .credits(0L) + .debits(0L) .fees(0L) .interest(0L) .payments(0L) .purchases(0L) + .creditDetails(JsonValue.from(mapOf())) + .debitDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt index dedc4958..cca753b0 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationListPageResponseTest.kt @@ -21,13 +21,13 @@ internal class TokenizationListPageResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -52,13 +52,13 @@ internal class TokenizationListPageResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -87,13 +87,13 @@ internal class TokenizationListPageResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt index ea8b7471..eb7ab473 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationSimulateResponseTest.kt @@ -21,13 +21,13 @@ internal class TokenizationSimulateResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -51,13 +51,13 @@ internal class TokenizationSimulateResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -85,13 +85,13 @@ internal class TokenizationSimulateResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt index 05633567..f945de12 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationTest.kt @@ -19,13 +19,13 @@ internal class TokenizationTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -43,7 +43,6 @@ internal class TokenizationTest { assertThat(tokenization.cardToken()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(tokenization.createdAt()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(tokenization.deviceId()).contains("device_id") assertThat(tokenization.dpan()).contains("dpan") assertThat(tokenization.status()).isEqualTo(Tokenization.Status.ACTIVE) assertThat(tokenization.tokenRequestorName()) @@ -53,6 +52,7 @@ internal class TokenizationTest { .isEqualTo(Tokenization.TokenizationChannel.DIGITAL_WALLET) assertThat(tokenization.updatedAt()) .isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(tokenization.deviceId()).contains("device_id") assertThat(tokenization.digitalCardArtToken()) .contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") assertThat(tokenization.events().getOrNull()) @@ -77,13 +77,13 @@ internal class TokenizationTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt index f908378f..b9a6b527 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/TokenizationUpdateDigitalCardArtResponseTest.kt @@ -20,13 +20,13 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -50,13 +50,13 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() @@ -84,13 +84,13 @@ internal class TokenizationUpdateDigitalCardArtResponseTest { .accountToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .cardToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deviceId("device_id") .dpan("dpan") .status(Tokenization.Status.ACTIVE) .tokenRequestorName(Tokenization.TokenRequestorName.AMAZON_ONE) .tokenUniqueReference("token_unique_reference") .tokenizationChannel(Tokenization.TokenizationChannel.DIGITAL_WALLET) .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deviceId("device_id") .digitalCardArtToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .addEvent( Tokenization.TokenizationEvent.builder() From 6040598e95a76273ab4f3ed790a7fbe28605ad4c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 18:00:07 +0000 Subject: [PATCH 5/6] feat(api): add payment_details fix(api): fix oneOf -> anyOf in account holder update --- .stats.yml | 4 +- .../kotlin/com/lithic/api/models/LoanTape.kt | 22 +- .../kotlin/com/lithic/api/models/Statement.kt | 22 +- .../models/AccountHolderUpdateParamsTest.kt | 258 ------------------ ...cialAccountLoanTapeListPageResponseTest.kt | 9 + .../com/lithic/api/models/LoanTapeTest.kt | 9 + .../com/lithic/api/models/StatementTest.kt | 6 + .../com/lithic/api/models/StatementsTest.kt | 6 + .../async/AccountHolderServiceAsyncTest.kt | 91 ------ .../blocking/AccountHolderServiceTest.kt | 91 ------ 10 files changed, 74 insertions(+), 444 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7d487e9f..61c0e26a 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-fceec607fd66c8b227edc9f52ca348a906855f9aa1b0727f5eeb9f5975889e91.yml -openapi_spec_hash: 759ede618594b93833ca93a34b97a11f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-2cfd81dfd3ad2c5a4e98161e54dbac5ddee125c058f9163f29aad4632cadf08d.yml +openapi_spec_hash: 400a2563ad969fba47b3eb0f02372b1e config_hash: f5a16e702bac54729afed6e50b0de3ff 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 eb5b01f5..8e2a9271 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 @@ -2754,6 +2754,7 @@ private constructor( private val purchases: JsonField, private val creditDetails: JsonValue, private val debitDetails: JsonValue, + private val paymentDetails: JsonValue, private val additionalProperties: MutableMap, ) { @@ -2779,6 +2780,9 @@ private constructor( @JsonProperty("debit_details") @ExcludeMissing debitDetails: JsonValue = JsonMissing.of(), + @JsonProperty("payment_details") + @ExcludeMissing + paymentDetails: JsonValue = JsonMissing.of(), ) : this( balanceTransfers, cashAdvances, @@ -2790,6 +2794,7 @@ private constructor( purchases, creditDetails, debitDetails, + paymentDetails, mutableMapOf(), ) @@ -2865,6 +2870,11 @@ private constructor( /** 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]. * @@ -2972,6 +2982,7 @@ private constructor( 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 @@ -2986,6 +2997,7 @@ private constructor( purchases = statementTotals.purchases creditDetails = statementTotals.creditDetails debitDetails = statementTotals.debitDetails + paymentDetails = statementTotals.paymentDetails additionalProperties = statementTotals.additionalProperties.toMutableMap() } @@ -3101,6 +3113,11 @@ private constructor( /** 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) @@ -3151,6 +3168,7 @@ private constructor( checkRequired("purchases", purchases), creditDetails, debitDetails, + paymentDetails, additionalProperties.toMutableMap(), ) } @@ -3214,6 +3232,7 @@ private constructor( purchases == other.purchases && creditDetails == other.creditDetails && debitDetails == other.debitDetails && + paymentDetails == other.paymentDetails && additionalProperties == other.additionalProperties } @@ -3229,6 +3248,7 @@ private constructor( purchases, creditDetails, debitDetails, + paymentDetails, additionalProperties, ) } @@ -3236,7 +3256,7 @@ private constructor( 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, additionalProperties=$additionalProperties}" + "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 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 47479cb8..a3a7136d 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 @@ -2399,6 +2399,7 @@ private constructor( private val purchases: JsonField, private val creditDetails: JsonValue, private val debitDetails: JsonValue, + private val paymentDetails: JsonValue, private val additionalProperties: MutableMap, ) { @@ -2424,6 +2425,9 @@ private constructor( @JsonProperty("debit_details") @ExcludeMissing debitDetails: JsonValue = JsonMissing.of(), + @JsonProperty("payment_details") + @ExcludeMissing + paymentDetails: JsonValue = JsonMissing.of(), ) : this( balanceTransfers, cashAdvances, @@ -2435,6 +2439,7 @@ private constructor( purchases, creditDetails, debitDetails, + paymentDetails, mutableMapOf(), ) @@ -2510,6 +2515,11 @@ private constructor( /** 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]. * @@ -2617,6 +2627,7 @@ private constructor( 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 @@ -2631,6 +2642,7 @@ private constructor( purchases = statementTotals.purchases creditDetails = statementTotals.creditDetails debitDetails = statementTotals.debitDetails + paymentDetails = statementTotals.paymentDetails additionalProperties = statementTotals.additionalProperties.toMutableMap() } @@ -2746,6 +2758,11 @@ private constructor( /** 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) @@ -2796,6 +2813,7 @@ private constructor( checkRequired("purchases", purchases), creditDetails, debitDetails, + paymentDetails, additionalProperties.toMutableMap(), ) } @@ -2859,6 +2877,7 @@ private constructor( purchases == other.purchases && creditDetails == other.creditDetails && debitDetails == other.debitDetails && + paymentDetails == other.paymentDetails && additionalProperties == other.additionalProperties } @@ -2874,6 +2893,7 @@ private constructor( purchases, creditDetails, debitDetails, + paymentDetails, additionalProperties, ) } @@ -2881,7 +2901,7 @@ private constructor( 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, additionalProperties=$additionalProperties}" + "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) : diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt index 8512ba7e..2401cae8 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/models/AccountHolderUpdateParamsTest.kt @@ -13,93 +13,7 @@ internal class AccountHolderUpdateParamsTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .addBeneficialOwnerIndividual( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) - .businessEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .controlPerson( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) .externalId("external_id") - .natureOfBusiness( - "Software company selling solutions to the restaurant industry" - ) - .websiteUrl("www.mybusiness.com") .build() ) .build() @@ -125,93 +39,7 @@ internal class AccountHolderUpdateParamsTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .addBeneficialOwnerIndividual( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) - .businessEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .controlPerson( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) .externalId("external_id") - .natureOfBusiness( - "Software company selling solutions to the restaurant industry" - ) - .websiteUrl("www.mybusiness.com") .build() ) .build() @@ -222,93 +50,7 @@ internal class AccountHolderUpdateParamsTest { .isEqualTo( AccountHolderUpdateParams.Body.ofKybPatchRequest( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .addBeneficialOwnerIndividual( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) - .businessEntity( - AccountHolderUpdateParams.Body.KybPatchRequest.KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .controlPerson( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch.builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) .externalId("external_id") - .natureOfBusiness( - "Software company selling solutions to the restaurant industry" - ) - .websiteUrl("www.mybusiness.com") .build() ) ) 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 42b8ee05..0979ae26 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 @@ -93,6 +93,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -151,6 +152,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -171,6 +173,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -257,6 +260,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -315,6 +319,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -335,6 +340,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -425,6 +431,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -483,6 +490,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -503,6 +511,7 @@ internal class FinancialAccountLoanTapeListPageResponseTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") 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 7a38026f..668819e6 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 @@ -91,6 +91,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -145,6 +146,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -165,6 +167,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") @@ -248,6 +251,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.endingBalance()).isEqualTo(0L) @@ -305,6 +309,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.previousStatementBalance()) @@ -325,6 +330,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) assertThat(loanTape.tier()).contains("tier") @@ -410,6 +416,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .endingBalance(0L) @@ -464,6 +471,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .previousStatementBalance( @@ -484,6 +492,7 @@ internal class LoanTapeTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .tier("tier") 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 fbc5b047..812bcab7 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 @@ -63,6 +63,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -82,6 +83,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -170,6 +172,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) assertThat(statement.startingBalance()).isEqualTo(0L) @@ -190,6 +193,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) assertThat(statement.interestDetails()) @@ -280,6 +284,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -299,6 +304,7 @@ internal class StatementTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( 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 896ce43f..26b2338a 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 @@ -65,6 +65,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -84,6 +85,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -174,6 +176,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -193,6 +196,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( @@ -287,6 +291,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .startingBalance(0L) @@ -306,6 +311,7 @@ internal class StatementsTest { .purchases(0L) .creditDetails(JsonValue.from(mapOf())) .debitDetails(JsonValue.from(mapOf())) + .paymentDetails(JsonValue.from(mapOf())) .build() ) .interestDetails( diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt index 5f129809..08f865ea 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncTest.kt @@ -11,7 +11,6 @@ import com.lithic.api.models.AccountHolderSimulateEnrollmentReviewParams import com.lithic.api.models.AccountHolderUpdateParams import com.lithic.api.models.AccountHolderUploadDocumentParams import com.lithic.api.models.Address -import com.lithic.api.models.AddressUpdate import com.lithic.api.models.Kyb import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -159,97 +158,7 @@ internal class AccountHolderServiceAsyncTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .addBeneficialOwnerIndividual( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) - .businessEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .controlPerson( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) .externalId("external_id") - .natureOfBusiness( - "Software company selling solutions to the restaurant industry" - ) - .websiteUrl("www.mybusiness.com") .build() ) .build() diff --git a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt index ce20fe24..5278ce0a 100644 --- a/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt +++ b/lithic-java-core/src/test/kotlin/com/lithic/api/services/blocking/AccountHolderServiceTest.kt @@ -11,7 +11,6 @@ import com.lithic.api.models.AccountHolderSimulateEnrollmentReviewParams import com.lithic.api.models.AccountHolderUpdateParams import com.lithic.api.models.AccountHolderUploadDocumentParams import com.lithic.api.models.Address -import com.lithic.api.models.AddressUpdate import com.lithic.api.models.Kyb import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -156,97 +155,7 @@ internal class AccountHolderServiceTest { .accountHolderToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .body( AccountHolderUpdateParams.Body.KybPatchRequest.builder() - .addBeneficialOwnerEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .addBeneficialOwnerIndividual( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) - .businessEntity( - AccountHolderUpdateParams.Body.KybPatchRequest - .KybBusinessEntityPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dbaBusinessName("dba_business_name") - .governmentId("114-123-1513") - .legalBusinessName("Acme, Inc.") - .parentCompany("parent_company") - .addPhoneNumber("+15555555555") - .build() - ) - .controlPerson( - AccountHolderUpdateParams.Body.KybPatchRequest.IndividualPatch - .builder() - .entityToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .address( - AddressUpdate.builder() - .address1("123 Old Forest Way") - .address2("address2") - .city("Omaha") - .country("USA") - .postalCode("68022") - .state("NE") - .build() - ) - .dob("1991-03-08 08:00:00") - .email("tom@middle-earth.com") - .firstName("Tom") - .lastName("Bombadil") - .phoneNumber("+15555555555") - .build() - ) .externalId("external_id") - .natureOfBusiness( - "Software company selling solutions to the restaurant industry" - ) - .websiteUrl("www.mybusiness.com") .build() ) .build() From 2b92cbd65495c817b548d0696366b35ffefd0e9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 18:00:35 +0000 Subject: [PATCH 6/6] release: 0.110.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 26 ++++++++++++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3ca49358..c37434e9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.109.0" + ".": "0.110.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f56c9c95..1c53b935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,31 @@ # Changelog +## 0.110.0 (2025-11-10) + +Full Changelog: [v0.109.0...v0.110.0](https://github.com/lithic-com/lithic-java/compare/v0.109.0...v0.110.0) + +### Features + +* **api:** add payment_details ([6040598](https://github.com/lithic-com/lithic-java/commit/6040598e95a76273ab4f3ed790a7fbe28605ad4c)) +* **api:** deprecate auth rule apply endpoint and fix several schemas ([b21d55c](https://github.com/lithic-com/lithic-java/commit/b21d55ce251d33366456db9f99bb4c4ac2cbc9fc)) +* **api:** new fields in Statements APIs ([ea05274](https://github.com/lithic-com/lithic-java/commit/ea052742fedfd9e39df7f080d3530caf8cc3e515)) + + +### Bug Fixes + +* **api:** fix oneOf -> anyOf in account holder update ([6040598](https://github.com/lithic-com/lithic-java/commit/6040598e95a76273ab4f3ed790a7fbe28605ad4c)) +* **api:** fixing spec for Tokenizations and Enhanced data ([ea05274](https://github.com/lithic-com/lithic-java/commit/ea052742fedfd9e39df7f080d3530caf8cc3e515)) + + +### Chores + +* **api:** adds support for new ACH_RECEIPT_RELEASED event ([a2bbd13](https://github.com/lithic-com/lithic-java/commit/a2bbd1301f29e85cdec582a799ef91255f35ddfa)) + + +### Documentation + +* **client:** update readme timeout snippet ([7757427](https://github.com/lithic-com/lithic-java/commit/77574272ea9690f4822524663854b13be0b4a5f1)) + ## 0.109.0 (2025-10-23) Full Changelog: [v0.108.0...v0.109.0](https://github.com/lithic-com/lithic-java/compare/v0.108.0...v0.109.0) diff --git a/README.md b/README.md index d3900198..0f829317 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.109.0) -[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.109.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.109.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.110.0) +[![javadoc](https://javadoc.io/badge2/com.lithic.api/lithic-java/0.110.0/javadoc.svg)](https://javadoc.io/doc/com.lithic.api/lithic-java/0.110.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.109.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.110.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.109.0") +implementation("com.lithic.api:lithic-java:0.110.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.109.0") com.lithic.api lithic-java - 0.109.0 + 0.110.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 0a4bbd13..816a8aa9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.lithic.api" - version = "0.109.0" // x-release-please-version + version = "0.110.0" // x-release-please-version } subprojects {