From ef561852f606957fefab5235b62d1238063a56c4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:02:26 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 4 +- .../cardrefunds/CardRefundCreateParams.kt | 156 ++++++++++++------ .../simulations/CardRefundServiceAsync.kt | 32 +++- .../blocking/simulations/CardRefundService.kt | 28 +++- .../cardrefunds/CardRefundCreateParamsTest.kt | 16 +- .../simulations/CardRefundServiceAsyncTest.kt | 1 + .../simulations/CardRefundServiceTest.kt | 1 + 7 files changed, 175 insertions(+), 63 deletions(-) diff --git a/.stats.yml b/.stats.yml index a9120ac7b..d034046d8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 214 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-749004bde06df3642fccde727f8e872c02795128db180789d1377c3168bd71ba.yml -openapi_spec_hash: 9058f9b3951c7608de5b67d8d5c87ffd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c51555226fd66ed304eb1e9c759a6485c071eb2cb9ca9ee86f5b5cd88552ee4a.yml +openapi_spec_hash: c5b09ec531c068cb675f8cd3729733c6 config_hash: a143293c5450ae8f52acad08f3102575 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParams.kt index 0bab3c9d9..42b6ac667 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParams.kt @@ -11,12 +11,12 @@ 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 /** * Simulates refunding a card transaction. The full value of the original sandbox transaction is @@ -29,14 +29,32 @@ private constructor( private val additionalQueryParams: QueryParams, ) : Params { + /** + * The identifier of the Pending Transaction for the refund authorization. If this is provided, + * `transaction` must not be provided as a refund with a refund authorized can not be linked to + * a regular transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun pendingTransactionId(): Optional = body.pendingTransactionId() + /** * The identifier for the Transaction to refund. The Transaction's source must have a category * of card_settlement. * - * @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). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun transactionId(): Optional = body.transactionId() + + /** + * Returns the raw JSON value of [pendingTransactionId]. + * + * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an unexpected + * type. */ - fun transactionId(): String = body.transactionId() + fun _pendingTransactionId(): JsonField = body._pendingTransactionId() /** * Returns the raw JSON value of [transactionId]. @@ -57,14 +75,9 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [CardRefundCreateParams]. - * - * The following fields are required: - * ```java - * .transactionId() - * ``` - */ + @JvmStatic fun none(): CardRefundCreateParams = builder().build() + + /** Returns a mutable builder for constructing an instance of [CardRefundCreateParams]. */ @JvmStatic fun builder() = Builder() } @@ -87,10 +100,31 @@ private constructor( * * This is generally only useful if you are already constructing the body separately. * Otherwise, it's more convenient to use the top-level setters instead: + * - [pendingTransactionId] * - [transactionId] */ fun body(body: Body) = apply { this.body = body.toBuilder() } + /** + * The identifier of the Pending Transaction for the refund authorization. If this is + * provided, `transaction` must not be provided as a refund with a refund authorized can not + * be linked to a regular transaction. + */ + fun pendingTransactionId(pendingTransactionId: String) = apply { + body.pendingTransactionId(pendingTransactionId) + } + + /** + * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.pendingTransactionId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun pendingTransactionId(pendingTransactionId: JsonField) = apply { + body.pendingTransactionId(pendingTransactionId) + } + /** * The identifier for the Transaction to refund. The Transaction's source must have a * category of card_settlement. @@ -229,13 +263,6 @@ private constructor( * Returns an immutable instance of [CardRefundCreateParams]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): CardRefundCreateParams = CardRefundCreateParams( @@ -254,25 +281,50 @@ private constructor( class Body @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val pendingTransactionId: JsonField, private val transactionId: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( + @JsonProperty("pending_transaction_id") + @ExcludeMissing + pendingTransactionId: JsonField = JsonMissing.of(), @JsonProperty("transaction_id") @ExcludeMissing - transactionId: JsonField = JsonMissing.of() - ) : this(transactionId, mutableMapOf()) + transactionId: JsonField = JsonMissing.of(), + ) : this(pendingTransactionId, transactionId, mutableMapOf()) + + /** + * The identifier of the Pending Transaction for the refund authorization. If this is + * provided, `transaction` must not be provided as a refund with a refund authorized can not + * be linked to a regular transaction. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun pendingTransactionId(): Optional = + pendingTransactionId.getOptional("pending_transaction_id") /** * The identifier for the Transaction to refund. The Transaction's source must have a * category of card_settlement. * - * @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). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun transactionId(): Optional = transactionId.getOptional("transaction_id") + + /** + * Returns the raw JSON value of [pendingTransactionId]. + * + * Unlike [pendingTransactionId], this method doesn't throw if the JSON field has an + * unexpected type. */ - fun transactionId(): String = transactionId.getRequired("transaction_id") + @JsonProperty("pending_transaction_id") + @ExcludeMissing + fun _pendingTransactionId(): JsonField = pendingTransactionId /** * Returns the raw JSON value of [transactionId]. @@ -298,29 +350,43 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .transactionId() - * ``` - */ + /** Returns a mutable builder for constructing an instance of [Body]. */ @JvmStatic fun builder() = Builder() } /** A builder for [Body]. */ class Builder internal constructor() { - private var transactionId: JsonField? = null + private var pendingTransactionId: JsonField = JsonMissing.of() + private var transactionId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { + pendingTransactionId = body.pendingTransactionId transactionId = body.transactionId additionalProperties = body.additionalProperties.toMutableMap() } + /** + * The identifier of the Pending Transaction for the refund authorization. If this is + * provided, `transaction` must not be provided as a refund with a refund authorized can + * not be linked to a regular transaction. + */ + fun pendingTransactionId(pendingTransactionId: String) = + pendingTransactionId(JsonField.of(pendingTransactionId)) + + /** + * Sets [Builder.pendingTransactionId] to an arbitrary JSON value. + * + * You should usually call [Builder.pendingTransactionId] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun pendingTransactionId(pendingTransactionId: JsonField) = apply { + this.pendingTransactionId = pendingTransactionId + } + /** * The identifier for the Transaction to refund. The Transaction's source must have a * category of card_settlement. @@ -361,19 +427,9 @@ private constructor( * Returns an immutable instance of [Body]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ fun build(): Body = - Body( - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) + Body(pendingTransactionId, transactionId, additionalProperties.toMutableMap()) } private var validated: Boolean = false @@ -383,6 +439,7 @@ private constructor( return@apply } + pendingTransactionId() transactionId() validated = true } @@ -402,7 +459,9 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (transactionId.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = + (if (pendingTransactionId.asKnown().isPresent) 1 else 0) + + (if (transactionId.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { @@ -410,16 +469,19 @@ private constructor( } return other is Body && + pendingTransactionId == other.pendingTransactionId && transactionId == other.transactionId && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(transactionId, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(pendingTransactionId, transactionId, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "Body{transactionId=$transactionId, additionalProperties=$additionalProperties}" + "Body{pendingTransactionId=$pendingTransactionId, transactionId=$transactionId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsync.kt index 6d39c8785..6b90dfd07 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsync.kt @@ -28,15 +28,23 @@ interface CardRefundServiceAsync { * Simulates refunding a card transaction. The full value of the original sandbox transaction is * refunded. */ - fun create(params: CardRefundCreateParams): CompletableFuture = - create(params, RequestOptions.none()) + fun create(): CompletableFuture = create(CardRefundCreateParams.none()) /** @see create */ fun create( - params: CardRefundCreateParams, + params: CardRefundCreateParams = CardRefundCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture + /** @see create */ + fun create( + params: CardRefundCreateParams = CardRefundCreateParams.none() + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see create */ + fun create(requestOptions: RequestOptions): CompletableFuture = + create(CardRefundCreateParams.none(), requestOptions) + /** * A view of [CardRefundServiceAsync] that provides access to raw HTTP responses for each * method. @@ -56,14 +64,24 @@ interface CardRefundServiceAsync { * Returns a raw HTTP response for `post /simulations/card_refunds`, but is otherwise the * same as [CardRefundServiceAsync.create]. */ - fun create( - params: CardRefundCreateParams - ): CompletableFuture> = create(params, RequestOptions.none()) + fun create(): CompletableFuture> = + create(CardRefundCreateParams.none()) /** @see create */ fun create( - params: CardRefundCreateParams, + params: CardRefundCreateParams = CardRefundCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> + + /** @see create */ + fun create( + params: CardRefundCreateParams = CardRefundCreateParams.none() + ): CompletableFuture> = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + requestOptions: RequestOptions + ): CompletableFuture> = + create(CardRefundCreateParams.none(), requestOptions) } } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardRefundService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardRefundService.kt index 26843f9c6..30345f396 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardRefundService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardRefundService.kt @@ -28,14 +28,22 @@ interface CardRefundService { * Simulates refunding a card transaction. The full value of the original sandbox transaction is * refunded. */ - fun create(params: CardRefundCreateParams): Transaction = create(params, RequestOptions.none()) + fun create(): Transaction = create(CardRefundCreateParams.none()) /** @see create */ fun create( - params: CardRefundCreateParams, + params: CardRefundCreateParams = CardRefundCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): Transaction + /** @see create */ + fun create(params: CardRefundCreateParams = CardRefundCreateParams.none()): Transaction = + create(params, RequestOptions.none()) + + /** @see create */ + fun create(requestOptions: RequestOptions): Transaction = + create(CardRefundCreateParams.none(), requestOptions) + /** A view of [CardRefundService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -53,14 +61,24 @@ interface CardRefundService { * same as [CardRefundService.create]. */ @MustBeClosed - fun create(params: CardRefundCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) + fun create(): HttpResponseFor = create(CardRefundCreateParams.none()) /** @see create */ @MustBeClosed fun create( - params: CardRefundCreateParams, + params: CardRefundCreateParams = CardRefundCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): HttpResponseFor + + /** @see create */ + @MustBeClosed + fun create( + params: CardRefundCreateParams = CardRefundCreateParams.none() + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create(requestOptions: RequestOptions): HttpResponseFor = + create(CardRefundCreateParams.none(), requestOptions) } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParamsTest.kt index 4b97816c0..baece6da6 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardrefunds/CardRefundCreateParamsTest.kt @@ -9,18 +9,30 @@ internal class CardRefundCreateParamsTest { @Test fun create() { - CardRefundCreateParams.builder().transactionId("transaction_uyrp7fld2ium70oa7oi").build() + CardRefundCreateParams.builder() + .pendingTransactionId("pending_transaction_id") + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .build() } @Test fun body() { val params = CardRefundCreateParams.builder() + .pendingTransactionId("pending_transaction_id") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() val body = params._body() - assertThat(body.transactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") + assertThat(body.pendingTransactionId()).contains("pending_transaction_id") + assertThat(body.transactionId()).contains("transaction_uyrp7fld2ium70oa7oi") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = CardRefundCreateParams.builder().build() + + val body = params._body() } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsyncTest.kt index 7707dc32b..7799c78f4 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardRefundServiceAsyncTest.kt @@ -23,6 +23,7 @@ internal class CardRefundServiceAsyncTest { val transactionFuture = cardRefundServiceAsync.create( CardRefundCreateParams.builder() + .pendingTransactionId("pending_transaction_id") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardRefundServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardRefundServiceTest.kt index b3cc6d670..cf3c0fbaf 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardRefundServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardRefundServiceTest.kt @@ -23,6 +23,7 @@ internal class CardRefundServiceTest { val transaction = cardRefundService.create( CardRefundCreateParams.builder() + .pendingTransactionId("pending_transaction_id") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) From 875463eb81ee38d065af9dae2cdb31d67d88e9b3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:02:53 +0000 Subject: [PATCH 2/2] release: 0.339.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2503a8405..705b0cb27 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.338.0" + ".": "0.339.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 31051f916..dbab610de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.339.0 (2025-09-26) + +Full Changelog: [v0.338.0...v0.339.0](https://github.com/Increase/increase-java/compare/v0.338.0...v0.339.0) + +### Features + +* **api:** api update ([ef56185](https://github.com/Increase/increase-java/commit/ef561852f606957fefab5235b62d1238063a56c4)) + ## 0.338.0 (2025-09-26) Full Changelog: [v0.337.1...v0.338.0](https://github.com/Increase/increase-java/compare/v0.337.1...v0.338.0) diff --git a/README.md b/README.md index 62cb79aec..295ffe620 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.338.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.338.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.338.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.increase.api/increase-java)](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.339.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.339.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.339.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.338.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.339.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.338.0") +implementation("com.increase.api:increase-java:0.339.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.338.0") com.increase.api increase-java - 0.338.0 + 0.339.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index a66106de5..25d8eb94a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.338.0" // x-release-please-version + version = "0.339.0" // x-release-please-version } subprojects {