diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index fe3ba3317..c6e0ed7db 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,6 +36,31 @@ jobs:
- name: Run lints
run: ./scripts/lint
+
+ build:
+ timeout-minutes: 15
+ name: build
+ runs-on: ${{ github.repository == 'stainless-sdks/lithic-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Java
+ uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: |
+ 8
+ 21
+ cache: gradle
+
+ - name: Set up Gradle
+ uses: gradle/actions/setup-gradle@v4
+
+ - name: Build SDK
+ run: ./scripts/build
+
test:
timeout-minutes: 15
name: test
diff --git a/.gitignore b/.gitignore
index 4e81838d6..b1346e6d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,6 @@
.gradle
.idea
.kotlin
-build
+build/
codegen.log
kls_database.db
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index aebbc8bc4..f70d9978a 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.101.0"
+ ".": "0.102.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 6ac2b12f6..1297b8759 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-aca56b6e4da5b97e586e66392dd3cf433208cb964e25081a661dd41cf456a88a.yml
-openapi_spec_hash: 297b9f330d31db8e5832463a0ce455ba
-config_hash: 99dad20b4a7d4a1390670762b9da4231
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-e16df7d65a6ababc8e0ca1f2a65070893d82d3b2b046394ab708d56fe717b3ad.yml
+openapi_spec_hash: ee82cf8fd5bb6b86abbae304f6c43934
+config_hash: c6d56596249e319c59d49d8e49a190b1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3960a3f85..baabb56d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,23 @@
# Changelog
+## 0.102.0 (2025-08-18)
+
+Full Changelog: [v0.101.0...v0.102.0](https://github.com/lithic-com/lithic-java/compare/v0.101.0...v0.102.0)
+
+### Features
+
+* **api:** adds Event types for additional API resources ([520922c](https://github.com/lithic-com/lithic-java/commit/520922c0da2d2813f35cefdbb9c70622a0bd3794))
+
+
+### Performance Improvements
+
+* **internal:** make formatting faster ([b9b6f21](https://github.com/lithic-com/lithic-java/commit/b9b6f21cda84140211bc62b8b61edf1c7ffa31bd))
+
+
+### Chores
+
+* **ci:** add build job ([a974607](https://github.com/lithic-com/lithic-java/commit/a974607e87bfdf5d0fc756970a746f45fac7641c))
+
## 0.101.0 (2025-08-13)
Full Changelog: [v0.100.0...v0.101.0](https://github.com/lithic-com/lithic-java/compare/v0.100.0...v0.101.0)
diff --git a/README.md b/README.md
index 0ce60d56f..0af7bfeba 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.101.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.101.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.102.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.102.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.101.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.102.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.101.0")
+implementation("com.lithic.api:lithic-java:0.102.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.101.0")
com.lithic.api
lithic-java
- 0.101.0
+ 0.102.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index e59ffab12..80c9c68c1 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,20 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.101.0" // x-release-please-version
+ version = "0.102.0" // x-release-please-version
+}
+
+subprojects {
+ // These are populated with dependencies by `buildSrc` scripts.
+ tasks.register("format") {
+ group = "Verification"
+ description = "Formats all source files."
+ }
+ tasks.register("lint") {
+ group = "Verification"
+ description = "Verifies all source files are formatted."
+ }
+ apply(plugin = "org.jetbrains.dokka")
}
subprojects {
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 778c89de5..c6dc92ec5 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -10,7 +10,6 @@ repositories {
}
dependencies {
- implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
implementation("com.vanniktech:gradle-maven-publish-plugin:0.28.0")
}
diff --git a/buildSrc/src/main/kotlin/lithic.java.gradle.kts b/buildSrc/src/main/kotlin/lithic.java.gradle.kts
index dfbacb86e..70fc33f41 100644
--- a/buildSrc/src/main/kotlin/lithic.java.gradle.kts
+++ b/buildSrc/src/main/kotlin/lithic.java.gradle.kts
@@ -1,24 +1,13 @@
-import com.diffplug.gradle.spotless.SpotlessExtension
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
`java-library`
- id("com.diffplug.spotless")
}
repositories {
mavenCentral()
}
-configure {
- java {
- importOrder()
- removeUnusedImports()
- palantirJavaFormat()
- toggleOffOn()
- }
-}
-
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
@@ -53,3 +42,86 @@ tasks.withType().configureEach {
exceptionFormat = TestExceptionFormat.FULL
}
}
+
+val palantir by configurations.creating
+dependencies {
+ palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
+}
+
+fun registerPalantir(
+ name: String,
+ description: String,
+) {
+ val javaName = "${name}Java"
+ tasks.register(javaName) {
+ group = "Verification"
+ this.description = description
+
+ classpath = palantir
+ mainClass = "com.palantir.javaformat.java.Main"
+
+ // Avoid an `IllegalAccessError` on Java 9+.
+ jvmArgs(
+ "--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
+ "--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
+ "--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
+ "--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
+ "--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
+ )
+
+ // Use paths relative to the current module.
+ val argumentFile =
+ project.layout.buildDirectory.file("palantir-$name-args.txt").get().asFile
+ val lastRunTimeFile =
+ project.layout.buildDirectory.file("palantir-$name-last-run.txt").get().asFile
+
+ // Read the time when this task was last executed for this module (if ever).
+ val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L
+
+ // Use a `fileTree` relative to the module's source directory.
+ val javaFiles = project.fileTree("src") { include("**/*.java") }
+
+ // Determine if any files need to be formatted or linted and continue only if there is at least
+ // one file.
+ onlyIf { javaFiles.any { it.lastModified() > lastRunTime } }
+
+ inputs.files(javaFiles)
+
+ doFirst {
+ // Create the argument file and set the preferred formatting style.
+ argumentFile.parentFile.mkdirs()
+ argumentFile.writeText("--palantir\n")
+
+ if (name == "lint") {
+ // For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
+ // the default 0) if any files need to be formatted, indicating that linting has failed.
+ argumentFile.appendText("--dry-run\n")
+ argumentFile.appendText("--set-exit-if-changed\n")
+ } else {
+ // `--dry-run` and `--replace` (for in-place formatting) are mutually exclusive.
+ argumentFile.appendText("--replace\n")
+ }
+
+ // Write the modified files to the argument file.
+ javaFiles.filter { it.lastModified() > lastRunTime }
+ .forEach { argumentFile.appendText("${it.absolutePath}\n") }
+ }
+
+ doLast {
+ // Record the last execution time for later up-to-date checking.
+ lastRunTimeFile.writeText(System.currentTimeMillis().toString())
+ }
+
+ // Pass the argument file using the @ symbol
+ args = listOf("@${argumentFile.absolutePath}")
+
+ outputs.upToDateWhen { javaFiles.none { it.lastModified() > lastRunTime } }
+ }
+
+ tasks.named(name) {
+ dependsOn(tasks.named(javaName))
+ }
+}
+
+registerPalantir(name = "format", description = "Formats all Java source files.")
+registerPalantir(name = "lint", description = "Verifies all Java source files are formatted.")
diff --git a/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts b/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts
index 6e0bcd005..911f27dd7 100644
--- a/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts
+++ b/buildSrc/src/main/kotlin/lithic.kotlin.gradle.kts
@@ -1,4 +1,3 @@
-import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
@@ -7,6 +6,10 @@ plugins {
kotlin("jvm")
}
+repositories {
+ mavenCentral()
+}
+
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(21))
@@ -27,14 +30,77 @@ kotlin {
}
}
-configure {
- kotlin {
- ktfmt().kotlinlangStyle()
- toggleOffOn()
- }
-}
-
tasks.withType().configureEach {
systemProperty("junit.jupiter.execution.parallel.enabled", true)
systemProperty("junit.jupiter.execution.parallel.mode.default", "concurrent")
}
+
+val ktfmt by configurations.creating
+dependencies {
+ ktfmt("com.facebook:ktfmt:0.56")
+}
+
+fun registerKtfmt(
+ name: String,
+ description: String,
+) {
+ val kotlinName = "${name}Kotlin"
+ tasks.register(kotlinName) {
+ group = "Verification"
+ this.description = description
+
+ classpath = ktfmt
+ mainClass = "com.facebook.ktfmt.cli.Main"
+
+ // Use paths relative to the current module.
+ val argumentFile = project.layout.buildDirectory.file("ktfmt-$name-args.txt").get().asFile
+ val lastRunTimeFile =
+ project.layout.buildDirectory.file("ktfmt-$name-last-run.txt").get().asFile
+
+ // Read the time when this task was last executed for this module (if ever).
+ val lastRunTime = lastRunTimeFile.takeIf { it.exists() }?.readText()?.toLongOrNull() ?: 0L
+
+ // Use a `fileTree` relative to the module's source directory.
+ val kotlinFiles = project.fileTree("src") { include("**/*.kt") }
+
+ // Determine if any files need to be formatted or linted and continue only if there is at least
+ // one file (otherwise Ktfmt will fail).
+ onlyIf { kotlinFiles.any { it.lastModified() > lastRunTime } }
+
+ inputs.files(kotlinFiles)
+
+ doFirst {
+ // Create the argument file and set the preferred formatting style.
+ argumentFile.parentFile.mkdirs()
+ argumentFile.writeText("--kotlinlang-style\n")
+
+ if (name == "lint") {
+ // For lint, do a dry run, so no files are modified. Set the exit code to 1 (instead of
+ // the default 0) if any files need to be formatted, indicating that linting has failed.
+ argumentFile.appendText("--dry-run\n")
+ argumentFile.appendText("--set-exit-if-changed\n")
+ }
+
+ // Write the modified files to the argument file.
+ kotlinFiles.filter { it.lastModified() > lastRunTime }
+ .forEach { argumentFile.appendText("${it.absolutePath}\n") }
+ }
+
+ doLast {
+ // Record the last execution time for later up-to-date checking.
+ lastRunTimeFile.writeText(System.currentTimeMillis().toString())
+ }
+
+ // Pass the argument file using the @ symbol
+ args = listOf("@${argumentFile.absolutePath}")
+
+ outputs.upToDateWhen { kotlinFiles.none { it.lastModified() > lastRunTime } }
+ }
+
+ tasks.named(name) {
+ dependsOn(tasks.named(kotlinName))
+ }
+}
+
+registerKtfmt(name = "format", description = "Formats all Kotlin source files.")
+registerKtfmt(name = "lint", description = "Verifies all Kotlin source files are formatted.")
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
index 148aed636..5bdb4b636 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountActivityListParams.kt
@@ -19,6 +19,7 @@ import kotlin.jvm.optionals.getOrNull
/** Retrieve a list of transactions across all public accounts. */
class AccountActivityListParams
private constructor(
+ private val accountToken: String?,
private val begin: OffsetDateTime?,
private val businessAccountToken: String?,
private val category: TransactionCategory?,
@@ -33,6 +34,9 @@ private constructor(
private val additionalQueryParams: QueryParams,
) : Params {
+ /** Filter by account token */
+ fun accountToken(): Optional = Optional.ofNullable(accountToken)
+
/**
* Date string in RFC 3339 format. Only entries created after the specified time will be
* included. UTC time zone.
@@ -96,6 +100,7 @@ private constructor(
/** A builder for [AccountActivityListParams]. */
class Builder internal constructor() {
+ private var accountToken: String? = null
private var begin: OffsetDateTime? = null
private var businessAccountToken: String? = null
private var category: TransactionCategory? = null
@@ -111,6 +116,7 @@ private constructor(
@JvmSynthetic
internal fun from(accountActivityListParams: AccountActivityListParams) = apply {
+ accountToken = accountActivityListParams.accountToken
begin = accountActivityListParams.begin
businessAccountToken = accountActivityListParams.businessAccountToken
category = accountActivityListParams.category
@@ -125,6 +131,12 @@ private constructor(
additionalQueryParams = accountActivityListParams.additionalQueryParams.toBuilder()
}
+ /** Filter by account token */
+ fun accountToken(accountToken: String?) = apply { this.accountToken = accountToken }
+
+ /** Alias for calling [Builder.accountToken] with `accountToken.orElse(null)`. */
+ fun accountToken(accountToken: Optional) = accountToken(accountToken.getOrNull())
+
/**
* Date string in RFC 3339 format. Only entries created after the specified time will be
* included. UTC time zone.
@@ -340,6 +352,7 @@ private constructor(
*/
fun build(): AccountActivityListParams =
AccountActivityListParams(
+ accountToken,
begin,
businessAccountToken,
category,
@@ -360,6 +373,7 @@ private constructor(
override fun _queryParams(): QueryParams =
QueryParams.builder()
.apply {
+ accountToken?.let { put("account_token", it) }
begin?.let { put("begin", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) }
businessAccountToken?.let { put("business_account_token", it) }
category?.let { put("category", it.toString()) }
@@ -857,6 +871,7 @@ private constructor(
}
return other is AccountActivityListParams &&
+ accountToken == other.accountToken &&
begin == other.begin &&
businessAccountToken == other.businessAccountToken &&
category == other.category &&
@@ -873,6 +888,7 @@ private constructor(
override fun hashCode(): Int =
Objects.hash(
+ accountToken,
begin,
businessAccountToken,
category,
@@ -888,5 +904,5 @@ private constructor(
)
override fun toString() =
- "AccountActivityListParams{begin=$begin, businessAccountToken=$businessAccountToken, category=$category, end=$end, endingBefore=$endingBefore, financialAccountToken=$financialAccountToken, pageSize=$pageSize, result=$result, startingAfter=$startingAfter, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "AccountActivityListParams{accountToken=$accountToken, begin=$begin, businessAccountToken=$businessAccountToken, category=$category, end=$end, endingBefore=$endingBefore, financialAccountToken=$financialAccountToken, pageSize=$pageSize, result=$result, startingAfter=$startingAfter, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
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 22a0f655a..d9b6c8fd3 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
@@ -389,7 +389,7 @@ private constructor(
private val created: JsonField,
private val currency: JsonField,
private val descriptor: JsonField,
- private val events: JsonField>,
+ private val events: JsonField>,
private val family: JsonField,
private val financialAccountToken: JsonField,
private val pendingAmount: JsonField,
@@ -417,7 +417,7 @@ private constructor(
descriptor: JsonField = JsonMissing.of(),
@JsonProperty("events")
@ExcludeMissing
- events: JsonField> = JsonMissing.of(),
+ events: JsonField> = JsonMissing.of(),
@JsonProperty("family")
@ExcludeMissing
family: JsonField = JsonMissing.of(),
@@ -502,7 +502,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 events(): List = events.getRequired("events")
+ fun events(): List = events.getRequired("events")
/**
* @throws LithicInvalidDataException if the JSON field has an unexpected type or is
@@ -603,7 +603,9 @@ private constructor(
*
* Unlike [events], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events
+ @JsonProperty("events")
+ @ExcludeMissing
+ fun _events(): JsonField> = events
/**
* Returns the raw JSON value of [family].
@@ -710,7 +712,7 @@ private constructor(
private var created: JsonField? = null
private var currency: JsonField? = null
private var descriptor: JsonField? = null
- private var events: JsonField>? = null
+ private var events: JsonField>? = null
private var family: JsonField? = null
private var financialAccountToken: JsonField? = null
private var pendingAmount: JsonField? = null
@@ -801,25 +803,25 @@ private constructor(
fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor }
/** List of transaction events */
- fun events(events: List) = events(JsonField.of(events))
+ fun events(events: List) = events(JsonField.of(events))
/**
* Sets [Builder.events] to an arbitrary JSON value.
*
- * You should usually call [Builder.events] with a well-typed `List` value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
+ * You should usually call [Builder.events] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
*/
- fun events(events: JsonField>) = apply {
+ fun events(events: JsonField>) = apply {
this.events = events.map { it.toMutableList() }
}
/**
- * Adds a single [JsonValue] to [events].
+ * Adds a single [FinancialEvent] to [events].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
- fun addEvent(event: JsonValue) = apply {
+ fun addEvent(event: FinancialEvent) = apply {
events =
(events ?: JsonField.of(mutableListOf())).also {
checkKnown("events", it).add(event)
@@ -990,7 +992,7 @@ private constructor(
created()
currency()
descriptor()
- events()
+ events().forEach { it.validate() }
family().validate()
financialAccountToken()
pendingAmount()
@@ -1022,7 +1024,7 @@ private constructor(
(if (created.asKnown().isPresent) 1 else 0) +
(if (currency.asKnown().isPresent) 1 else 0) +
(if (descriptor.asKnown().isPresent) 1 else 0) +
- (events.asKnown().getOrNull()?.size ?: 0) +
+ (events.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(family.asKnown().getOrNull()?.validity() ?: 0) +
(if (financialAccountToken.asKnown().isPresent) 1 else 0) +
(if (pendingAmount.asKnown().isPresent) 1 else 0) +
@@ -1232,133 +1234,262 @@ private constructor(
override fun toString() = value.toString()
}
- class TransactionFamilyTypes
- @JsonCreator
- private constructor(private val value: JsonField) : Enum {
+ /** Financial Event */
+ class FinancialEvent
+ private constructor(
+ private val token: JsonField,
+ private val amount: JsonField,
+ private val created: JsonField,
+ private val result: JsonField,
+ private val type: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(),
+ @JsonProperty("created")
+ @ExcludeMissing
+ created: JsonField = JsonMissing.of(),
+ @JsonProperty("result")
+ @ExcludeMissing
+ result: JsonField = JsonMissing.of(),
+ @JsonProperty("type")
+ @ExcludeMissing
+ type: JsonField = JsonMissing.of(),
+ ) : this(token, amount, created, result, type, mutableMapOf())
/**
- * Returns this class instance's raw value.
+ * Globally unique identifier.
*
- * 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 (e.g. if
+ * the server responded with an unexpected value).
*/
- @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
-
- companion object {
-
- @JvmField val CARD = of("CARD")
-
- @JvmField val PAYMENT = of("PAYMENT")
-
- @JvmField val TRANSFER = of("TRANSFER")
-
- @JvmField val INTERNAL = of("INTERNAL")
+ fun token(): Optional = token.getOptional("token")
- @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT")
+ /**
+ * Amount of the financial event that has been settled in the currency's smallest unit
+ * (e.g., cents).
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun amount(): Optional = amount.getOptional("amount")
- @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION")
+ /**
+ * Date and time when the financial event occurred. UTC time zone.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun created(): Optional = created.getOptional("created")
- @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value))
- }
+ /**
+ * APPROVED financial events were successful while DECLINED financial events were
+ * declined by user, Lithic, or the network.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun result(): Optional = result.getOptional("result")
- /** An enum containing [TransactionFamilyTypes]'s known values. */
- enum class Known {
- CARD,
- PAYMENT,
- TRANSFER,
- INTERNAL,
- EXTERNAL_PAYMENT,
- MANAGEMENT_OPERATION,
- }
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun type(): Optional = type.getOptional("type")
/**
- * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN]
- * member.
+ * Returns the raw JSON value of [token].
*
- * An instance of [TransactionFamilyTypes] 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.
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected type.
*/
- enum class Value {
- CARD,
- PAYMENT,
- TRANSFER,
- INTERNAL,
- EXTERNAL_PAYMENT,
- MANAGEMENT_OPERATION,
- /**
- * An enum member indicating that [TransactionFamilyTypes] was instantiated with an
- * unknown value.
- */
- _UNKNOWN,
- }
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
/**
- * Returns an enum member corresponding to this class instance's value, or
- * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ * Returns the raw JSON value of [amount].
*
- * Use the [known] method instead if you're certain the value is always known or if you
- * want to throw for the unknown case.
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
*/
- fun value(): Value =
- when (this) {
- CARD -> Value.CARD
- PAYMENT -> Value.PAYMENT
- TRANSFER -> Value.TRANSFER
- INTERNAL -> Value.INTERNAL
- EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT
- MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION
- else -> Value._UNKNOWN
- }
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
/**
- * 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.
+ * Returns the raw JSON value of [created].
*
- * @throws LithicInvalidDataException if this class instance's value is a not a known
- * member.
+ * Unlike [created], this method doesn't throw if the JSON field has an unexpected type.
*/
- fun known(): Known =
- when (this) {
- CARD -> Known.CARD
- PAYMENT -> Known.PAYMENT
- TRANSFER -> Known.TRANSFER
- INTERNAL -> Known.INTERNAL
- EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT
- MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION
- else ->
- throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $value")
- }
+ @JsonProperty("created")
+ @ExcludeMissing
+ fun _created(): JsonField = created
/**
- * Returns this class instance's primitive wire representation.
+ * Returns the raw JSON value of [result].
*
- * This differs from the [toString] method because that method is primarily for
- * debugging and generally doesn't throw.
+ * Unlike [result], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result
+
+ /**
+ * Returns the raw JSON value of [type].
*
- * @throws LithicInvalidDataException if this class instance's value does not have the
- * expected primitive type.
+ * Unlike [type], this method doesn't throw if the JSON field has an unexpected type.
*/
- fun asString(): String =
- _value().asString().orElseThrow {
- LithicInvalidDataException("Value is not a String")
+ @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type
+
+ @JsonAnySetter
+ private fun putAdditionalProperty(key: String, value: JsonValue) {
+ additionalProperties.put(key, value)
+ }
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map =
+ Collections.unmodifiableMap(additionalProperties)
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [FinancialEvent]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [FinancialEvent]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField = JsonMissing.of()
+ private var amount: JsonField = JsonMissing.of()
+ private var created: JsonField = JsonMissing.of()
+ private var result: JsonField = JsonMissing.of()
+ private var type: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(financialEvent: FinancialEvent) = apply {
+ token = financialEvent.token
+ amount = financialEvent.amount
+ created = financialEvent.created
+ result = financialEvent.result
+ type = financialEvent.type
+ additionalProperties = financialEvent.additionalProperties.toMutableMap()
+ }
+
+ /** Globally unique identifier. */
+ fun token(token: String) = token(JsonField.of(token))
+
+ /**
+ * Sets [Builder.token] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.token] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun token(token: JsonField) = apply { this.token = token }
+
+ /**
+ * Amount of the financial event that has been settled in the currency's smallest
+ * unit (e.g., cents).
+ */
+ fun amount(amount: Long) = amount(JsonField.of(amount))
+
+ /**
+ * Sets [Builder.amount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amount] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ /** Date and time when the financial event occurred. UTC time zone. */
+ fun created(created: OffsetDateTime) = created(JsonField.of(created))
+
+ /**
+ * Sets [Builder.created] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.created] with a well-typed [OffsetDateTime]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun created(created: JsonField) = apply { this.created = created }
+
+ /**
+ * APPROVED financial events were successful while DECLINED financial events were
+ * declined by user, Lithic, or the network.
+ */
+ fun result(result: Result) = result(JsonField.of(result))
+
+ /**
+ * Sets [Builder.result] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.result] with a well-typed [Result] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun result(result: JsonField) = apply { this.result = result }
+
+ fun type(type: FinancialEventType) = type(JsonField.of(type))
+
+ /**
+ * Sets [Builder.type] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.type] with a well-typed [FinancialEventType]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun type(type: JsonField) = apply { this.type = type }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ putAllAdditionalProperties(additionalProperties)
+ }
+
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ additionalProperties.put(key, value)
}
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun removeAdditionalProperty(key: String) = apply {
+ additionalProperties.remove(key)
+ }
+
+ fun removeAllAdditionalProperties(keys: Set) = apply {
+ keys.forEach(::removeAdditionalProperty)
+ }
+
+ /**
+ * Returns an immutable instance of [FinancialEvent].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): FinancialEvent =
+ FinancialEvent(
+ token,
+ amount,
+ created,
+ result,
+ type,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
private var validated: Boolean = false
- fun validate(): TransactionFamilyTypes = apply {
+ fun validate(): FinancialEvent = apply {
if (validated) {
return@apply
}
- known()
+ token()
+ amount()
+ created()
+ result().ifPresent { it.validate() }
+ type().ifPresent { it.validate() }
validated = true
}
@@ -1376,273 +1507,830 @@ private constructor(
*
* Used for best match union deserialization.
*/
- @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (token.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (created.asKnown().isPresent) 1 else 0) +
+ (result.asKnown().getOrNull()?.validity() ?: 0) +
+ (type.asKnown().getOrNull()?.validity() ?: 0)
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
+ /**
+ * APPROVED financial events were successful while DECLINED financial events were
+ * declined by user, Lithic, or the network.
+ */
+ class Result @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
- return other is TransactionFamilyTypes && value == other.value
- }
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
- override fun hashCode() = value.hashCode()
+ companion object {
- override fun toString() = value.toString()
- }
+ @JvmField val APPROVED = of("APPROVED")
- /** Transaction result */
- class TransactionResult
- @JsonCreator
- private constructor(private val value: JsonField) : Enum {
+ @JvmField val DECLINED = of("DECLINED")
- /**
- * 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 {
+ @JvmStatic fun of(value: String) = Result(JsonField.of(value))
+ }
- @JvmField val APPROVED = of("APPROVED")
+ /** An enum containing [Result]'s known values. */
+ enum class Known {
+ APPROVED,
+ DECLINED,
+ }
- @JvmField val DECLINED = of("DECLINED")
+ /**
+ * An enum containing [Result]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Result] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ APPROVED,
+ DECLINED,
+ /**
+ * An enum member indicating that [Result] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
- @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value))
- }
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if
+ * you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ APPROVED -> Value.APPROVED
+ DECLINED -> Value.DECLINED
+ else -> Value._UNKNOWN
+ }
- /** An enum containing [TransactionResult]'s known values. */
- enum class Known {
- APPROVED,
- DECLINED,
- }
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ APPROVED -> Known.APPROVED
+ DECLINED -> Known.DECLINED
+ else -> throw LithicInvalidDataException("Unknown Result: $value")
+ }
- /**
- * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN]
- * member.
- *
- * An instance of [TransactionResult] can contain an unknown value in a couple of cases:
- * - It was deserialized from data that doesn't match any known member. For example, if
- * the SDK is on an older version than the API, then the API may respond with new
- * members that the SDK is unaware of.
- * - It was constructed with an arbitrary value using the [of] method.
- */
- enum class Value {
- APPROVED,
- DECLINED,
/**
- * An enum member indicating that [TransactionResult] was instantiated with an
- * unknown value.
+ * 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.
*/
- _UNKNOWN,
- }
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
- /**
- * Returns an enum member corresponding to this class instance's value, or
- * [Value._UNKNOWN] if the class was instantiated with an unknown value.
- *
- * Use the [known] method instead if you're certain the value is always known or if you
- * want to throw for the unknown case.
- */
- fun value(): Value =
- when (this) {
- APPROVED -> Value.APPROVED
- DECLINED -> Value.DECLINED
- else -> Value._UNKNOWN
- }
+ private var validated: Boolean = false
- /**
- * Returns an enum member corresponding to this class instance's value.
- *
- * Use the [value] method instead if you're uncertain the value is always known and
- * don't want to throw for the unknown case.
- *
- * @throws LithicInvalidDataException if this class instance's value is a not a known
- * member.
- */
- fun known(): Known =
- when (this) {
- APPROVED -> Known.APPROVED
- DECLINED -> Known.DECLINED
- else -> throw LithicInvalidDataException("Unknown TransactionResult: $value")
- }
+ fun validate(): Result = apply {
+ if (validated) {
+ return@apply
+ }
- /**
- * 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")
+ known()
+ validated = true
}
- private var validated: Boolean = false
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
- fun validate(): TransactionResult = apply {
- if (validated) {
- return@apply
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Result && value == other.value
}
- known()
- validated = true
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
}
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: LithicInvalidDataException) {
- false
- }
+ class FinancialEventType
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
- /**
- * Returns 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
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
+ companion object {
- return other is TransactionResult && value == other.value
- }
+ @JvmField val ACH_ORIGINATION_CANCELLED = of("ACH_ORIGINATION_CANCELLED")
- override fun hashCode() = value.hashCode()
+ @JvmField val ACH_ORIGINATION_INITIATED = of("ACH_ORIGINATION_INITIATED")
- override fun toString() = value.toString()
- }
+ @JvmField val ACH_ORIGINATION_PROCESSED = of("ACH_ORIGINATION_PROCESSED")
- /** The status of the transaction */
- class TransactionStatus
- @JsonCreator
- private constructor(private val value: JsonField) : Enum {
+ @JvmField val ACH_ORIGINATION_RELEASED = of("ACH_ORIGINATION_RELEASED")
- /**
- * Returns this class instance's raw value.
- *
- * This is usually only useful if this instance was deserialized from data that doesn't
- * match any known member, and you want to know that value. For example, if the SDK is
- * on an older version than the API, then the API may respond with new members that the
- * SDK is unaware of.
- */
- @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+ @JvmField val ACH_ORIGINATION_REVIEWED = of("ACH_ORIGINATION_REVIEWED")
- companion object {
+ @JvmField val ACH_ORIGINATION_SETTLED = of("ACH_ORIGINATION_SETTLED")
- @JvmField val PENDING = of("PENDING")
+ @JvmField val ACH_RECEIPT_PROCESSED = of("ACH_RECEIPT_PROCESSED")
- @JvmField val SETTLED = of("SETTLED")
+ @JvmField val ACH_RECEIPT_SETTLED = of("ACH_RECEIPT_SETTLED")
- @JvmField val DECLINED = of("DECLINED")
+ @JvmField val ACH_RETURN_INITIATED = of("ACH_RETURN_INITIATED")
- @JvmField val REVERSED = of("REVERSED")
+ @JvmField val ACH_RETURN_PROCESSED = of("ACH_RETURN_PROCESSED")
- @JvmField val CANCELED = of("CANCELED")
+ @JvmField val ACH_RETURN_SETTLED = of("ACH_RETURN_SETTLED")
- @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value))
- }
+ @JvmField val AUTHORIZATION = of("AUTHORIZATION")
- /** An enum containing [TransactionStatus]'s known values. */
- enum class Known {
- PENDING,
- SETTLED,
- DECLINED,
- REVERSED,
- CANCELED,
- }
+ @JvmField val AUTHORIZATION_ADVICE = of("AUTHORIZATION_ADVICE")
- /**
- * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN]
- * member.
- *
- * An instance of [TransactionStatus] can contain an unknown value in a couple of cases:
- * - It was deserialized from data that doesn't match any known member. For example, if
- * the SDK is on an older version than the API, then the API may respond with new
- * members that the SDK is unaware of.
- * - It was constructed with an arbitrary value using the [of] method.
- */
- enum class Value {
- PENDING,
- SETTLED,
- DECLINED,
- REVERSED,
- CANCELED,
- /**
- * An enum member indicating that [TransactionStatus] was instantiated with an
- * unknown value.
- */
- _UNKNOWN,
- }
+ @JvmField val AUTHORIZATION_EXPIRY = of("AUTHORIZATION_EXPIRY")
- /**
- * Returns an enum member corresponding to this class instance's value, or
- * [Value._UNKNOWN] if the class was instantiated with an unknown value.
- *
- * Use the [known] method instead if you're certain the value is always known or if you
- * want to throw for the unknown case.
- */
- fun value(): Value =
- when (this) {
- PENDING -> Value.PENDING
- SETTLED -> Value.SETTLED
- DECLINED -> Value.DECLINED
- REVERSED -> Value.REVERSED
- CANCELED -> Value.CANCELED
- else -> Value._UNKNOWN
- }
+ @JvmField val AUTHORIZATION_REVERSAL = of("AUTHORIZATION_REVERSAL")
- /**
- * Returns an enum member corresponding to this class instance's value.
- *
- * Use the [value] method instead if you're uncertain the value is always known and
- * don't want to throw for the unknown case.
- *
- * @throws LithicInvalidDataException if this class instance's value is a not a known
- * member.
- */
- fun known(): Known =
- when (this) {
- PENDING -> Known.PENDING
- SETTLED -> Known.SETTLED
- DECLINED -> Known.DECLINED
- REVERSED -> Known.REVERSED
- CANCELED -> Known.CANCELED
- else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value")
- }
+ @JvmField val BALANCE_INQUIRY = of("BALANCE_INQUIRY")
- /**
- * 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")
- }
+ @JvmField val BILLING_ERROR = of("BILLING_ERROR")
- private var validated: Boolean = false
+ @JvmField val BILLING_ERROR_REVERSAL = of("BILLING_ERROR_REVERSAL")
- fun validate(): TransactionStatus = apply {
- if (validated) {
- return@apply
- }
+ @JvmField val CARD_TO_CARD = of("CARD_TO_CARD")
+
+ @JvmField val CASH_BACK = of("CASH_BACK")
+
+ @JvmField val CASH_BACK_REVERSAL = of("CASH_BACK_REVERSAL")
+
+ @JvmField val CLEARING = of("CLEARING")
+
+ @JvmField val COLLECTION = of("COLLECTION")
+
+ @JvmField val CORRECTION_CREDIT = of("CORRECTION_CREDIT")
+
+ @JvmField val CORRECTION_DEBIT = of("CORRECTION_DEBIT")
+
+ @JvmField val CREDIT_AUTHORIZATION = of("CREDIT_AUTHORIZATION")
+
+ @JvmField val CREDIT_AUTHORIZATION_ADVICE = of("CREDIT_AUTHORIZATION_ADVICE")
+
+ @JvmField val CURRENCY_CONVERSION = of("CURRENCY_CONVERSION")
+
+ @JvmField val CURRENCY_CONVERSION_REVERSAL = of("CURRENCY_CONVERSION_REVERSAL")
+
+ @JvmField val DISPUTE_WON = of("DISPUTE_WON")
+
+ @JvmField val EXTERNAL_ACH_CANCELED = of("EXTERNAL_ACH_CANCELED")
+
+ @JvmField val EXTERNAL_ACH_INITIATED = of("EXTERNAL_ACH_INITIATED")
+
+ @JvmField val EXTERNAL_ACH_RELEASED = of("EXTERNAL_ACH_RELEASED")
+
+ @JvmField val EXTERNAL_ACH_REVERSED = of("EXTERNAL_ACH_REVERSED")
+
+ @JvmField val EXTERNAL_ACH_SETTLED = of("EXTERNAL_ACH_SETTLED")
+
+ @JvmField val EXTERNAL_CHECK_CANCELED = of("EXTERNAL_CHECK_CANCELED")
+
+ @JvmField val EXTERNAL_CHECK_INITIATED = of("EXTERNAL_CHECK_INITIATED")
+
+ @JvmField val EXTERNAL_CHECK_RELEASED = of("EXTERNAL_CHECK_RELEASED")
+
+ @JvmField val EXTERNAL_CHECK_REVERSED = of("EXTERNAL_CHECK_REVERSED")
+
+ @JvmField val EXTERNAL_CHECK_SETTLED = of("EXTERNAL_CHECK_SETTLED")
+
+ @JvmField val EXTERNAL_TRANSFER_CANCELED = of("EXTERNAL_TRANSFER_CANCELED")
+
+ @JvmField val EXTERNAL_TRANSFER_INITIATED = of("EXTERNAL_TRANSFER_INITIATED")
+
+ @JvmField val EXTERNAL_TRANSFER_RELEASED = of("EXTERNAL_TRANSFER_RELEASED")
+
+ @JvmField val EXTERNAL_TRANSFER_REVERSED = of("EXTERNAL_TRANSFER_REVERSED")
+
+ @JvmField val EXTERNAL_TRANSFER_SETTLED = of("EXTERNAL_TRANSFER_SETTLED")
+
+ @JvmField val EXTERNAL_WIRE_CANCELED = of("EXTERNAL_WIRE_CANCELED")
+
+ @JvmField val EXTERNAL_WIRE_INITIATED = of("EXTERNAL_WIRE_INITIATED")
+
+ @JvmField val EXTERNAL_WIRE_RELEASED = of("EXTERNAL_WIRE_RELEASED")
+
+ @JvmField val EXTERNAL_WIRE_REVERSED = of("EXTERNAL_WIRE_REVERSED")
+
+ @JvmField val EXTERNAL_WIRE_SETTLED = of("EXTERNAL_WIRE_SETTLED")
+
+ @JvmField val FINANCIAL_AUTHORIZATION = of("FINANCIAL_AUTHORIZATION")
+
+ @JvmField
+ val FINANCIAL_CREDIT_AUTHORIZATION = of("FINANCIAL_CREDIT_AUTHORIZATION")
+
+ @JvmField val INTEREST = of("INTEREST")
+
+ @JvmField val INTEREST_REVERSAL = of("INTEREST_REVERSAL")
+
+ @JvmField val INTERNAL_ADJUSTMENT = of("INTERNAL_ADJUSTMENT")
+
+ @JvmField val LATE_PAYMENT = of("LATE_PAYMENT")
+
+ @JvmField val LATE_PAYMENT_REVERSAL = of("LATE_PAYMENT_REVERSAL")
+
+ @JvmField val LOSS_WRITE_OFF = of("LOSS_WRITE_OFF")
+
+ @JvmField val PROVISIONAL_CREDIT = of("PROVISIONAL_CREDIT")
+
+ @JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
+
+ @JvmField val SERVICE = of("SERVICE")
+
+ @JvmField val RETURN = of("RETURN")
+
+ @JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
+
+ @JvmField val TRANSFER = of("TRANSFER")
+
+ @JvmField val TRANSFER_INSUFFICIENT_FUNDS = of("TRANSFER_INSUFFICIENT_FUNDS")
+
+ @JvmField val RETURNED_PAYMENT = of("RETURNED_PAYMENT")
+
+ @JvmField val RETURNED_PAYMENT_REVERSAL = of("RETURNED_PAYMENT_REVERSAL")
+
+ @JvmField val LITHIC_NETWORK_PAYMENT = of("LITHIC_NETWORK_PAYMENT")
+
+ @JvmStatic fun of(value: String) = FinancialEventType(JsonField.of(value))
+ }
+
+ /** An enum containing [FinancialEventType]'s known values. */
+ enum class Known {
+ ACH_ORIGINATION_CANCELLED,
+ ACH_ORIGINATION_INITIATED,
+ ACH_ORIGINATION_PROCESSED,
+ ACH_ORIGINATION_RELEASED,
+ ACH_ORIGINATION_REVIEWED,
+ ACH_ORIGINATION_SETTLED,
+ ACH_RECEIPT_PROCESSED,
+ ACH_RECEIPT_SETTLED,
+ ACH_RETURN_INITIATED,
+ ACH_RETURN_PROCESSED,
+ ACH_RETURN_SETTLED,
+ AUTHORIZATION,
+ AUTHORIZATION_ADVICE,
+ AUTHORIZATION_EXPIRY,
+ AUTHORIZATION_REVERSAL,
+ BALANCE_INQUIRY,
+ BILLING_ERROR,
+ BILLING_ERROR_REVERSAL,
+ CARD_TO_CARD,
+ CASH_BACK,
+ CASH_BACK_REVERSAL,
+ CLEARING,
+ COLLECTION,
+ CORRECTION_CREDIT,
+ CORRECTION_DEBIT,
+ CREDIT_AUTHORIZATION,
+ CREDIT_AUTHORIZATION_ADVICE,
+ CURRENCY_CONVERSION,
+ CURRENCY_CONVERSION_REVERSAL,
+ DISPUTE_WON,
+ EXTERNAL_ACH_CANCELED,
+ EXTERNAL_ACH_INITIATED,
+ EXTERNAL_ACH_RELEASED,
+ EXTERNAL_ACH_REVERSED,
+ EXTERNAL_ACH_SETTLED,
+ EXTERNAL_CHECK_CANCELED,
+ EXTERNAL_CHECK_INITIATED,
+ EXTERNAL_CHECK_RELEASED,
+ EXTERNAL_CHECK_REVERSED,
+ EXTERNAL_CHECK_SETTLED,
+ EXTERNAL_TRANSFER_CANCELED,
+ EXTERNAL_TRANSFER_INITIATED,
+ EXTERNAL_TRANSFER_RELEASED,
+ EXTERNAL_TRANSFER_REVERSED,
+ EXTERNAL_TRANSFER_SETTLED,
+ EXTERNAL_WIRE_CANCELED,
+ EXTERNAL_WIRE_INITIATED,
+ EXTERNAL_WIRE_RELEASED,
+ EXTERNAL_WIRE_REVERSED,
+ EXTERNAL_WIRE_SETTLED,
+ FINANCIAL_AUTHORIZATION,
+ FINANCIAL_CREDIT_AUTHORIZATION,
+ INTEREST,
+ INTEREST_REVERSAL,
+ INTERNAL_ADJUSTMENT,
+ LATE_PAYMENT,
+ LATE_PAYMENT_REVERSAL,
+ LOSS_WRITE_OFF,
+ PROVISIONAL_CREDIT,
+ PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
+ RETURN,
+ RETURN_REVERSAL,
+ TRANSFER,
+ TRANSFER_INSUFFICIENT_FUNDS,
+ RETURNED_PAYMENT,
+ RETURNED_PAYMENT_REVERSAL,
+ LITHIC_NETWORK_PAYMENT,
+ }
+
+ /**
+ * An enum containing [FinancialEventType]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [FinancialEventType] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ ACH_ORIGINATION_CANCELLED,
+ ACH_ORIGINATION_INITIATED,
+ ACH_ORIGINATION_PROCESSED,
+ ACH_ORIGINATION_RELEASED,
+ ACH_ORIGINATION_REVIEWED,
+ ACH_ORIGINATION_SETTLED,
+ ACH_RECEIPT_PROCESSED,
+ ACH_RECEIPT_SETTLED,
+ ACH_RETURN_INITIATED,
+ ACH_RETURN_PROCESSED,
+ ACH_RETURN_SETTLED,
+ AUTHORIZATION,
+ AUTHORIZATION_ADVICE,
+ AUTHORIZATION_EXPIRY,
+ AUTHORIZATION_REVERSAL,
+ BALANCE_INQUIRY,
+ BILLING_ERROR,
+ BILLING_ERROR_REVERSAL,
+ CARD_TO_CARD,
+ CASH_BACK,
+ CASH_BACK_REVERSAL,
+ CLEARING,
+ COLLECTION,
+ CORRECTION_CREDIT,
+ CORRECTION_DEBIT,
+ CREDIT_AUTHORIZATION,
+ CREDIT_AUTHORIZATION_ADVICE,
+ CURRENCY_CONVERSION,
+ CURRENCY_CONVERSION_REVERSAL,
+ DISPUTE_WON,
+ EXTERNAL_ACH_CANCELED,
+ EXTERNAL_ACH_INITIATED,
+ EXTERNAL_ACH_RELEASED,
+ EXTERNAL_ACH_REVERSED,
+ EXTERNAL_ACH_SETTLED,
+ EXTERNAL_CHECK_CANCELED,
+ EXTERNAL_CHECK_INITIATED,
+ EXTERNAL_CHECK_RELEASED,
+ EXTERNAL_CHECK_REVERSED,
+ EXTERNAL_CHECK_SETTLED,
+ EXTERNAL_TRANSFER_CANCELED,
+ EXTERNAL_TRANSFER_INITIATED,
+ EXTERNAL_TRANSFER_RELEASED,
+ EXTERNAL_TRANSFER_REVERSED,
+ EXTERNAL_TRANSFER_SETTLED,
+ EXTERNAL_WIRE_CANCELED,
+ EXTERNAL_WIRE_INITIATED,
+ EXTERNAL_WIRE_RELEASED,
+ EXTERNAL_WIRE_REVERSED,
+ EXTERNAL_WIRE_SETTLED,
+ FINANCIAL_AUTHORIZATION,
+ FINANCIAL_CREDIT_AUTHORIZATION,
+ INTEREST,
+ INTEREST_REVERSAL,
+ INTERNAL_ADJUSTMENT,
+ LATE_PAYMENT,
+ LATE_PAYMENT_REVERSAL,
+ LOSS_WRITE_OFF,
+ PROVISIONAL_CREDIT,
+ PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
+ RETURN,
+ RETURN_REVERSAL,
+ TRANSFER,
+ TRANSFER_INSUFFICIENT_FUNDS,
+ RETURNED_PAYMENT,
+ RETURNED_PAYMENT_REVERSAL,
+ LITHIC_NETWORK_PAYMENT,
+ /**
+ * An enum member indicating that [FinancialEventType] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if
+ * you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ ACH_ORIGINATION_CANCELLED -> Value.ACH_ORIGINATION_CANCELLED
+ ACH_ORIGINATION_INITIATED -> Value.ACH_ORIGINATION_INITIATED
+ ACH_ORIGINATION_PROCESSED -> Value.ACH_ORIGINATION_PROCESSED
+ ACH_ORIGINATION_RELEASED -> Value.ACH_ORIGINATION_RELEASED
+ ACH_ORIGINATION_REVIEWED -> Value.ACH_ORIGINATION_REVIEWED
+ ACH_ORIGINATION_SETTLED -> Value.ACH_ORIGINATION_SETTLED
+ ACH_RECEIPT_PROCESSED -> Value.ACH_RECEIPT_PROCESSED
+ ACH_RECEIPT_SETTLED -> Value.ACH_RECEIPT_SETTLED
+ ACH_RETURN_INITIATED -> Value.ACH_RETURN_INITIATED
+ ACH_RETURN_PROCESSED -> Value.ACH_RETURN_PROCESSED
+ ACH_RETURN_SETTLED -> Value.ACH_RETURN_SETTLED
+ AUTHORIZATION -> Value.AUTHORIZATION
+ AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE
+ AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY
+ AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL
+ BALANCE_INQUIRY -> Value.BALANCE_INQUIRY
+ BILLING_ERROR -> Value.BILLING_ERROR
+ BILLING_ERROR_REVERSAL -> Value.BILLING_ERROR_REVERSAL
+ CARD_TO_CARD -> Value.CARD_TO_CARD
+ CASH_BACK -> Value.CASH_BACK
+ CASH_BACK_REVERSAL -> Value.CASH_BACK_REVERSAL
+ CLEARING -> Value.CLEARING
+ COLLECTION -> Value.COLLECTION
+ CORRECTION_CREDIT -> Value.CORRECTION_CREDIT
+ CORRECTION_DEBIT -> Value.CORRECTION_DEBIT
+ CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION
+ CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE
+ CURRENCY_CONVERSION -> Value.CURRENCY_CONVERSION
+ CURRENCY_CONVERSION_REVERSAL -> Value.CURRENCY_CONVERSION_REVERSAL
+ DISPUTE_WON -> Value.DISPUTE_WON
+ EXTERNAL_ACH_CANCELED -> Value.EXTERNAL_ACH_CANCELED
+ EXTERNAL_ACH_INITIATED -> Value.EXTERNAL_ACH_INITIATED
+ EXTERNAL_ACH_RELEASED -> Value.EXTERNAL_ACH_RELEASED
+ EXTERNAL_ACH_REVERSED -> Value.EXTERNAL_ACH_REVERSED
+ EXTERNAL_ACH_SETTLED -> Value.EXTERNAL_ACH_SETTLED
+ EXTERNAL_CHECK_CANCELED -> Value.EXTERNAL_CHECK_CANCELED
+ EXTERNAL_CHECK_INITIATED -> Value.EXTERNAL_CHECK_INITIATED
+ EXTERNAL_CHECK_RELEASED -> Value.EXTERNAL_CHECK_RELEASED
+ EXTERNAL_CHECK_REVERSED -> Value.EXTERNAL_CHECK_REVERSED
+ EXTERNAL_CHECK_SETTLED -> Value.EXTERNAL_CHECK_SETTLED
+ EXTERNAL_TRANSFER_CANCELED -> Value.EXTERNAL_TRANSFER_CANCELED
+ EXTERNAL_TRANSFER_INITIATED -> Value.EXTERNAL_TRANSFER_INITIATED
+ EXTERNAL_TRANSFER_RELEASED -> Value.EXTERNAL_TRANSFER_RELEASED
+ EXTERNAL_TRANSFER_REVERSED -> Value.EXTERNAL_TRANSFER_REVERSED
+ EXTERNAL_TRANSFER_SETTLED -> Value.EXTERNAL_TRANSFER_SETTLED
+ EXTERNAL_WIRE_CANCELED -> Value.EXTERNAL_WIRE_CANCELED
+ EXTERNAL_WIRE_INITIATED -> Value.EXTERNAL_WIRE_INITIATED
+ EXTERNAL_WIRE_RELEASED -> Value.EXTERNAL_WIRE_RELEASED
+ EXTERNAL_WIRE_REVERSED -> Value.EXTERNAL_WIRE_REVERSED
+ EXTERNAL_WIRE_SETTLED -> Value.EXTERNAL_WIRE_SETTLED
+ FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION
+ FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION
+ INTEREST -> Value.INTEREST
+ INTEREST_REVERSAL -> Value.INTEREST_REVERSAL
+ INTERNAL_ADJUSTMENT -> Value.INTERNAL_ADJUSTMENT
+ LATE_PAYMENT -> Value.LATE_PAYMENT
+ LATE_PAYMENT_REVERSAL -> Value.LATE_PAYMENT_REVERSAL
+ LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
+ PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
+ PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Value.SERVICE
+ RETURN -> Value.RETURN
+ RETURN_REVERSAL -> Value.RETURN_REVERSAL
+ TRANSFER -> Value.TRANSFER
+ TRANSFER_INSUFFICIENT_FUNDS -> Value.TRANSFER_INSUFFICIENT_FUNDS
+ RETURNED_PAYMENT -> Value.RETURNED_PAYMENT
+ RETURNED_PAYMENT_REVERSAL -> Value.RETURNED_PAYMENT_REVERSAL
+ LITHIC_NETWORK_PAYMENT -> Value.LITHIC_NETWORK_PAYMENT
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ ACH_ORIGINATION_CANCELLED -> Known.ACH_ORIGINATION_CANCELLED
+ ACH_ORIGINATION_INITIATED -> Known.ACH_ORIGINATION_INITIATED
+ ACH_ORIGINATION_PROCESSED -> Known.ACH_ORIGINATION_PROCESSED
+ ACH_ORIGINATION_RELEASED -> Known.ACH_ORIGINATION_RELEASED
+ ACH_ORIGINATION_REVIEWED -> Known.ACH_ORIGINATION_REVIEWED
+ ACH_ORIGINATION_SETTLED -> Known.ACH_ORIGINATION_SETTLED
+ ACH_RECEIPT_PROCESSED -> Known.ACH_RECEIPT_PROCESSED
+ ACH_RECEIPT_SETTLED -> Known.ACH_RECEIPT_SETTLED
+ ACH_RETURN_INITIATED -> Known.ACH_RETURN_INITIATED
+ ACH_RETURN_PROCESSED -> Known.ACH_RETURN_PROCESSED
+ ACH_RETURN_SETTLED -> Known.ACH_RETURN_SETTLED
+ AUTHORIZATION -> Known.AUTHORIZATION
+ AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE
+ AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY
+ AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL
+ BALANCE_INQUIRY -> Known.BALANCE_INQUIRY
+ BILLING_ERROR -> Known.BILLING_ERROR
+ BILLING_ERROR_REVERSAL -> Known.BILLING_ERROR_REVERSAL
+ CARD_TO_CARD -> Known.CARD_TO_CARD
+ CASH_BACK -> Known.CASH_BACK
+ CASH_BACK_REVERSAL -> Known.CASH_BACK_REVERSAL
+ CLEARING -> Known.CLEARING
+ COLLECTION -> Known.COLLECTION
+ CORRECTION_CREDIT -> Known.CORRECTION_CREDIT
+ CORRECTION_DEBIT -> Known.CORRECTION_DEBIT
+ CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION
+ CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE
+ CURRENCY_CONVERSION -> Known.CURRENCY_CONVERSION
+ CURRENCY_CONVERSION_REVERSAL -> Known.CURRENCY_CONVERSION_REVERSAL
+ DISPUTE_WON -> Known.DISPUTE_WON
+ EXTERNAL_ACH_CANCELED -> Known.EXTERNAL_ACH_CANCELED
+ EXTERNAL_ACH_INITIATED -> Known.EXTERNAL_ACH_INITIATED
+ EXTERNAL_ACH_RELEASED -> Known.EXTERNAL_ACH_RELEASED
+ EXTERNAL_ACH_REVERSED -> Known.EXTERNAL_ACH_REVERSED
+ EXTERNAL_ACH_SETTLED -> Known.EXTERNAL_ACH_SETTLED
+ EXTERNAL_CHECK_CANCELED -> Known.EXTERNAL_CHECK_CANCELED
+ EXTERNAL_CHECK_INITIATED -> Known.EXTERNAL_CHECK_INITIATED
+ EXTERNAL_CHECK_RELEASED -> Known.EXTERNAL_CHECK_RELEASED
+ EXTERNAL_CHECK_REVERSED -> Known.EXTERNAL_CHECK_REVERSED
+ EXTERNAL_CHECK_SETTLED -> Known.EXTERNAL_CHECK_SETTLED
+ EXTERNAL_TRANSFER_CANCELED -> Known.EXTERNAL_TRANSFER_CANCELED
+ EXTERNAL_TRANSFER_INITIATED -> Known.EXTERNAL_TRANSFER_INITIATED
+ EXTERNAL_TRANSFER_RELEASED -> Known.EXTERNAL_TRANSFER_RELEASED
+ EXTERNAL_TRANSFER_REVERSED -> Known.EXTERNAL_TRANSFER_REVERSED
+ EXTERNAL_TRANSFER_SETTLED -> Known.EXTERNAL_TRANSFER_SETTLED
+ EXTERNAL_WIRE_CANCELED -> Known.EXTERNAL_WIRE_CANCELED
+ EXTERNAL_WIRE_INITIATED -> Known.EXTERNAL_WIRE_INITIATED
+ EXTERNAL_WIRE_RELEASED -> Known.EXTERNAL_WIRE_RELEASED
+ EXTERNAL_WIRE_REVERSED -> Known.EXTERNAL_WIRE_REVERSED
+ EXTERNAL_WIRE_SETTLED -> Known.EXTERNAL_WIRE_SETTLED
+ FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION
+ FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION
+ INTEREST -> Known.INTEREST
+ INTEREST_REVERSAL -> Known.INTEREST_REVERSAL
+ INTERNAL_ADJUSTMENT -> Known.INTERNAL_ADJUSTMENT
+ LATE_PAYMENT -> Known.LATE_PAYMENT
+ LATE_PAYMENT_REVERSAL -> Known.LATE_PAYMENT_REVERSAL
+ LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
+ PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
+ PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Known.SERVICE
+ RETURN -> Known.RETURN
+ RETURN_REVERSAL -> Known.RETURN_REVERSAL
+ TRANSFER -> Known.TRANSFER
+ TRANSFER_INSUFFICIENT_FUNDS -> Known.TRANSFER_INSUFFICIENT_FUNDS
+ RETURNED_PAYMENT -> Known.RETURNED_PAYMENT
+ RETURNED_PAYMENT_REVERSAL -> Known.RETURNED_PAYMENT_REVERSAL
+ LITHIC_NETWORK_PAYMENT -> Known.LITHIC_NETWORK_PAYMENT
+ else ->
+ throw LithicInvalidDataException("Unknown FinancialEventType: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LithicInvalidDataException if this class instance's value does not have
+ * the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): FinancialEventType = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is FinancialEventType && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is FinancialEvent &&
+ token == other.token &&
+ amount == other.amount &&
+ created == other.created &&
+ result == other.result &&
+ type == other.type &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(token, amount, created, result, type, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "FinancialEvent{token=$token, amount=$amount, created=$created, result=$result, type=$type, additionalProperties=$additionalProperties}"
+ }
+
+ class TransactionFamilyTypes
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is
+ * on an older version than the API, then the API may respond with new members that the
+ * SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val CARD = of("CARD")
+
+ @JvmField val PAYMENT = of("PAYMENT")
+
+ @JvmField val TRANSFER = of("TRANSFER")
+
+ @JvmField val INTERNAL = of("INTERNAL")
+
+ @JvmField val EXTERNAL_PAYMENT = of("EXTERNAL_PAYMENT")
+
+ @JvmField val MANAGEMENT_OPERATION = of("MANAGEMENT_OPERATION")
+
+ @JvmStatic fun of(value: String) = TransactionFamilyTypes(JsonField.of(value))
+ }
+
+ /** An enum containing [TransactionFamilyTypes]'s known values. */
+ enum class Known {
+ CARD,
+ PAYMENT,
+ TRANSFER,
+ INTERNAL,
+ EXTERNAL_PAYMENT,
+ MANAGEMENT_OPERATION,
+ }
+
+ /**
+ * An enum containing [TransactionFamilyTypes]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionFamilyTypes] can contain an unknown value in a couple of
+ * cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ CARD,
+ PAYMENT,
+ TRANSFER,
+ INTERNAL,
+ EXTERNAL_PAYMENT,
+ MANAGEMENT_OPERATION,
+ /**
+ * An enum member indicating that [TransactionFamilyTypes] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ CARD -> Value.CARD
+ PAYMENT -> Value.PAYMENT
+ TRANSFER -> Value.TRANSFER
+ INTERNAL -> Value.INTERNAL
+ EXTERNAL_PAYMENT -> Value.EXTERNAL_PAYMENT
+ MANAGEMENT_OPERATION -> Value.MANAGEMENT_OPERATION
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ CARD -> Known.CARD
+ PAYMENT -> Known.PAYMENT
+ TRANSFER -> Known.TRANSFER
+ INTERNAL -> Known.INTERNAL
+ EXTERNAL_PAYMENT -> Known.EXTERNAL_PAYMENT
+ MANAGEMENT_OPERATION -> Known.MANAGEMENT_OPERATION
+ else ->
+ throw LithicInvalidDataException("Unknown TransactionFamilyTypes: $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(): TransactionFamilyTypes = apply {
+ if (validated) {
+ return@apply
+ }
known()
validated = true
@@ -1669,7 +2357,7 @@ private constructor(
return true
}
- return other is TransactionStatus && value == other.value
+ return other is TransactionFamilyTypes && value == other.value
}
override fun hashCode() = value.hashCode()
@@ -1677,737 +2365,707 @@ private constructor(
override fun toString() = value.toString()
}
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
+ /** Transaction result */
+ class TransactionResult
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
- return other is FinancialTransaction &&
- token == other.token &&
- category == other.category &&
- created == other.created &&
- currency == other.currency &&
- descriptor == other.descriptor &&
- events == other.events &&
- family == other.family &&
- financialAccountToken == other.financialAccountToken &&
- pendingAmount == other.pendingAmount &&
- result == other.result &&
- settledAmount == other.settledAmount &&
- status == other.status &&
- updated == other.updated &&
- additionalProperties == other.additionalProperties
- }
+ /**
+ * 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
- private val hashCode: Int by lazy {
- Objects.hash(
- token,
- category,
- created,
- currency,
- descriptor,
- events,
- family,
- financialAccountToken,
- pendingAmount,
- result,
- settledAmount,
- status,
- updated,
- additionalProperties,
- )
- }
+ companion object {
- override fun hashCode(): Int = hashCode
+ @JvmField val APPROVED = of("APPROVED")
- override fun toString() =
- "FinancialTransaction{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, updated=$updated, additionalProperties=$additionalProperties}"
- }
+ @JvmField val DECLINED = of("DECLINED")
- /** Book transfer transaction */
- class BookTransferTransaction
- private constructor(
- private val token: JsonField,
- private val category: JsonField,
- private val created: JsonField,
- private val currency: JsonField,
- private val events: JsonField>,
- private val family: JsonField,
- private val fromFinancialAccountToken: JsonField,
- private val pendingAmount: JsonField,
- private val result: JsonField,
- private val settledAmount: JsonField,
- private val status: JsonField,
- private val toFinancialAccountToken: JsonField,
- private val updated: JsonField,
- private val externalId: JsonField,
- private val externalResource: JsonField,
- private val transactionSeries: JsonField,
- private val additionalProperties: MutableMap,
- ) {
+ @JvmStatic fun of(value: String) = TransactionResult(JsonField.of(value))
+ }
- @JsonCreator
- private constructor(
- @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
- @JsonProperty("category")
- @ExcludeMissing
- category: JsonField = JsonMissing.of(),
- @JsonProperty("created")
- @ExcludeMissing
- created: JsonField = JsonMissing.of(),
- @JsonProperty("currency")
- @ExcludeMissing
- currency: JsonField = JsonMissing.of(),
- @JsonProperty("events")
- @ExcludeMissing
- events: JsonField> = JsonMissing.of(),
- @JsonProperty("family")
- @ExcludeMissing
- family: JsonField = JsonMissing.of(),
- @JsonProperty("from_financial_account_token")
- @ExcludeMissing
- fromFinancialAccountToken: JsonField = JsonMissing.of(),
- @JsonProperty("pending_amount")
- @ExcludeMissing
- pendingAmount: JsonField = JsonMissing.of(),
- @JsonProperty("result")
- @ExcludeMissing
- result: JsonField = JsonMissing.of(),
- @JsonProperty("settled_amount")
- @ExcludeMissing
- settledAmount: JsonField = JsonMissing.of(),
- @JsonProperty("status")
- @ExcludeMissing
- status: JsonField = JsonMissing.of(),
- @JsonProperty("to_financial_account_token")
- @ExcludeMissing
- toFinancialAccountToken: JsonField = JsonMissing.of(),
- @JsonProperty("updated")
- @ExcludeMissing
- updated: JsonField = JsonMissing.of(),
- @JsonProperty("external_id")
- @ExcludeMissing
- externalId: JsonField = JsonMissing.of(),
- @JsonProperty("external_resource")
- @ExcludeMissing
- externalResource: JsonField = JsonMissing.of(),
- @JsonProperty("transaction_series")
- @ExcludeMissing
- transactionSeries: JsonField = JsonMissing.of(),
- ) : this(
- token,
- category,
- created,
- currency,
- events,
- family,
- fromFinancialAccountToken,
- pendingAmount,
- result,
- settledAmount,
- status,
- toFinancialAccountToken,
- updated,
- externalId,
- externalResource,
- transactionSeries,
- mutableMapOf(),
- )
+ /** An enum containing [TransactionResult]'s known values. */
+ enum class Known {
+ APPROVED,
+ DECLINED,
+ }
- /**
- * Unique identifier for the transaction
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun token(): String = token.getRequired("token")
+ /**
+ * An enum containing [TransactionResult]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionResult] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ APPROVED,
+ DECLINED,
+ /**
+ * An enum member indicating that [TransactionResult] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
- /**
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun category(): TransactionCategory = category.getRequired("category")
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ APPROVED -> Value.APPROVED
+ DECLINED -> Value.DECLINED
+ else -> Value._UNKNOWN
+ }
- /**
- * ISO 8601 timestamp of when the transaction was created
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun created(): OffsetDateTime = created.getRequired("created")
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ APPROVED -> Known.APPROVED
+ DECLINED -> Known.DECLINED
+ else -> throw LithicInvalidDataException("Unknown TransactionResult: $value")
+ }
- /**
- * Currency of the transaction in ISO 4217 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 currency(): String = currency.getRequired("currency")
+ /**
+ * 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")
+ }
- /**
- * List of events associated with this book transfer
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun events(): List = events.getRequired("events")
+ private var validated: Boolean = false
- /**
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun family(): TransactionFamilyTypes = family.getRequired("family")
+ fun validate(): TransactionResult = apply {
+ if (validated) {
+ return@apply
+ }
- /**
- * Source account 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 fromFinancialAccountToken(): String =
- fromFinancialAccountToken.getRequired("from_financial_account_token")
+ known()
+ validated = true
+ }
- /**
- * The pending amount of the transaction 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 pendingAmount(): Long = pendingAmount.getRequired("pending_amount")
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
- /**
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun result(): TransactionResult = result.getRequired("result")
+ /**
+ * Returns 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
- /**
- * The settled amount of the transaction 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 settledAmount(): Long = settledAmount.getRequired("settled_amount")
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
- /**
- * The status of the transaction
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun status(): TransactionStatus = status.getRequired("status")
+ return other is TransactionResult && value == other.value
+ }
- /**
- * Destination account 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 toFinancialAccountToken(): String =
- toFinancialAccountToken.getRequired("to_financial_account_token")
+ override fun hashCode() = value.hashCode()
- /**
- * ISO 8601 timestamp of when the transaction was last updated
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
- * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
- */
- fun updated(): OffsetDateTime = updated.getRequired("updated")
+ override fun toString() = value.toString()
+ }
- /**
- * External identifier for the transaction
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun externalId(): Optional = externalId.getOptional("external_id")
+ /** The status of the transaction */
+ class TransactionStatus
+ @JsonCreator
+ private constructor(private val value: JsonField) : Enum {
- /**
- * External resource associated with the management operation
- *
- * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun externalResource(): Optional =
- externalResource.getOptional("external_resource")
+ /**
+ * 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
- /**
- * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun transactionSeries(): Optional =
- transactionSeries.getOptional("transaction_series")
+ companion object {
- /**
- * 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 PENDING = of("PENDING")
- /**
- * Returns the raw JSON value of [category].
- *
- * Unlike [category], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("category")
- @ExcludeMissing
- fun _category(): JsonField = category
+ @JvmField val SETTLED = of("SETTLED")
- /**
- * 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 DECLINED = of("DECLINED")
- /**
- * Returns the raw JSON value of [currency].
- *
- * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
+ @JvmField val REVERSED = of("REVERSED")
- /**
- * Returns the raw JSON value of [events].
- *
- * Unlike [events], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("events") @ExcludeMissing fun _events(): JsonField> = events
+ @JvmField val CANCELED = of("CANCELED")
- /**
- * Returns the raw JSON value of [family].
- *
- * Unlike [family], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("family")
- @ExcludeMissing
- fun _family(): JsonField = family
+ @JvmStatic fun of(value: String) = TransactionStatus(JsonField.of(value))
+ }
- /**
- * Returns the raw JSON value of [fromFinancialAccountToken].
- *
- * Unlike [fromFinancialAccountToken], this method doesn't throw if the JSON field has an
- * unexpected type.
- */
- @JsonProperty("from_financial_account_token")
- @ExcludeMissing
- fun _fromFinancialAccountToken(): JsonField = fromFinancialAccountToken
+ /** An enum containing [TransactionStatus]'s known values. */
+ enum class Known {
+ PENDING,
+ SETTLED,
+ DECLINED,
+ REVERSED,
+ CANCELED,
+ }
- /**
- * Returns the raw JSON value of [pendingAmount].
- *
- * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("pending_amount")
- @ExcludeMissing
- fun _pendingAmount(): JsonField = pendingAmount
+ /**
+ * An enum containing [TransactionStatus]'s known values, as well as an [_UNKNOWN]
+ * member.
+ *
+ * An instance of [TransactionStatus] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ PENDING,
+ SETTLED,
+ DECLINED,
+ REVERSED,
+ CANCELED,
+ /**
+ * An enum member indicating that [TransactionStatus] was instantiated with an
+ * unknown value.
+ */
+ _UNKNOWN,
+ }
- /**
- * Returns the raw JSON value of [result].
- *
- * Unlike [result], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if you
+ * want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ PENDING -> Value.PENDING
+ SETTLED -> Value.SETTLED
+ DECLINED -> Value.DECLINED
+ REVERSED -> Value.REVERSED
+ CANCELED -> Value.CANCELED
+ else -> Value._UNKNOWN
+ }
- /**
- * Returns the raw JSON value of [settledAmount].
- *
- * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("settled_amount")
- @ExcludeMissing
- fun _settledAmount(): JsonField = settledAmount
-
- /**
- * 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 [toFinancialAccountToken].
- *
- * Unlike [toFinancialAccountToken], this method doesn't throw if the JSON field has an
- * unexpected type.
- */
- @JsonProperty("to_financial_account_token")
- @ExcludeMissing
- fun _toFinancialAccountToken(): JsonField = toFinancialAccountToken
-
- /**
- * Returns the raw JSON value of [updated].
- *
- * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated
-
- /**
- * Returns the raw JSON value of [externalId].
- *
- * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("external_id")
- @ExcludeMissing
- fun _externalId(): JsonField = externalId
-
- /**
- * Returns the raw JSON value of [externalResource].
- *
- * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("external_resource")
- @ExcludeMissing
- fun _externalResource(): JsonField = externalResource
-
- /**
- * Returns the raw JSON value of [transactionSeries].
- *
- * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("transaction_series")
- @ExcludeMissing
- fun _transactionSeries(): JsonField = transactionSeries
-
- @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 an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ PENDING -> Known.PENDING
+ SETTLED -> Known.SETTLED
+ DECLINED -> Known.DECLINED
+ REVERSED -> Known.REVERSED
+ CANCELED -> Known.CANCELED
+ else -> throw LithicInvalidDataException("Unknown TransactionStatus: $value")
+ }
/**
- * Returns a mutable builder for constructing an instance of [BookTransferTransaction].
+ * Returns this class instance's primitive wire representation.
*
- * The following fields are required:
- * ```java
- * .token()
- * .category()
- * .created()
- * .currency()
- * .events()
- * .family()
- * .fromFinancialAccountToken()
- * .pendingAmount()
- * .result()
- * .settledAmount()
- * .status()
- * .toFinancialAccountToken()
- * .updated()
- * ```
+ * 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.
*/
- @JvmStatic fun builder() = Builder()
- }
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LithicInvalidDataException("Value is not a String")
+ }
- /** A builder for [BookTransferTransaction]. */
- class Builder internal constructor() {
+ private var validated: Boolean = false
- private var token: JsonField? = null
- private var category: JsonField? = null
- private var created: JsonField? = null
- private var currency: JsonField? = null
- private var events: JsonField>? = null
- private var family: JsonField? = null
- private var fromFinancialAccountToken: JsonField? = null
- private var pendingAmount: JsonField? = null
- private var result: JsonField? = null
- private var settledAmount: JsonField? = null
- private var status: JsonField? = null
- private var toFinancialAccountToken: JsonField? = null
- private var updated: JsonField? = null
- private var externalId: JsonField = JsonMissing.of()
- private var externalResource: JsonField = JsonMissing.of()
- private var transactionSeries: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
+ fun validate(): TransactionStatus = apply {
+ if (validated) {
+ return@apply
+ }
- @JvmSynthetic
- internal fun from(bookTransferTransaction: BookTransferTransaction) = apply {
- token = bookTransferTransaction.token
- category = bookTransferTransaction.category
- created = bookTransferTransaction.created
- currency = bookTransferTransaction.currency
- events = bookTransferTransaction.events.map { it.toMutableList() }
- family = bookTransferTransaction.family
- fromFinancialAccountToken = bookTransferTransaction.fromFinancialAccountToken
- pendingAmount = bookTransferTransaction.pendingAmount
- result = bookTransferTransaction.result
- settledAmount = bookTransferTransaction.settledAmount
- status = bookTransferTransaction.status
- toFinancialAccountToken = bookTransferTransaction.toFinancialAccountToken
- updated = bookTransferTransaction.updated
- externalId = bookTransferTransaction.externalId
- externalResource = bookTransferTransaction.externalResource
- transactionSeries = bookTransferTransaction.transactionSeries
- additionalProperties = bookTransferTransaction.additionalProperties.toMutableMap()
+ known()
+ validated = true
}
- /** Unique identifier for the transaction */
- fun token(token: String) = token(JsonField.of(token))
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
/**
- * Sets [Builder.token] to an arbitrary JSON value.
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
*
- * 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.
+ * Used for best match union deserialization.
*/
- fun token(token: JsonField) = apply { this.token = token }
+ @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1
- fun category(category: TransactionCategory) = category(JsonField.of(category))
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
- /**
- * Sets [Builder.category] to an arbitrary JSON value.
- *
- * You should usually call [Builder.category] with a well-typed [TransactionCategory]
- * value instead. This method is primarily for setting the field to an undocumented or
- * not yet supported value.
- */
- fun category(category: JsonField) = apply {
- this.category = category
+ return other is TransactionStatus && value == other.value
}
- /** ISO 8601 timestamp of when the transaction was created */
- fun created(created: OffsetDateTime) = created(JsonField.of(created))
-
- /**
- * Sets [Builder.created] to an arbitrary JSON value.
- *
- * You should usually call [Builder.created] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun created(created: JsonField) = apply { this.created = created }
+ override fun hashCode() = value.hashCode()
- /** Currency of the transaction in ISO 4217 format */
- fun currency(currency: String) = currency(JsonField.of(currency))
+ override fun toString() = value.toString()
+ }
- /**
- * Sets [Builder.currency] to an arbitrary JSON value.
- *
- * You should usually call [Builder.currency] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun currency(currency: JsonField) = apply { this.currency = currency }
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
- /** List of events associated with this book transfer */
- fun events(events: List) = events(JsonField.of(events))
+ return other is FinancialTransaction &&
+ token == other.token &&
+ category == other.category &&
+ created == other.created &&
+ currency == other.currency &&
+ descriptor == other.descriptor &&
+ events == other.events &&
+ family == other.family &&
+ financialAccountToken == other.financialAccountToken &&
+ pendingAmount == other.pendingAmount &&
+ result == other.result &&
+ settledAmount == other.settledAmount &&
+ status == other.status &&
+ updated == other.updated &&
+ additionalProperties == other.additionalProperties
+ }
- /**
- * Sets [Builder.events] to an arbitrary JSON value.
- *
- * You should usually call [Builder.events] with a well-typed `List` value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun events(events: JsonField>) = apply {
- this.events = events.map { it.toMutableList() }
- }
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ token,
+ category,
+ created,
+ currency,
+ descriptor,
+ events,
+ family,
+ financialAccountToken,
+ pendingAmount,
+ result,
+ settledAmount,
+ status,
+ updated,
+ additionalProperties,
+ )
+ }
- /**
- * Adds a single [JsonValue] to [events].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addEvent(event: JsonValue) = apply {
- events =
- (events ?: JsonField.of(mutableListOf())).also {
- checkKnown("events", it).add(event)
- }
- }
+ override fun hashCode(): Int = hashCode
- fun family(family: TransactionFamilyTypes) = family(JsonField.of(family))
+ override fun toString() =
+ "FinancialTransaction{token=$token, category=$category, created=$created, currency=$currency, descriptor=$descriptor, events=$events, family=$family, financialAccountToken=$financialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, updated=$updated, additionalProperties=$additionalProperties}"
+ }
- /**
- * Sets [Builder.family] to an arbitrary JSON value.
- *
- * You should usually call [Builder.family] with a well-typed [TransactionFamilyTypes]
- * value instead. This method is primarily for setting the field to an undocumented or
- * not yet supported value.
- */
- fun family(family: JsonField) = apply { this.family = family }
+ /** Book transfer transaction */
+ class BookTransferTransaction
+ private constructor(
+ private val token: JsonField,
+ private val category: JsonField,
+ private val created: JsonField,
+ private val currency: JsonField,
+ private val events: JsonField>,
+ private val family: JsonField,
+ private val fromFinancialAccountToken: JsonField,
+ private val pendingAmount: JsonField,
+ private val result: JsonField,
+ private val settledAmount: JsonField,
+ private val status: JsonField,
+ private val toFinancialAccountToken: JsonField,
+ private val updated: JsonField,
+ private val externalId: JsonField,
+ private val externalResource: JsonField,
+ private val transactionSeries: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
- /** Source account token */
- fun fromFinancialAccountToken(fromFinancialAccountToken: String) =
- fromFinancialAccountToken(JsonField.of(fromFinancialAccountToken))
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("category")
+ @ExcludeMissing
+ category: JsonField = JsonMissing.of(),
+ @JsonProperty("created")
+ @ExcludeMissing
+ created: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ currency: JsonField = JsonMissing.of(),
+ @JsonProperty("events")
+ @ExcludeMissing
+ events: JsonField> = JsonMissing.of(),
+ @JsonProperty("family")
+ @ExcludeMissing
+ family: JsonField = JsonMissing.of(),
+ @JsonProperty("from_financial_account_token")
+ @ExcludeMissing
+ fromFinancialAccountToken: JsonField = JsonMissing.of(),
+ @JsonProperty("pending_amount")
+ @ExcludeMissing
+ pendingAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("result")
+ @ExcludeMissing
+ result: JsonField = JsonMissing.of(),
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ settledAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("status")
+ @ExcludeMissing
+ status: JsonField = JsonMissing.of(),
+ @JsonProperty("to_financial_account_token")
+ @ExcludeMissing
+ toFinancialAccountToken: JsonField = JsonMissing.of(),
+ @JsonProperty("updated")
+ @ExcludeMissing
+ updated: JsonField = JsonMissing.of(),
+ @JsonProperty("external_id")
+ @ExcludeMissing
+ externalId: JsonField = JsonMissing.of(),
+ @JsonProperty("external_resource")
+ @ExcludeMissing
+ externalResource: JsonField = JsonMissing.of(),
+ @JsonProperty("transaction_series")
+ @ExcludeMissing
+ transactionSeries: JsonField = JsonMissing.of(),
+ ) : this(
+ token,
+ category,
+ created,
+ currency,
+ events,
+ family,
+ fromFinancialAccountToken,
+ pendingAmount,
+ result,
+ settledAmount,
+ status,
+ toFinancialAccountToken,
+ updated,
+ externalId,
+ externalResource,
+ transactionSeries,
+ mutableMapOf(),
+ )
- /**
- * Sets [Builder.fromFinancialAccountToken] to an arbitrary JSON value.
- *
- * You should usually call [Builder.fromFinancialAccountToken] with a well-typed
- * [String] value instead. This method is primarily for setting the field to an
- * undocumented or not yet supported value.
- */
- fun fromFinancialAccountToken(fromFinancialAccountToken: JsonField) = apply {
- this.fromFinancialAccountToken = fromFinancialAccountToken
- }
+ /**
+ * Unique identifier for the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun token(): String = token.getRequired("token")
- /** The pending amount of the transaction in cents */
- fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount))
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun category(): TransactionCategory = category.getRequired("category")
- /**
- * Sets [Builder.pendingAmount] to an arbitrary JSON value.
- *
- * You should usually call [Builder.pendingAmount] with a well-typed [Long] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun pendingAmount(pendingAmount: JsonField) = apply {
- this.pendingAmount = pendingAmount
- }
+ /**
+ * ISO 8601 timestamp of when the transaction was created
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun created(): OffsetDateTime = created.getRequired("created")
- fun result(result: TransactionResult) = result(JsonField.of(result))
+ /**
+ * Currency of the transaction in ISO 4217 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 currency(): String = currency.getRequired("currency")
- /**
- * Sets [Builder.result] to an arbitrary JSON value.
- *
- * You should usually call [Builder.result] with a well-typed [TransactionResult] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun result(result: JsonField) = apply { this.result = result }
+ /**
+ * List of events associated with this book transfer
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun events(): List = events.getRequired("events")
- /** The settled amount of the transaction in cents */
- fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun family(): TransactionFamilyTypes = family.getRequired("family")
- /**
- * Sets [Builder.settledAmount] to an arbitrary JSON value.
- *
- * You should usually call [Builder.settledAmount] with a well-typed [Long] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun settledAmount(settledAmount: JsonField) = apply {
- this.settledAmount = settledAmount
- }
+ /**
+ * Source account 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 fromFinancialAccountToken(): String =
+ fromFinancialAccountToken.getRequired("from_financial_account_token")
- /** The status of the transaction */
- fun status(status: TransactionStatus) = status(JsonField.of(status))
+ /**
+ * The pending amount of the transaction 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 pendingAmount(): Long = pendingAmount.getRequired("pending_amount")
- /**
- * Sets [Builder.status] to an arbitrary JSON value.
- *
- * You should usually call [Builder.status] with a well-typed [TransactionStatus] 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 }
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun result(): TransactionResult = result.getRequired("result")
- /** Destination account token */
- fun toFinancialAccountToken(toFinancialAccountToken: String) =
- toFinancialAccountToken(JsonField.of(toFinancialAccountToken))
+ /**
+ * The settled amount of the transaction 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 settledAmount(): Long = settledAmount.getRequired("settled_amount")
- /**
- * Sets [Builder.toFinancialAccountToken] to an arbitrary JSON value.
- *
- * You should usually call [Builder.toFinancialAccountToken] with a well-typed [String]
- * value instead. This method is primarily for setting the field to an undocumented or
- * not yet supported value.
- */
- fun toFinancialAccountToken(toFinancialAccountToken: JsonField) = apply {
- this.toFinancialAccountToken = toFinancialAccountToken
- }
+ /**
+ * The status of the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun status(): TransactionStatus = status.getRequired("status")
- /** ISO 8601 timestamp of when the transaction was last updated */
- fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))
+ /**
+ * Destination account 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 toFinancialAccountToken(): String =
+ toFinancialAccountToken.getRequired("to_financial_account_token")
- /**
- * Sets [Builder.updated] to an arbitrary JSON value.
- *
- * You should usually call [Builder.updated] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun updated(updated: JsonField) = apply { this.updated = updated }
+ /**
+ * ISO 8601 timestamp of when the transaction was last updated
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun updated(): OffsetDateTime = updated.getRequired("updated")
- /** External identifier for the transaction */
- fun externalId(externalId: String) = externalId(JsonField.of(externalId))
+ /**
+ * External identifier for the transaction
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun externalId(): Optional = externalId.getOptional("external_id")
- /**
- * Sets [Builder.externalId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.externalId] with a well-typed [String] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun externalId(externalId: JsonField) = apply { this.externalId = externalId }
+ /**
+ * External resource associated with the management operation
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun externalResource(): Optional =
+ externalResource.getOptional("external_resource")
- /** External resource associated with the management operation */
- fun externalResource(externalResource: ExternalResource?) =
- externalResource(JsonField.ofNullable(externalResource))
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun transactionSeries(): Optional =
+ transactionSeries.getOptional("transaction_series")
- /**
- * Alias for calling [Builder.externalResource] with `externalResource.orElse(null)`.
- */
- fun externalResource(externalResource: Optional) =
- externalResource(externalResource.getOrNull())
+ /**
+ * 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
- /**
- * Sets [Builder.externalResource] to an arbitrary JSON value.
- *
- * You should usually call [Builder.externalResource] with a well-typed
- * [ExternalResource] value instead. This method is primarily for setting the field to
- * an undocumented or not yet supported value.
- */
- fun externalResource(externalResource: JsonField) = apply {
- this.externalResource = externalResource
- }
+ /**
+ * Returns the raw JSON value of [category].
+ *
+ * Unlike [category], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("category")
+ @ExcludeMissing
+ fun _category(): JsonField = category
- fun transactionSeries(transactionSeries: TransactionSeries?) =
- transactionSeries(JsonField.ofNullable(transactionSeries))
+ /**
+ * 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
- /**
- * Alias for calling [Builder.transactionSeries] with `transactionSeries.orElse(null)`.
- */
- fun transactionSeries(transactionSeries: Optional) =
- transactionSeries(transactionSeries.getOrNull())
+ /**
+ * Returns the raw JSON value of [currency].
+ *
+ * Unlike [currency], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
- /**
- * Sets [Builder.transactionSeries] to an arbitrary JSON value.
- *
- * You should usually call [Builder.transactionSeries] with a well-typed
- * [TransactionSeries] value instead. This method is primarily for setting the field to
- * an undocumented or not yet supported value.
- */
- fun transactionSeries(transactionSeries: JsonField) = apply {
- this.transactionSeries = transactionSeries
- }
+ /**
+ * Returns the raw JSON value of [events].
+ *
+ * Unlike [events], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("events")
+ @ExcludeMissing
+ fun _events(): JsonField> = events
- fun additionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.clear()
- putAllAdditionalProperties(additionalProperties)
- }
+ /**
+ * Returns the raw JSON value of [family].
+ *
+ * Unlike [family], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("family")
+ @ExcludeMissing
+ fun _family(): JsonField = family
- fun putAdditionalProperty(key: String, value: JsonValue) = apply {
- additionalProperties.put(key, value)
- }
+ /**
+ * Returns the raw JSON value of [fromFinancialAccountToken].
+ *
+ * Unlike [fromFinancialAccountToken], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("from_financial_account_token")
+ @ExcludeMissing
+ fun _fromFinancialAccountToken(): JsonField = fromFinancialAccountToken
- fun putAllAdditionalProperties(additionalProperties: Map) = apply {
- this.additionalProperties.putAll(additionalProperties)
- }
+ /**
+ * Returns the raw JSON value of [pendingAmount].
+ *
+ * Unlike [pendingAmount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("pending_amount")
+ @ExcludeMissing
+ fun _pendingAmount(): JsonField = pendingAmount
- fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
+ /**
+ * Returns the raw JSON value of [result].
+ *
+ * Unlike [result], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("result") @ExcludeMissing fun _result(): JsonField = result
- fun removeAllAdditionalProperties(keys: Set) = apply {
- keys.forEach(::removeAdditionalProperty)
- }
+ /**
+ * Returns the raw JSON value of [settledAmount].
+ *
+ * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ fun _settledAmount(): JsonField = settledAmount
+
+ /**
+ * 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 [toFinancialAccountToken].
+ *
+ * Unlike [toFinancialAccountToken], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("to_financial_account_token")
+ @ExcludeMissing
+ fun _toFinancialAccountToken(): JsonField = toFinancialAccountToken
+
+ /**
+ * Returns the raw JSON value of [updated].
+ *
+ * Unlike [updated], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("updated") @ExcludeMissing fun _updated(): JsonField = updated
+
+ /**
+ * Returns the raw JSON value of [externalId].
+ *
+ * Unlike [externalId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("external_id")
+ @ExcludeMissing
+ fun _externalId(): JsonField = externalId
+
+ /**
+ * Returns the raw JSON value of [externalResource].
+ *
+ * Unlike [externalResource], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("external_resource")
+ @ExcludeMissing
+ fun _externalResource(): JsonField = externalResource
+
+ /**
+ * Returns the raw JSON value of [transactionSeries].
+ *
+ * Unlike [transactionSeries], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("transaction_series")
+ @ExcludeMissing
+ fun _transactionSeries(): JsonField = transactionSeries
+
+ @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 an immutable instance of [BookTransferTransaction].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
+ * Returns a mutable builder for constructing an instance of [BookTransferTransaction].
*
* The following fields are required:
* ```java
@@ -2425,450 +3083,409 @@ private constructor(
* .toFinancialAccountToken()
* .updated()
* ```
- *
- * @throws IllegalStateException if any required field is unset.
*/
- fun build(): BookTransferTransaction =
- BookTransferTransaction(
- checkRequired("token", token),
- checkRequired("category", category),
- checkRequired("created", created),
- checkRequired("currency", currency),
- checkRequired("events", events).map { it.toImmutable() },
- checkRequired("family", family),
- checkRequired("fromFinancialAccountToken", fromFinancialAccountToken),
- checkRequired("pendingAmount", pendingAmount),
- checkRequired("result", result),
- checkRequired("settledAmount", settledAmount),
- checkRequired("status", status),
- checkRequired("toFinancialAccountToken", toFinancialAccountToken),
- checkRequired("updated", updated),
- externalId,
- externalResource,
- transactionSeries,
- additionalProperties.toMutableMap(),
- )
+ @JvmStatic fun builder() = Builder()
}
- private var validated: Boolean = false
-
- fun validate(): BookTransferTransaction = apply {
- if (validated) {
- return@apply
- }
+ /** A builder for [BookTransferTransaction]. */
+ class Builder internal constructor() {
- token()
- category().validate()
- created()
- currency()
- events()
- family().validate()
- fromFinancialAccountToken()
- pendingAmount()
- result().validate()
- settledAmount()
- status().validate()
- toFinancialAccountToken()
- updated()
- externalId()
- externalResource().ifPresent { it.validate() }
- transactionSeries().ifPresent { it.validate() }
- validated = true
- }
+ private var token: JsonField? = null
+ private var category: JsonField? = null
+ private var created: JsonField? = null
+ private var currency: JsonField? = null
+ private var events: JsonField>? = null
+ private var family: JsonField? = null
+ private var fromFinancialAccountToken: JsonField? = null
+ private var pendingAmount: JsonField? = null
+ private var result: JsonField? = null
+ private var settledAmount: JsonField? = null
+ private var status: JsonField? = null
+ private var toFinancialAccountToken: JsonField? = null
+ private var updated: JsonField? = null
+ private var externalId: JsonField = JsonMissing.of()
+ private var externalResource: JsonField = JsonMissing.of()
+ private var transactionSeries: JsonField