diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 906878cb..dac8da6a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,10 +22,10 @@ jobs:
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
- uses: actions/setup-java@v5
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: |
@@ -34,7 +34,7 @@ jobs:
cache: gradle
- name: Set up Gradle
- uses: gradle/actions/setup-gradle@v4
+ uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3
- name: Run lints
run: ./scripts/lint
@@ -49,10 +49,10 @@ jobs:
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
- uses: actions/setup-java@v5
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: |
@@ -61,7 +61,7 @@ jobs:
cache: gradle
- name: Set up Gradle
- uses: gradle/actions/setup-gradle@v4
+ uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4.4.3
- name: Build SDK
run: ./scripts/build
@@ -71,7 +71,7 @@ jobs:
github.repository == 'stainless-sdks/lithic-java' &&
!startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
- uses: actions/github-script@v8
+ uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: core.setOutput('github_token', await core.getIDToken());
@@ -91,10 +91,10 @@ jobs:
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@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
- uses: actions/setup-java@v5
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: |
@@ -103,7 +103,7 @@ jobs:
cache: gradle
- name: Set up Gradle
- uses: gradle/gradle-build-action@v2
+ uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
- name: Run tests
run: ./scripts/test
diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml
index 68a62dbb..6d4b3b1d 100644
--- a/.github/workflows/publish-sonatype.yml
+++ b/.github/workflows/publish-sonatype.yml
@@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Java
- uses: actions/setup-java@v5
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: temurin
java-version: |
@@ -26,7 +26,7 @@ jobs:
cache: gradle
- name: Set up Gradle
- uses: gradle/gradle-build-action@v2
+ uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
- name: Publish to Sonatype
run: |-
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 8cee1761..627c2555 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -12,7 +12,7 @@ jobs:
if: github.repository == 'lithic-com/lithic-java' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
steps:
- - uses: actions/checkout@v6
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check release environment
run: |
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index f38100a4..47775e91 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.126.0"
+ ".": "0.127.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 9a940850..b5b02fac 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 193
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-00f07b0edcc0c3c5ef79920ced7f58dac2434df5e4c27ff6041783e8228315f9.yml
-openapi_spec_hash: 963688b09480159a06865075c94a2577
-config_hash: 265a2b679964f4ad5706de101ad2a942
+configured_endpoints: 194
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic/lithic-19240135588c2012b39cde86218a05c471b3e7831b57c736704e3fbca109e3a9.yml
+openapi_spec_hash: c6a5c719b89e08de52aea005b39fd5a6
+config_hash: 1c5c139a2aa0d1d45c063f953a9bc803
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e1207996..a89a88de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,18 @@
# Changelog
+## 0.127.0 (2026-05-15)
+
+Full Changelog: [v0.126.0...v0.127.0](https://github.com/lithic-com/lithic-java/compare/v0.126.0...v0.127.0)
+
+### Features
+
+* **api:** add card authorization challenge webhook, rename types in authorization models ([295e9f3](https://github.com/lithic-com/lithic-java/commit/295e9f3ce7a09c03f9c31b490f9b176d16c9194a))
+
+
+### Bug Fixes
+
+* **types:** change number from Long to Double in ConditionalValue and conditional actions ([57b5b27](https://github.com/lithic-com/lithic-java/commit/57b5b279f5c23550dbc40946227d483410ca0c14))
+
## 0.126.0 (2026-05-08)
Full Changelog: [v0.125.0...v0.126.0](https://github.com/lithic-com/lithic-java/compare/v0.125.0...v0.126.0)
diff --git a/README.md b/README.md
index 251eadd5..e4c826c5 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.126.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.126.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.127.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.127.0)
@@ -22,7 +22,7 @@ Use the Lithic MCP Server to enable AI assistants to interact with this API, all
-The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.126.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.127.0).
@@ -33,7 +33,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.126.0")
+implementation("com.lithic.api:lithic-java:0.127.0")
```
### Maven
@@ -42,7 +42,7 @@ implementation("com.lithic.api:lithic-java:0.126.0")
com.lithic.api
lithic-java
- 0.126.0
+ 0.127.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 4b8f86ba..86353f33 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.126.0" // x-release-please-version
+ version = "0.127.0" // x-release-please-version
}
subprojects {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
index 6dd840a3..4a24821c 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt
@@ -15,6 +15,7 @@ import com.lithic.api.services.blocking.AuthRuleService
import com.lithic.api.services.blocking.AuthStreamEnrollmentService
import com.lithic.api.services.blocking.BalanceService
import com.lithic.api.services.blocking.BookTransferService
+import com.lithic.api.services.blocking.CardAuthorizationService
import com.lithic.api.services.blocking.CardBulkOrderService
import com.lithic.api.services.blocking.CardProgramService
import com.lithic.api.services.blocking.CardService
@@ -94,6 +95,8 @@ interface LithicClient {
fun cards(): CardService
+ fun cardAuthorizations(): CardAuthorizationService
+
fun cardBulkOrders(): CardBulkOrderService
fun balances(): BalanceService
@@ -202,6 +205,8 @@ interface LithicClient {
fun cards(): CardService.WithRawResponse
+ fun cardAuthorizations(): CardAuthorizationService.WithRawResponse
+
fun cardBulkOrders(): CardBulkOrderService.WithRawResponse
fun balances(): BalanceService.WithRawResponse
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
index d5ee8d11..5949ef13 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt
@@ -14,6 +14,7 @@ import com.lithic.api.services.async.AuthRuleServiceAsync
import com.lithic.api.services.async.AuthStreamEnrollmentServiceAsync
import com.lithic.api.services.async.BalanceServiceAsync
import com.lithic.api.services.async.BookTransferServiceAsync
+import com.lithic.api.services.async.CardAuthorizationServiceAsync
import com.lithic.api.services.async.CardBulkOrderServiceAsync
import com.lithic.api.services.async.CardProgramServiceAsync
import com.lithic.api.services.async.CardServiceAsync
@@ -94,6 +95,8 @@ interface LithicClientAsync {
fun cards(): CardServiceAsync
+ fun cardAuthorizations(): CardAuthorizationServiceAsync
+
fun cardBulkOrders(): CardBulkOrderServiceAsync
fun balances(): BalanceServiceAsync
@@ -205,6 +208,8 @@ interface LithicClientAsync {
fun cards(): CardServiceAsync.WithRawResponse
+ fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse
+
fun cardBulkOrders(): CardBulkOrderServiceAsync.WithRawResponse
fun balances(): BalanceServiceAsync.WithRawResponse
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
index 97d63df6..5b72a4d0 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt
@@ -31,6 +31,8 @@ import com.lithic.api.services.async.BalanceServiceAsync
import com.lithic.api.services.async.BalanceServiceAsyncImpl
import com.lithic.api.services.async.BookTransferServiceAsync
import com.lithic.api.services.async.BookTransferServiceAsyncImpl
+import com.lithic.api.services.async.CardAuthorizationServiceAsync
+import com.lithic.api.services.async.CardAuthorizationServiceAsyncImpl
import com.lithic.api.services.async.CardBulkOrderServiceAsync
import com.lithic.api.services.async.CardBulkOrderServiceAsyncImpl
import com.lithic.api.services.async.CardProgramServiceAsync
@@ -131,6 +133,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
private val cards: CardServiceAsync by lazy { CardServiceAsyncImpl(clientOptionsWithUserAgent) }
+ private val cardAuthorizations: CardAuthorizationServiceAsync by lazy {
+ CardAuthorizationServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
private val cardBulkOrders: CardBulkOrderServiceAsync by lazy {
CardBulkOrderServiceAsyncImpl(clientOptionsWithUserAgent)
}
@@ -259,6 +265,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
override fun cards(): CardServiceAsync = cards
+ override fun cardAuthorizations(): CardAuthorizationServiceAsync = cardAuthorizations
+
override fun cardBulkOrders(): CardBulkOrderServiceAsync = cardBulkOrders
override fun balances(): BalanceServiceAsync = balances
@@ -357,6 +365,10 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
CardServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val cardAuthorizations: CardAuthorizationServiceAsync.WithRawResponse by lazy {
+ CardAuthorizationServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val cardBulkOrders: CardBulkOrderServiceAsync.WithRawResponse by lazy {
CardBulkOrderServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
@@ -488,6 +500,9 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
override fun cards(): CardServiceAsync.WithRawResponse = cards
+ override fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse =
+ cardAuthorizations
+
override fun cardBulkOrders(): CardBulkOrderServiceAsync.WithRawResponse = cardBulkOrders
override fun balances(): BalanceServiceAsync.WithRawResponse = balances
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
index f9808009..f5fec8e1 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt
@@ -31,6 +31,8 @@ import com.lithic.api.services.blocking.BalanceService
import com.lithic.api.services.blocking.BalanceServiceImpl
import com.lithic.api.services.blocking.BookTransferService
import com.lithic.api.services.blocking.BookTransferServiceImpl
+import com.lithic.api.services.blocking.CardAuthorizationService
+import com.lithic.api.services.blocking.CardAuthorizationServiceImpl
import com.lithic.api.services.blocking.CardBulkOrderService
import com.lithic.api.services.blocking.CardBulkOrderServiceImpl
import com.lithic.api.services.blocking.CardProgramService
@@ -128,6 +130,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
private val cards: CardService by lazy { CardServiceImpl(clientOptionsWithUserAgent) }
+ private val cardAuthorizations: CardAuthorizationService by lazy {
+ CardAuthorizationServiceImpl(clientOptionsWithUserAgent)
+ }
+
private val cardBulkOrders: CardBulkOrderService by lazy {
CardBulkOrderServiceImpl(clientOptionsWithUserAgent)
}
@@ -239,6 +245,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
override fun cards(): CardService = cards
+ override fun cardAuthorizations(): CardAuthorizationService = cardAuthorizations
+
override fun cardBulkOrders(): CardBulkOrderService = cardBulkOrders
override fun balances(): BalanceService = balances
@@ -337,6 +345,10 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
CardServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val cardAuthorizations: CardAuthorizationService.WithRawResponse by lazy {
+ CardAuthorizationServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val cardBulkOrders: CardBulkOrderService.WithRawResponse by lazy {
CardBulkOrderServiceImpl.WithRawResponseImpl(clientOptions)
}
@@ -468,6 +480,9 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
override fun cards(): CardService.WithRawResponse = cards
+ override fun cardAuthorizations(): CardAuthorizationService.WithRawResponse =
+ cardAuthorizations
+
override fun cardBulkOrders(): CardBulkOrderService.WithRawResponse = cardBulkOrders
override fun balances(): BalanceService.WithRawResponse = balances
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt
index 24b8c8ab..ef2ed837 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleCondition.kt
@@ -258,8 +258,11 @@ private constructor(
/** Alias for calling [value] with `ConditionalValue.ofRegex(regex)`. */
fun value(regex: String) = value(ConditionalValue.ofRegex(regex))
+ /** Alias for calling [value] with `ConditionalValue.ofInteger(integer)`. */
+ fun value(integer: Long) = value(ConditionalValue.ofInteger(integer))
+
/** Alias for calling [value] with `ConditionalValue.ofNumber(number)`. */
- fun value(number: Long) = value(ConditionalValue.ofNumber(number))
+ fun value(number: Double) = value(ConditionalValue.ofNumber(number))
/** Alias for calling [value] with `ConditionalValue.ofListOfStrings(listOfStrings)`. */
fun valueOfListOfStrings(listOfStrings: List) =
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorization.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorization.kt
new file mode 100644
index 00000000..4c4862ab
--- /dev/null
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardAuthorization.kt
@@ -0,0 +1,9445 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.lithic.api.models
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.lithic.api.core.Enum
+import com.lithic.api.core.ExcludeMissing
+import com.lithic.api.core.JsonField
+import com.lithic.api.core.JsonMissing
+import com.lithic.api.core.JsonValue
+import com.lithic.api.core.checkKnown
+import com.lithic.api.core.checkRequired
+import com.lithic.api.core.toImmutable
+import com.lithic.api.errors.LithicInvalidDataException
+import java.time.OffsetDateTime
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Card Authorization */
+class CardAuthorization
+@JsonCreator(mode = JsonCreator.Mode.DISABLED)
+private constructor(
+ private val token: JsonField,
+ private val acquirerFee: JsonField,
+ private val amount: JsonField,
+ private val amounts: JsonField,
+ private val authorizationAmount: JsonField,
+ private val avs: JsonField,
+ private val card: JsonField,
+ private val cardholderCurrency: JsonField,
+ private val cashAmount: JsonField,
+ private val created: JsonField,
+ private val merchant: JsonField,
+ private val merchantAmount: JsonField,
+ private val merchantCurrency: JsonField,
+ private val serviceLocation: JsonField,
+ private val settledAmount: JsonField,
+ private val status: JsonField,
+ private val transactionInitiator: JsonField,
+ private val accountType: JsonField,
+ private val cardholderAuthentication: JsonField,
+ private val cashback: JsonField,
+ private val conversionRate: JsonField,
+ private val eventToken: JsonField,
+ private val fleetInfo: JsonField,
+ private val latestChallenge: JsonField,
+ private val network: JsonField,
+ private val networkRiskScore: JsonField,
+ private val networkSpecificData: JsonField,
+ private val pos: JsonField,
+ private val tokenInfo: JsonField,
+ private val ttl: JsonField,
+ private val additionalProperties: MutableMap,
+) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(),
+ @JsonProperty("acquirer_fee")
+ @ExcludeMissing
+ acquirerFee: JsonField = JsonMissing.of(),
+ @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(),
+ @JsonProperty("amounts") @ExcludeMissing amounts: JsonField = JsonMissing.of(),
+ @JsonProperty("authorization_amount")
+ @ExcludeMissing
+ authorizationAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("avs") @ExcludeMissing avs: JsonField = JsonMissing.of(),
+ @JsonProperty("card") @ExcludeMissing card: JsonField = JsonMissing.of(),
+ @JsonProperty("cardholder_currency")
+ @ExcludeMissing
+ cardholderCurrency: JsonField = JsonMissing.of(),
+ @JsonProperty("cash_amount") @ExcludeMissing cashAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("created")
+ @ExcludeMissing
+ created: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant")
+ @ExcludeMissing
+ merchant: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_amount")
+ @ExcludeMissing
+ merchantAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_currency")
+ @ExcludeMissing
+ merchantCurrency: JsonField = JsonMissing.of(),
+ @JsonProperty("service_location")
+ @ExcludeMissing
+ serviceLocation: JsonField = JsonMissing.of(),
+ @JsonProperty("settled_amount")
+ @ExcludeMissing
+ settledAmount: JsonField = JsonMissing.of(),
+ @JsonProperty("status")
+ @ExcludeMissing
+ status: JsonField = JsonMissing.of(),
+ @JsonProperty("transaction_initiator")
+ @ExcludeMissing
+ transactionInitiator: JsonField = JsonMissing.of(),
+ @JsonProperty("account_type")
+ @ExcludeMissing
+ accountType: JsonField = JsonMissing.of(),
+ @JsonProperty("cardholder_authentication")
+ @ExcludeMissing
+ cardholderAuthentication: JsonField = JsonMissing.of(),
+ @JsonProperty("cashback") @ExcludeMissing cashback: JsonField = JsonMissing.of(),
+ @JsonProperty("conversion_rate")
+ @ExcludeMissing
+ conversionRate: JsonField = JsonMissing.of(),
+ @JsonProperty("event_token")
+ @ExcludeMissing
+ eventToken: JsonField = JsonMissing.of(),
+ @JsonProperty("fleet_info")
+ @ExcludeMissing
+ fleetInfo: JsonField = JsonMissing.of(),
+ @JsonProperty("latest_challenge")
+ @ExcludeMissing
+ latestChallenge: JsonField = JsonMissing.of(),
+ @JsonProperty("network") @ExcludeMissing network: JsonField = JsonMissing.of(),
+ @JsonProperty("network_risk_score")
+ @ExcludeMissing
+ networkRiskScore: JsonField = JsonMissing.of(),
+ @JsonProperty("network_specific_data")
+ @ExcludeMissing
+ networkSpecificData: JsonField = JsonMissing.of(),
+ @JsonProperty("pos") @ExcludeMissing pos: JsonField = JsonMissing.of(),
+ @JsonProperty("token_info")
+ @ExcludeMissing
+ tokenInfo: JsonField = JsonMissing.of(),
+ @JsonProperty("ttl") @ExcludeMissing ttl: JsonField = JsonMissing.of(),
+ ) : this(
+ token,
+ acquirerFee,
+ amount,
+ amounts,
+ authorizationAmount,
+ avs,
+ card,
+ cardholderCurrency,
+ cashAmount,
+ created,
+ merchant,
+ merchantAmount,
+ merchantCurrency,
+ serviceLocation,
+ settledAmount,
+ status,
+ transactionInitiator,
+ accountType,
+ cardholderAuthentication,
+ cashback,
+ conversionRate,
+ eventToken,
+ fleetInfo,
+ latestChallenge,
+ network,
+ networkRiskScore,
+ networkSpecificData,
+ pos,
+ tokenInfo,
+ ttl,
+ mutableMapOf(),
+ )
+
+ /**
+ * The provisional transaction group uuid associated with the authorization
+ *
+ * @throws LithicInvalidDataException if 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")
+
+ /**
+ * Fee (in cents) assessed by the merchant and paid for by the cardholder. Will be zero if no
+ * fee is assessed. Rebates may be transmitted as a negative value to indicate credited fees.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun acquirerFee(): Long = acquirerFee.getRequired("acquirer_fee")
+
+ /**
+ * Deprecated, use `amounts`. Authorization amount of the transaction (in cents), including any
+ * acquirer fees. The contents of this field are identical to `authorization_amount`.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ @Deprecated("deprecated") fun amount(): Long = amount.getRequired("amount")
+
+ /**
+ * Structured amounts for this authorization. The `cardholder` and `merchant` amounts reflect
+ * the original network authorization values. For programs with hold adjustments enabled (e.g.,
+ * automated fuel dispensers or tipping MCCs), the `hold` amount may exceed the `cardholder` and
+ * `merchant` amounts to account for anticipated final transaction amounts such as tips or fuel
+ * fill-ups
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun amounts(): Amounts = amounts.getRequired("amounts")
+
+ /**
+ * Deprecated, use `amounts`. The base transaction amount (in cents) plus the acquirer fee
+ * field. This is the amount the issuer should authorize against unless the issuer is paying the
+ * acquirer fee on behalf of the cardholder.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ @Deprecated("deprecated")
+ fun authorizationAmount(): Long = authorizationAmount.getRequired("authorization_amount")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun avs(): Avs = avs.getRequired("avs")
+
+ /**
+ * Card object in ASA
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun card(): AsaRequestCard = card.getRequired("card")
+
+ /**
+ * Deprecated, use `amounts`. 3-character alphabetic ISO 4217 code for cardholder's billing
+ * currency.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ @Deprecated("deprecated")
+ fun cardholderCurrency(): String = cardholderCurrency.getRequired("cardholder_currency")
+
+ /**
+ * The portion of the transaction requested as cash back by the cardholder, and does not include
+ * any acquirer fees. The amount field includes the purchase amount, the requested cash back
+ * amount, and any acquirer fees.
+ *
+ * If no cash back was requested, the value of this field will be 0, and the field will always
+ * be present.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun cashAmount(): Long = cashAmount.getRequired("cash_amount")
+
+ /**
+ * Date and time when the transaction first occurred in UTC.
+ *
+ * @throws LithicInvalidDataException if 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")
+
+ /**
+ * Merchant information including full location details.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun merchant(): TransactionMerchant = merchant.getRequired("merchant")
+
+ /**
+ * Deprecated, use `amounts`. The amount that the merchant will receive, denominated in
+ * `merchant_currency` and in the smallest currency unit. Note the amount includes
+ * `acquirer_fee`, similar to `authorization_amount`. It will be different from
+ * `authorization_amount` if the merchant is taking payment in a different currency.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ @Deprecated("deprecated")
+ fun merchantAmount(): Long = merchantAmount.getRequired("merchant_amount")
+
+ /**
+ * 3-character alphabetic ISO 4217 code for the local currency 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).
+ */
+ @Deprecated("deprecated")
+ fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency")
+
+ /**
+ * Where the cardholder received the service, when different from the card acceptor location.
+ * This is populated from network data elements such as Mastercard DE-122 SE1 SF9-14 and Visa
+ * F34 DS02.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun serviceLocation(): Optional =
+ serviceLocation.getOptional("service_location")
+
+ /**
+ * Deprecated, use `amounts`. Amount (in cents) of the transaction that has been settled,
+ * including any acquirer fees.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ @Deprecated("deprecated")
+ fun settledAmount(): Long = settledAmount.getRequired("settled_amount")
+
+ /**
+ * The type of authorization request that this request is for. Note that `CREDIT_AUTHORIZATION`
+ * and `FINANCIAL_CREDIT_AUTHORIZATION` is only available to users with credit decisioning via
+ * ASA enabled.
+ *
+ * @throws LithicInvalidDataException if 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(): AsaRequestStatus = status.getRequired("status")
+
+ /**
+ * The entity that initiated 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 transactionInitiator(): TransactionInitiator =
+ transactionInitiator.getRequired("transaction_initiator")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun accountType(): Optional = accountType.getOptional("account_type")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun cardholderAuthentication(): Optional =
+ cardholderAuthentication.getOptional("cardholder_authentication")
+
+ /**
+ * Deprecated, use `cash_amount`.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun cashback(): Optional = cashback.getOptional("cashback")
+
+ /**
+ * Deprecated, use `amounts`. If the transaction was requested in a currency other than the
+ * settlement currency, this field will be populated to indicate the rate used to translate the
+ * merchant_amount to the amount (i.e., `merchant_amount` x `conversion_rate` = `amount`). Note
+ * that the `merchant_amount` is in the local currency and the amount is in the settlement
+ * currency.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ @Deprecated("deprecated")
+ fun conversionRate(): Optional = conversionRate.getOptional("conversion_rate")
+
+ /**
+ * The event token associated with the authorization. This field is only set for programs
+ * enrolled into the beta.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun eventToken(): Optional = eventToken.getOptional("event_token")
+
+ /**
+ * Optional Object containing information if the Card is a part of a Fleet managed program
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun fleetInfo(): Optional = fleetInfo.getOptional("fleet_info")
+
+ /**
+ * The latest Authorization Challenge that was issued to the cardholder for this merchant.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun latestChallenge(): Optional =
+ latestChallenge.getOptional("latest_challenge")
+
+ /**
+ * Card network of the authorization.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun network(): Optional = network.getOptional("network")
+
+ /**
+ * Network-provided score assessing risk level associated with a given authorization. Scores are
+ * on a range of 0-999, with 0 representing the lowest risk and 999 representing the highest
+ * risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will normalize
+ * the score by multiplying the raw score by 10x.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun networkRiskScore(): Optional = networkRiskScore.getOptional("network_risk_score")
+
+ /**
+ * Contains raw data provided by the card network, including attributes that provide further
+ * context about the authorization. If populated by the network, data is organized by Lithic and
+ * passed through without further modification. Please consult the official network
+ * documentation for more details about these values and how to use them. This object is only
+ * available to certain programs- contact your Customer Success Manager to discuss enabling
+ * access.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun networkSpecificData(): Optional =
+ networkSpecificData.getOptional("network_specific_data")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun pos(): Optional = pos.getOptional("pos")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun tokenInfo(): Optional = tokenInfo.getOptional("token_info")
+
+ /**
+ * Deprecated: approximate time-to-live for the authorization.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun ttl(): Optional = ttl.getOptional("ttl")
+
+ /**
+ * Returns the raw JSON value of [token].
+ *
+ * Unlike [token], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token
+
+ /**
+ * Returns the raw JSON value of [acquirerFee].
+ *
+ * Unlike [acquirerFee], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("acquirer_fee") @ExcludeMissing fun _acquirerFee(): JsonField = acquirerFee
+
+ /**
+ * Returns the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("amount")
+ @ExcludeMissing
+ fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [amounts].
+ *
+ * Unlike [amounts], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("amounts") @ExcludeMissing fun _amounts(): JsonField = amounts
+
+ /**
+ * Returns the raw JSON value of [authorizationAmount].
+ *
+ * Unlike [authorizationAmount], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("authorization_amount")
+ @ExcludeMissing
+ fun _authorizationAmount(): JsonField = authorizationAmount
+
+ /**
+ * Returns the raw JSON value of [avs].
+ *
+ * Unlike [avs], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("avs") @ExcludeMissing fun _avs(): JsonField = avs
+
+ /**
+ * Returns the raw JSON value of [card].
+ *
+ * Unlike [card], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("card") @ExcludeMissing fun _card(): JsonField = card
+
+ /**
+ * Returns the raw JSON value of [cardholderCurrency].
+ *
+ * Unlike [cardholderCurrency], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("cardholder_currency")
+ @ExcludeMissing
+ fun _cardholderCurrency(): JsonField = cardholderCurrency
+
+ /**
+ * Returns the raw JSON value of [cashAmount].
+ *
+ * Unlike [cashAmount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cash_amount") @ExcludeMissing fun _cashAmount(): JsonField = cashAmount
+
+ /**
+ * Returns the raw JSON value of [created].
+ *
+ * Unlike [created], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("created") @ExcludeMissing fun _created(): JsonField = created
+
+ /**
+ * Returns the raw JSON value of [merchant].
+ *
+ * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("merchant")
+ @ExcludeMissing
+ fun _merchant(): JsonField = merchant
+
+ /**
+ * Returns the raw JSON value of [merchantAmount].
+ *
+ * Unlike [merchantAmount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("merchant_amount")
+ @ExcludeMissing
+ fun _merchantAmount(): JsonField = merchantAmount
+
+ /**
+ * Returns the raw JSON value of [merchantCurrency].
+ *
+ * Unlike [merchantCurrency], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("merchant_currency")
+ @ExcludeMissing
+ fun _merchantCurrency(): JsonField = merchantCurrency
+
+ /**
+ * Returns the raw JSON value of [serviceLocation].
+ *
+ * Unlike [serviceLocation], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("service_location")
+ @ExcludeMissing
+ fun _serviceLocation(): JsonField = serviceLocation
+
+ /**
+ * Returns the raw JSON value of [settledAmount].
+ *
+ * Unlike [settledAmount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @Deprecated("deprecated")
+ @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 [transactionInitiator].
+ *
+ * Unlike [transactionInitiator], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("transaction_initiator")
+ @ExcludeMissing
+ fun _transactionInitiator(): JsonField = transactionInitiator
+
+ /**
+ * Returns the raw JSON value of [accountType].
+ *
+ * Unlike [accountType], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("account_type")
+ @ExcludeMissing
+ fun _accountType(): JsonField = accountType
+
+ /**
+ * Returns the raw JSON value of [cardholderAuthentication].
+ *
+ * Unlike [cardholderAuthentication], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("cardholder_authentication")
+ @ExcludeMissing
+ fun _cardholderAuthentication(): JsonField = cardholderAuthentication
+
+ /**
+ * Returns the raw JSON value of [cashback].
+ *
+ * Unlike [cashback], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cashback") @ExcludeMissing fun _cashback(): JsonField = cashback
+
+ /**
+ * Returns the raw JSON value of [conversionRate].
+ *
+ * Unlike [conversionRate], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @Deprecated("deprecated")
+ @JsonProperty("conversion_rate")
+ @ExcludeMissing
+ fun _conversionRate(): JsonField = conversionRate
+
+ /**
+ * Returns the raw JSON value of [eventToken].
+ *
+ * Unlike [eventToken], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("event_token") @ExcludeMissing fun _eventToken(): JsonField = eventToken
+
+ /**
+ * Returns the raw JSON value of [fleetInfo].
+ *
+ * Unlike [fleetInfo], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("fleet_info")
+ @ExcludeMissing
+ fun _fleetInfo(): JsonField = fleetInfo
+
+ /**
+ * Returns the raw JSON value of [latestChallenge].
+ *
+ * Unlike [latestChallenge], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("latest_challenge")
+ @ExcludeMissing
+ fun _latestChallenge(): JsonField = latestChallenge
+
+ /**
+ * Returns the raw JSON value of [network].
+ *
+ * Unlike [network], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("network") @ExcludeMissing fun _network(): JsonField = network
+
+ /**
+ * Returns the raw JSON value of [networkRiskScore].
+ *
+ * Unlike [networkRiskScore], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("network_risk_score")
+ @ExcludeMissing
+ fun _networkRiskScore(): JsonField = networkRiskScore
+
+ /**
+ * Returns the raw JSON value of [networkSpecificData].
+ *
+ * Unlike [networkSpecificData], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("network_specific_data")
+ @ExcludeMissing
+ fun _networkSpecificData(): JsonField = networkSpecificData
+
+ /**
+ * Returns the raw JSON value of [pos].
+ *
+ * Unlike [pos], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pos") @ExcludeMissing fun _pos(): JsonField = pos
+
+ /**
+ * Returns the raw JSON value of [tokenInfo].
+ *
+ * Unlike [tokenInfo], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("token_info") @ExcludeMissing fun _tokenInfo(): JsonField = tokenInfo
+
+ /**
+ * Returns the raw JSON value of [ttl].
+ *
+ * Unlike [ttl], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("ttl") @ExcludeMissing fun _ttl(): JsonField = ttl
+
+ @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 [CardAuthorization].
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .acquirerFee()
+ * .amount()
+ * .amounts()
+ * .authorizationAmount()
+ * .avs()
+ * .card()
+ * .cardholderCurrency()
+ * .cashAmount()
+ * .created()
+ * .merchant()
+ * .merchantAmount()
+ * .merchantCurrency()
+ * .serviceLocation()
+ * .settledAmount()
+ * .status()
+ * .transactionInitiator()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardAuthorization]. */
+ class Builder internal constructor() {
+
+ private var token: JsonField? = null
+ private var acquirerFee: JsonField? = null
+ private var amount: JsonField? = null
+ private var amounts: JsonField? = null
+ private var authorizationAmount: JsonField? = null
+ private var avs: JsonField? = null
+ private var card: JsonField? = null
+ private var cardholderCurrency: JsonField? = null
+ private var cashAmount: JsonField? = null
+ private var created: JsonField? = null
+ private var merchant: JsonField? = null
+ private var merchantAmount: JsonField? = null
+ private var merchantCurrency: JsonField? = null
+ private var serviceLocation: JsonField? = null
+ private var settledAmount: JsonField? = null
+ private var status: JsonField? = null
+ private var transactionInitiator: JsonField? = null
+ private var accountType: JsonField = JsonMissing.of()
+ private var cardholderAuthentication: JsonField = JsonMissing.of()
+ private var cashback: JsonField = JsonMissing.of()
+ private var conversionRate: JsonField = JsonMissing.of()
+ private var eventToken: JsonField = JsonMissing.of()
+ private var fleetInfo: JsonField = JsonMissing.of()
+ private var latestChallenge: JsonField = JsonMissing.of()
+ private var network: JsonField = JsonMissing.of()
+ private var networkRiskScore: JsonField = JsonMissing.of()
+ private var networkSpecificData: JsonField = JsonMissing.of()
+ private var pos: JsonField = JsonMissing.of()
+ private var tokenInfo: JsonField = JsonMissing.of()
+ private var ttl: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(cardAuthorization: CardAuthorization) = apply {
+ token = cardAuthorization.token
+ acquirerFee = cardAuthorization.acquirerFee
+ amount = cardAuthorization.amount
+ amounts = cardAuthorization.amounts
+ authorizationAmount = cardAuthorization.authorizationAmount
+ avs = cardAuthorization.avs
+ card = cardAuthorization.card
+ cardholderCurrency = cardAuthorization.cardholderCurrency
+ cashAmount = cardAuthorization.cashAmount
+ created = cardAuthorization.created
+ merchant = cardAuthorization.merchant
+ merchantAmount = cardAuthorization.merchantAmount
+ merchantCurrency = cardAuthorization.merchantCurrency
+ serviceLocation = cardAuthorization.serviceLocation
+ settledAmount = cardAuthorization.settledAmount
+ status = cardAuthorization.status
+ transactionInitiator = cardAuthorization.transactionInitiator
+ accountType = cardAuthorization.accountType
+ cardholderAuthentication = cardAuthorization.cardholderAuthentication
+ cashback = cardAuthorization.cashback
+ conversionRate = cardAuthorization.conversionRate
+ eventToken = cardAuthorization.eventToken
+ fleetInfo = cardAuthorization.fleetInfo
+ latestChallenge = cardAuthorization.latestChallenge
+ network = cardAuthorization.network
+ networkRiskScore = cardAuthorization.networkRiskScore
+ networkSpecificData = cardAuthorization.networkSpecificData
+ pos = cardAuthorization.pos
+ tokenInfo = cardAuthorization.tokenInfo
+ ttl = cardAuthorization.ttl
+ additionalProperties = cardAuthorization.additionalProperties.toMutableMap()
+ }
+
+ /** The provisional transaction group uuid associated with the authorization */
+ 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 }
+
+ /**
+ * Fee (in cents) assessed by the merchant and paid for by the cardholder. Will be zero if
+ * no fee is assessed. Rebates may be transmitted as a negative value to indicate credited
+ * fees.
+ */
+ fun acquirerFee(acquirerFee: Long) = acquirerFee(JsonField.of(acquirerFee))
+
+ /**
+ * Sets [Builder.acquirerFee] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.acquirerFee] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee }
+
+ /**
+ * Deprecated, use `amounts`. Authorization amount of the transaction (in cents), including
+ * any acquirer fees. The contents of this field are identical to `authorization_amount`.
+ */
+ @Deprecated("deprecated") 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.
+ */
+ @Deprecated("deprecated")
+ fun amount(amount: JsonField) = apply { this.amount = amount }
+
+ /**
+ * Structured amounts for this authorization. The `cardholder` and `merchant` amounts
+ * reflect the original network authorization values. For programs with hold adjustments
+ * enabled (e.g., automated fuel dispensers or tipping MCCs), the `hold` amount may exceed
+ * the `cardholder` and `merchant` amounts to account for anticipated final transaction
+ * amounts such as tips or fuel fill-ups
+ */
+ fun amounts(amounts: Amounts) = amounts(JsonField.of(amounts))
+
+ /**
+ * Sets [Builder.amounts] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.amounts] with a well-typed [Amounts] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun amounts(amounts: JsonField) = apply { this.amounts = amounts }
+
+ /**
+ * Deprecated, use `amounts`. The base transaction amount (in cents) plus the acquirer fee
+ * field. This is the amount the issuer should authorize against unless the issuer is paying
+ * the acquirer fee on behalf of the cardholder.
+ */
+ @Deprecated("deprecated")
+ fun authorizationAmount(authorizationAmount: Long) =
+ authorizationAmount(JsonField.of(authorizationAmount))
+
+ /**
+ * Sets [Builder.authorizationAmount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.authorizationAmount] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ @Deprecated("deprecated")
+ fun authorizationAmount(authorizationAmount: JsonField) = apply {
+ this.authorizationAmount = authorizationAmount
+ }
+
+ fun avs(avs: Avs) = avs(JsonField.of(avs))
+
+ /**
+ * Sets [Builder.avs] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.avs] with a well-typed [Avs] value instead. This method
+ * is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun avs(avs: JsonField) = apply { this.avs = avs }
+
+ /** Card object in ASA */
+ fun card(card: AsaRequestCard) = card(JsonField.of(card))
+
+ /**
+ * Sets [Builder.card] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.card] with a well-typed [AsaRequestCard] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun card(card: JsonField) = apply { this.card = card }
+
+ /**
+ * Deprecated, use `amounts`. 3-character alphabetic ISO 4217 code for cardholder's billing
+ * currency.
+ */
+ @Deprecated("deprecated")
+ fun cardholderCurrency(cardholderCurrency: String) =
+ cardholderCurrency(JsonField.of(cardholderCurrency))
+
+ /**
+ * Sets [Builder.cardholderCurrency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cardholderCurrency] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ @Deprecated("deprecated")
+ fun cardholderCurrency(cardholderCurrency: JsonField) = apply {
+ this.cardholderCurrency = cardholderCurrency
+ }
+
+ /**
+ * The portion of the transaction requested as cash back by the cardholder, and does not
+ * include any acquirer fees. The amount field includes the purchase amount, the requested
+ * cash back amount, and any acquirer fees.
+ *
+ * If no cash back was requested, the value of this field will be 0, and the field will
+ * always be present.
+ */
+ fun cashAmount(cashAmount: Long) = cashAmount(JsonField.of(cashAmount))
+
+ /**
+ * Sets [Builder.cashAmount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cashAmount] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun cashAmount(cashAmount: JsonField) = apply { this.cashAmount = cashAmount }
+
+ /** Date and time when the transaction first occurred in UTC. */
+ 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 }
+
+ /** Merchant information including full location details. */
+ fun merchant(merchant: TransactionMerchant) = merchant(JsonField.of(merchant))
+
+ /**
+ * Sets [Builder.merchant] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchant] with a well-typed [TransactionMerchant] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun merchant(merchant: JsonField) = apply { this.merchant = merchant }
+
+ /**
+ * Deprecated, use `amounts`. The amount that the merchant will receive, denominated in
+ * `merchant_currency` and in the smallest currency unit. Note the amount includes
+ * `acquirer_fee`, similar to `authorization_amount`. It will be different from
+ * `authorization_amount` if the merchant is taking payment in a different currency.
+ */
+ @Deprecated("deprecated")
+ fun merchantAmount(merchantAmount: Long) = merchantAmount(JsonField.of(merchantAmount))
+
+ /**
+ * Sets [Builder.merchantAmount] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantAmount] with a well-typed [Long] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ @Deprecated("deprecated")
+ fun merchantAmount(merchantAmount: JsonField) = apply {
+ this.merchantAmount = merchantAmount
+ }
+
+ /** 3-character alphabetic ISO 4217 code for the local currency of the transaction. */
+ @Deprecated("deprecated")
+ fun merchantCurrency(merchantCurrency: String) =
+ merchantCurrency(JsonField.of(merchantCurrency))
+
+ /**
+ * Sets [Builder.merchantCurrency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantCurrency] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ @Deprecated("deprecated")
+ fun merchantCurrency(merchantCurrency: JsonField) = apply {
+ this.merchantCurrency = merchantCurrency
+ }
+
+ /**
+ * Where the cardholder received the service, when different from the card acceptor
+ * location. This is populated from network data elements such as Mastercard DE-122 SE1
+ * SF9-14 and Visa F34 DS02.
+ */
+ fun serviceLocation(serviceLocation: ServiceLocation?) =
+ serviceLocation(JsonField.ofNullable(serviceLocation))
+
+ /** Alias for calling [Builder.serviceLocation] with `serviceLocation.orElse(null)`. */
+ fun serviceLocation(serviceLocation: Optional) =
+ serviceLocation(serviceLocation.getOrNull())
+
+ /**
+ * Sets [Builder.serviceLocation] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.serviceLocation] with a well-typed [ServiceLocation]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun serviceLocation(serviceLocation: JsonField) = apply {
+ this.serviceLocation = serviceLocation
+ }
+
+ /**
+ * Deprecated, use `amounts`. Amount (in cents) of the transaction that has been settled,
+ * including any acquirer fees.
+ */
+ @Deprecated("deprecated")
+ fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))
+
+ /**
+ * 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.
+ */
+ @Deprecated("deprecated")
+ fun settledAmount(settledAmount: JsonField) = apply {
+ this.settledAmount = settledAmount
+ }
+
+ /**
+ * The type of authorization request that this request is for. Note that
+ * `CREDIT_AUTHORIZATION` and `FINANCIAL_CREDIT_AUTHORIZATION` is only available to users
+ * with credit decisioning via ASA enabled.
+ */
+ fun status(status: AsaRequestStatus) = status(JsonField.of(status))
+
+ /**
+ * Sets [Builder.status] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.status] with a well-typed [AsaRequestStatus] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun status(status: JsonField) = apply { this.status = status }
+
+ /** The entity that initiated the transaction. */
+ fun transactionInitiator(transactionInitiator: TransactionInitiator) =
+ transactionInitiator(JsonField.of(transactionInitiator))
+
+ /**
+ * Sets [Builder.transactionInitiator] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.transactionInitiator] with a well-typed
+ * [TransactionInitiator] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun transactionInitiator(transactionInitiator: JsonField) = apply {
+ this.transactionInitiator = transactionInitiator
+ }
+
+ fun accountType(accountType: AccountType) = accountType(JsonField.of(accountType))
+
+ /**
+ * Sets [Builder.accountType] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.accountType] with a well-typed [AccountType] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun accountType(accountType: JsonField) = apply {
+ this.accountType = accountType
+ }
+
+ fun cardholderAuthentication(cardholderAuthentication: CardholderAuthentication) =
+ cardholderAuthentication(JsonField.of(cardholderAuthentication))
+
+ /**
+ * Sets [Builder.cardholderAuthentication] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cardholderAuthentication] with a well-typed
+ * [CardholderAuthentication] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun cardholderAuthentication(
+ cardholderAuthentication: JsonField
+ ) = apply { this.cardholderAuthentication = cardholderAuthentication }
+
+ /** Deprecated, use `cash_amount`. */
+ fun cashback(cashback: Long) = cashback(JsonField.of(cashback))
+
+ /**
+ * Sets [Builder.cashback] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cashback] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun cashback(cashback: JsonField) = apply { this.cashback = cashback }
+
+ /**
+ * Deprecated, use `amounts`. If the transaction was requested in a currency other than the
+ * settlement currency, this field will be populated to indicate the rate used to translate
+ * the merchant_amount to the amount (i.e., `merchant_amount` x `conversion_rate` =
+ * `amount`). Note that the `merchant_amount` is in the local currency and the amount is in
+ * the settlement currency.
+ */
+ @Deprecated("deprecated")
+ fun conversionRate(conversionRate: Double) = conversionRate(JsonField.of(conversionRate))
+
+ /**
+ * Sets [Builder.conversionRate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.conversionRate] with a well-typed [Double] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ @Deprecated("deprecated")
+ fun conversionRate(conversionRate: JsonField) = apply {
+ this.conversionRate = conversionRate
+ }
+
+ /**
+ * The event token associated with the authorization. This field is only set for programs
+ * enrolled into the beta.
+ */
+ fun eventToken(eventToken: String) = eventToken(JsonField.of(eventToken))
+
+ /**
+ * Sets [Builder.eventToken] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.eventToken] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun eventToken(eventToken: JsonField) = apply { this.eventToken = eventToken }
+
+ /**
+ * Optional Object containing information if the Card is a part of a Fleet managed program
+ */
+ fun fleetInfo(fleetInfo: AsaRequestFleetInfo?) = fleetInfo(JsonField.ofNullable(fleetInfo))
+
+ /** Alias for calling [Builder.fleetInfo] with `fleetInfo.orElse(null)`. */
+ fun fleetInfo(fleetInfo: Optional) = fleetInfo(fleetInfo.getOrNull())
+
+ /**
+ * Sets [Builder.fleetInfo] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.fleetInfo] with a well-typed [AsaRequestFleetInfo] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun fleetInfo(fleetInfo: JsonField) = apply {
+ this.fleetInfo = fleetInfo
+ }
+
+ /**
+ * The latest Authorization Challenge that was issued to the cardholder for this merchant.
+ */
+ fun latestChallenge(latestChallenge: LatestChallenge) =
+ latestChallenge(JsonField.of(latestChallenge))
+
+ /**
+ * Sets [Builder.latestChallenge] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.latestChallenge] with a well-typed [LatestChallenge]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun latestChallenge(latestChallenge: JsonField) = apply {
+ this.latestChallenge = latestChallenge
+ }
+
+ /** Card network of the authorization. */
+ fun network(network: Network) = network(JsonField.of(network))
+
+ /**
+ * Sets [Builder.network] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.network] with a well-typed [Network] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun network(network: JsonField) = apply { this.network = network }
+
+ /**
+ * Network-provided score assessing risk level associated with a given authorization. Scores
+ * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the
+ * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will
+ * normalize the score by multiplying the raw score by 10x.
+ */
+ fun networkRiskScore(networkRiskScore: Long?) =
+ networkRiskScore(JsonField.ofNullable(networkRiskScore))
+
+ /**
+ * Alias for [Builder.networkRiskScore].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun networkRiskScore(networkRiskScore: Long) = networkRiskScore(networkRiskScore as Long?)
+
+ /** Alias for calling [Builder.networkRiskScore] with `networkRiskScore.orElse(null)`. */
+ fun networkRiskScore(networkRiskScore: Optional) =
+ networkRiskScore(networkRiskScore.getOrNull())
+
+ /**
+ * Sets [Builder.networkRiskScore] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.networkRiskScore] with a well-typed [Long] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun networkRiskScore(networkRiskScore: JsonField) = apply {
+ this.networkRiskScore = networkRiskScore
+ }
+
+ /**
+ * Contains raw data provided by the card network, including attributes that provide further
+ * context about the authorization. If populated by the network, data is organized by Lithic
+ * and passed through without further modification. Please consult the official network
+ * documentation for more details about these values and how to use them. This object is
+ * only available to certain programs- contact your Customer Success Manager to discuss
+ * enabling access.
+ */
+ fun networkSpecificData(networkSpecificData: AsaNetworkSpecificData?) =
+ networkSpecificData(JsonField.ofNullable(networkSpecificData))
+
+ /**
+ * Alias for calling [Builder.networkSpecificData] with `networkSpecificData.orElse(null)`.
+ */
+ fun networkSpecificData(networkSpecificData: Optional) =
+ networkSpecificData(networkSpecificData.getOrNull())
+
+ /**
+ * Sets [Builder.networkSpecificData] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.networkSpecificData] with a well-typed
+ * [AsaNetworkSpecificData] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun networkSpecificData(networkSpecificData: JsonField) = apply {
+ this.networkSpecificData = networkSpecificData
+ }
+
+ fun pos(pos: Pos) = pos(JsonField.of(pos))
+
+ /**
+ * Sets [Builder.pos] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pos] with a well-typed [Pos] value instead. This method
+ * is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun pos(pos: JsonField) = apply { this.pos = pos }
+
+ fun tokenInfo(tokenInfo: TokenInfo?) = tokenInfo(JsonField.ofNullable(tokenInfo))
+
+ /** Alias for calling [Builder.tokenInfo] with `tokenInfo.orElse(null)`. */
+ fun tokenInfo(tokenInfo: Optional) = tokenInfo(tokenInfo.getOrNull())
+
+ /**
+ * Sets [Builder.tokenInfo] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.tokenInfo] with a well-typed [TokenInfo] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun tokenInfo(tokenInfo: JsonField) = apply { this.tokenInfo = tokenInfo }
+
+ /** Deprecated: approximate time-to-live for the authorization. */
+ fun ttl(ttl: OffsetDateTime) = ttl(JsonField.of(ttl))
+
+ /**
+ * Sets [Builder.ttl] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.ttl] with a well-typed [OffsetDateTime] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun ttl(ttl: JsonField) = apply { this.ttl = ttl }
+
+ 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 [CardAuthorization].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .token()
+ * .acquirerFee()
+ * .amount()
+ * .amounts()
+ * .authorizationAmount()
+ * .avs()
+ * .card()
+ * .cardholderCurrency()
+ * .cashAmount()
+ * .created()
+ * .merchant()
+ * .merchantAmount()
+ * .merchantCurrency()
+ * .serviceLocation()
+ * .settledAmount()
+ * .status()
+ * .transactionInitiator()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardAuthorization =
+ CardAuthorization(
+ checkRequired("token", token),
+ checkRequired("acquirerFee", acquirerFee),
+ checkRequired("amount", amount),
+ checkRequired("amounts", amounts),
+ checkRequired("authorizationAmount", authorizationAmount),
+ checkRequired("avs", avs),
+ checkRequired("card", card),
+ checkRequired("cardholderCurrency", cardholderCurrency),
+ checkRequired("cashAmount", cashAmount),
+ checkRequired("created", created),
+ checkRequired("merchant", merchant),
+ checkRequired("merchantAmount", merchantAmount),
+ checkRequired("merchantCurrency", merchantCurrency),
+ checkRequired("serviceLocation", serviceLocation),
+ checkRequired("settledAmount", settledAmount),
+ checkRequired("status", status),
+ checkRequired("transactionInitiator", transactionInitiator),
+ accountType,
+ cardholderAuthentication,
+ cashback,
+ conversionRate,
+ eventToken,
+ fleetInfo,
+ latestChallenge,
+ network,
+ networkRiskScore,
+ networkSpecificData,
+ pos,
+ tokenInfo,
+ ttl,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws LithicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): CardAuthorization = apply {
+ if (validated) {
+ return@apply
+ }
+
+ token()
+ acquirerFee()
+ amount()
+ amounts().validate()
+ authorizationAmount()
+ avs().validate()
+ card().validate()
+ cardholderCurrency()
+ cashAmount()
+ created()
+ merchant().validate()
+ merchantAmount()
+ merchantCurrency()
+ serviceLocation().ifPresent { it.validate() }
+ settledAmount()
+ status().validate()
+ transactionInitiator().validate()
+ accountType().ifPresent { it.validate() }
+ cardholderAuthentication().ifPresent { it.validate() }
+ cashback()
+ conversionRate()
+ eventToken()
+ fleetInfo().ifPresent { it.validate() }
+ latestChallenge().ifPresent { it.validate() }
+ network().ifPresent { it.validate() }
+ networkRiskScore()
+ networkSpecificData().ifPresent { it.validate() }
+ pos().ifPresent { it.validate() }
+ tokenInfo().ifPresent { it.validate() }
+ ttl()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (token.asKnown().isPresent) 1 else 0) +
+ (if (acquirerFee.asKnown().isPresent) 1 else 0) +
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (amounts.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (authorizationAmount.asKnown().isPresent) 1 else 0) +
+ (avs.asKnown().getOrNull()?.validity() ?: 0) +
+ (card.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (cardholderCurrency.asKnown().isPresent) 1 else 0) +
+ (if (cashAmount.asKnown().isPresent) 1 else 0) +
+ (if (created.asKnown().isPresent) 1 else 0) +
+ (merchant.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (merchantAmount.asKnown().isPresent) 1 else 0) +
+ (if (merchantCurrency.asKnown().isPresent) 1 else 0) +
+ (serviceLocation.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (settledAmount.asKnown().isPresent) 1 else 0) +
+ (status.asKnown().getOrNull()?.validity() ?: 0) +
+ (transactionInitiator.asKnown().getOrNull()?.validity() ?: 0) +
+ (accountType.asKnown().getOrNull()?.validity() ?: 0) +
+ (cardholderAuthentication.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (cashback.asKnown().isPresent) 1 else 0) +
+ (if (conversionRate.asKnown().isPresent) 1 else 0) +
+ (if (eventToken.asKnown().isPresent) 1 else 0) +
+ (fleetInfo.asKnown().getOrNull()?.validity() ?: 0) +
+ (latestChallenge.asKnown().getOrNull()?.validity() ?: 0) +
+ (network.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (networkRiskScore.asKnown().isPresent) 1 else 0) +
+ (networkSpecificData.asKnown().getOrNull()?.validity() ?: 0) +
+ (pos.asKnown().getOrNull()?.validity() ?: 0) +
+ (tokenInfo.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (ttl.asKnown().isPresent) 1 else 0)
+
+ /**
+ * Structured amounts for this authorization. The `cardholder` and `merchant` amounts reflect
+ * the original network authorization values. For programs with hold adjustments enabled (e.g.,
+ * automated fuel dispensers or tipping MCCs), the `hold` amount may exceed the `cardholder` and
+ * `merchant` amounts to account for anticipated final transaction amounts such as tips or fuel
+ * fill-ups
+ */
+ class Amounts
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val cardholder: JsonField,
+ private val hold: JsonField,
+ private val merchant: JsonField,
+ private val settlement: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("cardholder")
+ @ExcludeMissing
+ cardholder: JsonField = JsonMissing.of(),
+ @JsonProperty("hold") @ExcludeMissing hold: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant")
+ @ExcludeMissing
+ merchant: JsonField = JsonMissing.of(),
+ @JsonProperty("settlement")
+ @ExcludeMissing
+ settlement: JsonField = JsonMissing.of(),
+ ) : this(cardholder, hold, merchant, settlement, mutableMapOf())
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun cardholder(): ConvertedAmount = cardholder.getRequired("cardholder")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun hold(): Optional = hold.getOptional("hold")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun merchant(): Amount = merchant.getRequired("merchant")
+
+ /**
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun settlement(): Optional = settlement.getOptional("settlement")
+
+ /**
+ * Returns the raw JSON value of [cardholder].
+ *
+ * Unlike [cardholder], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("cardholder")
+ @ExcludeMissing
+ fun _cardholder(): JsonField = cardholder
+
+ /**
+ * Returns the raw JSON value of [hold].
+ *
+ * Unlike [hold], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("hold") @ExcludeMissing fun _hold(): JsonField = hold
+
+ /**
+ * Returns the raw JSON value of [merchant].
+ *
+ * Unlike [merchant], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("merchant") @ExcludeMissing fun _merchant(): JsonField = merchant
+
+ /**
+ * Returns the raw JSON value of [settlement].
+ *
+ * Unlike [settlement], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("settlement")
+ @ExcludeMissing
+ fun _settlement(): JsonField = settlement
+
+ @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 [Amounts].
+ *
+ * The following fields are required:
+ * ```java
+ * .cardholder()
+ * .hold()
+ * .merchant()
+ * .settlement()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Amounts]. */
+ class Builder internal constructor() {
+
+ private var cardholder: JsonField? = null
+ private var hold: JsonField? = null
+ private var merchant: JsonField? = null
+ private var settlement: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(amounts: Amounts) = apply {
+ cardholder = amounts.cardholder
+ hold = amounts.hold
+ merchant = amounts.merchant
+ settlement = amounts.settlement
+ additionalProperties = amounts.additionalProperties.toMutableMap()
+ }
+
+ fun cardholder(cardholder: ConvertedAmount) = cardholder(JsonField.of(cardholder))
+
+ /**
+ * Sets [Builder.cardholder] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.cardholder] with a well-typed [ConvertedAmount]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun cardholder(cardholder: JsonField) = apply {
+ this.cardholder = cardholder
+ }
+
+ fun hold(hold: Amount?) = hold(JsonField.ofNullable(hold))
+
+ /** Alias for calling [Builder.hold] with `hold.orElse(null)`. */
+ fun hold(hold: Optional) = hold(hold.getOrNull())
+
+ /**
+ * Sets [Builder.hold] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.hold] with a well-typed [Amount] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun hold(hold: JsonField) = apply { this.hold = hold }
+
+ fun merchant(merchant: Amount) = merchant(JsonField.of(merchant))
+
+ /**
+ * Sets [Builder.merchant] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchant] with a well-typed [Amount] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun merchant(merchant: JsonField) = apply { this.merchant = merchant }
+
+ fun settlement(settlement: Amount?) = settlement(JsonField.ofNullable(settlement))
+
+ /** Alias for calling [Builder.settlement] with `settlement.orElse(null)`. */
+ fun settlement(settlement: Optional) = settlement(settlement.getOrNull())
+
+ /**
+ * Sets [Builder.settlement] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.settlement] with a well-typed [Amount] value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun settlement(settlement: JsonField) = apply { this.settlement = settlement }
+
+ 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 [Amounts].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .cardholder()
+ * .hold()
+ * .merchant()
+ * .settlement()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Amounts =
+ Amounts(
+ checkRequired("cardholder", cardholder),
+ checkRequired("hold", hold),
+ checkRequired("merchant", merchant),
+ checkRequired("settlement", settlement),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing fields.
+ *
+ * @throws LithicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Amounts = apply {
+ if (validated) {
+ return@apply
+ }
+
+ cardholder().validate()
+ hold().ifPresent { it.validate() }
+ merchant().validate()
+ settlement().ifPresent { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (cardholder.asKnown().getOrNull()?.validity() ?: 0) +
+ (hold.asKnown().getOrNull()?.validity() ?: 0) +
+ (merchant.asKnown().getOrNull()?.validity() ?: 0) +
+ (settlement.asKnown().getOrNull()?.validity() ?: 0)
+
+ class ConvertedAmount
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val conversionRate: JsonField,
+ private val currency: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(),
+ @JsonProperty("conversion_rate")
+ @ExcludeMissing
+ conversionRate: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ currency: JsonField = JsonMissing.of(),
+ ) : this(amount, conversionRate, currency, mutableMapOf())
+
+ /**
+ * Amount in the smallest unit of the applicable currency (e.g., 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 amount(): Long = amount.getRequired("amount")
+
+ /**
+ * Exchange rate used for currency conversion
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun conversionRate(): String = conversionRate.getRequired("conversion_rate")
+
+ /**
+ * 3-character alphabetic ISO 4217 currency
+ *
+ * @throws LithicInvalidDataException if 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 the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [conversionRate].
+ *
+ * Unlike [conversionRate], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("conversion_rate")
+ @ExcludeMissing
+ fun _conversionRate(): JsonField = conversionRate
+
+ /**
+ * 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
+
+ @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 [ConvertedAmount].
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .conversionRate()
+ * .currency()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [ConvertedAmount]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField? = null
+ private var conversionRate: JsonField? = null
+ private var currency: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(convertedAmount: ConvertedAmount) = apply {
+ amount = convertedAmount.amount
+ conversionRate = convertedAmount.conversionRate
+ currency = convertedAmount.currency
+ additionalProperties = convertedAmount.additionalProperties.toMutableMap()
+ }
+
+ /** Amount in the smallest unit of the applicable currency (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 }
+
+ /** Exchange rate used for currency conversion */
+ fun conversionRate(conversionRate: String) =
+ conversionRate(JsonField.of(conversionRate))
+
+ /**
+ * Sets [Builder.conversionRate] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.conversionRate] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun conversionRate(conversionRate: JsonField) = apply {
+ this.conversionRate = conversionRate
+ }
+
+ /** 3-character alphabetic ISO 4217 currency */
+ fun currency(currency: String) = currency(JsonField.of(currency))
+
+ /**
+ * Sets [Builder.currency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.currency] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun currency(currency: JsonField) = apply { this.currency = currency }
+
+ 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 [ConvertedAmount].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .conversionRate()
+ * .currency()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): ConvertedAmount =
+ ConvertedAmount(
+ checkRequired("amount", amount),
+ checkRequired("conversionRate", conversionRate),
+ checkRequired("currency", currency),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws LithicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): ConvertedAmount = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ conversionRate()
+ currency()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (conversionRate.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is ConvertedAmount &&
+ amount == other.amount &&
+ conversionRate == other.conversionRate &&
+ currency == other.currency &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, conversionRate, currency, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "ConvertedAmount{amount=$amount, conversionRate=$conversionRate, currency=$currency, additionalProperties=$additionalProperties}"
+ }
+
+ class Amount
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val amount: JsonField,
+ private val currency: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(),
+ @JsonProperty("currency")
+ @ExcludeMissing
+ currency: JsonField = JsonMissing.of(),
+ ) : this(amount, currency, mutableMapOf())
+
+ /**
+ * Amount in the smallest unit of the applicable currency (e.g., 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 amount(): Long = amount.getRequired("amount")
+
+ /**
+ * 3-character alphabetic ISO 4217 currency
+ *
+ * @throws LithicInvalidDataException if 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 the raw JSON value of [amount].
+ *
+ * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount
+
+ /**
+ * Returns the raw JSON value of [currency].
+ *
+ * Unlike [currency], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("currency") @ExcludeMissing fun _currency(): JsonField = currency
+
+ @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 [Amount].
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .currency()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Amount]. */
+ class Builder internal constructor() {
+
+ private var amount: JsonField? = null
+ private var currency: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(amount: Amount) = apply {
+ this.amount = amount.amount
+ currency = amount.currency
+ additionalProperties = amount.additionalProperties.toMutableMap()
+ }
+
+ /** Amount in the smallest unit of the applicable currency (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 }
+
+ /** 3-character alphabetic ISO 4217 currency */
+ fun currency(currency: String) = currency(JsonField.of(currency))
+
+ /**
+ * Sets [Builder.currency] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.currency] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun currency(currency: JsonField) = apply { this.currency = currency }
+
+ 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 [Amount].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .amount()
+ * .currency()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Amount =
+ Amount(
+ checkRequired("amount", amount),
+ checkRequired("currency", currency),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ /**
+ * Validates that the types of all values in this object match their expected types
+ * recursively.
+ *
+ * This method is _not_ forwards compatible with new types from the API for existing
+ * fields.
+ *
+ * @throws LithicInvalidDataException if any value type in this object doesn't match its
+ * expected type.
+ */
+ fun validate(): Amount = apply {
+ if (validated) {
+ return@apply
+ }
+
+ amount()
+ currency()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (if (amount.asKnown().isPresent) 1 else 0) +
+ (if (currency.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Amount &&
+ amount == other.amount &&
+ currency == other.currency &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(amount, currency, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Amount{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Amounts &&
+ cardholder == other.cardholder &&
+ hold == other.hold &&
+ merchant == other.merchant &&
+ settlement == other.settlement &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(cardholder, hold, merchant, settlement, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Amounts{cardholder=$cardholder, hold=$hold, merchant=$merchant, settlement=$settlement, additionalProperties=$additionalProperties}"
+ }
+
+ class Avs
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val address: JsonField,
+ private val addressOnFileMatch: JsonField,
+ private val zipcode: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("address") @ExcludeMissing address: JsonField = JsonMissing.of(),
+ @JsonProperty("address_on_file_match")
+ @ExcludeMissing
+ addressOnFileMatch: JsonField = JsonMissing.of(),
+ @JsonProperty("zipcode") @ExcludeMissing zipcode: JsonField = JsonMissing.of(),
+ ) : this(address, addressOnFileMatch, zipcode, mutableMapOf())
+
+ /**
+ * Cardholder address
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun address(): String = address.getRequired("address")
+
+ /**
+ * Lithic's evaluation result comparing the transaction's address data with the cardholder
+ * KYC data if it exists. In the event Lithic does not have any Cardholder KYC data, or the
+ * transaction does not contain any address data, NOT_PRESENT will be returned
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun addressOnFileMatch(): AddressMatchResult =
+ addressOnFileMatch.getRequired("address_on_file_match")
+
+ /**
+ * Cardholder ZIP code
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun zipcode(): String = zipcode.getRequired("zipcode")
+
+ /**
+ * Returns the raw JSON value of [address].
+ *
+ * Unlike [address], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("address") @ExcludeMissing fun _address(): JsonField = address
+
+ /**
+ * Returns the raw JSON value of [addressOnFileMatch].
+ *
+ * Unlike [addressOnFileMatch], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("address_on_file_match")
+ @ExcludeMissing
+ fun _addressOnFileMatch(): JsonField = addressOnFileMatch
+
+ /**
+ * Returns the raw JSON value of [zipcode].
+ *
+ * Unlike [zipcode], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("zipcode") @ExcludeMissing fun _zipcode(): JsonField = zipcode
+
+ @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 [Avs].
+ *
+ * The following fields are required:
+ * ```java
+ * .address()
+ * .addressOnFileMatch()
+ * .zipcode()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Avs]. */
+ class Builder internal constructor() {
+
+ private var address: JsonField