diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index fd28aa524..e4f54275b 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.331.0"
+ ".": "0.332.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index d5dac36dd..e5dc4c9fa 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 213
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-8d71e78a4afd7e1ce2436bf2428777d623f468bb3b6c37c36ed8ed3155fe6c77.yml
-openapi_spec_hash: 3064d7c7468a53e4797ef16b648fd06d
-config_hash: e1e8bc2138a13f290956ae6687f099cd
+configured_endpoints: 214
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-d0d6147287983a83fc0ad164f706c3cdc48a13e223fd601aa954bbf0bbc402ed.yml
+openapi_spec_hash: a3ccd1aa9bc5d03e6660b535d25401b1
+config_hash: 8dadd60eab7ab858cf06c6a8633ed9f3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index af681693c..8cf42cec1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,25 @@
# Changelog
+## 0.332.0 (2025-09-19)
+
+Full Changelog: [v0.331.0...v0.332.0](https://github.com/Increase/increase-java/compare/v0.331.0...v0.332.0)
+
+### Features
+
+* **api:** api update ([754b269](https://github.com/Increase/increase-java/commit/754b2695831ca2b9d96552479be756bb1824e4a3))
+* **api:** api update ([afa92a3](https://github.com/Increase/increase-java/commit/afa92a3e8ff77106c78b4201c7b75b709d3f177b))
+* **client:** expose sleeper option ([42e0af4](https://github.com/Increase/increase-java/commit/42e0af4be43e8108563e40081422505320c5caf6))
+
+
+### Bug Fixes
+
+* **client:** ensure single timer is created per client ([42e0af4](https://github.com/Increase/increase-java/commit/42e0af4be43e8108563e40081422505320c5caf6))
+
+
+### Chores
+
+* improve formatter performance ([0795a95](https://github.com/Increase/increase-java/commit/0795a9506c0f7734ec77df11f4613e16d972f7dc))
+
## 0.331.0 (2025-09-19)
Full Changelog: [v0.330.0...v0.331.0](https://github.com/Increase/increase-java/compare/v0.330.0...v0.331.0)
diff --git a/README.md b/README.md
index fc67dd6d7..a2f025fef 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.331.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.331.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.332.0)
+[](https://javadoc.io/doc/com.increase.api/increase-java/0.332.0)
@@ -13,7 +13,7 @@ The Increase Java SDK is similar to the Increase Kotlin SDK but with minor diffe
-The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.331.0).
+The REST API documentation can be found on [increase.com](https://increase.com/documentation). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.increase.api/increase-java/0.332.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [increase.com](https://increase.com/d
### Gradle
```kotlin
-implementation("com.increase.api:increase-java:0.331.0")
+implementation("com.increase.api:increase-java:0.332.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.331.0")
com.increase.api
increase-java
- 0.331.0
+ 0.332.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index c727ff2ce..d2274a3a5 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.331.0" // x-release-please-version
+ version = "0.332.0" // x-release-please-version
}
subprojects {
diff --git a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
index e39a18d6e..8d8f55ae4 100644
--- a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
+++ b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClient.kt
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper
import com.increase.api.client.IncreaseClient
import com.increase.api.client.IncreaseClientImpl
import com.increase.api.core.ClientOptions
+import com.increase.api.core.Sleeper
import com.increase.api.core.Timeout
import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
@@ -133,6 +134,17 @@ class IncreaseOkHttpClient private constructor() {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { clientOptions.sleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
diff --git a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
index d4c0b7a53..d80607c7e 100644
--- a/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
+++ b/increase-java-client-okhttp/src/main/kotlin/com/increase/api/client/okhttp/IncreaseOkHttpClientAsync.kt
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.json.JsonMapper
import com.increase.api.client.IncreaseClientAsync
import com.increase.api.client.IncreaseClientAsyncImpl
import com.increase.api.core.ClientOptions
+import com.increase.api.core.Sleeper
import com.increase.api.core.Timeout
import com.increase.api.core.http.AsyncStreamResponse
import com.increase.api.core.http.Headers
@@ -133,6 +134,17 @@ class IncreaseOkHttpClientAsync private constructor() {
clientOptions.streamHandlerExecutor(streamHandlerExecutor)
}
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { clientOptions.sleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt
index 952133bfb..043884976 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt
@@ -12,6 +12,7 @@ import com.increase.api.services.blocking.AchTransferService
import com.increase.api.services.blocking.BookkeepingAccountService
import com.increase.api.services.blocking.BookkeepingEntryService
import com.increase.api.services.blocking.BookkeepingEntrySetService
+import com.increase.api.services.blocking.CardDetailService
import com.increase.api.services.blocking.CardPaymentService
import com.increase.api.services.blocking.CardPurchaseSupplementService
import com.increase.api.services.blocking.CardPushTransferService
@@ -104,6 +105,8 @@ interface IncreaseClient {
fun cards(): CardService
+ fun cardDetails(): CardDetailService
+
fun cardPayments(): CardPaymentService
fun cardPurchaseSupplements(): CardPurchaseSupplementService
@@ -237,6 +240,8 @@ interface IncreaseClient {
fun cards(): CardService.WithRawResponse
+ fun cardDetails(): CardDetailService.WithRawResponse
+
fun cardPayments(): CardPaymentService.WithRawResponse
fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt
index 254077478..6a8f5b80a 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt
@@ -12,6 +12,7 @@ import com.increase.api.services.async.AchTransferServiceAsync
import com.increase.api.services.async.BookkeepingAccountServiceAsync
import com.increase.api.services.async.BookkeepingEntryServiceAsync
import com.increase.api.services.async.BookkeepingEntrySetServiceAsync
+import com.increase.api.services.async.CardDetailServiceAsync
import com.increase.api.services.async.CardPaymentServiceAsync
import com.increase.api.services.async.CardPurchaseSupplementServiceAsync
import com.increase.api.services.async.CardPushTransferServiceAsync
@@ -104,6 +105,8 @@ interface IncreaseClientAsync {
fun cards(): CardServiceAsync
+ fun cardDetails(): CardDetailServiceAsync
+
fun cardPayments(): CardPaymentServiceAsync
fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync
@@ -241,6 +244,8 @@ interface IncreaseClientAsync {
fun cards(): CardServiceAsync.WithRawResponse
+ fun cardDetails(): CardDetailServiceAsync.WithRawResponse
+
fun cardPayments(): CardPaymentServiceAsync.WithRawResponse
fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt
index 7c881b56d..7d133d327 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt
@@ -22,6 +22,8 @@ import com.increase.api.services.async.BookkeepingEntryServiceAsync
import com.increase.api.services.async.BookkeepingEntryServiceAsyncImpl
import com.increase.api.services.async.BookkeepingEntrySetServiceAsync
import com.increase.api.services.async.BookkeepingEntrySetServiceAsyncImpl
+import com.increase.api.services.async.CardDetailServiceAsync
+import com.increase.api.services.async.CardDetailServiceAsyncImpl
import com.increase.api.services.async.CardPaymentServiceAsync
import com.increase.api.services.async.CardPaymentServiceAsyncImpl
import com.increase.api.services.async.CardPurchaseSupplementServiceAsync
@@ -147,6 +149,10 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa
private val cards: CardServiceAsync by lazy { CardServiceAsyncImpl(clientOptionsWithUserAgent) }
+ private val cardDetails: CardDetailServiceAsync by lazy {
+ CardDetailServiceAsyncImpl(clientOptionsWithUserAgent)
+ }
+
private val cardPayments: CardPaymentServiceAsync by lazy {
CardPaymentServiceAsyncImpl(clientOptionsWithUserAgent)
}
@@ -363,6 +369,8 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa
override fun cards(): CardServiceAsync = cards
+ override fun cardDetails(): CardDetailServiceAsync = cardDetails
+
override fun cardPayments(): CardPaymentServiceAsync = cardPayments
override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync =
@@ -491,6 +499,10 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa
CardServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
+ private val cardDetails: CardDetailServiceAsync.WithRawResponse by lazy {
+ CardDetailServiceAsyncImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val cardPayments: CardPaymentServiceAsync.WithRawResponse by lazy {
CardPaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions)
}
@@ -713,6 +725,8 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa
override fun cards(): CardServiceAsync.WithRawResponse = cards
+ override fun cardDetails(): CardDetailServiceAsync.WithRawResponse = cardDetails
+
override fun cardPayments(): CardPaymentServiceAsync.WithRawResponse = cardPayments
override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse =
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt
index b2c6d0aa0..300cf175e 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt
@@ -22,6 +22,8 @@ import com.increase.api.services.blocking.BookkeepingEntryService
import com.increase.api.services.blocking.BookkeepingEntryServiceImpl
import com.increase.api.services.blocking.BookkeepingEntrySetService
import com.increase.api.services.blocking.BookkeepingEntrySetServiceImpl
+import com.increase.api.services.blocking.CardDetailService
+import com.increase.api.services.blocking.CardDetailServiceImpl
import com.increase.api.services.blocking.CardPaymentService
import com.increase.api.services.blocking.CardPaymentServiceImpl
import com.increase.api.services.blocking.CardPurchaseSupplementService
@@ -145,6 +147,10 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli
private val cards: CardService by lazy { CardServiceImpl(clientOptionsWithUserAgent) }
+ private val cardDetails: CardDetailService by lazy {
+ CardDetailServiceImpl(clientOptionsWithUserAgent)
+ }
+
private val cardPayments: CardPaymentService by lazy {
CardPaymentServiceImpl(clientOptionsWithUserAgent)
}
@@ -348,6 +354,8 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli
override fun cards(): CardService = cards
+ override fun cardDetails(): CardDetailService = cardDetails
+
override fun cardPayments(): CardPaymentService = cardPayments
override fun cardPurchaseSupplements(): CardPurchaseSupplementService = cardPurchaseSupplements
@@ -475,6 +483,10 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli
CardServiceImpl.WithRawResponseImpl(clientOptions)
}
+ private val cardDetails: CardDetailService.WithRawResponse by lazy {
+ CardDetailServiceImpl.WithRawResponseImpl(clientOptions)
+ }
+
private val cardPayments: CardPaymentService.WithRawResponse by lazy {
CardPaymentServiceImpl.WithRawResponseImpl(clientOptions)
}
@@ -694,6 +706,8 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli
override fun cards(): CardService.WithRawResponse = cards
+ override fun cardDetails(): CardDetailService.WithRawResponse = cardDetails
+
override fun cardPayments(): CardPaymentService.WithRawResponse = cardPayments
override fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse =
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
index 9cb09226b..0dff03ae7 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/ClientOptions.kt
@@ -54,6 +54,16 @@ private constructor(
* This class takes ownership of the executor and shuts it down, if possible, when closed.
*/
@get:JvmName("streamHandlerExecutor") val streamHandlerExecutor: Executor,
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ @get:JvmName("sleeper") val sleeper: Sleeper,
/**
* The clock to use for operations that require timing, like retries.
*
@@ -153,6 +163,7 @@ private constructor(
private var checkJacksonVersionCompatibility: Boolean = true
private var jsonMapper: JsonMapper = jsonMapper()
private var streamHandlerExecutor: Executor? = null
+ private var sleeper: Sleeper? = null
private var clock: Clock = Clock.systemUTC()
private var baseUrl: String? = null
private var headers: Headers.Builder = Headers.builder()
@@ -169,6 +180,7 @@ private constructor(
checkJacksonVersionCompatibility = clientOptions.checkJacksonVersionCompatibility
jsonMapper = clientOptions.jsonMapper
streamHandlerExecutor = clientOptions.streamHandlerExecutor
+ sleeper = clientOptions.sleeper
clock = clientOptions.clock
baseUrl = clientOptions.baseUrl
headers = clientOptions.headers.toBuilder()
@@ -224,6 +236,17 @@ private constructor(
else streamHandlerExecutor
}
+ /**
+ * The interface to use for delaying execution, like during retries.
+ *
+ * This is primarily useful for using fake delays in tests.
+ *
+ * Defaults to real execution delays.
+ *
+ * This class takes ownership of the sleeper and closes it when closed.
+ */
+ fun sleeper(sleeper: Sleeper) = apply { this.sleeper = PhantomReachableSleeper(sleeper) }
+
/**
* The clock to use for operations that require timing, like retries.
*
@@ -423,6 +446,25 @@ private constructor(
*/
fun build(): ClientOptions {
val httpClient = checkRequired("httpClient", httpClient)
+ val streamHandlerExecutor =
+ streamHandlerExecutor
+ ?: PhantomReachableExecutorService(
+ Executors.newCachedThreadPool(
+ object : ThreadFactory {
+
+ private val threadFactory: ThreadFactory =
+ Executors.defaultThreadFactory()
+ private val count = AtomicLong(0)
+
+ override fun newThread(runnable: Runnable): Thread =
+ threadFactory.newThread(runnable).also {
+ it.name =
+ "increase-stream-handler-thread-${count.getAndIncrement()}"
+ }
+ }
+ )
+ )
+ val sleeper = sleeper ?: PhantomReachableSleeper(DefaultSleeper())
val apiKey = checkRequired("apiKey", apiKey)
val headers = Headers.builder()
@@ -446,27 +488,15 @@ private constructor(
httpClient,
RetryingHttpClient.builder()
.httpClient(httpClient)
+ .sleeper(sleeper)
.clock(clock)
.maxRetries(maxRetries)
.idempotencyHeader("Idempotency-Key")
.build(),
checkJacksonVersionCompatibility,
jsonMapper,
- streamHandlerExecutor
- ?: Executors.newCachedThreadPool(
- object : ThreadFactory {
-
- private val threadFactory: ThreadFactory =
- Executors.defaultThreadFactory()
- private val count = AtomicLong(0)
-
- override fun newThread(runnable: Runnable): Thread =
- threadFactory.newThread(runnable).also {
- it.name =
- "increase-stream-handler-thread-${count.getAndIncrement()}"
- }
- }
- ),
+ streamHandlerExecutor,
+ sleeper,
clock,
baseUrl,
headers.build(),
@@ -493,5 +523,6 @@ private constructor(
fun close() {
httpClient.close()
(streamHandlerExecutor as? ExecutorService)?.shutdown()
+ sleeper.close()
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/DefaultSleeper.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/DefaultSleeper.kt
new file mode 100644
index 000000000..fc7a98b29
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/DefaultSleeper.kt
@@ -0,0 +1,28 @@
+package com.increase.api.core
+
+import java.time.Duration
+import java.util.Timer
+import java.util.TimerTask
+import java.util.concurrent.CompletableFuture
+
+class DefaultSleeper : Sleeper {
+
+ private val timer = Timer("DefaultSleeper", true)
+
+ override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis())
+
+ override fun sleepAsync(duration: Duration): CompletableFuture {
+ val future = CompletableFuture()
+ timer.schedule(
+ object : TimerTask() {
+ override fun run() {
+ future.complete(null)
+ }
+ },
+ duration.toMillis(),
+ )
+ return future
+ }
+
+ override fun close() = timer.cancel()
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/PhantomReachableSleeper.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/PhantomReachableSleeper.kt
new file mode 100644
index 000000000..8a31ec508
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/PhantomReachableSleeper.kt
@@ -0,0 +1,23 @@
+package com.increase.api.core
+
+import java.time.Duration
+import java.util.concurrent.CompletableFuture
+
+/**
+ * A delegating wrapper around a [Sleeper] that closes it once it's only phantom reachable.
+ *
+ * This class ensures the [Sleeper] is closed even if the user forgets to do it.
+ */
+internal class PhantomReachableSleeper(private val sleeper: Sleeper) : Sleeper {
+
+ init {
+ closeWhenPhantomReachable(this, sleeper)
+ }
+
+ override fun sleep(duration: Duration) = sleeper.sleep(duration)
+
+ override fun sleepAsync(duration: Duration): CompletableFuture =
+ sleeper.sleepAsync(duration)
+
+ override fun close() = sleeper.close()
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/Sleeper.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/Sleeper.kt
new file mode 100644
index 000000000..596b43bc5
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/Sleeper.kt
@@ -0,0 +1,21 @@
+package com.increase.api.core
+
+import java.time.Duration
+import java.util.concurrent.CompletableFuture
+
+/**
+ * An interface for delaying execution for a specified amount of time.
+ *
+ * Useful for testing and cleaning up resources.
+ */
+interface Sleeper : AutoCloseable {
+
+ /** Synchronously pauses execution for the given [duration]. */
+ fun sleep(duration: Duration)
+
+ /** Asynchronously pauses execution for the given [duration]. */
+ fun sleepAsync(duration: Duration): CompletableFuture
+
+ /** Overridden from [AutoCloseable] to not have a checked exception in its signature. */
+ override fun close()
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt
index dd525c06b..31bafe457 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/core/http/RetryingHttpClient.kt
@@ -1,6 +1,8 @@
package com.increase.api.core.http
+import com.increase.api.core.DefaultSleeper
import com.increase.api.core.RequestOptions
+import com.increase.api.core.Sleeper
import com.increase.api.core.checkRequired
import com.increase.api.errors.IncreaseIoException
import com.increase.api.errors.IncreaseRetryableException
@@ -11,8 +13,6 @@ import java.time.OffsetDateTime
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeParseException
import java.time.temporal.ChronoUnit
-import java.util.Timer
-import java.util.TimerTask
import java.util.UUID
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ThreadLocalRandom
@@ -130,7 +130,10 @@ private constructor(
return executeWithRetries(modifiedRequest, requestOptions)
}
- override fun close() = httpClient.close()
+ override fun close() {
+ httpClient.close()
+ sleeper.close()
+ }
private fun isRetryable(request: HttpRequest): Boolean =
// Some requests, such as when a request body is being streamed, cannot be retried because
@@ -235,33 +238,14 @@ private constructor(
class Builder internal constructor() {
private var httpClient: HttpClient? = null
- private var sleeper: Sleeper =
- object : Sleeper {
-
- private val timer = Timer("RetryingHttpClient", true)
-
- override fun sleep(duration: Duration) = Thread.sleep(duration.toMillis())
-
- override fun sleepAsync(duration: Duration): CompletableFuture {
- val future = CompletableFuture()
- timer.schedule(
- object : TimerTask() {
- override fun run() {
- future.complete(null)
- }
- },
- duration.toMillis(),
- )
- return future
- }
- }
+ private var sleeper: Sleeper? = null
private var clock: Clock = Clock.systemUTC()
private var maxRetries: Int = 2
private var idempotencyHeader: String? = null
fun httpClient(httpClient: HttpClient) = apply { this.httpClient = httpClient }
- @JvmSynthetic internal fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper }
+ fun sleeper(sleeper: Sleeper) = apply { this.sleeper = sleeper }
fun clock(clock: Clock) = apply { this.clock = clock }
@@ -272,17 +256,10 @@ private constructor(
fun build(): HttpClient =
RetryingHttpClient(
checkRequired("httpClient", httpClient),
- sleeper,
+ sleeper ?: DefaultSleeper(),
clock,
maxRetries,
idempotencyHeader,
)
}
-
- internal interface Sleeper {
-
- fun sleep(duration: Duration)
-
- fun sleepAsync(duration: Duration): CompletableFuture
- }
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParams.kt
similarity index 92%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParams.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParams.kt
index b2d0040f1..4c62b8124 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParams.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
@@ -23,7 +23,7 @@ import kotlin.jvm.optionals.getOrNull
* Create an iframe URL for a Card to display the card details. More details about styling and usage
* can be found in the [documentation](/documentation/embedded-card-component).
*/
-class CardCreateDetailsIframeParams
+class CardDetailCreateDetailsIframeParams
private constructor(
private val cardId: String?,
private val body: Body,
@@ -61,16 +61,16 @@ private constructor(
companion object {
- @JvmStatic fun none(): CardCreateDetailsIframeParams = builder().build()
+ @JvmStatic fun none(): CardDetailCreateDetailsIframeParams = builder().build()
/**
* Returns a mutable builder for constructing an instance of
- * [CardCreateDetailsIframeParams].
+ * [CardDetailCreateDetailsIframeParams].
*/
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardCreateDetailsIframeParams]. */
+ /** A builder for [CardDetailCreateDetailsIframeParams]. */
class Builder internal constructor() {
private var cardId: String? = null
@@ -79,11 +79,14 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(cardCreateDetailsIframeParams: CardCreateDetailsIframeParams) = apply {
- cardId = cardCreateDetailsIframeParams.cardId
- body = cardCreateDetailsIframeParams.body.toBuilder()
- additionalHeaders = cardCreateDetailsIframeParams.additionalHeaders.toBuilder()
- additionalQueryParams = cardCreateDetailsIframeParams.additionalQueryParams.toBuilder()
+ internal fun from(
+ cardDetailCreateDetailsIframeParams: CardDetailCreateDetailsIframeParams
+ ) = apply {
+ cardId = cardDetailCreateDetailsIframeParams.cardId
+ body = cardDetailCreateDetailsIframeParams.body.toBuilder()
+ additionalHeaders = cardDetailCreateDetailsIframeParams.additionalHeaders.toBuilder()
+ additionalQueryParams =
+ cardDetailCreateDetailsIframeParams.additionalQueryParams.toBuilder()
}
/** The identifier of the Card to retrieve details for. */
@@ -233,12 +236,12 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardCreateDetailsIframeParams].
+ * Returns an immutable instance of [CardDetailCreateDetailsIframeParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
- fun build(): CardCreateDetailsIframeParams =
- CardCreateDetailsIframeParams(
+ fun build(): CardDetailCreateDetailsIframeParams =
+ CardDetailCreateDetailsIframeParams(
cardId,
body.build(),
additionalHeaders.build(),
@@ -412,7 +415,7 @@ private constructor(
return true
}
- return other is CardCreateDetailsIframeParams &&
+ return other is CardDetailCreateDetailsIframeParams &&
cardId == other.cardId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
@@ -423,5 +426,5 @@ private constructor(
Objects.hash(cardId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "CardCreateDetailsIframeParams{cardId=$cardId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "CardDetailCreateDetailsIframeParams{cardId=$cardId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetailsParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParams.kt
similarity index 85%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetailsParams.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParams.kt
index d4c911a4e..7dae413a4 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetailsParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParams.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.increase.api.core.Params
import com.increase.api.core.http.Headers
@@ -13,7 +13,7 @@ import kotlin.jvm.optionals.getOrNull
* Sensitive details for a Card include the primary account number, expiry, card verification code,
* and PIN.
*/
-class CardDetailsParams
+class CardDetailDetailsParams
private constructor(
private val cardId: String?,
private val additionalHeaders: Headers,
@@ -33,13 +33,13 @@ private constructor(
companion object {
- @JvmStatic fun none(): CardDetailsParams = builder().build()
+ @JvmStatic fun none(): CardDetailDetailsParams = builder().build()
- /** Returns a mutable builder for constructing an instance of [CardDetailsParams]. */
+ /** Returns a mutable builder for constructing an instance of [CardDetailDetailsParams]. */
@JvmStatic fun builder() = Builder()
}
- /** A builder for [CardDetailsParams]. */
+ /** A builder for [CardDetailDetailsParams]. */
class Builder internal constructor() {
private var cardId: String? = null
@@ -47,10 +47,10 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(cardDetailsParams: CardDetailsParams) = apply {
- cardId = cardDetailsParams.cardId
- additionalHeaders = cardDetailsParams.additionalHeaders.toBuilder()
- additionalQueryParams = cardDetailsParams.additionalQueryParams.toBuilder()
+ internal fun from(cardDetailDetailsParams: CardDetailDetailsParams) = apply {
+ cardId = cardDetailDetailsParams.cardId
+ additionalHeaders = cardDetailDetailsParams.additionalHeaders.toBuilder()
+ additionalQueryParams = cardDetailDetailsParams.additionalQueryParams.toBuilder()
}
/** The identifier of the Card to retrieve details for. */
@@ -158,12 +158,16 @@ private constructor(
}
/**
- * Returns an immutable instance of [CardDetailsParams].
+ * Returns an immutable instance of [CardDetailDetailsParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
- fun build(): CardDetailsParams =
- CardDetailsParams(cardId, additionalHeaders.build(), additionalQueryParams.build())
+ fun build(): CardDetailDetailsParams =
+ CardDetailDetailsParams(
+ cardId,
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
}
fun _pathParam(index: Int): String =
@@ -181,7 +185,7 @@ private constructor(
return true
}
- return other is CardDetailsParams &&
+ return other is CardDetailDetailsParams &&
cardId == other.cardId &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
@@ -190,5 +194,5 @@ private constructor(
override fun hashCode(): Int = Objects.hash(cardId, additionalHeaders, additionalQueryParams)
override fun toString() =
- "CardDetailsParams{cardId=$cardId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "CardDetailDetailsParams{cardId=$cardId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParams.kt
new file mode 100644
index 000000000..c62bff4c1
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParams.kt
@@ -0,0 +1,435 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.carddetails
+
+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.increase.api.core.ExcludeMissing
+import com.increase.api.core.JsonField
+import com.increase.api.core.JsonMissing
+import com.increase.api.core.JsonValue
+import com.increase.api.core.Params
+import com.increase.api.core.checkRequired
+import com.increase.api.core.http.Headers
+import com.increase.api.core.http.QueryParams
+import com.increase.api.errors.IncreaseInvalidDataException
+import java.util.Collections
+import java.util.Objects
+import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
+
+/** Update a Card's PIN */
+class CardDetailUpdateParams
+private constructor(
+ private val cardId: String?,
+ private val body: Body,
+ private val additionalHeaders: Headers,
+ private val additionalQueryParams: QueryParams,
+) : Params {
+
+ /** The card identifier. */
+ fun cardId(): Optional = Optional.ofNullable(cardId)
+
+ /**
+ * The 4-digit PIN for the card, for use with ATMs.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun pin(): String = body.pin()
+
+ /**
+ * Returns the raw JSON value of [pin].
+ *
+ * Unlike [pin], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _pin(): JsonField = body._pin()
+
+ fun _additionalBodyProperties(): Map = body._additionalProperties()
+
+ /** Additional headers to send with the request. */
+ fun _additionalHeaders(): Headers = additionalHeaders
+
+ /** Additional query param to send with the request. */
+ fun _additionalQueryParams(): QueryParams = additionalQueryParams
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /**
+ * Returns a mutable builder for constructing an instance of [CardDetailUpdateParams].
+ *
+ * The following fields are required:
+ * ```java
+ * .pin()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [CardDetailUpdateParams]. */
+ class Builder internal constructor() {
+
+ private var cardId: String? = null
+ private var body: Body.Builder = Body.builder()
+ private var additionalHeaders: Headers.Builder = Headers.builder()
+ private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
+
+ @JvmSynthetic
+ internal fun from(cardDetailUpdateParams: CardDetailUpdateParams) = apply {
+ cardId = cardDetailUpdateParams.cardId
+ body = cardDetailUpdateParams.body.toBuilder()
+ additionalHeaders = cardDetailUpdateParams.additionalHeaders.toBuilder()
+ additionalQueryParams = cardDetailUpdateParams.additionalQueryParams.toBuilder()
+ }
+
+ /** The card identifier. */
+ fun cardId(cardId: String?) = apply { this.cardId = cardId }
+
+ /** Alias for calling [Builder.cardId] with `cardId.orElse(null)`. */
+ fun cardId(cardId: Optional) = cardId(cardId.getOrNull())
+
+ /**
+ * Sets the entire request body.
+ *
+ * This is generally only useful if you are already constructing the body separately.
+ * Otherwise, it's more convenient to use the top-level setters instead:
+ * - [pin]
+ */
+ fun body(body: Body) = apply { this.body = body.toBuilder() }
+
+ /** The 4-digit PIN for the card, for use with ATMs. */
+ fun pin(pin: String) = apply { body.pin(pin) }
+
+ /**
+ * Sets [Builder.pin] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pin] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun pin(pin: JsonField) = apply { body.pin(pin) }
+
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ body.additionalProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ body.putAdditionalProperty(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
+ apply {
+ body.putAllAdditionalProperties(additionalBodyProperties)
+ }
+
+ fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ body.removeAllAdditionalProperties(keys)
+ }
+
+ fun additionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun additionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.clear()
+ putAllAdditionalHeaders(additionalHeaders)
+ }
+
+ fun putAdditionalHeader(name: String, value: String) = apply {
+ additionalHeaders.put(name, value)
+ }
+
+ fun putAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.put(name, values)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.putAll(additionalHeaders)
+ }
+
+ fun replaceAdditionalHeaders(name: String, value: String) = apply {
+ additionalHeaders.replace(name, value)
+ }
+
+ fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
+ additionalHeaders.replace(name, values)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
+ this.additionalHeaders.replaceAll(additionalHeaders)
+ }
+
+ fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
+
+ fun removeAllAdditionalHeaders(names: Set) = apply {
+ additionalHeaders.removeAll(names)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun additionalQueryParams(additionalQueryParams: Map>) = apply {
+ this.additionalQueryParams.clear()
+ putAllAdditionalQueryParams(additionalQueryParams)
+ }
+
+ fun putAdditionalQueryParam(key: String, value: String) = apply {
+ additionalQueryParams.put(key, value)
+ }
+
+ fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.put(key, values)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.putAll(additionalQueryParams)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, value: String) = apply {
+ additionalQueryParams.replace(key, value)
+ }
+
+ fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
+ additionalQueryParams.replace(key, values)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
+ apply {
+ this.additionalQueryParams.replaceAll(additionalQueryParams)
+ }
+
+ fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
+
+ fun removeAllAdditionalQueryParams(keys: Set) = apply {
+ additionalQueryParams.removeAll(keys)
+ }
+
+ /**
+ * Returns an immutable instance of [CardDetailUpdateParams].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .pin()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): CardDetailUpdateParams =
+ CardDetailUpdateParams(
+ cardId,
+ body.build(),
+ additionalHeaders.build(),
+ additionalQueryParams.build(),
+ )
+ }
+
+ fun _body(): Body = body
+
+ fun _pathParam(index: Int): String =
+ when (index) {
+ 0 -> cardId ?: ""
+ else -> ""
+ }
+
+ override fun _headers(): Headers = additionalHeaders
+
+ override fun _queryParams(): QueryParams = additionalQueryParams
+
+ class Body
+ private constructor(
+ private val pin: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("pin") @ExcludeMissing pin: JsonField = JsonMissing.of()
+ ) : this(pin, mutableMapOf())
+
+ /**
+ * The 4-digit PIN for the card, for use with ATMs.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected value).
+ */
+ fun pin(): String = pin.getRequired("pin")
+
+ /**
+ * Returns the raw JSON value of [pin].
+ *
+ * Unlike [pin], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pin") @ExcludeMissing fun _pin(): JsonField = pin
+
+ @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 [Body].
+ *
+ * The following fields are required:
+ * ```java
+ * .pin()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Body]. */
+ class Builder internal constructor() {
+
+ private var pin: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(body: Body) = apply {
+ pin = body.pin
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
+
+ /** The 4-digit PIN for the card, for use with ATMs. */
+ fun pin(pin: String) = pin(JsonField.of(pin))
+
+ /**
+ * Sets [Builder.pin] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pin] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun pin(pin: JsonField) = apply { this.pin = pin }
+
+ 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 [Body].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .pin()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Body = Body(checkRequired("pin", pin), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ pin()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ 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 (pin.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Body &&
+ pin == other.pin &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(pin, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() = "Body{pin=$pin, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is CardDetailUpdateParams &&
+ cardId == other.cardId &&
+ body == other.body &&
+ additionalHeaders == other.additionalHeaders &&
+ additionalQueryParams == other.additionalQueryParams
+ }
+
+ override fun hashCode(): Int =
+ Objects.hash(cardId, body, additionalHeaders, additionalQueryParams)
+
+ override fun toString() =
+ "CardDetailUpdateParams{cardId=$cardId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetails.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetails.kt
similarity index 98%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetails.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetails.kt
index 11d4a5b23..a6bb8015c 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardDetails.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardDetails.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
@@ -17,7 +17,12 @@ import java.util.Collections
import java.util.Objects
import kotlin.jvm.optionals.getOrNull
-/** An object containing the sensitive details (card number, cvc, etc) for a Card. */
+/**
+ * An object containing the sensitive details (card number, CVC, PIN, etc) for a Card. These details
+ * are not included in the Card object. If you'd prefer to never access these details directly, you
+ * can use the [embedded iframe](/documentation/embedded-card-component) to display the information
+ * to your users.
+ */
class CardDetails
private constructor(
private val cardId: JsonField,
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardIframeUrl.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardIframeUrl.kt
similarity index 99%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardIframeUrl.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardIframeUrl.kt
index 86cb1b129..2726e185f 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardIframeUrl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddetails/CardIframeUrl.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt
index 9d5ca7299..36c988181 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt
@@ -67,6 +67,14 @@ private constructor(
*/
fun entityId(): Optional = body.entityId()
+ /**
+ * The 4-digit PIN for the card, for use with ATMs.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun pin(): Optional = body.pin()
+
/**
* The status to update the Card with.
*
@@ -103,6 +111,13 @@ private constructor(
*/
fun _entityId(): JsonField = body._entityId()
+ /**
+ * Returns the raw JSON value of [pin].
+ *
+ * Unlike [pin], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _pin(): JsonField = body._pin()
+
/**
* Returns the raw JSON value of [status].
*
@@ -159,7 +174,7 @@ private constructor(
* - [description]
* - [digitalWallet]
* - [entityId]
- * - [status]
+ * - [pin]
* - etc.
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -225,6 +240,17 @@ private constructor(
*/
fun entityId(entityId: JsonField) = apply { body.entityId(entityId) }
+ /** The 4-digit PIN for the card, for use with ATMs. */
+ fun pin(pin: String) = apply { body.pin(pin) }
+
+ /**
+ * Sets [Builder.pin] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pin] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun pin(pin: JsonField) = apply { body.pin(pin) }
+
/** The status to update the Card with. */
fun status(status: Status) = apply { body.status(status) }
@@ -385,6 +411,7 @@ private constructor(
private val description: JsonField,
private val digitalWallet: JsonField,
private val entityId: JsonField,
+ private val pin: JsonField,
private val status: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -403,8 +430,9 @@ private constructor(
@JsonProperty("entity_id")
@ExcludeMissing
entityId: JsonField = JsonMissing.of(),
+ @JsonProperty("pin") @ExcludeMissing pin: JsonField = JsonMissing.of(),
@JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
- ) : this(billingAddress, description, digitalWallet, entityId, status, mutableMapOf())
+ ) : this(billingAddress, description, digitalWallet, entityId, pin, status, mutableMapOf())
/**
* The card's updated billing address.
@@ -441,6 +469,14 @@ private constructor(
*/
fun entityId(): Optional = entityId.getOptional("entity_id")
+ /**
+ * The 4-digit PIN for the card, for use with ATMs.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun pin(): Optional = pin.getOptional("pin")
+
/**
* The status to update the Card with.
*
@@ -485,6 +521,13 @@ private constructor(
*/
@JsonProperty("entity_id") @ExcludeMissing fun _entityId(): JsonField = entityId
+ /**
+ * Returns the raw JSON value of [pin].
+ *
+ * Unlike [pin], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("pin") @ExcludeMissing fun _pin(): JsonField = pin
+
/**
* Returns the raw JSON value of [status].
*
@@ -517,6 +560,7 @@ private constructor(
private var description: JsonField = JsonMissing.of()
private var digitalWallet: JsonField = JsonMissing.of()
private var entityId: JsonField = JsonMissing.of()
+ private var pin: JsonField = JsonMissing.of()
private var status: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -526,6 +570,7 @@ private constructor(
description = body.description
digitalWallet = body.digitalWallet
entityId = body.entityId
+ pin = body.pin
status = body.status
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -592,6 +637,18 @@ private constructor(
*/
fun entityId(entityId: JsonField) = apply { this.entityId = entityId }
+ /** The 4-digit PIN for the card, for use with ATMs. */
+ fun pin(pin: String) = pin(JsonField.of(pin))
+
+ /**
+ * Sets [Builder.pin] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.pin] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun pin(pin: JsonField) = apply { this.pin = pin }
+
/** The status to update the Card with. */
fun status(status: Status) = status(JsonField.of(status))
@@ -634,6 +691,7 @@ private constructor(
description,
digitalWallet,
entityId,
+ pin,
status,
additionalProperties.toMutableMap(),
)
@@ -650,6 +708,7 @@ private constructor(
description()
digitalWallet().ifPresent { it.validate() }
entityId()
+ pin()
status().ifPresent { it.validate() }
validated = true
}
@@ -674,6 +733,7 @@ private constructor(
(if (description.asKnown().isPresent) 1 else 0) +
(digitalWallet.asKnown().getOrNull()?.validity() ?: 0) +
(if (entityId.asKnown().isPresent) 1 else 0) +
+ (if (pin.asKnown().isPresent) 1 else 0) +
(status.asKnown().getOrNull()?.validity() ?: 0)
override fun equals(other: Any?): Boolean {
@@ -686,6 +746,7 @@ private constructor(
description == other.description &&
digitalWallet == other.digitalWallet &&
entityId == other.entityId &&
+ pin == other.pin &&
status == other.status &&
additionalProperties == other.additionalProperties
}
@@ -696,6 +757,7 @@ private constructor(
description,
digitalWallet,
entityId,
+ pin,
status,
additionalProperties,
)
@@ -704,7 +766,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{billingAddress=$billingAddress, description=$description, digitalWallet=$digitalWallet, entityId=$entityId, status=$status, additionalProperties=$additionalProperties}"
+ "Body{billingAddress=$billingAddress, description=$description, digitalWallet=$digitalWallet, entityId=$entityId, pin=$pin, status=$status, additionalProperties=$additionalProperties}"
}
/** The card's updated billing address. */
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParams.kt
similarity index 96%
rename from increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParams.kt
rename to increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParams.kt
index c42600b54..138b1eb39 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParams.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParams.kt
@@ -26,7 +26,7 @@ import kotlin.jvm.optionals.getOrNull
* This endpoint allows you to simulate receiving a tracking update for a Physical Card, to simulate
* the progress of a shipment.
*/
-class PhysicalCardTrackingUpdatesParams
+class PhysicalCardCreateParams
private constructor(
private val physicalCardId: String?,
private val body: Body,
@@ -128,8 +128,7 @@ private constructor(
companion object {
/**
- * Returns a mutable builder for constructing an instance of
- * [PhysicalCardTrackingUpdatesParams].
+ * Returns a mutable builder for constructing an instance of [PhysicalCardCreateParams].
*
* The following fields are required:
* ```java
@@ -139,7 +138,7 @@ private constructor(
@JvmStatic fun builder() = Builder()
}
- /** A builder for [PhysicalCardTrackingUpdatesParams]. */
+ /** A builder for [PhysicalCardCreateParams]. */
class Builder internal constructor() {
private var physicalCardId: String? = null
@@ -148,14 +147,12 @@ private constructor(
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
- internal fun from(physicalCardTrackingUpdatesParams: PhysicalCardTrackingUpdatesParams) =
- apply {
- physicalCardId = physicalCardTrackingUpdatesParams.physicalCardId
- body = physicalCardTrackingUpdatesParams.body.toBuilder()
- additionalHeaders = physicalCardTrackingUpdatesParams.additionalHeaders.toBuilder()
- additionalQueryParams =
- physicalCardTrackingUpdatesParams.additionalQueryParams.toBuilder()
- }
+ internal fun from(physicalCardCreateParams: PhysicalCardCreateParams) = apply {
+ physicalCardId = physicalCardCreateParams.physicalCardId
+ body = physicalCardCreateParams.body.toBuilder()
+ additionalHeaders = physicalCardCreateParams.additionalHeaders.toBuilder()
+ additionalQueryParams = physicalCardCreateParams.additionalQueryParams.toBuilder()
+ }
/** The Physical Card you would like to action. */
fun physicalCardId(physicalCardId: String?) = apply { this.physicalCardId = physicalCardId }
@@ -362,7 +359,7 @@ private constructor(
}
/**
- * Returns an immutable instance of [PhysicalCardTrackingUpdatesParams].
+ * Returns an immutable instance of [PhysicalCardCreateParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
@@ -373,8 +370,8 @@ private constructor(
*
* @throws IllegalStateException if any required field is unset.
*/
- fun build(): PhysicalCardTrackingUpdatesParams =
- PhysicalCardTrackingUpdatesParams(
+ fun build(): PhysicalCardCreateParams =
+ PhysicalCardCreateParams(
physicalCardId,
body.build(),
additionalHeaders.build(),
@@ -880,7 +877,7 @@ private constructor(
return true
}
- return other is PhysicalCardTrackingUpdatesParams &&
+ return other is PhysicalCardCreateParams &&
physicalCardId == other.physicalCardId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
@@ -891,5 +888,5 @@ private constructor(
Objects.hash(physicalCardId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "PhysicalCardTrackingUpdatesParams{physicalCardId=$physicalCardId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "PhysicalCardCreateParams{physicalCardId=$physicalCardId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsync.kt
new file mode 100644
index 000000000..88a860529
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsync.kt
@@ -0,0 +1,252 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.async
+
+import com.increase.api.core.ClientOptions
+import com.increase.api.core.RequestOptions
+import com.increase.api.core.http.HttpResponseFor
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailDetailsParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import com.increase.api.models.carddetails.CardDetails
+import com.increase.api.models.carddetails.CardIframeUrl
+import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+
+interface CardDetailServiceAsync {
+
+ /**
+ * Returns a view of this service that provides access to raw HTTP responses for each method.
+ */
+ fun withRawResponse(): WithRawResponse
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): CardDetailServiceAsync
+
+ /** Update a Card's PIN */
+ fun update(cardId: String, params: CardDetailUpdateParams): CompletableFuture =
+ update(cardId, params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ cardId: String,
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ update(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see update */
+ fun update(params: CardDetailUpdateParams): CompletableFuture =
+ update(params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
+ /**
+ * Create an iframe URL for a Card to display the card details. More details about styling and
+ * usage can be found in the [documentation](/documentation/embedded-card-component).
+ */
+ fun createDetailsIframe(cardId: String): CompletableFuture =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ ): CompletableFuture = createDetailsIframe(cardId, params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams
+ ): CompletableFuture = createDetailsIframe(params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none(), requestOptions)
+
+ /**
+ * Sensitive details for a Card include the primary account number, expiry, card verification
+ * code, and PIN.
+ */
+ fun details(cardId: String): CompletableFuture =
+ details(cardId, CardDetailDetailsParams.none())
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ details(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ ): CompletableFuture = details(cardId, params, RequestOptions.none())
+
+ /** @see details */
+ fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
+ /** @see details */
+ fun details(params: CardDetailDetailsParams): CompletableFuture =
+ details(params, RequestOptions.none())
+
+ /** @see details */
+ fun details(cardId: String, requestOptions: RequestOptions): CompletableFuture =
+ details(cardId, CardDetailDetailsParams.none(), requestOptions)
+
+ /**
+ * A view of [CardDetailServiceAsync] that provides access to raw HTTP responses for each
+ * method.
+ */
+ interface WithRawResponse {
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): CardDetailServiceAsync.WithRawResponse
+
+ /**
+ * Returns a raw HTTP response for `patch /cards/{card_id}/details`, but is otherwise the
+ * same as [CardDetailServiceAsync.update].
+ */
+ fun update(
+ cardId: String,
+ params: CardDetailUpdateParams,
+ ): CompletableFuture> =
+ update(cardId, params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ cardId: String,
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ update(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see update */
+ fun update(
+ params: CardDetailUpdateParams
+ ): CompletableFuture> = update(params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
+
+ /**
+ * Returns a raw HTTP response for `post /cards/{card_id}/create_details_iframe`, but is
+ * otherwise the same as [CardDetailServiceAsync.createDetailsIframe].
+ */
+ fun createDetailsIframe(cardId: String): CompletableFuture> =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams =
+ CardDetailCreateDetailsIframeParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ ): CompletableFuture> =
+ createDetailsIframe(cardId, params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams
+ ): CompletableFuture> =
+ createDetailsIframe(params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none(), requestOptions)
+
+ /**
+ * Returns a raw HTTP response for `get /cards/{card_id}/details`, but is otherwise the same
+ * as [CardDetailServiceAsync.details].
+ */
+ fun details(cardId: String): CompletableFuture> =
+ details(cardId, CardDetailDetailsParams.none())
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ details(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ ): CompletableFuture> =
+ details(cardId, params, RequestOptions.none())
+
+ /** @see details */
+ fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
+
+ /** @see details */
+ fun details(
+ params: CardDetailDetailsParams
+ ): CompletableFuture> = details(params, RequestOptions.none())
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> =
+ details(cardId, CardDetailDetailsParams.none(), requestOptions)
+ }
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsyncImpl.kt
new file mode 100644
index 000000000..289aad6fc
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDetailServiceAsyncImpl.kt
@@ -0,0 +1,175 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.async
+
+import com.increase.api.core.ClientOptions
+import com.increase.api.core.RequestOptions
+import com.increase.api.core.checkRequired
+import com.increase.api.core.handlers.errorBodyHandler
+import com.increase.api.core.handlers.errorHandler
+import com.increase.api.core.handlers.jsonHandler
+import com.increase.api.core.http.HttpMethod
+import com.increase.api.core.http.HttpRequest
+import com.increase.api.core.http.HttpResponse
+import com.increase.api.core.http.HttpResponse.Handler
+import com.increase.api.core.http.HttpResponseFor
+import com.increase.api.core.http.json
+import com.increase.api.core.http.parseable
+import com.increase.api.core.prepareAsync
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailDetailsParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import com.increase.api.models.carddetails.CardDetails
+import com.increase.api.models.carddetails.CardIframeUrl
+import java.util.concurrent.CompletableFuture
+import java.util.function.Consumer
+import kotlin.jvm.optionals.getOrNull
+
+class CardDetailServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) :
+ CardDetailServiceAsync {
+
+ private val withRawResponse: CardDetailServiceAsync.WithRawResponse by lazy {
+ WithRawResponseImpl(clientOptions)
+ }
+
+ override fun withRawResponse(): CardDetailServiceAsync.WithRawResponse = withRawResponse
+
+ override fun withOptions(modifier: Consumer): CardDetailServiceAsync =
+ CardDetailServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
+ override fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // patch /cards/{card_id}/details
+ withRawResponse().update(params, requestOptions).thenApply { it.parse() }
+
+ override fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // post /cards/{card_id}/create_details_iframe
+ withRawResponse().createDetailsIframe(params, requestOptions).thenApply { it.parse() }
+
+ override fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // get /cards/{card_id}/details
+ withRawResponse().details(params, requestOptions).thenApply { it.parse() }
+
+ class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
+ CardDetailServiceAsync.WithRawResponse {
+
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
+
+ override fun withOptions(
+ modifier: Consumer
+ ): CardDetailServiceAsync.WithRawResponse =
+ CardDetailServiceAsyncImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
+ private val updateHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.PATCH)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "details")
+ .body(json(clientOptions.jsonMapper, params._body()))
+ .build()
+ .prepareAsync(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ return request
+ .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
+ .thenApply { response ->
+ errorHandler.handle(response).parseable {
+ response
+ .use { updateHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+ }
+
+ private val createDetailsIframeHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.POST)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "create_details_iframe")
+ .body(json(clientOptions.jsonMapper, params._body()))
+ .build()
+ .prepareAsync(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ return request
+ .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
+ .thenApply { response ->
+ errorHandler.handle(response).parseable {
+ response
+ .use { createDetailsIframeHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+ }
+
+ private val detailsHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture> {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "details")
+ .build()
+ .prepareAsync(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ return request
+ .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
+ .thenApply { response ->
+ errorHandler.handle(response).parseable {
+ response
+ .use { detailsHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsync.kt
index 643698c0d..ab866c160 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsync.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsync.kt
@@ -6,11 +6,7 @@ import com.increase.api.core.ClientOptions
import com.increase.api.core.RequestOptions
import com.increase.api.core.http.HttpResponseFor
import com.increase.api.models.cards.Card
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
-import com.increase.api.models.cards.CardDetails
-import com.increase.api.models.cards.CardDetailsParams
-import com.increase.api.models.cards.CardIframeUrl
import com.increase.api.models.cards.CardListPageAsync
import com.increase.api.models.cards.CardListParams
import com.increase.api.models.cards.CardRetrieveParams
@@ -120,80 +116,6 @@ interface CardServiceAsync {
fun list(requestOptions: RequestOptions): CompletableFuture =
list(CardListParams.none(), requestOptions)
- /**
- * Create an iframe URL for a Card to display the card details. More details about styling and
- * usage can be found in the [documentation](/documentation/embedded-card-component).
- */
- fun createDetailsIframe(cardId: String): CompletableFuture =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture =
- createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- ): CompletableFuture = createDetailsIframe(cardId, params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams
- ): CompletableFuture = createDetailsIframe(params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none(), requestOptions)
-
- /**
- * Sensitive details for a Card include the primary account number, expiry, card verification
- * code, and PIN.
- */
- fun details(cardId: String): CompletableFuture =
- details(cardId, CardDetailsParams.none())
-
- /** @see details */
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture =
- details(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see details */
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- ): CompletableFuture = details(cardId, params, RequestOptions.none())
-
- /** @see details */
- fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
- /** @see details */
- fun details(params: CardDetailsParams): CompletableFuture =
- details(params, RequestOptions.none())
-
- /** @see details */
- fun details(cardId: String, requestOptions: RequestOptions): CompletableFuture =
- details(cardId, CardDetailsParams.none(), requestOptions)
-
/** A view of [CardServiceAsync] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
@@ -318,85 +240,5 @@ interface CardServiceAsync {
requestOptions: RequestOptions
): CompletableFuture> =
list(CardListParams.none(), requestOptions)
-
- /**
- * Returns a raw HTTP response for `post /cards/{card_id}/create_details_iframe`, but is
- * otherwise the same as [CardServiceAsync.createDetailsIframe].
- */
- fun createDetailsIframe(cardId: String): CompletableFuture> =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture> =
- createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- ): CompletableFuture> =
- createDetailsIframe(cardId, params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams
- ): CompletableFuture> =
- createDetailsIframe(params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- requestOptions: RequestOptions,
- ): CompletableFuture> =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none(), requestOptions)
-
- /**
- * Returns a raw HTTP response for `get /cards/{card_id}/details`, but is otherwise the same
- * as [CardServiceAsync.details].
- */
- fun details(cardId: String): CompletableFuture> =
- details(cardId, CardDetailsParams.none())
-
- /** @see details */
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture> =
- details(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see details */
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- ): CompletableFuture> =
- details(cardId, params, RequestOptions.none())
-
- /** @see details */
- fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
-
- /** @see details */
- fun details(params: CardDetailsParams): CompletableFuture> =
- details(params, RequestOptions.none())
-
- /** @see details */
- fun details(
- cardId: String,
- requestOptions: RequestOptions,
- ): CompletableFuture> =
- details(cardId, CardDetailsParams.none(), requestOptions)
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsyncImpl.kt
index 285012808..89375e46e 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsyncImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardServiceAsyncImpl.kt
@@ -17,11 +17,7 @@ import com.increase.api.core.http.json
import com.increase.api.core.http.parseable
import com.increase.api.core.prepareAsync
import com.increase.api.models.cards.Card
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
-import com.increase.api.models.cards.CardDetails
-import com.increase.api.models.cards.CardDetailsParams
-import com.increase.api.models.cards.CardIframeUrl
import com.increase.api.models.cards.CardListPageAsync
import com.increase.api.models.cards.CardListPageResponse
import com.increase.api.models.cards.CardListParams
@@ -71,20 +67,6 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
// get /cards
withRawResponse().list(params, requestOptions).thenApply { it.parse() }
- override fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // post /cards/{card_id}/create_details_iframe
- withRawResponse().createDetailsIframe(params, requestOptions).thenApply { it.parse() }
-
- override fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // get /cards/{card_id}/details
- withRawResponse().details(params, requestOptions).thenApply { it.parse() }
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CardServiceAsync.WithRawResponse {
@@ -230,72 +212,5 @@ class CardServiceAsyncImpl internal constructor(private val clientOptions: Clien
}
}
}
-
- private val createDetailsIframeHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions,
- ): CompletableFuture> {
- // We check here instead of in the params builder because this can be specified
- // positionally or in the params class.
- checkRequired("cardId", params.cardId().getOrNull())
- val request =
- HttpRequest.builder()
- .method(HttpMethod.POST)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("cards", params._pathParam(0), "create_details_iframe")
- .body(json(clientOptions.jsonMapper, params._body()))
- .build()
- .prepareAsync(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- return request
- .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
- .thenApply { response ->
- errorHandler.handle(response).parseable {
- response
- .use { createDetailsIframeHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
- }
-
- private val detailsHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions,
- ): CompletableFuture> {
- // We check here instead of in the params builder because this can be specified
- // positionally or in the params class.
- checkRequired("cardId", params.cardId().getOrNull())
- val request =
- HttpRequest.builder()
- .method(HttpMethod.GET)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("cards", params._pathParam(0), "details")
- .build()
- .prepareAsync(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- return request
- .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) }
- .thenApply { response ->
- errorHandler.handle(response).parseable {
- response
- .use { detailsHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
- }
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsync.kt
index 1e3a375d1..40c50896f 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsync.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsync.kt
@@ -7,7 +7,7 @@ import com.increase.api.core.RequestOptions
import com.increase.api.core.http.HttpResponseFor
import com.increase.api.models.physicalcards.PhysicalCard
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
@@ -25,6 +25,33 @@ interface PhysicalCardServiceAsync {
*/
fun withOptions(modifier: Consumer): PhysicalCardServiceAsync
+ /**
+ * This endpoint allows you to simulate receiving a tracking update for a Physical Card, to
+ * simulate the progress of a shipment.
+ */
+ fun create(
+ physicalCardId: String,
+ params: PhysicalCardCreateParams,
+ ): CompletableFuture = create(physicalCardId, params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ physicalCardId: String,
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture =
+ create(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
+
+ /** @see create */
+ fun create(params: PhysicalCardCreateParams): CompletableFuture =
+ create(params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture
+
/**
* This endpoint allows you to simulate advancing the shipment status of a Physical Card, to
* simulate e.g., that a physical card was attempted shipped but then failed delivery.
@@ -54,35 +81,6 @@ interface PhysicalCardServiceAsync {
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture
- /**
- * This endpoint allows you to simulate receiving a tracking update for a Physical Card, to
- * simulate the progress of a shipment.
- */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- ): CompletableFuture =
- trackingUpdates(physicalCardId, params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture =
- trackingUpdates(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams
- ): CompletableFuture = trackingUpdates(params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture
-
/**
* A view of [PhysicalCardServiceAsync] that provides access to raw HTTP responses for each
* method.
@@ -98,6 +96,36 @@ interface PhysicalCardServiceAsync {
modifier: Consumer
): PhysicalCardServiceAsync.WithRawResponse
+ /**
+ * Returns a raw HTTP response for `post
+ * /simulations/physical_cards/{physical_card_id}/tracking_updates`, but is otherwise the
+ * same as [PhysicalCardServiceAsync.create].
+ */
+ fun create(
+ physicalCardId: String,
+ params: PhysicalCardCreateParams,
+ ): CompletableFuture> =
+ create(physicalCardId, params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ physicalCardId: String,
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture> =
+ create(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
+
+ /** @see create */
+ fun create(
+ params: PhysicalCardCreateParams
+ ): CompletableFuture> = create(params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CompletableFuture>
+
/**
* Returns a raw HTTP response for `post
* /simulations/physical_cards/{physical_card_id}/advance_shipment`, but is otherwise the
@@ -131,39 +159,5 @@ interface PhysicalCardServiceAsync {
params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions = RequestOptions.none(),
): CompletableFuture>
-
- /**
- * Returns a raw HTTP response for `post
- * /simulations/physical_cards/{physical_card_id}/tracking_updates`, but is otherwise the
- * same as [PhysicalCardServiceAsync.trackingUpdates].
- */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- ): CompletableFuture> =
- trackingUpdates(physicalCardId, params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture> =
- trackingUpdates(
- params.toBuilder().physicalCardId(physicalCardId).build(),
- requestOptions,
- )
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams
- ): CompletableFuture> =
- trackingUpdates(params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CompletableFuture>
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncImpl.kt
index 7989586db..48b54f2b0 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncImpl.kt
@@ -18,7 +18,7 @@ import com.increase.api.core.http.parseable
import com.increase.api.core.prepareAsync
import com.increase.api.models.physicalcards.PhysicalCard
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.util.concurrent.CompletableFuture
import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
@@ -35,6 +35,13 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
override fun withOptions(modifier: Consumer): PhysicalCardServiceAsync =
PhysicalCardServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+ override fun create(
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions,
+ ): CompletableFuture =
+ // post /simulations/physical_cards/{physical_card_id}/tracking_updates
+ withRawResponse().create(params, requestOptions).thenApply { it.parse() }
+
override fun advanceShipment(
params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions,
@@ -42,13 +49,6 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
// post /simulations/physical_cards/{physical_card_id}/advance_shipment
withRawResponse().advanceShipment(params, requestOptions).thenApply { it.parse() }
- override fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions,
- ): CompletableFuture =
- // post /simulations/physical_cards/{physical_card_id}/tracking_updates
- withRawResponse().trackingUpdates(params, requestOptions).thenApply { it.parse() }
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
PhysicalCardServiceAsync.WithRawResponse {
@@ -62,11 +62,11 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val advanceShipmentHandler: Handler =
+ private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- override fun advanceShipment(
- params: PhysicalCardAdvanceShipmentParams,
+ override fun create(
+ params: PhysicalCardCreateParams,
requestOptions: RequestOptions,
): CompletableFuture> {
// We check here instead of in the params builder because this can be specified
@@ -80,7 +80,7 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
"simulations",
"physical_cards",
params._pathParam(0),
- "advance_shipment",
+ "tracking_updates",
)
.body(json(clientOptions.jsonMapper, params._body()))
.build()
@@ -91,7 +91,7 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { advanceShipmentHandler.handle(it) }
+ .use { createHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
@@ -101,11 +101,11 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
}
}
- private val trackingUpdatesHandler: Handler =
+ private val advanceShipmentHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- override fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
+ override fun advanceShipment(
+ params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions,
): CompletableFuture> {
// We check here instead of in the params builder because this can be specified
@@ -119,7 +119,7 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
"simulations",
"physical_cards",
params._pathParam(0),
- "tracking_updates",
+ "advance_shipment",
)
.body(json(clientOptions.jsonMapper, params._body()))
.build()
@@ -130,7 +130,7 @@ class PhysicalCardServiceAsyncImpl internal constructor(private val clientOption
.thenApply { response ->
errorHandler.handle(response).parseable {
response
- .use { trackingUpdatesHandler.handle(it) }
+ .use { advanceShipmentHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailService.kt
new file mode 100644
index 000000000..c5357578c
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailService.kt
@@ -0,0 +1,247 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.blocking
+
+import com.google.errorprone.annotations.MustBeClosed
+import com.increase.api.core.ClientOptions
+import com.increase.api.core.RequestOptions
+import com.increase.api.core.http.HttpResponseFor
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailDetailsParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import com.increase.api.models.carddetails.CardDetails
+import com.increase.api.models.carddetails.CardIframeUrl
+import java.util.function.Consumer
+
+interface CardDetailService {
+
+ /**
+ * Returns a view of this service that provides access to raw HTTP responses for each method.
+ */
+ fun withRawResponse(): WithRawResponse
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(modifier: Consumer): CardDetailService
+
+ /** Update a Card's PIN */
+ fun update(cardId: String, params: CardDetailUpdateParams): CardDetails =
+ update(cardId, params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ cardId: String,
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardDetails = update(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see update */
+ fun update(params: CardDetailUpdateParams): CardDetails = update(params, RequestOptions.none())
+
+ /** @see update */
+ fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardDetails
+
+ /**
+ * Create an iframe URL for a Card to display the card details. More details about styling and
+ * usage can be found in the [documentation](/documentation/embedded-card-component).
+ */
+ fun createDetailsIframe(cardId: String): CardIframeUrl =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardIframeUrl =
+ createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ ): CardIframeUrl = createDetailsIframe(cardId, params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardIframeUrl
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(params: CardDetailCreateDetailsIframeParams): CardIframeUrl =
+ createDetailsIframe(params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ fun createDetailsIframe(cardId: String, requestOptions: RequestOptions): CardIframeUrl =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none(), requestOptions)
+
+ /**
+ * Sensitive details for a Card include the primary account number, expiry, card verification
+ * code, and PIN.
+ */
+ fun details(cardId: String): CardDetails = details(cardId, CardDetailDetailsParams.none())
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardDetails = details(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see details */
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ ): CardDetails = details(cardId, params, RequestOptions.none())
+
+ /** @see details */
+ fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): CardDetails
+
+ /** @see details */
+ fun details(params: CardDetailDetailsParams): CardDetails =
+ details(params, RequestOptions.none())
+
+ /** @see details */
+ fun details(cardId: String, requestOptions: RequestOptions): CardDetails =
+ details(cardId, CardDetailDetailsParams.none(), requestOptions)
+
+ /** A view of [CardDetailService] that provides access to raw HTTP responses for each method. */
+ interface WithRawResponse {
+
+ /**
+ * Returns a view of this service with the given option modifications applied.
+ *
+ * The original service is not modified.
+ */
+ fun withOptions(
+ modifier: Consumer
+ ): CardDetailService.WithRawResponse
+
+ /**
+ * Returns a raw HTTP response for `patch /cards/{card_id}/details`, but is otherwise the
+ * same as [CardDetailService.update].
+ */
+ @MustBeClosed
+ fun update(cardId: String, params: CardDetailUpdateParams): HttpResponseFor =
+ update(cardId, params, RequestOptions.none())
+
+ /** @see update */
+ @MustBeClosed
+ fun update(
+ cardId: String,
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor =
+ update(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see update */
+ @MustBeClosed
+ fun update(params: CardDetailUpdateParams): HttpResponseFor =
+ update(params, RequestOptions.none())
+
+ /** @see update */
+ @MustBeClosed
+ fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor
+
+ /**
+ * Returns a raw HTTP response for `post /cards/{card_id}/create_details_iframe`, but is
+ * otherwise the same as [CardDetailService.createDetailsIframe].
+ */
+ @MustBeClosed
+ fun createDetailsIframe(cardId: String): HttpResponseFor =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none())
+
+ /** @see createDetailsIframe */
+ @MustBeClosed
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams =
+ CardDetailCreateDetailsIframeParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor =
+ createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see createDetailsIframe */
+ @MustBeClosed
+ fun createDetailsIframe(
+ cardId: String,
+ params: CardDetailCreateDetailsIframeParams = CardDetailCreateDetailsIframeParams.none(),
+ ): HttpResponseFor =
+ createDetailsIframe(cardId, params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ @MustBeClosed
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor
+
+ /** @see createDetailsIframe */
+ @MustBeClosed
+ fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams
+ ): HttpResponseFor = createDetailsIframe(params, RequestOptions.none())
+
+ /** @see createDetailsIframe */
+ @MustBeClosed
+ fun createDetailsIframe(
+ cardId: String,
+ requestOptions: RequestOptions,
+ ): HttpResponseFor =
+ createDetailsIframe(cardId, CardDetailCreateDetailsIframeParams.none(), requestOptions)
+
+ /**
+ * Returns a raw HTTP response for `get /cards/{card_id}/details`, but is otherwise the same
+ * as [CardDetailService.details].
+ */
+ @MustBeClosed
+ fun details(cardId: String): HttpResponseFor =
+ details(cardId, CardDetailDetailsParams.none())
+
+ /** @see details */
+ @MustBeClosed
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor =
+ details(params.toBuilder().cardId(cardId).build(), requestOptions)
+
+ /** @see details */
+ @MustBeClosed
+ fun details(
+ cardId: String,
+ params: CardDetailDetailsParams = CardDetailDetailsParams.none(),
+ ): HttpResponseFor = details(cardId, params, RequestOptions.none())
+
+ /** @see details */
+ @MustBeClosed
+ fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): HttpResponseFor
+
+ /** @see details */
+ @MustBeClosed
+ fun details(params: CardDetailDetailsParams): HttpResponseFor =
+ details(params, RequestOptions.none())
+
+ /** @see details */
+ @MustBeClosed
+ fun details(cardId: String, requestOptions: RequestOptions): HttpResponseFor =
+ details(cardId, CardDetailDetailsParams.none(), requestOptions)
+ }
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailServiceImpl.kt
new file mode 100644
index 000000000..a10c3c194
--- /dev/null
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDetailServiceImpl.kt
@@ -0,0 +1,165 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.blocking
+
+import com.increase.api.core.ClientOptions
+import com.increase.api.core.RequestOptions
+import com.increase.api.core.checkRequired
+import com.increase.api.core.handlers.errorBodyHandler
+import com.increase.api.core.handlers.errorHandler
+import com.increase.api.core.handlers.jsonHandler
+import com.increase.api.core.http.HttpMethod
+import com.increase.api.core.http.HttpRequest
+import com.increase.api.core.http.HttpResponse
+import com.increase.api.core.http.HttpResponse.Handler
+import com.increase.api.core.http.HttpResponseFor
+import com.increase.api.core.http.json
+import com.increase.api.core.http.parseable
+import com.increase.api.core.prepare
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailDetailsParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import com.increase.api.models.carddetails.CardDetails
+import com.increase.api.models.carddetails.CardIframeUrl
+import java.util.function.Consumer
+import kotlin.jvm.optionals.getOrNull
+
+class CardDetailServiceImpl internal constructor(private val clientOptions: ClientOptions) :
+ CardDetailService {
+
+ private val withRawResponse: CardDetailService.WithRawResponse by lazy {
+ WithRawResponseImpl(clientOptions)
+ }
+
+ override fun withRawResponse(): CardDetailService.WithRawResponse = withRawResponse
+
+ override fun withOptions(modifier: Consumer): CardDetailService =
+ CardDetailServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+
+ override fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions,
+ ): CardDetails =
+ // patch /cards/{card_id}/details
+ withRawResponse().update(params, requestOptions).parse()
+
+ override fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions,
+ ): CardIframeUrl =
+ // post /cards/{card_id}/create_details_iframe
+ withRawResponse().createDetailsIframe(params, requestOptions).parse()
+
+ override fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions,
+ ): CardDetails =
+ // get /cards/{card_id}/details
+ withRawResponse().details(params, requestOptions).parse()
+
+ class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
+ CardDetailService.WithRawResponse {
+
+ private val errorHandler: Handler =
+ errorHandler(errorBodyHandler(clientOptions.jsonMapper))
+
+ override fun withOptions(
+ modifier: Consumer
+ ): CardDetailService.WithRawResponse =
+ CardDetailServiceImpl.WithRawResponseImpl(
+ clientOptions.toBuilder().apply(modifier::accept).build()
+ )
+
+ private val updateHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun update(
+ params: CardDetailUpdateParams,
+ requestOptions: RequestOptions,
+ ): HttpResponseFor {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.PATCH)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "details")
+ .body(json(clientOptions.jsonMapper, params._body()))
+ .build()
+ .prepare(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ val response = clientOptions.httpClient.execute(request, requestOptions)
+ return errorHandler.handle(response).parseable {
+ response
+ .use { updateHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+
+ private val createDetailsIframeHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun createDetailsIframe(
+ params: CardDetailCreateDetailsIframeParams,
+ requestOptions: RequestOptions,
+ ): HttpResponseFor {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.POST)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "create_details_iframe")
+ .body(json(clientOptions.jsonMapper, params._body()))
+ .build()
+ .prepare(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ val response = clientOptions.httpClient.execute(request, requestOptions)
+ return errorHandler.handle(response).parseable {
+ response
+ .use { createDetailsIframeHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+
+ private val detailsHandler: Handler =
+ jsonHandler(clientOptions.jsonMapper)
+
+ override fun details(
+ params: CardDetailDetailsParams,
+ requestOptions: RequestOptions,
+ ): HttpResponseFor {
+ // We check here instead of in the params builder because this can be specified
+ // positionally or in the params class.
+ checkRequired("cardId", params.cardId().getOrNull())
+ val request =
+ HttpRequest.builder()
+ .method(HttpMethod.GET)
+ .baseUrl(clientOptions.baseUrl())
+ .addPathSegments("cards", params._pathParam(0), "details")
+ .build()
+ .prepare(clientOptions, params)
+ val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
+ val response = clientOptions.httpClient.execute(request, requestOptions)
+ return errorHandler.handle(response).parseable {
+ response
+ .use { detailsHandler.handle(it) }
+ .also {
+ if (requestOptions.responseValidation!!) {
+ it.validate()
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardService.kt
index 301587c2d..3087e548e 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardService.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardService.kt
@@ -7,11 +7,7 @@ import com.increase.api.core.ClientOptions
import com.increase.api.core.RequestOptions
import com.increase.api.core.http.HttpResponseFor
import com.increase.api.models.cards.Card
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
-import com.increase.api.models.cards.CardDetails
-import com.increase.api.models.cards.CardDetailsParams
-import com.increase.api.models.cards.CardIframeUrl
import com.increase.api.models.cards.CardListPage
import com.increase.api.models.cards.CardListParams
import com.increase.api.models.cards.CardRetrieveParams
@@ -112,71 +108,6 @@ interface CardService {
fun list(requestOptions: RequestOptions): CardListPage =
list(CardListParams.none(), requestOptions)
- /**
- * Create an iframe URL for a Card to display the card details. More details about styling and
- * usage can be found in the [documentation](/documentation/embedded-card-component).
- */
- fun createDetailsIframe(cardId: String): CardIframeUrl =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CardIframeUrl =
- createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- ): CardIframeUrl = createDetailsIframe(cardId, params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CardIframeUrl
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(params: CardCreateDetailsIframeParams): CardIframeUrl =
- createDetailsIframe(params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- fun createDetailsIframe(cardId: String, requestOptions: RequestOptions): CardIframeUrl =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none(), requestOptions)
-
- /**
- * Sensitive details for a Card include the primary account number, expiry, card verification
- * code, and PIN.
- */
- fun details(cardId: String): CardDetails = details(cardId, CardDetailsParams.none())
-
- /** @see details */
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CardDetails = details(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see details */
- fun details(cardId: String, params: CardDetailsParams = CardDetailsParams.none()): CardDetails =
- details(cardId, params, RequestOptions.none())
-
- /** @see details */
- fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): CardDetails
-
- /** @see details */
- fun details(params: CardDetailsParams): CardDetails = details(params, RequestOptions.none())
-
- /** @see details */
- fun details(cardId: String, requestOptions: RequestOptions): CardDetails =
- details(cardId, CardDetailsParams.none(), requestOptions)
-
/** A view of [CardService] that provides access to raw HTTP responses for each method. */
interface WithRawResponse {
@@ -304,92 +235,5 @@ interface CardService {
@MustBeClosed
fun list(requestOptions: RequestOptions): HttpResponseFor =
list(CardListParams.none(), requestOptions)
-
- /**
- * Returns a raw HTTP response for `post /cards/{card_id}/create_details_iframe`, but is
- * otherwise the same as [CardService.createDetailsIframe].
- */
- @MustBeClosed
- fun createDetailsIframe(cardId: String): HttpResponseFor =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none())
-
- /** @see createDetailsIframe */
- @MustBeClosed
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): HttpResponseFor =
- createDetailsIframe(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see createDetailsIframe */
- @MustBeClosed
- fun createDetailsIframe(
- cardId: String,
- params: CardCreateDetailsIframeParams = CardCreateDetailsIframeParams.none(),
- ): HttpResponseFor =
- createDetailsIframe(cardId, params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- @MustBeClosed
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): HttpResponseFor
-
- /** @see createDetailsIframe */
- @MustBeClosed
- fun createDetailsIframe(
- params: CardCreateDetailsIframeParams
- ): HttpResponseFor = createDetailsIframe(params, RequestOptions.none())
-
- /** @see createDetailsIframe */
- @MustBeClosed
- fun createDetailsIframe(
- cardId: String,
- requestOptions: RequestOptions,
- ): HttpResponseFor =
- createDetailsIframe(cardId, CardCreateDetailsIframeParams.none(), requestOptions)
-
- /**
- * Returns a raw HTTP response for `get /cards/{card_id}/details`, but is otherwise the same
- * as [CardService.details].
- */
- @MustBeClosed
- fun details(cardId: String): HttpResponseFor =
- details(cardId, CardDetailsParams.none())
-
- /** @see details */
- @MustBeClosed
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- requestOptions: RequestOptions = RequestOptions.none(),
- ): HttpResponseFor =
- details(params.toBuilder().cardId(cardId).build(), requestOptions)
-
- /** @see details */
- @MustBeClosed
- fun details(
- cardId: String,
- params: CardDetailsParams = CardDetailsParams.none(),
- ): HttpResponseFor = details(cardId, params, RequestOptions.none())
-
- /** @see details */
- @MustBeClosed
- fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): HttpResponseFor
-
- /** @see details */
- @MustBeClosed
- fun details(params: CardDetailsParams): HttpResponseFor =
- details(params, RequestOptions.none())
-
- /** @see details */
- @MustBeClosed
- fun details(cardId: String, requestOptions: RequestOptions): HttpResponseFor =
- details(cardId, CardDetailsParams.none(), requestOptions)
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardServiceImpl.kt
index 7fac4e858..e8b35f2da 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardServiceImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardServiceImpl.kt
@@ -17,11 +17,7 @@ import com.increase.api.core.http.json
import com.increase.api.core.http.parseable
import com.increase.api.core.prepare
import com.increase.api.models.cards.Card
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
-import com.increase.api.models.cards.CardDetails
-import com.increase.api.models.cards.CardDetailsParams
-import com.increase.api.models.cards.CardIframeUrl
import com.increase.api.models.cards.CardListPage
import com.increase.api.models.cards.CardListPageResponse
import com.increase.api.models.cards.CardListParams
@@ -57,17 +53,6 @@ class CardServiceImpl internal constructor(private val clientOptions: ClientOpti
// get /cards
withRawResponse().list(params, requestOptions).parse()
- override fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions,
- ): CardIframeUrl =
- // post /cards/{card_id}/create_details_iframe
- withRawResponse().createDetailsIframe(params, requestOptions).parse()
-
- override fun details(params: CardDetailsParams, requestOptions: RequestOptions): CardDetails =
- // get /cards/{card_id}/details
- withRawResponse().details(params, requestOptions).parse()
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
CardService.WithRawResponse {
@@ -200,66 +185,5 @@ class CardServiceImpl internal constructor(private val clientOptions: ClientOpti
}
}
}
-
- private val createDetailsIframeHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun createDetailsIframe(
- params: CardCreateDetailsIframeParams,
- requestOptions: RequestOptions,
- ): HttpResponseFor {
- // We check here instead of in the params builder because this can be specified
- // positionally or in the params class.
- checkRequired("cardId", params.cardId().getOrNull())
- val request =
- HttpRequest.builder()
- .method(HttpMethod.POST)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("cards", params._pathParam(0), "create_details_iframe")
- .body(json(clientOptions.jsonMapper, params._body()))
- .build()
- .prepare(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- val response = clientOptions.httpClient.execute(request, requestOptions)
- return errorHandler.handle(response).parseable {
- response
- .use { createDetailsIframeHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
-
- private val detailsHandler: Handler =
- jsonHandler(clientOptions.jsonMapper)
-
- override fun details(
- params: CardDetailsParams,
- requestOptions: RequestOptions,
- ): HttpResponseFor {
- // We check here instead of in the params builder because this can be specified
- // positionally or in the params class.
- checkRequired("cardId", params.cardId().getOrNull())
- val request =
- HttpRequest.builder()
- .method(HttpMethod.GET)
- .baseUrl(clientOptions.baseUrl())
- .addPathSegments("cards", params._pathParam(0), "details")
- .build()
- .prepare(clientOptions, params)
- val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
- val response = clientOptions.httpClient.execute(request, requestOptions)
- return errorHandler.handle(response).parseable {
- response
- .use { detailsHandler.handle(it) }
- .also {
- if (requestOptions.responseValidation!!) {
- it.validate()
- }
- }
- }
- }
}
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardService.kt
index 58e057a6d..01c47e7ab 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardService.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardService.kt
@@ -8,7 +8,7 @@ import com.increase.api.core.RequestOptions
import com.increase.api.core.http.HttpResponseFor
import com.increase.api.models.physicalcards.PhysicalCard
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.util.function.Consumer
interface PhysicalCardService {
@@ -25,6 +25,31 @@ interface PhysicalCardService {
*/
fun withOptions(modifier: Consumer): PhysicalCardService
+ /**
+ * This endpoint allows you to simulate receiving a tracking update for a Physical Card, to
+ * simulate the progress of a shipment.
+ */
+ fun create(physicalCardId: String, params: PhysicalCardCreateParams): PhysicalCard =
+ create(physicalCardId, params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ physicalCardId: String,
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): PhysicalCard =
+ create(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
+
+ /** @see create */
+ fun create(params: PhysicalCardCreateParams): PhysicalCard =
+ create(params, RequestOptions.none())
+
+ /** @see create */
+ fun create(
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions = RequestOptions.none(),
+ ): PhysicalCard
+
/**
* This endpoint allows you to simulate advancing the shipment status of a Physical Card, to
* simulate e.g., that a physical card was attempted shipped but then failed delivery.
@@ -52,33 +77,6 @@ interface PhysicalCardService {
requestOptions: RequestOptions = RequestOptions.none(),
): PhysicalCard
- /**
- * This endpoint allows you to simulate receiving a tracking update for a Physical Card, to
- * simulate the progress of a shipment.
- */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- ): PhysicalCard = trackingUpdates(physicalCardId, params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): PhysicalCard =
- trackingUpdates(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
-
- /** @see trackingUpdates */
- fun trackingUpdates(params: PhysicalCardTrackingUpdatesParams): PhysicalCard =
- trackingUpdates(params, RequestOptions.none())
-
- /** @see trackingUpdates */
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions = RequestOptions.none(),
- ): PhysicalCard
-
/**
* A view of [PhysicalCardService] that provides access to raw HTTP responses for each method.
*/
@@ -95,75 +93,70 @@ interface PhysicalCardService {
/**
* Returns a raw HTTP response for `post
- * /simulations/physical_cards/{physical_card_id}/advance_shipment`, but is otherwise the
- * same as [PhysicalCardService.advanceShipment].
+ * /simulations/physical_cards/{physical_card_id}/tracking_updates`, but is otherwise the
+ * same as [PhysicalCardService.create].
*/
@MustBeClosed
- fun advanceShipment(
+ fun create(
physicalCardId: String,
- params: PhysicalCardAdvanceShipmentParams,
- ): HttpResponseFor =
- advanceShipment(physicalCardId, params, RequestOptions.none())
+ params: PhysicalCardCreateParams,
+ ): HttpResponseFor = create(physicalCardId, params, RequestOptions.none())
- /** @see advanceShipment */
+ /** @see create */
@MustBeClosed
- fun advanceShipment(
+ fun create(
physicalCardId: String,
- params: PhysicalCardAdvanceShipmentParams,
+ params: PhysicalCardCreateParams,
requestOptions: RequestOptions = RequestOptions.none(),
): HttpResponseFor =
- advanceShipment(
- params.toBuilder().physicalCardId(physicalCardId).build(),
- requestOptions,
- )
+ create(params.toBuilder().physicalCardId(physicalCardId).build(), requestOptions)
- /** @see advanceShipment */
+ /** @see create */
@MustBeClosed
- fun advanceShipment(
- params: PhysicalCardAdvanceShipmentParams
- ): HttpResponseFor = advanceShipment(params, RequestOptions.none())
+ fun create(params: PhysicalCardCreateParams): HttpResponseFor =
+ create(params, RequestOptions.none())
- /** @see advanceShipment */
+ /** @see create */
@MustBeClosed
- fun advanceShipment(
- params: PhysicalCardAdvanceShipmentParams,
+ fun create(
+ params: PhysicalCardCreateParams,
requestOptions: RequestOptions = RequestOptions.none(),
): HttpResponseFor
/**
* Returns a raw HTTP response for `post
- * /simulations/physical_cards/{physical_card_id}/tracking_updates`, but is otherwise the
- * same as [PhysicalCardService.trackingUpdates].
+ * /simulations/physical_cards/{physical_card_id}/advance_shipment`, but is otherwise the
+ * same as [PhysicalCardService.advanceShipment].
*/
@MustBeClosed
- fun trackingUpdates(
+ fun advanceShipment(
physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
+ params: PhysicalCardAdvanceShipmentParams,
): HttpResponseFor =
- trackingUpdates(physicalCardId, params, RequestOptions.none())
+ advanceShipment(physicalCardId, params, RequestOptions.none())
- /** @see trackingUpdates */
+ /** @see advanceShipment */
@MustBeClosed
- fun trackingUpdates(
+ fun advanceShipment(
physicalCardId: String,
- params: PhysicalCardTrackingUpdatesParams,
+ params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions = RequestOptions.none(),
): HttpResponseFor =
- trackingUpdates(
+ advanceShipment(
params.toBuilder().physicalCardId(physicalCardId).build(),
requestOptions,
)
- /** @see trackingUpdates */
+ /** @see advanceShipment */
@MustBeClosed
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams
- ): HttpResponseFor = trackingUpdates(params, RequestOptions.none())
+ fun advanceShipment(
+ params: PhysicalCardAdvanceShipmentParams
+ ): HttpResponseFor = advanceShipment(params, RequestOptions.none())
- /** @see trackingUpdates */
+ /** @see advanceShipment */
@MustBeClosed
- fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
+ fun advanceShipment(
+ params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions = RequestOptions.none(),
): HttpResponseFor
}
diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceImpl.kt
index 8d950be39..d5d39d29a 100644
--- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceImpl.kt
+++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceImpl.kt
@@ -18,7 +18,7 @@ import com.increase.api.core.http.parseable
import com.increase.api.core.prepare
import com.increase.api.models.physicalcards.PhysicalCard
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.util.function.Consumer
import kotlin.jvm.optionals.getOrNull
@@ -34,6 +34,13 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
override fun withOptions(modifier: Consumer): PhysicalCardService =
PhysicalCardServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build())
+ override fun create(
+ params: PhysicalCardCreateParams,
+ requestOptions: RequestOptions,
+ ): PhysicalCard =
+ // post /simulations/physical_cards/{physical_card_id}/tracking_updates
+ withRawResponse().create(params, requestOptions).parse()
+
override fun advanceShipment(
params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions,
@@ -41,13 +48,6 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
// post /simulations/physical_cards/{physical_card_id}/advance_shipment
withRawResponse().advanceShipment(params, requestOptions).parse()
- override fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
- requestOptions: RequestOptions,
- ): PhysicalCard =
- // post /simulations/physical_cards/{physical_card_id}/tracking_updates
- withRawResponse().trackingUpdates(params, requestOptions).parse()
-
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
PhysicalCardService.WithRawResponse {
@@ -61,11 +61,11 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
clientOptions.toBuilder().apply(modifier::accept).build()
)
- private val advanceShipmentHandler: Handler =
+ private val createHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- override fun advanceShipment(
- params: PhysicalCardAdvanceShipmentParams,
+ override fun create(
+ params: PhysicalCardCreateParams,
requestOptions: RequestOptions,
): HttpResponseFor {
// We check here instead of in the params builder because this can be specified
@@ -79,7 +79,7 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
"simulations",
"physical_cards",
params._pathParam(0),
- "advance_shipment",
+ "tracking_updates",
)
.body(json(clientOptions.jsonMapper, params._body()))
.build()
@@ -88,7 +88,7 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
val response = clientOptions.httpClient.execute(request, requestOptions)
return errorHandler.handle(response).parseable {
response
- .use { advanceShipmentHandler.handle(it) }
+ .use { createHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
@@ -97,11 +97,11 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
}
}
- private val trackingUpdatesHandler: Handler =
+ private val advanceShipmentHandler: Handler =
jsonHandler(clientOptions.jsonMapper)
- override fun trackingUpdates(
- params: PhysicalCardTrackingUpdatesParams,
+ override fun advanceShipment(
+ params: PhysicalCardAdvanceShipmentParams,
requestOptions: RequestOptions,
): HttpResponseFor {
// We check here instead of in the params builder because this can be specified
@@ -115,7 +115,7 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
"simulations",
"physical_cards",
params._pathParam(0),
- "tracking_updates",
+ "advance_shipment",
)
.body(json(clientOptions.jsonMapper, params._body()))
.build()
@@ -124,7 +124,7 @@ class PhysicalCardServiceImpl internal constructor(private val clientOptions: Cl
val response = clientOptions.httpClient.execute(request, requestOptions)
return errorHandler.handle(response).parseable {
response
- .use { trackingUpdatesHandler.handle(it) }
+ .use { advanceShipmentHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/core/http/RetryingHttpClientTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/core/http/RetryingHttpClientTest.kt
index 65e9901c6..7acabbd07 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/core/http/RetryingHttpClientTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/core/http/RetryingHttpClientTest.kt
@@ -6,6 +6,7 @@ import com.github.tomakehurst.wiremock.junit5.WireMockTest
import com.github.tomakehurst.wiremock.stubbing.Scenario
import com.increase.api.client.okhttp.OkHttpClient
import com.increase.api.core.RequestOptions
+import com.increase.api.core.Sleeper
import com.increase.api.errors.IncreaseRetryableException
import java.io.InputStream
import java.time.Duration
@@ -294,12 +295,14 @@ internal class RetryingHttpClientTest {
.httpClient(failingHttpClient)
.maxRetries(2)
.sleeper(
- object : RetryingHttpClient.Sleeper {
+ object : Sleeper {
override fun sleep(duration: Duration) {}
override fun sleepAsync(duration: Duration): CompletableFuture =
CompletableFuture.completedFuture(null)
+
+ override fun close() {}
}
)
.build()
@@ -333,12 +336,14 @@ internal class RetryingHttpClientTest {
.httpClient(httpClient)
// Use a no-op `Sleeper` to make the test fast.
.sleeper(
- object : RetryingHttpClient.Sleeper {
+ object : Sleeper {
override fun sleep(duration: Duration) {}
override fun sleepAsync(duration: Duration): CompletableFuture =
CompletableFuture.completedFuture(null)
+
+ override fun close() {}
}
)
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParamsTest.kt
similarity index 65%
rename from increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParamsTest.kt
rename to increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParamsTest.kt
index f1309a233..2383c37be 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateDetailsIframeParamsTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailCreateDetailsIframeParamsTest.kt
@@ -1,15 +1,15 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
-internal class CardCreateDetailsIframeParamsTest {
+internal class CardDetailCreateDetailsIframeParamsTest {
@Test
fun create() {
- CardCreateDetailsIframeParams.builder()
+ CardDetailCreateDetailsIframeParams.builder()
.cardId("card_oubs0hwk5rn6knuecxg2")
.physicalCardId("physical_card_id")
.build()
@@ -18,7 +18,9 @@ internal class CardCreateDetailsIframeParamsTest {
@Test
fun pathParams() {
val params =
- CardCreateDetailsIframeParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
+ CardDetailCreateDetailsIframeParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .build()
assertThat(params._pathParam(0)).isEqualTo("card_oubs0hwk5rn6knuecxg2")
// out-of-bound path param
@@ -28,7 +30,7 @@ internal class CardCreateDetailsIframeParamsTest {
@Test
fun body() {
val params =
- CardCreateDetailsIframeParams.builder()
+ CardDetailCreateDetailsIframeParams.builder()
.cardId("card_oubs0hwk5rn6knuecxg2")
.physicalCardId("physical_card_id")
.build()
@@ -41,7 +43,9 @@ internal class CardCreateDetailsIframeParamsTest {
@Test
fun bodyWithoutOptionalFields() {
val params =
- CardCreateDetailsIframeParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
+ CardDetailCreateDetailsIframeParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .build()
val body = params._body()
}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParamsTest.kt
similarity index 58%
rename from increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsParamsTest.kt
rename to increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParamsTest.kt
index 9dd4e8516..d060c8a2c 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsParamsTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailDetailsParamsTest.kt
@@ -1,20 +1,20 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
-internal class CardDetailsParamsTest {
+internal class CardDetailDetailsParamsTest {
@Test
fun create() {
- CardDetailsParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
+ CardDetailDetailsParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
}
@Test
fun pathParams() {
- val params = CardDetailsParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
+ val params = CardDetailDetailsParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").build()
assertThat(params._pathParam(0)).isEqualTo("card_oubs0hwk5rn6knuecxg2")
// out-of-bound path param
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParamsTest.kt
new file mode 100644
index 000000000..0868c5287
--- /dev/null
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailUpdateParamsTest.kt
@@ -0,0 +1,34 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.models.carddetails
+
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.jupiter.api.Test
+
+internal class CardDetailUpdateParamsTest {
+
+ @Test
+ fun create() {
+ CardDetailUpdateParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").pin("1234").build()
+ }
+
+ @Test
+ fun pathParams() {
+ val params =
+ CardDetailUpdateParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").pin("1234").build()
+
+ assertThat(params._pathParam(0)).isEqualTo("card_oubs0hwk5rn6knuecxg2")
+ // out-of-bound path param
+ assertThat(params._pathParam(1)).isEqualTo("")
+ }
+
+ @Test
+ fun body() {
+ val params =
+ CardDetailUpdateParams.builder().cardId("card_oubs0hwk5rn6knuecxg2").pin("1234").build()
+
+ val body = params._body()
+
+ assertThat(body.pin()).isEqualTo("1234")
+ }
+}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailsTest.kt
similarity index 97%
rename from increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsTest.kt
rename to increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailsTest.kt
index 45b492e2f..1f8857032 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardDetailsTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardDetailsTest.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.increase.api.core.jsonMapper
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardIframeUrlTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardIframeUrlTest.kt
similarity index 97%
rename from increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardIframeUrlTest.kt
rename to increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardIframeUrlTest.kt
index 53c1a7b43..d762a9266 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardIframeUrlTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddetails/CardIframeUrlTest.kt
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless.
-package com.increase.api.models.cards
+package com.increase.api.models.carddetails
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.increase.api.core.jsonMapper
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt
index 8c85822f4..5b0cd2cb9 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt
@@ -29,6 +29,7 @@ internal class CardUpdateParamsTest {
.build()
)
.entityId("entity_id")
+ .pin("xxxx")
.status(CardUpdateParams.Status.ACTIVE)
.build()
}
@@ -65,6 +66,7 @@ internal class CardUpdateParamsTest {
.build()
)
.entityId("entity_id")
+ .pin("xxxx")
.status(CardUpdateParams.Status.ACTIVE)
.build()
@@ -90,6 +92,7 @@ internal class CardUpdateParamsTest {
.build()
)
assertThat(body.entityId()).contains("entity_id")
+ assertThat(body.pin()).contains("xxxx")
assertThat(body.status()).contains(CardUpdateParams.Status.ACTIVE)
}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParamsTest.kt
similarity index 68%
rename from increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParamsTest.kt
rename to increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParamsTest.kt
index d199fff4d..f22d28af7 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardTrackingUpdatesParamsTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/physicalcards/PhysicalCardCreateParamsTest.kt
@@ -6,13 +6,13 @@ import java.time.OffsetDateTime
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
-internal class PhysicalCardTrackingUpdatesParamsTest {
+internal class PhysicalCardCreateParamsTest {
@Test
fun create() {
- PhysicalCardTrackingUpdatesParams.builder()
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
.carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.city("New York")
.postalCode("10045")
@@ -23,9 +23,9 @@ internal class PhysicalCardTrackingUpdatesParamsTest {
@Test
fun pathParams() {
val params =
- PhysicalCardTrackingUpdatesParams.builder()
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
.build()
assertThat(params._pathParam(0)).isEqualTo("physical_card_ode8duyq5v2ynhjoharl")
@@ -36,9 +36,9 @@ internal class PhysicalCardTrackingUpdatesParamsTest {
@Test
fun body() {
val params =
- PhysicalCardTrackingUpdatesParams.builder()
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
.carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.city("New York")
.postalCode("10045")
@@ -47,7 +47,7 @@ internal class PhysicalCardTrackingUpdatesParamsTest {
val body = params._body()
- assertThat(body.category()).isEqualTo(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ assertThat(body.category()).isEqualTo(PhysicalCardCreateParams.Category.DELIVERED)
assertThat(body.carrierEstimatedDeliveryAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(body.city()).contains("New York")
@@ -58,13 +58,13 @@ internal class PhysicalCardTrackingUpdatesParamsTest {
@Test
fun bodyWithoutOptionalFields() {
val params =
- PhysicalCardTrackingUpdatesParams.builder()
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
.build()
val body = params._body()
- assertThat(body.category()).isEqualTo(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
+ assertThat(body.category()).isEqualTo(PhysicalCardCreateParams.Category.DELIVERED)
}
}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDetailServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDetailServiceAsyncTest.kt
new file mode 100644
index 000000000..8b9fb2621
--- /dev/null
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDetailServiceAsyncTest.kt
@@ -0,0 +1,71 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.async
+
+import com.increase.api.TestServerExtension
+import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(TestServerExtension::class)
+internal class CardDetailServiceAsyncTest {
+
+ @Test
+ fun update() {
+ val client =
+ IncreaseOkHttpClientAsync.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailServiceAsync = client.cardDetails()
+
+ val cardDetailsFuture =
+ cardDetailServiceAsync.update(
+ CardDetailUpdateParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .pin("1234")
+ .build()
+ )
+
+ val cardDetails = cardDetailsFuture.get()
+ cardDetails.validate()
+ }
+
+ @Test
+ fun createDetailsIframe() {
+ val client =
+ IncreaseOkHttpClientAsync.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailServiceAsync = client.cardDetails()
+
+ val cardIframeUrlFuture =
+ cardDetailServiceAsync.createDetailsIframe(
+ CardDetailCreateDetailsIframeParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .physicalCardId("physical_card_id")
+ .build()
+ )
+
+ val cardIframeUrl = cardIframeUrlFuture.get()
+ cardIframeUrl.validate()
+ }
+
+ @Test
+ fun details() {
+ val client =
+ IncreaseOkHttpClientAsync.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailServiceAsync = client.cardDetails()
+
+ val cardDetailsFuture = cardDetailServiceAsync.details("card_oubs0hwk5rn6knuecxg2")
+
+ val cardDetails = cardDetailsFuture.get()
+ cardDetails.validate()
+ }
+}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt
index 249de5e2a..6e8899062 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt
@@ -4,7 +4,6 @@ package com.increase.api.services.async
import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
import com.increase.api.models.cards.CardUpdateParams
import org.junit.jupiter.api.Test
@@ -97,6 +96,7 @@ internal class CardServiceAsyncTest {
.build()
)
.entityId("entity_id")
+ .pin("xxxx")
.status(CardUpdateParams.Status.ACTIVE)
.build()
)
@@ -119,40 +119,4 @@ internal class CardServiceAsyncTest {
val page = pageFuture.get()
page.response().validate()
}
-
- @Test
- fun createDetailsIframe() {
- val client =
- IncreaseOkHttpClientAsync.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val cardServiceAsync = client.cards()
-
- val cardIframeUrlFuture =
- cardServiceAsync.createDetailsIframe(
- CardCreateDetailsIframeParams.builder()
- .cardId("card_oubs0hwk5rn6knuecxg2")
- .physicalCardId("physical_card_id")
- .build()
- )
-
- val cardIframeUrl = cardIframeUrlFuture.get()
- cardIframeUrl.validate()
- }
-
- @Test
- fun details() {
- val client =
- IncreaseOkHttpClientAsync.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val cardServiceAsync = client.cards()
-
- val cardDetailsFuture = cardServiceAsync.details("card_oubs0hwk5rn6knuecxg2")
-
- val cardDetails = cardDetailsFuture.get()
- cardDetails.validate()
- }
}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncTest.kt
index c499f638a..656f8af14 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/PhysicalCardServiceAsyncTest.kt
@@ -5,7 +5,7 @@ package com.increase.api.services.async.simulations
import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.time.OffsetDateTime
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
@@ -14,7 +14,7 @@ import org.junit.jupiter.api.extension.ExtendWith
internal class PhysicalCardServiceAsyncTest {
@Test
- fun advanceShipment() {
+ fun create() {
val client =
IncreaseOkHttpClientAsync.builder()
.baseUrl(TestServerExtension.BASE_URL)
@@ -23,10 +23,14 @@ internal class PhysicalCardServiceAsyncTest {
val physicalCardServiceAsync = client.simulations().physicalCards()
val physicalCardFuture =
- physicalCardServiceAsync.advanceShipment(
- PhysicalCardAdvanceShipmentParams.builder()
+ physicalCardServiceAsync.create(
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .shipmentStatus(PhysicalCardAdvanceShipmentParams.ShipmentStatus.SHIPPED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
+ .carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
+ .city("New York")
+ .postalCode("10045")
+ .state("NY")
.build()
)
@@ -35,7 +39,7 @@ internal class PhysicalCardServiceAsyncTest {
}
@Test
- fun trackingUpdates() {
+ fun advanceShipment() {
val client =
IncreaseOkHttpClientAsync.builder()
.baseUrl(TestServerExtension.BASE_URL)
@@ -44,14 +48,10 @@ internal class PhysicalCardServiceAsyncTest {
val physicalCardServiceAsync = client.simulations().physicalCards()
val physicalCardFuture =
- physicalCardServiceAsync.trackingUpdates(
- PhysicalCardTrackingUpdatesParams.builder()
+ physicalCardServiceAsync.advanceShipment(
+ PhysicalCardAdvanceShipmentParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
- .carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
- .city("New York")
- .postalCode("10045")
- .state("NY")
+ .shipmentStatus(PhysicalCardAdvanceShipmentParams.ShipmentStatus.SHIPPED)
.build()
)
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDetailServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDetailServiceTest.kt
new file mode 100644
index 000000000..8be2ab0cf
--- /dev/null
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDetailServiceTest.kt
@@ -0,0 +1,68 @@
+// File generated from our OpenAPI spec by Stainless.
+
+package com.increase.api.services.blocking
+
+import com.increase.api.TestServerExtension
+import com.increase.api.client.okhttp.IncreaseOkHttpClient
+import com.increase.api.models.carddetails.CardDetailCreateDetailsIframeParams
+import com.increase.api.models.carddetails.CardDetailUpdateParams
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.extension.ExtendWith
+
+@ExtendWith(TestServerExtension::class)
+internal class CardDetailServiceTest {
+
+ @Test
+ fun update() {
+ val client =
+ IncreaseOkHttpClient.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailService = client.cardDetails()
+
+ val cardDetails =
+ cardDetailService.update(
+ CardDetailUpdateParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .pin("1234")
+ .build()
+ )
+
+ cardDetails.validate()
+ }
+
+ @Test
+ fun createDetailsIframe() {
+ val client =
+ IncreaseOkHttpClient.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailService = client.cardDetails()
+
+ val cardIframeUrl =
+ cardDetailService.createDetailsIframe(
+ CardDetailCreateDetailsIframeParams.builder()
+ .cardId("card_oubs0hwk5rn6knuecxg2")
+ .physicalCardId("physical_card_id")
+ .build()
+ )
+
+ cardIframeUrl.validate()
+ }
+
+ @Test
+ fun details() {
+ val client =
+ IncreaseOkHttpClient.builder()
+ .baseUrl(TestServerExtension.BASE_URL)
+ .apiKey("My API Key")
+ .build()
+ val cardDetailService = client.cardDetails()
+
+ val cardDetails = cardDetailService.details("card_oubs0hwk5rn6knuecxg2")
+
+ cardDetails.validate()
+ }
+}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt
index c7a8ac424..d5c72bc46 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt
@@ -4,7 +4,6 @@ package com.increase.api.services.blocking
import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClient
-import com.increase.api.models.cards.CardCreateDetailsIframeParams
import com.increase.api.models.cards.CardCreateParams
import com.increase.api.models.cards.CardUpdateParams
import org.junit.jupiter.api.Test
@@ -95,6 +94,7 @@ internal class CardServiceTest {
.build()
)
.entityId("entity_id")
+ .pin("xxxx")
.status(CardUpdateParams.Status.ACTIVE)
.build()
)
@@ -115,38 +115,4 @@ internal class CardServiceTest {
page.response().validate()
}
-
- @Test
- fun createDetailsIframe() {
- val client =
- IncreaseOkHttpClient.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val cardService = client.cards()
-
- val cardIframeUrl =
- cardService.createDetailsIframe(
- CardCreateDetailsIframeParams.builder()
- .cardId("card_oubs0hwk5rn6knuecxg2")
- .physicalCardId("physical_card_id")
- .build()
- )
-
- cardIframeUrl.validate()
- }
-
- @Test
- fun details() {
- val client =
- IncreaseOkHttpClient.builder()
- .baseUrl(TestServerExtension.BASE_URL)
- .apiKey("My API Key")
- .build()
- val cardService = client.cards()
-
- val cardDetails = cardService.details("card_oubs0hwk5rn6knuecxg2")
-
- cardDetails.validate()
- }
}
diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceTest.kt
index 2eef479ce..2398206e5 100644
--- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceTest.kt
+++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/PhysicalCardServiceTest.kt
@@ -5,7 +5,7 @@ package com.increase.api.services.blocking.simulations
import com.increase.api.TestServerExtension
import com.increase.api.client.okhttp.IncreaseOkHttpClient
import com.increase.api.models.simulations.physicalcards.PhysicalCardAdvanceShipmentParams
-import com.increase.api.models.simulations.physicalcards.PhysicalCardTrackingUpdatesParams
+import com.increase.api.models.simulations.physicalcards.PhysicalCardCreateParams
import java.time.OffsetDateTime
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.ExtendWith
@@ -14,7 +14,7 @@ import org.junit.jupiter.api.extension.ExtendWith
internal class PhysicalCardServiceTest {
@Test
- fun advanceShipment() {
+ fun create() {
val client =
IncreaseOkHttpClient.builder()
.baseUrl(TestServerExtension.BASE_URL)
@@ -23,10 +23,14 @@ internal class PhysicalCardServiceTest {
val physicalCardService = client.simulations().physicalCards()
val physicalCard =
- physicalCardService.advanceShipment(
- PhysicalCardAdvanceShipmentParams.builder()
+ physicalCardService.create(
+ PhysicalCardCreateParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .shipmentStatus(PhysicalCardAdvanceShipmentParams.ShipmentStatus.SHIPPED)
+ .category(PhysicalCardCreateParams.Category.DELIVERED)
+ .carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
+ .city("New York")
+ .postalCode("10045")
+ .state("NY")
.build()
)
@@ -34,7 +38,7 @@ internal class PhysicalCardServiceTest {
}
@Test
- fun trackingUpdates() {
+ fun advanceShipment() {
val client =
IncreaseOkHttpClient.builder()
.baseUrl(TestServerExtension.BASE_URL)
@@ -43,14 +47,10 @@ internal class PhysicalCardServiceTest {
val physicalCardService = client.simulations().physicalCards()
val physicalCard =
- physicalCardService.trackingUpdates(
- PhysicalCardTrackingUpdatesParams.builder()
+ physicalCardService.advanceShipment(
+ PhysicalCardAdvanceShipmentParams.builder()
.physicalCardId("physical_card_ode8duyq5v2ynhjoharl")
- .category(PhysicalCardTrackingUpdatesParams.Category.DELIVERED)
- .carrierEstimatedDeliveryAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
- .city("New York")
- .postalCode("10045")
- .state("NY")
+ .shipmentStatus(PhysicalCardAdvanceShipmentParams.ShipmentStatus.SHIPPED)
.build()
)
diff --git a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt
index 3e72bd6f1..1892cf456 100644
--- a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt
+++ b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt
@@ -53,6 +53,7 @@ internal class ProGuardCompatibilityTest {
assertThat(client.accountNumbers()).isNotNull()
assertThat(client.accountTransfers()).isNotNull()
assertThat(client.cards()).isNotNull()
+ assertThat(client.cardDetails()).isNotNull()
assertThat(client.cardPayments()).isNotNull()
assertThat(client.cardPurchaseSupplements()).isNotNull()
assertThat(client.physicalCards()).isNotNull()
diff --git a/scripts/fast-format b/scripts/fast-format
index e16bfc56f..1b3bc473a 100755
--- a/scripts/fast-format
+++ b/scripts/fast-format
@@ -2,7 +2,12 @@
set -euo pipefail
+echo "Script started with $# arguments"
+echo "Arguments: $*"
+echo "Script location: $(dirname "$0")"
+
cd "$(dirname "$0")/.."
+echo "Changed to directory: $(pwd)"
if [ $# -eq 0 ]; then
echo "Usage: $0 [additional-formatter-args...]"
@@ -12,6 +17,8 @@ fi
FILE_LIST="$1"
+echo "Looking for file: $FILE_LIST"
+
if [ ! -f "$FILE_LIST" ]; then
echo "Error: File '$FILE_LIST' not found"
exit 1
@@ -23,9 +30,9 @@ if ! command -v ktfmt-fast-format &> /dev/null; then
fi
# Process Kotlin files
-kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/')
-kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/')
-echo "==> Found $(echo "$kt_files" | wc -l) Kotlin files:"
+echo "==> Looking for Kotlin files"
+kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/' || true)
+echo "==> Done looking for Kotlin files"
if [[ -n "$kt_files" ]]; then
echo "==> will format Kotlin files"