diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f86031a6a..8e585de79 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.406.0" + ".": "0.407.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index fd48d4fba..87e086700 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 232 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-92af5c57fac9c88bad16079e7b437371720d00c368fd4eea5987f94b25855fcb.yml -openapi_spec_hash: 7831d7cdab2d8972f5193916c617c9a2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a822d0695f48967e594a88eef888b826cd51b62959bd4b3d0163b7d010bab969.yml +openapi_spec_hash: 95ea277ed84c04aefd25bcb63ae4e2e5 config_hash: 27e44ed36b9c5617b580ead7231a594a diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c077f71b..d2fd18c94 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.407.0 (2026-01-28) + +Full Changelog: [v0.406.0...v0.407.0](https://github.com/Increase/increase-java/compare/v0.406.0...v0.407.0) + +### Features + +* **api:** api update ([858a7a6](https://github.com/Increase/increase-java/commit/858a7a60e7b0a4fc71228581cb003c98fda30d5d)) + ## 0.406.0 (2026-01-27) Full Changelog: [v0.405.0...v0.406.0](https://github.com/Increase/increase-java/compare/v0.405.0...v0.406.0) diff --git a/README.md b/README.md index e2ffce6a2..2375057bd 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.406.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.406.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.406.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.407.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.407.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.407.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.406.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.407.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.406.0") +implementation("com.increase.api:increase-java:0.407.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.406.0") com.increase.api increase-java - 0.406.0 + 0.407.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index fcc205c6d..289e422cc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.406.0" // x-release-please-version + version = "0.407.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDispute.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDispute.kt index b08e60e3a..09175f8d9 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDispute.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDispute.kt @@ -42,6 +42,7 @@ private constructor( private val userSubmissionRequiredBy: JsonField, private val visa: JsonField, private val win: JsonField, + private val withdrawal: JsonField, private val additionalProperties: MutableMap, ) { @@ -68,6 +69,9 @@ private constructor( userSubmissionRequiredBy: JsonField = JsonMissing.of(), @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), @JsonProperty("win") @ExcludeMissing win: JsonField = JsonMissing.of(), + @JsonProperty("withdrawal") + @ExcludeMissing + withdrawal: JsonField = JsonMissing.of(), ) : this( id, amount, @@ -82,6 +86,7 @@ private constructor( userSubmissionRequiredBy, visa, win, + withdrawal, mutableMapOf(), ) @@ -198,6 +203,14 @@ private constructor( */ fun win(): Optional = win.getOptional("win") + /** + * If the Card Dispute has been withdrawn, this will contain details of the withdrawal. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun withdrawal(): Optional = withdrawal.getOptional("withdrawal") + /** * Returns the raw JSON value of [id]. * @@ -299,6 +312,15 @@ private constructor( */ @JsonProperty("win") @ExcludeMissing fun _win(): JsonField = win + /** + * Returns the raw JSON value of [withdrawal]. + * + * Unlike [withdrawal], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("withdrawal") + @ExcludeMissing + fun _withdrawal(): JsonField = withdrawal + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -331,6 +353,7 @@ private constructor( * .userSubmissionRequiredBy() * .visa() * .win() + * .withdrawal() * ``` */ @JvmStatic fun builder() = Builder() @@ -352,6 +375,7 @@ private constructor( private var userSubmissionRequiredBy: JsonField? = null private var visa: JsonField? = null private var win: JsonField? = null + private var withdrawal: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -369,6 +393,7 @@ private constructor( userSubmissionRequiredBy = cardDispute.userSubmissionRequiredBy visa = cardDispute.visa win = cardDispute.win + withdrawal = cardDispute.withdrawal additionalProperties = cardDispute.additionalProperties.toMutableMap() } @@ -567,6 +592,21 @@ private constructor( */ fun win(win: JsonField) = apply { this.win = win } + /** If the Card Dispute has been withdrawn, this will contain details of the withdrawal. */ + fun withdrawal(withdrawal: Withdrawal?) = withdrawal(JsonField.ofNullable(withdrawal)) + + /** Alias for calling [Builder.withdrawal] with `withdrawal.orElse(null)`. */ + fun withdrawal(withdrawal: Optional) = withdrawal(withdrawal.getOrNull()) + + /** + * Sets [Builder.withdrawal] to an arbitrary JSON value. + * + * You should usually call [Builder.withdrawal] with a well-typed [Withdrawal] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun withdrawal(withdrawal: JsonField) = apply { this.withdrawal = withdrawal } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -606,6 +646,7 @@ private constructor( * .userSubmissionRequiredBy() * .visa() * .win() + * .withdrawal() * ``` * * @throws IllegalStateException if any required field is unset. @@ -625,6 +666,7 @@ private constructor( checkRequired("userSubmissionRequiredBy", userSubmissionRequiredBy), checkRequired("visa", visa), checkRequired("win", win), + checkRequired("withdrawal", withdrawal), additionalProperties.toMutableMap(), ) } @@ -649,6 +691,7 @@ private constructor( userSubmissionRequiredBy() visa().ifPresent { it.validate() } win().ifPresent { it.validate() } + withdrawal().ifPresent { it.validate() } validated = true } @@ -679,7 +722,8 @@ private constructor( (type.asKnown().getOrNull()?.validity() ?: 0) + (if (userSubmissionRequiredBy.asKnown().isPresent) 1 else 0) + (visa.asKnown().getOrNull()?.validity() ?: 0) + - (win.asKnown().getOrNull()?.validity() ?: 0) + (win.asKnown().getOrNull()?.validity() ?: 0) + + (withdrawal.asKnown().getOrNull()?.validity() ?: 0) /** If the Card Dispute's status is `lost`, this will contain details of the lost dispute. */ class Loss @@ -41377,6 +41421,175 @@ private constructor( override fun toString() = "Win{wonAt=$wonAt, additionalProperties=$additionalProperties}" } + /** If the Card Dispute has been withdrawn, this will contain details of the withdrawal. */ + class Withdrawal + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val explanation: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of() + ) : this(explanation, mutableMapOf()) + + /** + * The explanation for the withdrawal of the Card Dispute. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun explanation(): Optional = explanation.getOptional("explanation") + + /** + * Returns the raw JSON value of [explanation]. + * + * Unlike [explanation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("explanation") + @ExcludeMissing + fun _explanation(): JsonField = explanation + + @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 [Withdrawal]. + * + * The following fields are required: + * ```java + * .explanation() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Withdrawal]. */ + class Builder internal constructor() { + + private var explanation: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(withdrawal: Withdrawal) = apply { + explanation = withdrawal.explanation + additionalProperties = withdrawal.additionalProperties.toMutableMap() + } + + /** The explanation for the withdrawal of the Card Dispute. */ + fun explanation(explanation: String?) = explanation(JsonField.ofNullable(explanation)) + + /** Alias for calling [Builder.explanation] with `explanation.orElse(null)`. */ + fun explanation(explanation: Optional) = explanation(explanation.getOrNull()) + + /** + * Sets [Builder.explanation] to an arbitrary JSON value. + * + * You should usually call [Builder.explanation] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun explanation(explanation: JsonField) = apply { + this.explanation = explanation + } + + 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 [Withdrawal]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .explanation() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Withdrawal = + Withdrawal( + checkRequired("explanation", explanation), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Withdrawal = apply { + if (validated) { + return@apply + } + + explanation() + 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 (explanation.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Withdrawal && + explanation == other.explanation && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(explanation, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Withdrawal{explanation=$explanation, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -41396,6 +41609,7 @@ private constructor( userSubmissionRequiredBy == other.userSubmissionRequiredBy && visa == other.visa && win == other.win && + withdrawal == other.withdrawal && additionalProperties == other.additionalProperties } @@ -41414,6 +41628,7 @@ private constructor( userSubmissionRequiredBy, visa, win, + withdrawal, additionalProperties, ) } @@ -41421,5 +41636,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "CardDispute{id=$id, amount=$amount, cardId=$cardId, createdAt=$createdAt, disputedTransactionId=$disputedTransactionId, idempotencyKey=$idempotencyKey, loss=$loss, network=$network, status=$status, type=$type, userSubmissionRequiredBy=$userSubmissionRequiredBy, visa=$visa, win=$win, additionalProperties=$additionalProperties}" + "CardDispute{id=$id, amount=$amount, cardId=$cardId, createdAt=$createdAt, disputedTransactionId=$disputedTransactionId, idempotencyKey=$idempotencyKey, loss=$loss, network=$network, status=$status, type=$type, userSubmissionRequiredBy=$userSubmissionRequiredBy, visa=$visa, win=$win, withdrawal=$withdrawal, additionalProperties=$additionalProperties}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParams.kt index 1f32200a3..4916c40da 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParams.kt @@ -2,11 +2,19 @@ package com.increase.api.models.carddisputes +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.http.Headers import com.increase.api.core.http.QueryParams -import com.increase.api.core.toImmutable +import com.increase.api.errors.IncreaseInvalidDataException +import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull @@ -15,16 +23,30 @@ import kotlin.jvm.optionals.getOrNull class CardDisputeWithdrawParams private constructor( private val cardDisputeId: String?, + private val body: Body, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, ) : Params { /** The identifier of the Card Dispute to withdraw. */ fun cardDisputeId(): Optional = Optional.ofNullable(cardDisputeId) - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties + /** + * The explanation for withdrawing the Card Dispute. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun explanation(): Optional = body.explanation() + + /** + * Returns the raw JSON value of [explanation]. + * + * Unlike [explanation], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _explanation(): JsonField = body._explanation() + + fun _additionalBodyProperties(): Map = body._additionalProperties() /** Additional headers to send with the request. */ fun _additionalHeaders(): Headers = additionalHeaders @@ -48,17 +70,16 @@ private constructor( class Builder internal constructor() { private var cardDisputeId: String? = null + private var body: Body.Builder = Body.builder() private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(cardDisputeWithdrawParams: CardDisputeWithdrawParams) = apply { cardDisputeId = cardDisputeWithdrawParams.cardDisputeId + body = cardDisputeWithdrawParams.body.toBuilder() additionalHeaders = cardDisputeWithdrawParams.additionalHeaders.toBuilder() additionalQueryParams = cardDisputeWithdrawParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - cardDisputeWithdrawParams.additionalBodyProperties.toMutableMap() } /** The identifier of the Card Dispute to withdraw. */ @@ -68,6 +89,46 @@ private constructor( fun cardDisputeId(cardDisputeId: Optional) = cardDisputeId(cardDisputeId.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: + * - [explanation] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** The explanation for withdrawing the Card Dispute. */ + fun explanation(explanation: String) = apply { body.explanation(explanation) } + + /** + * Sets [Builder.explanation] to an arbitrary JSON value. + * + * You should usually call [Builder.explanation] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun explanation(explanation: JsonField) = apply { body.explanation(explanation) } + + 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) @@ -166,28 +227,6 @@ private constructor( additionalQueryParams.removeAll(keys) } - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - /** * Returns an immutable instance of [CardDisputeWithdrawParams]. * @@ -196,14 +235,13 @@ private constructor( fun build(): CardDisputeWithdrawParams = CardDisputeWithdrawParams( cardDisputeId, + body.build(), additionalHeaders.build(), additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), ) } - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) + fun _body(): Body = body fun _pathParam(index: Int): String = when (index) { @@ -215,6 +253,153 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val explanation: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of() + ) : this(explanation, mutableMapOf()) + + /** + * The explanation for withdrawing the Card Dispute. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun explanation(): Optional = explanation.getOptional("explanation") + + /** + * Returns the raw JSON value of [explanation]. + * + * Unlike [explanation], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("explanation") + @ExcludeMissing + fun _explanation(): JsonField = explanation + + @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]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var explanation: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + explanation = body.explanation + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** The explanation for withdrawing the Card Dispute. */ + fun explanation(explanation: String) = explanation(JsonField.of(explanation)) + + /** + * Sets [Builder.explanation] to an arbitrary JSON value. + * + * You should usually call [Builder.explanation] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun explanation(explanation: JsonField) = apply { + this.explanation = explanation + } + + 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. + */ + fun build(): Body = Body(explanation, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + explanation() + 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 (explanation.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + explanation == other.explanation && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { Objects.hash(explanation, additionalProperties) } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{explanation=$explanation, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -222,19 +407,14 @@ private constructor( return other is CardDisputeWithdrawParams && cardDisputeId == other.cardDisputeId && + body == other.body && additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties + additionalQueryParams == other.additionalQueryParams } override fun hashCode(): Int = - Objects.hash( - cardDisputeId, - additionalHeaders, - additionalQueryParams, - additionalBodyProperties, - ) + Objects.hash(cardDisputeId, body, additionalHeaders, additionalQueryParams) override fun toString() = - "CardDisputeWithdrawParams{cardDisputeId=$cardDisputeId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" + "CardDisputeWithdrawParams{cardDisputeId=$cardDisputeId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncImpl.kt index 8714063fe..c3dfe8d13 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncImpl.kt @@ -243,7 +243,7 @@ class CardDisputeServiceAsyncImpl internal constructor(private val clientOptions .method(HttpMethod.POST) .baseUrl(clientOptions.baseUrl()) .addPathSegments("card_disputes", params._pathParam(0), "withdraw") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .body(json(clientOptions.jsonMapper, params._body())) .build() .prepareAsync(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeServiceImpl.kt index d40ef689d..436d32761 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeServiceImpl.kt @@ -229,7 +229,7 @@ class CardDisputeServiceImpl internal constructor(private val clientOptions: Cli .method(HttpMethod.POST) .baseUrl(clientOptions.baseUrl()) .addPathSegments("card_disputes", params._pathParam(0), "withdraw") - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } + .body(json(clientOptions.jsonMapper, params._body())) .build() .prepare(clientOptions, params) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponseTest.kt index df26e5669..72d6d8377 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponseTest.kt @@ -1394,6 +1394,13 @@ internal class CardDisputeListPageResponseTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + .withdrawal( + CardDispute.Withdrawal.builder() + .explanation( + "The cardholder requested a withdrawal of the dispute." + ) + .build() + ) .build() ) .nextCursor("v57w5d") @@ -2686,6 +2693,11 @@ internal class CardDisputeListPageResponseTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + .withdrawal( + CardDispute.Withdrawal.builder() + .explanation("The cardholder requested a withdrawal of the dispute.") + .build() + ) .build() ) assertThat(cardDisputeListPageResponse.nextCursor()).contains("v57w5d") @@ -4075,6 +4087,13 @@ internal class CardDisputeListPageResponseTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + .withdrawal( + CardDispute.Withdrawal.builder() + .explanation( + "The cardholder requested a withdrawal of the dispute." + ) + .build() + ) .build() ) .nextCursor("v57w5d") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeTest.kt index 6334810d2..b00714438 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeTest.kt @@ -1214,6 +1214,11 @@ internal class CardDisputeTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + .withdrawal( + CardDispute.Withdrawal.builder() + .explanation("The cardholder requested a withdrawal of the dispute.") + .build() + ) .build() assertThat(cardDispute.id()).isEqualTo("card_dispute_h9sc95nbl1cgltpp7men") @@ -2367,6 +2372,12 @@ internal class CardDisputeTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + assertThat(cardDispute.withdrawal()) + .contains( + CardDispute.Withdrawal.builder() + .explanation("The cardholder requested a withdrawal of the dispute.") + .build() + ) } @Test @@ -3573,6 +3584,11 @@ internal class CardDisputeTest { .wonAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .build() ) + .withdrawal( + CardDispute.Withdrawal.builder() + .explanation("The cardholder requested a withdrawal of the dispute.") + .build() + ) .build() val roundtrippedCardDispute = diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParamsTest.kt index 3b15d88a8..9769d4657 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeWithdrawParamsTest.kt @@ -11,6 +11,7 @@ internal class CardDisputeWithdrawParamsTest { fun create() { CardDisputeWithdrawParams.builder() .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") + .explanation("The explanation for withdrawing the Card Dispute.") .build() } @@ -25,4 +26,27 @@ internal class CardDisputeWithdrawParamsTest { // out-of-bound path param assertThat(params._pathParam(1)).isEqualTo("") } + + @Test + fun body() { + val params = + CardDisputeWithdrawParams.builder() + .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") + .explanation("The explanation for withdrawing the Card Dispute.") + .build() + + val body = params._body() + + assertThat(body.explanation()).contains("The explanation for withdrawing the Card Dispute.") + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + CardDisputeWithdrawParams.builder() + .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") + .build() + + val body = params._body() + } } diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncTest.kt index 3c15debd9..2f46fd88b 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncTest.kt @@ -6,6 +6,7 @@ import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync import com.increase.api.models.carddisputes.CardDisputeCreateParams import com.increase.api.models.carddisputes.CardDisputeSubmitUserSubmissionParams +import com.increase.api.models.carddisputes.CardDisputeWithdrawParams import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -1779,7 +1780,12 @@ internal class CardDisputeServiceAsyncTest { val cardDisputeServiceAsync = client.cardDisputes() val cardDisputeFuture = - cardDisputeServiceAsync.withdraw("card_dispute_h9sc95nbl1cgltpp7men") + cardDisputeServiceAsync.withdraw( + CardDisputeWithdrawParams.builder() + .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") + .explanation("The explanation for withdrawing the Card Dispute.") + .build() + ) val cardDispute = cardDisputeFuture.get() cardDispute.validate() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDisputeServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDisputeServiceTest.kt index 7417ab147..52697e67b 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDisputeServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDisputeServiceTest.kt @@ -6,6 +6,7 @@ import com.increase.api.TestServerExtension import com.increase.api.client.okhttp.IncreaseOkHttpClient import com.increase.api.models.carddisputes.CardDisputeCreateParams import com.increase.api.models.carddisputes.CardDisputeSubmitUserSubmissionParams +import com.increase.api.models.carddisputes.CardDisputeWithdrawParams import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -1773,7 +1774,13 @@ internal class CardDisputeServiceTest { .build() val cardDisputeService = client.cardDisputes() - val cardDispute = cardDisputeService.withdraw("card_dispute_h9sc95nbl1cgltpp7men") + val cardDispute = + cardDisputeService.withdraw( + CardDisputeWithdrawParams.builder() + .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") + .explanation("The explanation for withdrawing the Card Dispute.") + .build() + ) cardDispute.validate() }