diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d486cde74..87d60805f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.96.0"
+ ".": "0.96.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c76911aaa..e9cc8cb8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 0.96.1 (2025-07-18)
+
+Full Changelog: [v0.96.0...v0.96.1](https://github.com/lithic-com/lithic-java/compare/v0.96.0...v0.96.1)
+
+### Bug Fixes
+
+* **client:** ensure error handling always occurs ([037c1ff](https://github.com/lithic-com/lithic-java/commit/037c1ffd0e92cb6e86f9e434f96f9cff6a6393e2))
+
+
+### Chores
+
+* fix conflict ([83182ce](https://github.com/lithic-com/lithic-java/commit/83182ce0bcaf7edb9d5874e2496c3ea6314295a9))
+* **internal:** allow running specific example from cli ([59ee949](https://github.com/lithic-com/lithic-java/commit/59ee949248a1e53456df67804bbae9ccb2a258d3))
+
## 0.96.0 (2025-07-15)
Full Changelog: [v0.95.0...v0.96.0](https://github.com/lithic-com/lithic-java/compare/v0.95.0...v0.96.0)
diff --git a/README.md b/README.md
index 53ba3ec55..5566ea841 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.96.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.96.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.96.1)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.96.1)
@@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc
-The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.96.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.96.1).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.96.0")
+implementation("com.lithic.api:lithic-java:0.96.1")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.96.0")
com.lithic.api
lithic-java
- 0.96.0
+ 0.96.1
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 147075849..64088c199 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.96.0" // x-release-please-version
+ version = "0.96.1" // x-release-please-version
}
subprojects {
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 8d7d5bb73..fa05a6755 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
@@ -3,14 +3,14 @@
package com.lithic.api.client
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.getPackageVersion
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -285,7 +285,8 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
LithicClientAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val accounts: AccountServiceAsync.WithRawResponse by lazy {
AccountServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -472,7 +473,7 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
override fun networkPrograms(): NetworkProgramServiceAsync.WithRawResponse = networkPrograms
private val apiStatusHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun apiStatus(
params: ClientApiStatusParams,
@@ -489,7 +490,7 @@ class LithicClientAsyncImpl(private val clientOptions: ClientOptions) : LithicCl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { apiStatusHandler.handle(it) }
.also {
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 859f2f678..28a889f85 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
@@ -3,14 +3,14 @@
package com.lithic.api.client
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.getPackageVersion
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -267,7 +267,8 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
LithicClient.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val accounts: AccountService.WithRawResponse by lazy {
AccountServiceImpl.WithRawResponseImpl(clientOptions)
@@ -453,7 +454,7 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
override fun networkPrograms(): NetworkProgramService.WithRawResponse = networkPrograms
private val apiStatusHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun apiStatus(
params: ClientApiStatusParams,
@@ -468,7 +469,7 @@ class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient
.prepare(clientOptions, params)
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
val response = clientOptions.httpClient.execute(request, requestOptions)
- return response.parseable {
+ return errorHandler.handle(response).parseable {
response
.use { apiStatusHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/core/handlers/ErrorHandler.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/core/handlers/ErrorHandler.kt
index 6fda9991d..2dd9da026 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/core/handlers/ErrorHandler.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/core/handlers/ErrorHandler.kt
@@ -19,7 +19,7 @@ import com.lithic.api.errors.UnexpectedStatusCodeException
import com.lithic.api.errors.UnprocessableEntityException
@JvmSynthetic
-internal fun errorHandler(jsonMapper: JsonMapper): Handler {
+internal fun errorBodyHandler(jsonMapper: JsonMapper): Handler {
val handler = jsonHandler(jsonMapper)
return object : Handler {
@@ -33,52 +33,52 @@ internal fun errorHandler(jsonMapper: JsonMapper): Handler {
}
@JvmSynthetic
-internal fun Handler.withErrorHandler(errorHandler: Handler): Handler =
- object : Handler {
- override fun handle(response: HttpResponse): T =
+internal fun errorHandler(errorBodyHandler: Handler): Handler =
+ object : Handler {
+ override fun handle(response: HttpResponse): HttpResponse =
when (val statusCode = response.statusCode()) {
- in 200..299 -> this@withErrorHandler.handle(response)
+ in 200..299 -> response
400 ->
throw BadRequestException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
401 ->
throw UnauthorizedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
403 ->
throw PermissionDeniedException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
404 ->
throw NotFoundException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
422 ->
throw UnprocessableEntityException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
429 ->
throw RateLimitException.builder()
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
in 500..599 ->
throw InternalServerException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
else ->
throw UnexpectedStatusCodeException.builder()
.statusCode(statusCode)
.headers(response.headers())
- .body(errorHandler.handle(response))
+ .body(errorBodyHandler.handle(response))
.build()
}
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncImpl.kt
index 5960e0bc1..91b71340f 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountHolderServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -118,7 +118,8 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
AccountHolderServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -129,7 +130,6 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: AccountHolderCreateParams,
@@ -150,7 +150,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -163,7 +163,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
}
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: AccountHolderRetrieveParams,
@@ -183,7 +183,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -197,7 +197,6 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
private val updateHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun update(
params: AccountHolderUpdateParams,
@@ -218,7 +217,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -232,7 +231,6 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: AccountHolderListParams,
@@ -249,7 +247,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -271,7 +269,6 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
private val listDocumentsHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun listDocuments(
params: AccountHolderListDocumentsParams,
@@ -291,7 +288,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listDocumentsHandler.handle(it) }
.also {
@@ -304,7 +301,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
}
private val retrieveDocumentHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieveDocument(
params: AccountHolderRetrieveDocumentParams,
@@ -330,7 +327,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveDocumentHandler.handle(it) }
.also {
@@ -343,7 +340,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
}
private val simulateEnrollmentDocumentReviewHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun simulateEnrollmentDocumentReview(
params: AccountHolderSimulateEnrollmentDocumentReviewParams,
@@ -366,7 +363,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { simulateEnrollmentDocumentReviewHandler.handle(it) }
.also {
@@ -381,7 +378,6 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
private val simulateEnrollmentReviewHandler:
Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun simulateEnrollmentReview(
params: AccountHolderSimulateEnrollmentReviewParams,
@@ -399,7 +395,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { simulateEnrollmentReviewHandler.handle(it) }
.also {
@@ -412,7 +408,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
}
private val uploadDocumentHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun uploadDocument(
params: AccountHolderUploadDocumentParams,
@@ -433,7 +429,7 @@ class AccountHolderServiceAsyncImpl internal constructor(private val clientOptio
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { uploadDocumentHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountServiceAsyncImpl.kt
index 699c54de2..fd5397a09 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AccountServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -71,7 +71,8 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
AccountServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -81,7 +82,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
)
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: AccountRetrieveParams,
@@ -101,7 +102,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -113,8 +114,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: AccountUpdateParams,
@@ -135,7 +135,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -149,7 +149,6 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: AccountListParams,
@@ -166,7 +165,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -187,7 +186,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val retrieveSpendLimitsHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieveSpendLimits(
params: AccountRetrieveSpendLimitsParams,
@@ -207,7 +206,7 @@ class AccountServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveSpendLimitsHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AggregateBalanceServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AggregateBalanceServiceAsyncImpl.kt
index a1c9ad5eb..e45199b7a 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AggregateBalanceServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AggregateBalanceServiceAsyncImpl.kt
@@ -3,13 +3,13 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -44,7 +44,8 @@ internal constructor(private val clientOptions: ClientOptions) : AggregateBalanc
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
AggregateBalanceServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -55,7 +56,6 @@ internal constructor(private val clientOptions: ClientOptions) : AggregateBalanc
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: AggregateBalanceListParams,
@@ -72,7 +72,7 @@ internal constructor(private val clientOptions: ClientOptions) : AggregateBalanc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthStreamEnrollmentServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthStreamEnrollmentServiceAsyncImpl.kt
index 22cd82340..6d5557a32 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthStreamEnrollmentServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/AuthStreamEnrollmentServiceAsyncImpl.kt
@@ -3,12 +3,11 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.handlers.emptyHandler
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
import com.lithic.api.core.http.HttpResponse
@@ -57,7 +56,8 @@ internal constructor(private val clientOptions: ClientOptions) : AuthStreamEnrol
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
AuthStreamEnrollmentServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -67,7 +67,7 @@ internal constructor(private val clientOptions: ClientOptions) : AuthStreamEnrol
)
private val retrieveSecretHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieveSecret(
params: AuthStreamEnrollmentRetrieveSecretParams,
@@ -84,7 +84,7 @@ internal constructor(private val clientOptions: ClientOptions) : AuthStreamEnrol
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveSecretHandler.handle(it) }
.also {
@@ -96,8 +96,7 @@ internal constructor(private val clientOptions: ClientOptions) : AuthStreamEnrol
}
}
- private val rotateSecretHandler: Handler =
- emptyHandler().withErrorHandler(errorHandler)
+ private val rotateSecretHandler: Handler = emptyHandler()
override fun rotateSecret(
params: AuthStreamEnrollmentRotateSecretParams,
@@ -115,7 +114,9 @@ internal constructor(private val clientOptions: ClientOptions) : AuthStreamEnrol
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable { response.use { rotateSecretHandler.handle(it) } }
+ errorHandler.handle(response).parseable {
+ response.use { rotateSecretHandler.handle(it) }
+ }
}
}
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BalanceServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BalanceServiceAsyncImpl.kt
index a15c8fe43..1e461f1c7 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BalanceServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BalanceServiceAsyncImpl.kt
@@ -3,13 +3,13 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -42,7 +42,8 @@ class BalanceServiceAsyncImpl internal constructor(private val clientOptions: Cl
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
BalanceServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -53,7 +54,6 @@ class BalanceServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: BalanceListParams,
@@ -70,7 +70,7 @@ class BalanceServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BookTransferServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BookTransferServiceAsyncImpl.kt
index 695e5727c..97990dec2 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BookTransferServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/BookTransferServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -70,7 +70,8 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
BookTransferServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -81,7 +82,6 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: BookTransferCreateParams,
@@ -99,7 +99,7 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -113,7 +113,6 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retrieve(
params: BookTransferRetrieveParams,
@@ -133,7 +132,7 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -147,7 +146,6 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: BookTransferListParams,
@@ -164,7 +162,7 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -186,7 +184,6 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
private val reverseHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun reverse(
params: BookTransferReverseParams,
@@ -207,7 +204,7 @@ class BookTransferServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { reverseHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardProgramServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardProgramServiceAsyncImpl.kt
index eaf7baa7a..501be47ac 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardProgramServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardProgramServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -53,7 +53,8 @@ class CardProgramServiceAsyncImpl internal constructor(private val clientOptions
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CardProgramServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -63,7 +64,7 @@ class CardProgramServiceAsyncImpl internal constructor(private val clientOptions
)
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: CardProgramRetrieveParams,
@@ -83,7 +84,7 @@ class CardProgramServiceAsyncImpl internal constructor(private val clientOptions
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -97,7 +98,6 @@ class CardProgramServiceAsyncImpl internal constructor(private val clientOptions
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: CardProgramListParams,
@@ -114,7 +114,7 @@ class CardProgramServiceAsyncImpl internal constructor(private val clientOptions
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardServiceAsyncImpl.kt
index d66bf78bb..3facd014d 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/CardServiceAsyncImpl.kt
@@ -3,15 +3,15 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
import com.lithic.api.core.handlers.stringHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -167,7 +167,8 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CardServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val aggregateBalances: AggregateBalanceServiceAsync.WithRawResponse by lazy {
AggregateBalanceServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -197,8 +198,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
override fun financialTransactions(): FinancialTransactionServiceAsync.WithRawResponse =
financialTransactions
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: CardCreateParams,
@@ -216,7 +216,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -228,8 +228,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: CardRetrieveParams,
@@ -249,7 +248,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -261,8 +260,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: CardUpdateParams,
@@ -283,7 +281,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -297,7 +295,6 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: CardListParams,
@@ -314,7 +311,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -335,7 +332,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
private val convertPhysicalHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun convertPhysical(
params: CardConvertPhysicalParams,
@@ -356,7 +353,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { convertPhysicalHandler.handle(it) }
.also {
@@ -368,7 +365,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val embedHandler: Handler = stringHandler().withErrorHandler(errorHandler)
+ private val embedHandler: Handler = stringHandler()
override fun embed(
params: CardEmbedParams,
@@ -385,13 +382,14 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable { response.use { embedHandler.handle(it) } }
+ errorHandler.handle(response).parseable {
+ response.use { embedHandler.handle(it) }
+ }
}
}
private val provisionHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun provision(
params: CardProvisionParams,
@@ -412,7 +410,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { provisionHandler.handle(it) }
.also {
@@ -424,8 +422,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val reissueHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val reissueHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun reissue(
params: CardReissueParams,
@@ -446,7 +443,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { reissueHandler.handle(it) }
.also {
@@ -458,8 +455,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val renewHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val renewHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun renew(
params: CardRenewParams,
@@ -480,7 +476,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { renewHandler.handle(it) }
.also {
@@ -493,7 +489,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
private val retrieveSpendLimitsHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieveSpendLimits(
params: CardRetrieveSpendLimitsParams,
@@ -513,7 +509,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveSpendLimitsHandler.handle(it) }
.also {
@@ -525,8 +521,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val searchByPanHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val searchByPanHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun searchByPan(
params: CardSearchByPanParams,
@@ -544,7 +539,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { searchByPanHandler.handle(it) }
.also {
@@ -558,7 +553,6 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
private val webProvisionHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun webProvision(
params: CardWebProvisionParams,
@@ -579,7 +573,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { webProvisionHandler.handle(it) }
.also {
@@ -592,8 +586,9 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
- private val embedHandler: Handler = stringHandler().withErrorHandler(errorHandler)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
+ private val embedHandler: Handler = stringHandler()
override fun getEmbedHtml(
params: CardGetEmbedHtmlParams,
@@ -620,7 +615,7 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
.build()
return clientOptions.httpClient.executeAsync(request, requestOptions).thenApply { response
->
- response.let { embedHandler.handle(it) }
+ errorHandler.handle(response).let { embedHandler.handle(it) }
}
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DigitalCardArtServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DigitalCardArtServiceAsyncImpl.kt
index 3dfc7c20c..eeccb78d7 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DigitalCardArtServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DigitalCardArtServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -55,7 +55,8 @@ internal constructor(private val clientOptions: ClientOptions) : DigitalCardArtS
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
DigitalCardArtServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -65,7 +66,7 @@ internal constructor(private val clientOptions: ClientOptions) : DigitalCardArtS
)
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: DigitalCardArtRetrieveParams,
@@ -85,7 +86,7 @@ internal constructor(private val clientOptions: ClientOptions) : DigitalCardArtS
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -99,7 +100,6 @@ internal constructor(private val clientOptions: ClientOptions) : DigitalCardArtS
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: DigitalCardArtListParams,
@@ -116,7 +116,7 @@ internal constructor(private val clientOptions: ClientOptions) : DigitalCardArtS
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt
index a7b0057ac..2150207e3 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/DisputeServiceAsyncImpl.kt
@@ -3,16 +3,16 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.MultipartField
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
import com.lithic.api.core.handlers.emptyHandler
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -117,7 +117,8 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
DisputeServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -126,8 +127,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val createHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun create(
params: DisputeCreateParams,
@@ -145,7 +145,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -158,7 +158,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: DisputeRetrieveParams,
@@ -178,7 +178,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -190,8 +190,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val updateHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun update(
params: DisputeUpdateParams,
@@ -212,7 +211,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -226,7 +225,6 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: DisputeListParams,
@@ -243,7 +241,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -263,8 +261,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
}
- private val deleteHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val deleteHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun delete(
params: DisputeDeleteParams,
@@ -285,7 +282,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { deleteHandler.handle(it) }
.also {
@@ -298,7 +295,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val deleteEvidenceHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun deleteEvidence(
params: DisputeDeleteEvidenceParams,
@@ -325,7 +322,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { deleteEvidenceHandler.handle(it) }
.also {
@@ -338,7 +335,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val initiateEvidenceUploadHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun initiateEvidenceUpload(
params: DisputeInitiateEvidenceUploadParams,
@@ -359,7 +356,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { initiateEvidenceUploadHandler.handle(it) }
.also {
@@ -373,7 +370,6 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
private val listEvidencesHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun listEvidences(
params: DisputeListEvidencesParams,
@@ -393,7 +389,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listEvidencesHandler.handle(it) }
.also {
@@ -414,7 +410,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
}
private val retrieveEvidenceHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieveEvidence(
params: DisputeRetrieveEvidenceParams,
@@ -440,7 +436,7 @@ class DisputeServiceAsyncImpl internal constructor(private val clientOptions: Cl
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveEvidenceHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/EventServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/EventServiceAsyncImpl.kt
index 2420e02f1..f6f9e9a73 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/EventServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/EventServiceAsyncImpl.kt
@@ -7,11 +7,12 @@ import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
import com.lithic.api.core.handlers.emptyHandler
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -81,7 +82,8 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
EventServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val subscriptions: SubscriptionServiceAsync.WithRawResponse by lazy {
SubscriptionServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -103,8 +105,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
override fun eventSubscriptions(): EventSubscriptionServiceAsync.WithRawResponse =
eventSubscriptions
- private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ private val retrieveHandler: Handler = jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: EventRetrieveParams,
@@ -124,7 +125,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -138,7 +139,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: EventListParams,
@@ -155,7 +155,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -177,7 +177,6 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
private val listAttemptsHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun listAttempts(
params: EventListAttemptsParams,
@@ -197,7 +196,7 @@ class EventServiceAsyncImpl internal constructor(private val clientOptions: Clie
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listAttemptsHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt
index e09aa9518..8d0e8a75c 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalBankAccountServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -103,7 +103,8 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
ExternalBankAccountServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val microDeposits: MicroDepositServiceAsync.WithRawResponse by lazy {
MicroDepositServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -120,7 +121,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun create(
params: ExternalBankAccountCreateParams,
@@ -138,7 +138,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -152,7 +152,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retrieve(
params: ExternalBankAccountRetrieveParams,
@@ -172,7 +171,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -186,7 +185,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val updateHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun update(
params: ExternalBankAccountUpdateParams,
@@ -207,7 +205,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -221,7 +219,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: ExternalBankAccountListParams,
@@ -238,7 +235,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -261,7 +258,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val retryMicroDepositsHandler:
Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retryMicroDeposits(
params: ExternalBankAccountRetryMicroDepositsParams,
@@ -287,7 +283,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retryMicroDepositsHandler.handle(it) }
.also {
@@ -301,7 +297,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
private val retryPrenoteHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retryPrenote(
params: ExternalBankAccountRetryPrenoteParams,
@@ -327,7 +322,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalBankAcc
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retryPrenoteHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalPaymentServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalPaymentServiceAsyncImpl.kt
index 7e59fcfa4..f96884a22 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalPaymentServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/ExternalPaymentServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.json
@@ -96,7 +96,8 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
ExternalPaymentServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -106,7 +107,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
)
private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun create(
params: ExternalPaymentCreateParams,
@@ -124,7 +125,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -137,7 +138,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
}
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: ExternalPaymentRetrieveParams,
@@ -157,7 +158,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -171,7 +172,6 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: ExternalPaymentListParams,
@@ -188,7 +188,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -209,7 +209,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
}
private val cancelHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun cancel(
params: ExternalPaymentCancelParams,
@@ -230,7 +230,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { cancelHandler.handle(it) }
.also {
@@ -243,7 +243,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
}
private val releaseHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun release(
params: ExternalPaymentReleaseParams,
@@ -264,7 +264,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { releaseHandler.handle(it) }
.also {
@@ -277,7 +277,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
}
private val reverseHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun reverse(
params: ExternalPaymentReverseParams,
@@ -298,7 +298,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { reverseHandler.handle(it) }
.also {
@@ -311,7 +311,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
}
private val settleHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun settle(
params: ExternalPaymentSettleParams,
@@ -332,7 +332,7 @@ internal constructor(private val clientOptions: ClientOptions) : ExternalPayment
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { settleHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt
index 72bde816b..ca57d2c0e 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FinancialAccountServiceAsyncImpl.kt
@@ -3,13 +3,12 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
import com.lithic.api.core.handlers.emptyHandler
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
import com.lithic.api.core.http.HttpResponse
@@ -126,7 +125,8 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
FinancialAccountServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val balances: BalanceServiceAsync.WithRawResponse by lazy {
BalanceServiceAsyncImpl.WithRawResponseImpl(clientOptions)
@@ -169,7 +169,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
override fun loanTapes(): LoanTapeServiceAsync.WithRawResponse = loanTapes
private val createHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun create(
params: FinancialAccountCreateParams,
@@ -187,7 +187,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { createHandler.handle(it) }
.also {
@@ -200,7 +200,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
}
private val retrieveHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun retrieve(
params: FinancialAccountRetrieveParams,
@@ -220,7 +220,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -233,7 +233,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
}
private val updateHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun update(
params: FinancialAccountUpdateParams,
@@ -254,7 +254,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateHandler.handle(it) }
.also {
@@ -268,7 +268,6 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
private val listHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun list(
params: FinancialAccountListParams,
@@ -285,7 +284,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { listHandler.handle(it) }
.also {
@@ -305,8 +304,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
}
}
- private val registerAccountNumberHandler: Handler =
- emptyHandler().withErrorHandler(errorHandler)
+ private val registerAccountNumberHandler: Handler = emptyHandler()
override fun registerAccountNumber(
params: FinancialAccountRegisterAccountNumberParams,
@@ -332,12 +330,14 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable { response.use { registerAccountNumberHandler.handle(it) } }
+ errorHandler.handle(response).parseable {
+ response.use { registerAccountNumberHandler.handle(it) }
+ }
}
}
private val updateStatusHandler: Handler =
- jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler)
+ jsonHandler(clientOptions.jsonMapper)
override fun updateStatus(
params: FinancialAccountUpdateStatusParams,
@@ -363,7 +363,7 @@ internal constructor(private val clientOptions: ClientOptions) : FinancialAccoun
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { updateStatusHandler.handle(it) }
.also {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FundingEventServiceAsyncImpl.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FundingEventServiceAsyncImpl.kt
index 5d5b4e8bd..f3aa916e0 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FundingEventServiceAsyncImpl.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/services/async/FundingEventServiceAsyncImpl.kt
@@ -3,14 +3,14 @@
package com.lithic.api.services.async
import com.lithic.api.core.ClientOptions
-import com.lithic.api.core.JsonValue
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.checkRequired
+import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
-import com.lithic.api.core.handlers.withErrorHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
+import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
@@ -62,7 +62,8 @@ class FundingEventServiceAsyncImpl internal constructor(private val clientOption
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
FundingEventServiceAsync.WithRawResponse {
- private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper)
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
override fun withOptions(
modifier: Consumer
@@ -73,7 +74,6 @@ class FundingEventServiceAsyncImpl internal constructor(private val clientOption
private val retrieveHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- .withErrorHandler(errorHandler)
override fun retrieve(
params: FundingEventRetrieveParams,
@@ -93,7 +93,7 @@ class FundingEventServiceAsyncImpl internal constructor(private val clientOption
return request
.thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
.thenApply { response ->
- response.parseable {
+ errorHandler.handle(response).parseable {
response
.use { retrieveHandler.handle(it) }
.also {
@@ -107,7 +107,6 @@ class FundingEventServiceAsyncImpl internal constructor(private val clientOption
private val listHandler: Handler =
jsonHandler