diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f7582d696..4a8316f57 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.389.0" + ".": "0.390.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b1d32ecc6..356c41695 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 227 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-63db8a5872b6a112abfc879f75a53bc6975994025752e86b27ab327884d94655.yml -openapi_spec_hash: b7ffb71e0102fcd040a575bf917656e3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4e978c9426fb846c81f3169f5c1bc7aad137577c13e52ac48fcc756e613a1557.yml +openapi_spec_hash: b44f228e3feac325305cd744c072ebc9 config_hash: ca52ca9a2968f330339fd50c1a386e05 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b72fc1ea..56e2e042d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.390.0 (2026-01-05) + +Full Changelog: [v0.389.0...v0.390.0](https://github.com/Increase/increase-java/compare/v0.389.0...v0.390.0) + +### Features + +* **api:** api update ([03ee177](https://github.com/Increase/increase-java/commit/03ee177555c58bfe68a197658753b7ea9ebe282e)) +* **client:** add `HttpRequest#url()` method ([ab5d43a](https://github.com/Increase/increase-java/commit/ab5d43a329eac1ef864127751bb109097abb6742)) + ## 0.389.0 (2026-01-01) Full Changelog: [v0.388.0...v0.389.0](https://github.com/Increase/increase-java/compare/v0.388.0...v0.389.0) diff --git a/README.md b/README.md index fee6de3f5..53dcf5433 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.389.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.389.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.389.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.390.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.390.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.390.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.389.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.390.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.389.0") +implementation("com.increase.api:increase-java:0.390.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.389.0") com.increase.api increase-java - 0.389.0 + 0.390.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 1bcbe8acd..31561f226 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.389.0" // x-release-please-version + version = "0.390.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/core/http/HttpRequest.kt b/increase-java-core/src/main/kotlin/com/increase/api/core/http/HttpRequest.kt index c8c0f5f72..b1da9684a 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/core/http/HttpRequest.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/core/http/HttpRequest.kt @@ -2,6 +2,7 @@ package com.increase.api.core.http import com.increase.api.core.checkRequired import com.increase.api.core.toImmutable +import java.net.URLEncoder class HttpRequest private constructor( @@ -13,6 +14,35 @@ private constructor( @get:JvmName("body") val body: HttpRequestBody?, ) { + fun url(): String = buildString { + append(baseUrl) + + pathSegments.forEach { segment -> + if (!endsWith("/")) { + append("/") + } + append(URLEncoder.encode(segment, "UTF-8")) + } + + if (queryParams.isEmpty()) { + return@buildString + } + + append("?") + var isFirst = true + queryParams.keys().forEach { key -> + queryParams.values(key).forEach { value -> + if (!isFirst) { + append("&") + } + append(URLEncoder.encode(key, "UTF-8")) + append("=") + append(URLEncoder.encode(value, "UTF-8")) + isFirst = false + } + } + } + fun toBuilder(): Builder = Builder().from(this) override fun toString(): String = 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 6dbf64042..9295195a4 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 @@ -11416,6 +11416,7 @@ private constructor( private val category: JsonField, private val chargeback: JsonField, private val createdAt: JsonField, + private val explanation: JsonField, private val furtherInformationRequestedAt: JsonField, private val furtherInformationRequestedReason: JsonField, private val merchantPrearbitrationDecline: JsonField, @@ -11443,6 +11444,9 @@ private constructor( @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of(), @JsonProperty("further_information_requested_at") @ExcludeMissing furtherInformationRequestedAt: JsonField = JsonMissing.of(), @@ -11469,6 +11473,7 @@ private constructor( category, chargeback, createdAt, + explanation, furtherInformationRequestedAt, furtherInformationRequestedReason, merchantPrearbitrationDecline, @@ -11537,6 +11542,15 @@ private constructor( */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + * + * @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") + /** * The date and time at which Increase requested further information from the user for * the Visa Card Dispute. @@ -11659,6 +11673,16 @@ private constructor( @ExcludeMissing fun _createdAt(): JsonField = createdAt + /** + * 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 + /** * Returns the raw JSON value of [furtherInformationRequestedAt]. * @@ -11744,6 +11768,7 @@ private constructor( * .category() * .chargeback() * .createdAt() + * .explanation() * .furtherInformationRequestedAt() * .furtherInformationRequestedReason() * .merchantPrearbitrationDecline() @@ -11764,6 +11789,7 @@ private constructor( private var category: JsonField? = null private var chargeback: JsonField? = null private var createdAt: JsonField? = null + private var explanation: JsonField? = null private var furtherInformationRequestedAt: JsonField? = null private var furtherInformationRequestedReason: JsonField? = null private var merchantPrearbitrationDecline: @@ -11782,6 +11808,7 @@ private constructor( category = userSubmission.category chargeback = userSubmission.chargeback createdAt = userSubmission.createdAt + explanation = userSubmission.explanation furtherInformationRequestedAt = userSubmission.furtherInformationRequestedAt furtherInformationRequestedReason = userSubmission.furtherInformationRequestedReason @@ -11923,6 +11950,28 @@ private constructor( this.createdAt = createdAt } + /** + * The free-form explanation provided to Increase to provide more context for the + * user submission. This field is not sent directly to the card networks. + */ + 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 + } + /** * The date and time at which Increase requested further information from the user * for the Visa Card Dispute. @@ -12104,6 +12153,7 @@ private constructor( * .category() * .chargeback() * .createdAt() + * .explanation() * .furtherInformationRequestedAt() * .furtherInformationRequestedReason() * .merchantPrearbitrationDecline() @@ -12122,6 +12172,7 @@ private constructor( checkRequired("category", category), checkRequired("chargeback", chargeback), checkRequired("createdAt", createdAt), + checkRequired("explanation", explanation), checkRequired( "furtherInformationRequestedAt", furtherInformationRequestedAt, @@ -12154,6 +12205,7 @@ private constructor( category().validate() chargeback().ifPresent { it.validate() } createdAt() + explanation() furtherInformationRequestedAt() furtherInformationRequestedReason() merchantPrearbitrationDecline().ifPresent { it.validate() } @@ -12185,6 +12237,7 @@ private constructor( (category.asKnown().getOrNull()?.validity() ?: 0) + (chargeback.asKnown().getOrNull()?.validity() ?: 0) + (if (createdAt.asKnown().isPresent) 1 else 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + (if (furtherInformationRequestedAt.asKnown().isPresent) 1 else 0) + (if (furtherInformationRequestedReason.asKnown().isPresent) 1 else 0) + (merchantPrearbitrationDecline.asKnown().getOrNull()?.validity() ?: 0) + @@ -41052,6 +41105,7 @@ private constructor( category == other.category && chargeback == other.chargeback && createdAt == other.createdAt && + explanation == other.explanation && furtherInformationRequestedAt == other.furtherInformationRequestedAt && furtherInformationRequestedReason == other.furtherInformationRequestedReason && merchantPrearbitrationDecline == other.merchantPrearbitrationDecline && @@ -41069,6 +41123,7 @@ private constructor( category, chargeback, createdAt, + explanation, furtherInformationRequestedAt, furtherInformationRequestedReason, merchantPrearbitrationDecline, @@ -41082,7 +41137,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "UserSubmission{acceptedAt=$acceptedAt, amount=$amount, attachmentFiles=$attachmentFiles, category=$category, chargeback=$chargeback, createdAt=$createdAt, furtherInformationRequestedAt=$furtherInformationRequestedAt, furtherInformationRequestedReason=$furtherInformationRequestedReason, merchantPrearbitrationDecline=$merchantPrearbitrationDecline, status=$status, updatedAt=$updatedAt, userPrearbitration=$userPrearbitration, additionalProperties=$additionalProperties}" + "UserSubmission{acceptedAt=$acceptedAt, amount=$amount, attachmentFiles=$attachmentFiles, category=$category, chargeback=$chargeback, createdAt=$createdAt, explanation=$explanation, furtherInformationRequestedAt=$furtherInformationRequestedAt, furtherInformationRequestedReason=$furtherInformationRequestedReason, merchantPrearbitrationDecline=$merchantPrearbitrationDecline, status=$status, updatedAt=$updatedAt, userPrearbitration=$userPrearbitration, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParams.kt index 9fd2064d1..ce4e4d911 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParams.kt @@ -68,6 +68,15 @@ private constructor( */ fun attachmentFiles(): Optional> = body.attachmentFiles() + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + * + * @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() + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is `visa`. * @@ -105,6 +114,13 @@ private constructor( */ fun _attachmentFiles(): JsonField> = body._attachmentFiles() + /** + * 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() + /** * Returns the raw JSON value of [visa]. * @@ -159,7 +175,7 @@ private constructor( * - [network] * - [amount] * - [attachmentFiles] - * - [visa] + * - [explanation] * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -237,6 +253,21 @@ private constructor( body.addAttachmentFile(attachmentFile) } + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + */ + 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) } + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -402,6 +433,7 @@ private constructor( private val network: JsonField, private val amount: JsonField, private val attachmentFiles: JsonField>, + private val explanation: JsonField, private val visa: JsonField, private val additionalProperties: MutableMap, ) { @@ -416,8 +448,19 @@ private constructor( @JsonProperty("attachment_files") @ExcludeMissing attachmentFiles: JsonField> = JsonMissing.of(), + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of(), @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), - ) : this(disputedTransactionId, network, amount, attachmentFiles, visa, mutableMapOf()) + ) : this( + disputedTransactionId, + network, + amount, + attachmentFiles, + explanation, + visa, + mutableMapOf(), + ) /** * The Transaction you wish to dispute. This Transaction must have a `source_type` of @@ -457,6 +500,15 @@ private constructor( fun attachmentFiles(): Optional> = attachmentFiles.getOptional("attachment_files") + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + * + * @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") + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -500,6 +552,15 @@ private constructor( @ExcludeMissing fun _attachmentFiles(): JsonField> = attachmentFiles + /** + * 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 + /** * Returns the raw JSON value of [visa]. * @@ -540,6 +601,7 @@ private constructor( private var network: JsonField? = null private var amount: JsonField = JsonMissing.of() private var attachmentFiles: JsonField>? = null + private var explanation: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -549,6 +611,7 @@ private constructor( network = body.network amount = body.amount attachmentFiles = body.attachmentFiles.map { it.toMutableList() } + explanation = body.explanation visa = body.visa additionalProperties = body.additionalProperties.toMutableMap() } @@ -629,6 +692,23 @@ private constructor( } } + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + */ + 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 + } + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -682,6 +762,7 @@ private constructor( checkRequired("network", network), amount, (attachmentFiles ?: JsonMissing.of()).map { it.toImmutable() }, + explanation, visa, additionalProperties.toMutableMap(), ) @@ -698,6 +779,7 @@ private constructor( network().validate() amount() attachmentFiles().ifPresent { it.forEach { it.validate() } } + explanation() visa().ifPresent { it.validate() } validated = true } @@ -722,6 +804,7 @@ private constructor( (network.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + (attachmentFiles.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + (visa.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -734,6 +817,7 @@ private constructor( network == other.network && amount == other.amount && attachmentFiles == other.attachmentFiles && + explanation == other.explanation && visa == other.visa && additionalProperties == other.additionalProperties } @@ -744,6 +828,7 @@ private constructor( network, amount, attachmentFiles, + explanation, visa, additionalProperties, ) @@ -752,7 +837,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Body{disputedTransactionId=$disputedTransactionId, network=$network, amount=$amount, attachmentFiles=$attachmentFiles, visa=$visa, additionalProperties=$additionalProperties}" + "Body{disputedTransactionId=$disputedTransactionId, network=$network, amount=$amount, attachmentFiles=$attachmentFiles, explanation=$explanation, visa=$visa, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParams.kt index fd9c0cad3..50de11bf8 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParams.kt @@ -63,6 +63,15 @@ private constructor( */ fun attachmentFiles(): Optional> = body.attachmentFiles() + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + * + * @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() + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is `visa`. * @@ -92,6 +101,13 @@ private constructor( */ fun _attachmentFiles(): JsonField> = body._attachmentFiles() + /** + * 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() + /** * Returns the raw JSON value of [visa]. * @@ -157,7 +173,9 @@ private constructor( * - [network] * - [amount] * - [attachmentFiles] + * - [explanation] * - [visa] + * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -215,6 +233,21 @@ private constructor( body.addAttachmentFile(attachmentFile) } + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + */ + 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) } + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -385,6 +418,7 @@ private constructor( private val network: JsonField, private val amount: JsonField, private val attachmentFiles: JsonField>, + private val explanation: JsonField, private val visa: JsonField, private val additionalProperties: MutableMap, ) { @@ -396,8 +430,11 @@ private constructor( @JsonProperty("attachment_files") @ExcludeMissing attachmentFiles: JsonField> = JsonMissing.of(), + @JsonProperty("explanation") + @ExcludeMissing + explanation: JsonField = JsonMissing.of(), @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), - ) : this(network, amount, attachmentFiles, visa, mutableMapOf()) + ) : this(network, amount, attachmentFiles, explanation, visa, mutableMapOf()) /** * The network of the Card Dispute. Details specific to the network are required under the @@ -427,6 +464,15 @@ private constructor( fun attachmentFiles(): Optional> = attachmentFiles.getOptional("attachment_files") + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + * + * @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") + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -460,6 +506,15 @@ private constructor( @ExcludeMissing fun _attachmentFiles(): JsonField> = attachmentFiles + /** + * 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 + /** * Returns the raw JSON value of [visa]. * @@ -498,6 +553,7 @@ private constructor( private var network: JsonField? = null private var amount: JsonField = JsonMissing.of() private var attachmentFiles: JsonField>? = null + private var explanation: JsonField = JsonMissing.of() private var visa: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -506,6 +562,7 @@ private constructor( network = body.network amount = body.amount attachmentFiles = body.attachmentFiles.map { it.toMutableList() } + explanation = body.explanation visa = body.visa additionalProperties = body.additionalProperties.toMutableMap() } @@ -568,6 +625,23 @@ private constructor( } } + /** + * The free-form explanation provided to Increase to provide more context for the user + * submission. This field is not sent directly to the card networks. + */ + 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 + } + /** * The Visa-specific parameters for the dispute. Required if and only if `network` is * `visa`. @@ -619,6 +693,7 @@ private constructor( checkRequired("network", network), amount, (attachmentFiles ?: JsonMissing.of()).map { it.toImmutable() }, + explanation, visa, additionalProperties.toMutableMap(), ) @@ -634,6 +709,7 @@ private constructor( network().validate() amount() attachmentFiles().ifPresent { it.forEach { it.validate() } } + explanation() visa().ifPresent { it.validate() } validated = true } @@ -657,6 +733,7 @@ private constructor( (network.asKnown().getOrNull()?.validity() ?: 0) + (if (amount.asKnown().isPresent) 1 else 0) + (attachmentFiles.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + (visa.asKnown().getOrNull()?.validity() ?: 0) override fun equals(other: Any?): Boolean { @@ -668,18 +745,19 @@ private constructor( network == other.network && amount == other.amount && attachmentFiles == other.attachmentFiles && + explanation == other.explanation && visa == other.visa && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(network, amount, attachmentFiles, visa, additionalProperties) + Objects.hash(network, amount, attachmentFiles, explanation, visa, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Body{network=$network, amount=$amount, attachmentFiles=$attachmentFiles, visa=$visa, additionalProperties=$additionalProperties}" + "Body{network=$network, amount=$amount, attachmentFiles=$attachmentFiles, explanation=$explanation, visa=$visa, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/test/kotlin/com/increase/api/core/http/HttpRequestTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/core/http/HttpRequestTest.kt new file mode 100644 index 000000000..5cb47a06c --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/core/http/HttpRequestTest.kt @@ -0,0 +1,110 @@ +package com.increase.api.core.http + +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource + +internal class HttpRequestTest { + + enum class UrlTestCase(val request: HttpRequest, val expectedUrl: String) { + BASE_URL_ONLY( + HttpRequest.builder().method(HttpMethod.GET).baseUrl("https://api.example.com").build(), + expectedUrl = "https://api.example.com", + ), + BASE_URL_WITH_TRAILING_SLASH( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com/") + .build(), + expectedUrl = "https://api.example.com/", + ), + SINGLE_PATH_SEGMENT( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("users") + .build(), + expectedUrl = "https://api.example.com/users", + ), + MULTIPLE_PATH_SEGMENTS( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegments("users", "123", "profile") + .build(), + expectedUrl = "https://api.example.com/users/123/profile", + ), + PATH_SEGMENT_WITH_SPECIAL_CHARS( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("user name") + .build(), + expectedUrl = "https://api.example.com/user+name", + ), + SINGLE_QUERY_PARAM( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("users") + .putQueryParam("limit", "10") + .build(), + expectedUrl = "https://api.example.com/users?limit=10", + ), + MULTIPLE_QUERY_PARAMS( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("users") + .putQueryParam("limit", "10") + .putQueryParam("offset", "20") + .build(), + expectedUrl = "https://api.example.com/users?limit=10&offset=20", + ), + QUERY_PARAM_WITH_SPECIAL_CHARS( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("search") + .putQueryParam("q", "hello world") + .build(), + expectedUrl = "https://api.example.com/search?q=hello+world", + ), + MULTIPLE_VALUES_SAME_PARAM( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com") + .addPathSegment("users") + .putQueryParams("tags", listOf("admin", "user")) + .build(), + expectedUrl = "https://api.example.com/users?tags=admin&tags=user", + ), + BASE_URL_WITH_TRAILING_SLASH_AND_PATH( + HttpRequest.builder() + .method(HttpMethod.GET) + .baseUrl("https://api.example.com/") + .addPathSegment("users") + .build(), + expectedUrl = "https://api.example.com/users", + ), + COMPLEX_URL( + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl("https://api.example.com") + .addPathSegments("v1", "users", "123") + .putQueryParams("include", listOf("profile", "settings")) + .putQueryParam("format", "json") + .build(), + expectedUrl = + "https://api.example.com/v1/users/123?include=profile&include=settings&format=json", + ), + } + + @ParameterizedTest + @EnumSource + fun url(testCase: UrlTestCase) { + val actualUrl = testCase.request.url() + + assertThat(actualUrl).isEqualTo(testCase.expectedUrl) + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParamsTest.kt index 8dead8032..e87fff3eb 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParamsTest.kt @@ -18,6 +18,7 @@ internal class CardDisputeCreateParamsTest { .addAttachmentFile( CardDisputeCreateParams.AttachmentFile.builder().fileId("file_id").build() ) + .explanation("x") .visa( CardDisputeCreateParams.Visa.builder() .category(CardDisputeCreateParams.Visa.Category.FRAUD) @@ -700,6 +701,7 @@ internal class CardDisputeCreateParamsTest { .addAttachmentFile( CardDisputeCreateParams.AttachmentFile.builder().fileId("file_id").build() ) + .explanation("x") .visa( CardDisputeCreateParams.Visa.builder() .category(CardDisputeCreateParams.Visa.Category.FRAUD) @@ -1409,6 +1411,7 @@ internal class CardDisputeCreateParamsTest { .containsExactly( CardDisputeCreateParams.AttachmentFile.builder().fileId("file_id").build() ) + assertThat(body.explanation()).contains("x") assertThat(body.visa()) .contains( CardDisputeCreateParams.Visa.builder() 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 9b87a2a8c..1a5e31587 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 @@ -1343,6 +1343,7 @@ internal class CardDisputeListPageResponseTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( @@ -2635,6 +2636,7 @@ internal class CardDisputeListPageResponseTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( @@ -4020,6 +4022,7 @@ internal class CardDisputeListPageResponseTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParamsTest.kt index 1e6673c95..9c006ab43 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeSubmitUserSubmissionParamsTest.kt @@ -20,6 +20,7 @@ internal class CardDisputeSubmitUserSubmissionParamsTest { .fileId("file_id") .build() ) + .explanation("x") .visa( CardDisputeSubmitUserSubmissionParams.Visa.builder() .category( @@ -906,6 +907,7 @@ internal class CardDisputeSubmitUserSubmissionParamsTest { .fileId("file_id") .build() ) + .explanation("x") .visa( CardDisputeSubmitUserSubmissionParams.Visa.builder() .category( @@ -1794,6 +1796,7 @@ internal class CardDisputeSubmitUserSubmissionParamsTest { .fileId("file_id") .build() ) + assertThat(body.explanation()).contains("x") assertThat(body.visa()) .contains( CardDisputeSubmitUserSubmissionParams.Visa.builder() 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 35a842b36..c7ad5aa82 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 @@ -1170,6 +1170,7 @@ internal class CardDisputeTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( @@ -2321,6 +2322,7 @@ internal class CardDisputeTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( @@ -3525,6 +3527,7 @@ internal class CardDisputeTest { .build() ) .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) + .explanation(null) .furtherInformationRequestedAt(null) .furtherInformationRequestedReason(null) .merchantPrearbitrationDecline( 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 274501834..c8e7ef1c8 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 @@ -31,6 +31,7 @@ internal class CardDisputeServiceAsyncTest { .addAttachmentFile( CardDisputeCreateParams.AttachmentFile.builder().fileId("file_id").build() ) + .explanation("x") .visa( CardDisputeCreateParams.Visa.builder() .category(CardDisputeCreateParams.Visa.Category.FRAUD) @@ -810,6 +811,7 @@ internal class CardDisputeServiceAsyncTest { .fileId("file_id") .build() ) + .explanation("x") .visa( CardDisputeSubmitUserSubmissionParams.Visa.builder() .category( 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 e4296d8d5..1d6a64919 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 @@ -31,6 +31,7 @@ internal class CardDisputeServiceTest { .addAttachmentFile( CardDisputeCreateParams.AttachmentFile.builder().fileId("file_id").build() ) + .explanation("x") .visa( CardDisputeCreateParams.Visa.builder() .category(CardDisputeCreateParams.Visa.Category.FRAUD) @@ -806,6 +807,7 @@ internal class CardDisputeServiceTest { .fileId("file_id") .build() ) + .explanation("x") .visa( CardDisputeSubmitUserSubmissionParams.Visa.builder() .category(