diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 24f979195..09eb6e203 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.328.0" + ".": "0.329.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 14e640b1e..f6bbc76b8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 217 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-61210b27ac135ed841515ad3c3dfedaf42dc1398b0a3ed63bbd6c154d1b31a6a.yml -openapi_spec_hash: b0d2957f6269776252f0ddaa6489772a -config_hash: e1885b38eded054b77308a024c5d80cc +configured_endpoints: 213 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-fc17d091731928c882b2272ea5de831cafcbf237a7887652a5f133c29cb1bbc4.yml +openapi_spec_hash: aad429d087b7557be4103d1309cd81a0 +config_hash: e1e8bc2138a13f290956ae6687f099cd diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d9123e2..e937fc0ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.329.0 (2025-09-17) + +Full Changelog: [v0.328.0...v0.329.0](https://github.com/Increase/increase-java/compare/v0.328.0...v0.329.0) + +### Features + +* **api:** api update ([efaab46](https://github.com/Increase/increase-java/commit/efaab46aafff0c6af9a18189d4b92b77615f8b56)) + ## 0.328.0 (2025-09-17) Full Changelog: [v0.327.0...v0.328.0](https://github.com/Increase/increase-java/compare/v0.327.0...v0.328.0) diff --git a/README.md b/README.md index 88c465de9..026159446 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.328.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.328.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.328.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.329.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.329.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.329.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.328.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.329.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.328.0") +implementation("com.increase.api:increase-java:0.329.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.328.0") com.increase.api increase-java - 0.328.0 + 0.329.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index cc729f654..081f65a96 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.328.0" // x-release-please-version + version = "0.329.0" // x-release-please-version } subprojects { diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt index 4de8c0ea2..952133bfb 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClient.kt @@ -12,7 +12,6 @@ import com.increase.api.services.blocking.AchTransferService import com.increase.api.services.blocking.BookkeepingAccountService import com.increase.api.services.blocking.BookkeepingEntryService import com.increase.api.services.blocking.BookkeepingEntrySetService -import com.increase.api.services.blocking.CardDisputeService import com.increase.api.services.blocking.CardPaymentService import com.increase.api.services.blocking.CardPurchaseSupplementService import com.increase.api.services.blocking.CardPushTransferService @@ -109,8 +108,6 @@ interface IncreaseClient { fun cardPurchaseSupplements(): CardPurchaseSupplementService - fun cardDisputes(): CardDisputeService - fun physicalCards(): PhysicalCardService fun digitalCardProfiles(): DigitalCardProfileService @@ -244,8 +241,6 @@ interface IncreaseClient { fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse - fun cardDisputes(): CardDisputeService.WithRawResponse - fun physicalCards(): PhysicalCardService.WithRawResponse fun digitalCardProfiles(): DigitalCardProfileService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt index ac800b994..254077478 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsync.kt @@ -12,7 +12,6 @@ import com.increase.api.services.async.AchTransferServiceAsync import com.increase.api.services.async.BookkeepingAccountServiceAsync import com.increase.api.services.async.BookkeepingEntryServiceAsync import com.increase.api.services.async.BookkeepingEntrySetServiceAsync -import com.increase.api.services.async.CardDisputeServiceAsync import com.increase.api.services.async.CardPaymentServiceAsync import com.increase.api.services.async.CardPurchaseSupplementServiceAsync import com.increase.api.services.async.CardPushTransferServiceAsync @@ -109,8 +108,6 @@ interface IncreaseClientAsync { fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync - fun cardDisputes(): CardDisputeServiceAsync - fun physicalCards(): PhysicalCardServiceAsync fun digitalCardProfiles(): DigitalCardProfileServiceAsync @@ -248,8 +245,6 @@ interface IncreaseClientAsync { fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse - fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse - fun physicalCards(): PhysicalCardServiceAsync.WithRawResponse fun digitalCardProfiles(): DigitalCardProfileServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt index 1adb82f42..7c881b56d 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientAsyncImpl.kt @@ -22,8 +22,6 @@ import com.increase.api.services.async.BookkeepingEntryServiceAsync import com.increase.api.services.async.BookkeepingEntryServiceAsyncImpl import com.increase.api.services.async.BookkeepingEntrySetServiceAsync import com.increase.api.services.async.BookkeepingEntrySetServiceAsyncImpl -import com.increase.api.services.async.CardDisputeServiceAsync -import com.increase.api.services.async.CardDisputeServiceAsyncImpl import com.increase.api.services.async.CardPaymentServiceAsync import com.increase.api.services.async.CardPaymentServiceAsyncImpl import com.increase.api.services.async.CardPurchaseSupplementServiceAsync @@ -157,10 +155,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa CardPurchaseSupplementServiceAsyncImpl(clientOptionsWithUserAgent) } - private val cardDisputes: CardDisputeServiceAsync by lazy { - CardDisputeServiceAsyncImpl(clientOptionsWithUserAgent) - } - private val physicalCards: PhysicalCardServiceAsync by lazy { PhysicalCardServiceAsyncImpl(clientOptionsWithUserAgent) } @@ -374,8 +368,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync = cardPurchaseSupplements - override fun cardDisputes(): CardDisputeServiceAsync = cardDisputes - override fun physicalCards(): PhysicalCardServiceAsync = physicalCards override fun digitalCardProfiles(): DigitalCardProfileServiceAsync = digitalCardProfiles @@ -508,10 +500,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa CardPurchaseSupplementServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val cardDisputes: CardDisputeServiceAsync.WithRawResponse by lazy { - CardDisputeServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val physicalCards: PhysicalCardServiceAsync.WithRawResponse by lazy { PhysicalCardServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -730,8 +718,6 @@ class IncreaseClientAsyncImpl(private val clientOptions: ClientOptions) : Increa override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse = cardPurchaseSupplements - override fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse = cardDisputes - override fun physicalCards(): PhysicalCardServiceAsync.WithRawResponse = physicalCards override fun digitalCardProfiles(): DigitalCardProfileServiceAsync.WithRawResponse = diff --git a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt index 0f57c4411..b2c6d0aa0 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/client/IncreaseClientImpl.kt @@ -22,8 +22,6 @@ import com.increase.api.services.blocking.BookkeepingEntryService import com.increase.api.services.blocking.BookkeepingEntryServiceImpl import com.increase.api.services.blocking.BookkeepingEntrySetService import com.increase.api.services.blocking.BookkeepingEntrySetServiceImpl -import com.increase.api.services.blocking.CardDisputeService -import com.increase.api.services.blocking.CardDisputeServiceImpl import com.increase.api.services.blocking.CardPaymentService import com.increase.api.services.blocking.CardPaymentServiceImpl import com.increase.api.services.blocking.CardPurchaseSupplementService @@ -155,10 +153,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli CardPurchaseSupplementServiceImpl(clientOptionsWithUserAgent) } - private val cardDisputes: CardDisputeService by lazy { - CardDisputeServiceImpl(clientOptionsWithUserAgent) - } - private val physicalCards: PhysicalCardService by lazy { PhysicalCardServiceImpl(clientOptionsWithUserAgent) } @@ -358,8 +352,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun cardPurchaseSupplements(): CardPurchaseSupplementService = cardPurchaseSupplements - override fun cardDisputes(): CardDisputeService = cardDisputes - override fun physicalCards(): PhysicalCardService = physicalCards override fun digitalCardProfiles(): DigitalCardProfileService = digitalCardProfiles @@ -491,10 +483,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli CardPurchaseSupplementServiceImpl.WithRawResponseImpl(clientOptions) } - private val cardDisputes: CardDisputeService.WithRawResponse by lazy { - CardDisputeServiceImpl.WithRawResponseImpl(clientOptions) - } - private val physicalCards: PhysicalCardService.WithRawResponse by lazy { PhysicalCardServiceImpl.WithRawResponseImpl(clientOptions) } @@ -711,8 +699,6 @@ class IncreaseClientImpl(private val clientOptions: ClientOptions) : IncreaseCli override fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse = cardPurchaseSupplements - override fun cardDisputes(): CardDisputeService.WithRawResponse = cardDisputes - override fun physicalCards(): PhysicalCardService.WithRawResponse = physicalCards override fun digitalCardProfiles(): DigitalCardProfileService.WithRawResponse = 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 deleted file mode 100644 index ae014c8d5..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDispute.kt +++ /dev/null @@ -1,2053 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -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.Enum -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.checkRequired -import com.increase.api.errors.IncreaseInvalidDataException -import java.time.OffsetDateTime -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * If unauthorized activity occurs on a card, you can create a Card Dispute and we'll return the - * funds if appropriate. - */ -class CardDispute -private constructor( - private val id: JsonField, - private val acceptance: JsonField, - private val amount: JsonField, - private val createdAt: JsonField, - private val disputedTransactionId: JsonField, - private val explanation: JsonField, - private val idempotencyKey: JsonField, - private val loss: JsonField, - private val rejection: JsonField, - private val status: JsonField, - private val type: JsonField, - private val win: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("acceptance") - @ExcludeMissing - acceptance: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("created_at") - @ExcludeMissing - createdAt: JsonField = JsonMissing.of(), - @JsonProperty("disputed_transaction_id") - @ExcludeMissing - disputedTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - @JsonProperty("idempotency_key") - @ExcludeMissing - idempotencyKey: JsonField = JsonMissing.of(), - @JsonProperty("loss") @ExcludeMissing loss: JsonField = JsonMissing.of(), - @JsonProperty("rejection") - @ExcludeMissing - rejection: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("type") @ExcludeMissing type: JsonField = JsonMissing.of(), - @JsonProperty("win") @ExcludeMissing win: JsonField = JsonMissing.of(), - ) : this( - id, - acceptance, - amount, - createdAt, - disputedTransactionId, - explanation, - idempotencyKey, - loss, - rejection, - status, - type, - win, - mutableMapOf(), - ) - - /** - * The Card Dispute identifier. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * If the Card Dispute's status is `accepted`, this will contain details of the successful - * dispute. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun acceptance(): Optional = acceptance.getOptional("acceptance") - - /** - * The amount of the dispute, if provided, or the transaction amount otherwise. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was created. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") - - /** - * The identifier of the Transaction that was disputed. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun disputedTransactionId(): String = - disputedTransactionId.getRequired("disputed_transaction_id") - - /** - * Why you disputed the Transaction in question. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun explanation(): String = explanation.getRequired("explanation") - - /** - * The idempotency key you chose for this object. This value is unique across Increase and is - * used to ensure that a request is only processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun idempotencyKey(): Optional = idempotencyKey.getOptional("idempotency_key") - - /** - * If the Card Dispute's status is `lost`, this will contain details of the lost dispute. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun loss(): Optional = loss.getOptional("loss") - - /** - * If the Card Dispute's status is `rejected`, this will contain details of the unsuccessful - * dispute. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun rejection(): Optional = rejection.getOptional("rejection") - - /** - * The results of the Dispute investigation. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Status = status.getRequired("status") - - /** - * A constant representing the object's type. For this resource it will always be - * `card_dispute`. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun type(): Type = type.getRequired("type") - - /** - * If the Card Dispute's status is `won`, this will contain details of the won dispute. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun win(): Optional = win.getOptional("win") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [acceptance]. - * - * Unlike [acceptance], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("acceptance") - @ExcludeMissing - fun _acceptance(): JsonField = acceptance - - /** - * Returns the raw JSON value of [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") - @ExcludeMissing - fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [disputedTransactionId]. - * - * Unlike [disputedTransactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("disputed_transaction_id") - @ExcludeMissing - fun _disputedTransactionId(): JsonField = disputedTransactionId - - /** - * 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 [idempotencyKey]. - * - * Unlike [idempotencyKey], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("idempotency_key") - @ExcludeMissing - fun _idempotencyKey(): JsonField = idempotencyKey - - /** - * Returns the raw JSON value of [loss]. - * - * Unlike [loss], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("loss") @ExcludeMissing fun _loss(): JsonField = loss - - /** - * Returns the raw JSON value of [rejection]. - * - * Unlike [rejection], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("rejection") @ExcludeMissing fun _rejection(): JsonField = rejection - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [type]. - * - * Unlike [type], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("type") @ExcludeMissing fun _type(): JsonField = type - - /** - * Returns the raw JSON value of [win]. - * - * Unlike [win], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("win") @ExcludeMissing fun _win(): JsonField = win - - @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 [CardDispute]. - * - * The following fields are required: - * ```java - * .id() - * .acceptance() - * .amount() - * .createdAt() - * .disputedTransactionId() - * .explanation() - * .idempotencyKey() - * .loss() - * .rejection() - * .status() - * .type() - * .win() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDispute]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var acceptance: JsonField? = null - private var amount: JsonField? = null - private var createdAt: JsonField? = null - private var disputedTransactionId: JsonField? = null - private var explanation: JsonField? = null - private var idempotencyKey: JsonField? = null - private var loss: JsonField? = null - private var rejection: JsonField? = null - private var status: JsonField? = null - private var type: JsonField? = null - private var win: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardDispute: CardDispute) = apply { - id = cardDispute.id - acceptance = cardDispute.acceptance - amount = cardDispute.amount - createdAt = cardDispute.createdAt - disputedTransactionId = cardDispute.disputedTransactionId - explanation = cardDispute.explanation - idempotencyKey = cardDispute.idempotencyKey - loss = cardDispute.loss - rejection = cardDispute.rejection - status = cardDispute.status - type = cardDispute.type - win = cardDispute.win - additionalProperties = cardDispute.additionalProperties.toMutableMap() - } - - /** The Card Dispute identifier. */ - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** - * If the Card Dispute's status is `accepted`, this will contain details of the successful - * dispute. - */ - fun acceptance(acceptance: Acceptance?) = acceptance(JsonField.ofNullable(acceptance)) - - /** Alias for calling [Builder.acceptance] with `acceptance.orElse(null)`. */ - fun acceptance(acceptance: Optional) = acceptance(acceptance.getOrNull()) - - /** - * Sets [Builder.acceptance] to an arbitrary JSON value. - * - * You should usually call [Builder.acceptance] with a well-typed [Acceptance] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acceptance(acceptance: JsonField) = apply { this.acceptance = acceptance } - - /** The amount of the dispute, if provided, or the transaction amount otherwise. */ - fun amount(amount: Long?) = amount(JsonField.ofNullable(amount)) - - /** - * Alias for [Builder.amount]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun amount(amount: Long) = amount(amount as Long?) - - /** Alias for calling [Builder.amount] with `amount.orElse(null)`. */ - fun amount(amount: Optional) = amount(amount.getOrNull()) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was created. - */ - fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** The identifier of the Transaction that was disputed. */ - fun disputedTransactionId(disputedTransactionId: String) = - disputedTransactionId(JsonField.of(disputedTransactionId)) - - /** - * Sets [Builder.disputedTransactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.disputedTransactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun disputedTransactionId(disputedTransactionId: JsonField) = apply { - this.disputedTransactionId = disputedTransactionId - } - - /** Why you disputed the Transaction in question. */ - 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 idempotency key you chose for this object. This value is unique across Increase and - * is used to ensure that a request is only processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(idempotencyKey: String?) = - idempotencyKey(JsonField.ofNullable(idempotencyKey)) - - /** Alias for calling [Builder.idempotencyKey] with `idempotencyKey.orElse(null)`. */ - fun idempotencyKey(idempotencyKey: Optional) = - idempotencyKey(idempotencyKey.getOrNull()) - - /** - * Sets [Builder.idempotencyKey] to an arbitrary JSON value. - * - * You should usually call [Builder.idempotencyKey] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun idempotencyKey(idempotencyKey: JsonField) = apply { - this.idempotencyKey = idempotencyKey - } - - /** - * If the Card Dispute's status is `lost`, this will contain details of the lost dispute. - */ - fun loss(loss: Loss?) = loss(JsonField.ofNullable(loss)) - - /** Alias for calling [Builder.loss] with `loss.orElse(null)`. */ - fun loss(loss: Optional) = loss(loss.getOrNull()) - - /** - * Sets [Builder.loss] to an arbitrary JSON value. - * - * You should usually call [Builder.loss] with a well-typed [Loss] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun loss(loss: JsonField) = apply { this.loss = loss } - - /** - * If the Card Dispute's status is `rejected`, this will contain details of the unsuccessful - * dispute. - */ - fun rejection(rejection: Rejection?) = rejection(JsonField.ofNullable(rejection)) - - /** Alias for calling [Builder.rejection] with `rejection.orElse(null)`. */ - fun rejection(rejection: Optional) = rejection(rejection.getOrNull()) - - /** - * Sets [Builder.rejection] to an arbitrary JSON value. - * - * You should usually call [Builder.rejection] with a well-typed [Rejection] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun rejection(rejection: JsonField) = apply { this.rejection = rejection } - - /** The results of the Dispute investigation. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** - * A constant representing the object's type. For this resource it will always be - * `card_dispute`. - */ - fun type(type: Type) = type(JsonField.of(type)) - - /** - * Sets [Builder.type] to an arbitrary JSON value. - * - * You should usually call [Builder.type] with a well-typed [Type] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun type(type: JsonField) = apply { this.type = type } - - /** If the Card Dispute's status is `won`, this will contain details of the won dispute. */ - fun win(win: Win?) = win(JsonField.ofNullable(win)) - - /** Alias for calling [Builder.win] with `win.orElse(null)`. */ - fun win(win: Optional) = win(win.getOrNull()) - - /** - * Sets [Builder.win] to an arbitrary JSON value. - * - * You should usually call [Builder.win] with a well-typed [Win] value instead. This method - * is primarily for setting the field to an undocumented or not yet supported value. - */ - fun win(win: JsonField) = apply { this.win = win } - - 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 [CardDispute]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .acceptance() - * .amount() - * .createdAt() - * .disputedTransactionId() - * .explanation() - * .idempotencyKey() - * .loss() - * .rejection() - * .status() - * .type() - * .win() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDispute = - CardDispute( - checkRequired("id", id), - checkRequired("acceptance", acceptance), - checkRequired("amount", amount), - checkRequired("createdAt", createdAt), - checkRequired("disputedTransactionId", disputedTransactionId), - checkRequired("explanation", explanation), - checkRequired("idempotencyKey", idempotencyKey), - checkRequired("loss", loss), - checkRequired("rejection", rejection), - checkRequired("status", status), - checkRequired("type", type), - checkRequired("win", win), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardDispute = apply { - if (validated) { - return@apply - } - - id() - acceptance().ifPresent { it.validate() } - amount() - createdAt() - disputedTransactionId() - explanation() - idempotencyKey() - loss().ifPresent { it.validate() } - rejection().ifPresent { it.validate() } - status().validate() - type().validate() - win().ifPresent { it.validate() } - 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 (id.asKnown().isPresent) 1 else 0) + - (acceptance.asKnown().getOrNull()?.validity() ?: 0) + - (if (amount.asKnown().isPresent) 1 else 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (disputedTransactionId.asKnown().isPresent) 1 else 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + - (if (idempotencyKey.asKnown().isPresent) 1 else 0) + - (loss.asKnown().getOrNull()?.validity() ?: 0) + - (rejection.asKnown().getOrNull()?.validity() ?: 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (type.asKnown().getOrNull()?.validity() ?: 0) + - (win.asKnown().getOrNull()?.validity() ?: 0) - - /** - * If the Card Dispute's status is `accepted`, this will contain details of the successful - * dispute. - */ - class Acceptance - private constructor( - private val acceptedAt: JsonField, - private val cardDisputeId: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("accepted_at") - @ExcludeMissing - acceptedAt: JsonField = JsonMissing.of(), - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(acceptedAt, cardDisputeId, transactionId, mutableMapOf()) - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was accepted. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun acceptedAt(): OffsetDateTime = acceptedAt.getRequired("accepted_at") - - /** - * The identifier of the Card Dispute that was accepted. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - - /** - * The identifier of the Transaction that was created to return the disputed funds to your - * account. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): String = transactionId.getRequired("transaction_id") - - /** - * Returns the raw JSON value of [acceptedAt]. - * - * Unlike [acceptedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("accepted_at") - @ExcludeMissing - fun _acceptedAt(): JsonField = acceptedAt - - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId - - @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 [Acceptance]. - * - * The following fields are required: - * ```java - * .acceptedAt() - * .cardDisputeId() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Acceptance]. */ - class Builder internal constructor() { - - private var acceptedAt: JsonField? = null - private var cardDisputeId: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(acceptance: Acceptance) = apply { - acceptedAt = acceptance.acceptedAt - cardDisputeId = acceptance.cardDisputeId - transactionId = acceptance.transactionId - additionalProperties = acceptance.additionalProperties.toMutableMap() - } - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the - * Card Dispute was accepted. - */ - fun acceptedAt(acceptedAt: OffsetDateTime) = acceptedAt(JsonField.of(acceptedAt)) - - /** - * Sets [Builder.acceptedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.acceptedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun acceptedAt(acceptedAt: JsonField) = apply { - this.acceptedAt = acceptedAt - } - - /** The identifier of the Card Dispute that was accepted. */ - fun cardDisputeId(cardDisputeId: String) = cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - - /** - * The identifier of the Transaction that was created to return the disputed funds to - * your account. - */ - fun transactionId(transactionId: String) = transactionId(JsonField.of(transactionId)) - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - 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 [Acceptance]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .acceptedAt() - * .cardDisputeId() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Acceptance = - Acceptance( - checkRequired("acceptedAt", acceptedAt), - checkRequired("cardDisputeId", cardDisputeId), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Acceptance = apply { - if (validated) { - return@apply - } - - acceptedAt() - cardDisputeId() - transactionId() - 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 (acceptedAt.asKnown().isPresent) 1 else 0) + - (if (cardDisputeId.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Acceptance && - acceptedAt == other.acceptedAt && - cardDisputeId == other.cardDisputeId && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(acceptedAt, cardDisputeId, transactionId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Acceptance{acceptedAt=$acceptedAt, cardDisputeId=$cardDisputeId, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } - - /** If the Card Dispute's status is `lost`, this will contain details of the lost dispute. */ - class Loss - private constructor( - private val cardDisputeId: JsonField, - private val explanation: JsonField, - private val lostAt: JsonField, - private val transactionId: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - @JsonProperty("lost_at") - @ExcludeMissing - lostAt: JsonField = JsonMissing.of(), - @JsonProperty("transaction_id") - @ExcludeMissing - transactionId: JsonField = JsonMissing.of(), - ) : this(cardDisputeId, explanation, lostAt, transactionId, mutableMapOf()) - - /** - * The identifier of the Card Dispute that was lost. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - - /** - * Why the Card Dispute was lost. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun explanation(): String = explanation.getRequired("explanation") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was lost. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun lostAt(): OffsetDateTime = lostAt.getRequired("lost_at") - - /** - * The identifier of the Transaction that was created to debit the disputed funds from your - * account. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun transactionId(): String = transactionId.getRequired("transaction_id") - - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - - /** - * 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 [lostAt]. - * - * Unlike [lostAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("lost_at") @ExcludeMissing fun _lostAt(): JsonField = lostAt - - /** - * Returns the raw JSON value of [transactionId]. - * - * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("transaction_id") - @ExcludeMissing - fun _transactionId(): JsonField = transactionId - - @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 [Loss]. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .explanation() - * .lostAt() - * .transactionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Loss]. */ - class Builder internal constructor() { - - private var cardDisputeId: JsonField? = null - private var explanation: JsonField? = null - private var lostAt: JsonField? = null - private var transactionId: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(loss: Loss) = apply { - cardDisputeId = loss.cardDisputeId - explanation = loss.explanation - lostAt = loss.lostAt - transactionId = loss.transactionId - additionalProperties = loss.additionalProperties.toMutableMap() - } - - /** The identifier of the Card Dispute that was lost. */ - fun cardDisputeId(cardDisputeId: String) = cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - - /** Why the Card Dispute was lost. */ - 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the - * Card Dispute was lost. - */ - fun lostAt(lostAt: OffsetDateTime) = lostAt(JsonField.of(lostAt)) - - /** - * Sets [Builder.lostAt] to an arbitrary JSON value. - * - * You should usually call [Builder.lostAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun lostAt(lostAt: JsonField) = apply { this.lostAt = lostAt } - - /** - * The identifier of the Transaction that was created to debit the disputed funds from - * your account. - */ - fun transactionId(transactionId: String) = transactionId(JsonField.of(transactionId)) - - /** - * Sets [Builder.transactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.transactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun transactionId(transactionId: JsonField) = apply { - this.transactionId = transactionId - } - - 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 [Loss]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .explanation() - * .lostAt() - * .transactionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Loss = - Loss( - checkRequired("cardDisputeId", cardDisputeId), - checkRequired("explanation", explanation), - checkRequired("lostAt", lostAt), - checkRequired("transactionId", transactionId), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Loss = apply { - if (validated) { - return@apply - } - - cardDisputeId() - explanation() - lostAt() - transactionId() - 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 (cardDisputeId.asKnown().isPresent) 1 else 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + - (if (lostAt.asKnown().isPresent) 1 else 0) + - (if (transactionId.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Loss && - cardDisputeId == other.cardDisputeId && - explanation == other.explanation && - lostAt == other.lostAt && - transactionId == other.transactionId && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(cardDisputeId, explanation, lostAt, transactionId, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Loss{cardDisputeId=$cardDisputeId, explanation=$explanation, lostAt=$lostAt, transactionId=$transactionId, additionalProperties=$additionalProperties}" - } - - /** - * If the Card Dispute's status is `rejected`, this will contain details of the unsuccessful - * dispute. - */ - class Rejection - private constructor( - private val cardDisputeId: JsonField, - private val explanation: JsonField, - private val rejectedAt: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - @JsonProperty("rejected_at") - @ExcludeMissing - rejectedAt: JsonField = JsonMissing.of(), - ) : this(cardDisputeId, explanation, rejectedAt, mutableMapOf()) - - /** - * The identifier of the Card Dispute that was rejected. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - - /** - * Why the Card Dispute was rejected. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun explanation(): String = explanation.getRequired("explanation") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was rejected. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun rejectedAt(): OffsetDateTime = rejectedAt.getRequired("rejected_at") - - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - - /** - * 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 [rejectedAt]. - * - * Unlike [rejectedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("rejected_at") - @ExcludeMissing - fun _rejectedAt(): JsonField = rejectedAt - - @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 [Rejection]. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .explanation() - * .rejectedAt() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Rejection]. */ - class Builder internal constructor() { - - private var cardDisputeId: JsonField? = null - private var explanation: JsonField? = null - private var rejectedAt: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(rejection: Rejection) = apply { - cardDisputeId = rejection.cardDisputeId - explanation = rejection.explanation - rejectedAt = rejection.rejectedAt - additionalProperties = rejection.additionalProperties.toMutableMap() - } - - /** The identifier of the Card Dispute that was rejected. */ - fun cardDisputeId(cardDisputeId: String) = cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - - /** Why the Card Dispute was rejected. */ - 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 [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the - * Card Dispute was rejected. - */ - fun rejectedAt(rejectedAt: OffsetDateTime) = rejectedAt(JsonField.of(rejectedAt)) - - /** - * Sets [Builder.rejectedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.rejectedAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun rejectedAt(rejectedAt: JsonField) = apply { - this.rejectedAt = rejectedAt - } - - 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 [Rejection]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .explanation() - * .rejectedAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Rejection = - Rejection( - checkRequired("cardDisputeId", cardDisputeId), - checkRequired("explanation", explanation), - checkRequired("rejectedAt", rejectedAt), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Rejection = apply { - if (validated) { - return@apply - } - - cardDisputeId() - explanation() - rejectedAt() - 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 (cardDisputeId.asKnown().isPresent) 1 else 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + - (if (rejectedAt.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Rejection && - cardDisputeId == other.cardDisputeId && - explanation == other.explanation && - rejectedAt == other.rejectedAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(cardDisputeId, explanation, rejectedAt, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Rejection{cardDisputeId=$cardDisputeId, explanation=$explanation, rejectedAt=$rejectedAt, additionalProperties=$additionalProperties}" - } - - /** The results of the Dispute investigation. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** The Card Dispute is pending review. */ - @JvmField val PENDING_REVIEWING = of("pending_reviewing") - - /** Increase has requested more information related to the Card Dispute from you. */ - @JvmField val PENDING_USER_INFORMATION = of("pending_user_information") - - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - @JvmField val ACCEPTED = of("accepted") - - /** The Card Dispute has been rejected. */ - @JvmField val REJECTED = of("rejected") - - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - @JvmField val LOST = of("lost") - - /** The Card Dispute has been won and no further action can be taken. */ - @JvmField val WON = of("won") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - /** The Card Dispute is pending review. */ - PENDING_REVIEWING, - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - } - - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The Card Dispute is pending review. */ - PENDING_REVIEWING, - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PENDING_REVIEWING -> Value.PENDING_REVIEWING - PENDING_USER_INFORMATION -> Value.PENDING_USER_INFORMATION - ACCEPTED -> Value.ACCEPTED - REJECTED -> Value.REJECTED - LOST -> Value.LOST - WON -> Value.WON - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING_REVIEWING -> Known.PENDING_REVIEWING - PENDING_USER_INFORMATION -> Known.PENDING_USER_INFORMATION - ACCEPTED -> Known.ACCEPTED - REJECTED -> Known.REJECTED - LOST -> Known.LOST - WON -> Known.WON - else -> throw IncreaseInvalidDataException("Unknown Status: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Status = apply { - if (validated) { - return@apply - } - - known() - 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 (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * A constant representing the object's type. For this resource it will always be - * `card_dispute`. - */ - class Type @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CARD_DISPUTE = of("card_dispute") - - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) - } - - /** An enum containing [Type]'s known values. */ - enum class Known { - CARD_DISPUTE - } - - /** - * An enum containing [Type]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Type] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CARD_DISPUTE, - /** An enum member indicating that [Type] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CARD_DISPUTE -> Value.CARD_DISPUTE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CARD_DISPUTE -> Known.CARD_DISPUTE - else -> throw IncreaseInvalidDataException("Unknown Type: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Type = apply { - if (validated) { - return@apply - } - - known() - 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 (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Type && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** If the Card Dispute's status is `won`, this will contain details of the won dispute. */ - class Win - private constructor( - private val cardDisputeId: JsonField, - private val wonAt: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), - @JsonProperty("won_at") - @ExcludeMissing - wonAt: JsonField = JsonMissing.of(), - ) : this(cardDisputeId, wonAt, mutableMapOf()) - - /** - * The identifier of the Card Dispute that was won. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card - * Dispute was won. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun wonAt(): OffsetDateTime = wonAt.getRequired("won_at") - - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - - /** - * Returns the raw JSON value of [wonAt]. - * - * Unlike [wonAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("won_at") @ExcludeMissing fun _wonAt(): JsonField = wonAt - - @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 [Win]. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .wonAt() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Win]. */ - class Builder internal constructor() { - - private var cardDisputeId: JsonField? = null - private var wonAt: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(win: Win) = apply { - cardDisputeId = win.cardDisputeId - wonAt = win.wonAt - additionalProperties = win.additionalProperties.toMutableMap() - } - - /** The identifier of the Card Dispute that was won. */ - fun cardDisputeId(cardDisputeId: String) = cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - - /** - * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the - * Card Dispute was won. - */ - fun wonAt(wonAt: OffsetDateTime) = wonAt(JsonField.of(wonAt)) - - /** - * Sets [Builder.wonAt] to an arbitrary JSON value. - * - * You should usually call [Builder.wonAt] with a well-typed [OffsetDateTime] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun wonAt(wonAt: JsonField) = apply { this.wonAt = wonAt } - - 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 [Win]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .cardDisputeId() - * .wonAt() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Win = - Win( - checkRequired("cardDisputeId", cardDisputeId), - checkRequired("wonAt", wonAt), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Win = apply { - if (validated) { - return@apply - } - - cardDisputeId() - wonAt() - 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 (cardDisputeId.asKnown().isPresent) 1 else 0) + - (if (wonAt.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Win && - cardDisputeId == other.cardDisputeId && - wonAt == other.wonAt && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(cardDisputeId, wonAt, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Win{cardDisputeId=$cardDisputeId, wonAt=$wonAt, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDispute && - id == other.id && - acceptance == other.acceptance && - amount == other.amount && - createdAt == other.createdAt && - disputedTransactionId == other.disputedTransactionId && - explanation == other.explanation && - idempotencyKey == other.idempotencyKey && - loss == other.loss && - rejection == other.rejection && - status == other.status && - type == other.type && - win == other.win && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - acceptance, - amount, - createdAt, - disputedTransactionId, - explanation, - idempotencyKey, - loss, - rejection, - status, - type, - win, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardDispute{id=$id, acceptance=$acceptance, amount=$amount, createdAt=$createdAt, disputedTransactionId=$disputedTransactionId, explanation=$explanation, idempotencyKey=$idempotencyKey, loss=$loss, rejection=$rejection, status=$status, type=$type, win=$win, additionalProperties=$additionalProperties}" -} 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 deleted file mode 100644 index a6625be86..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParams.kt +++ /dev/null @@ -1,592 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -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.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 - -/** Create a Card Dispute */ -class CardDisputeCreateParams -private constructor( - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** - * The Transaction you wish to dispute. This Transaction must have a `source_type` 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). - */ - fun disputedTransactionId(): String = body.disputedTransactionId() - - /** - * Why you are disputing this Transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun explanation(): String = body.explanation() - - /** - * The monetary amount of the part of the transaction that is being disputed. This is optional - * and will default to the full amount of the transaction if not provided. If provided, the - * amount must be less than or equal to the amount of the transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun amount(): Optional = body.amount() - - /** - * Returns the raw JSON value of [disputedTransactionId]. - * - * Unlike [disputedTransactionId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _disputedTransactionId(): JsonField = body._disputedTransactionId() - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _amount(): JsonField = body._amount() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [CardDisputeCreateParams]. - * - * The following fields are required: - * ```java - * .disputedTransactionId() - * .explanation() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeCreateParams]. */ - class Builder internal constructor() { - - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(cardDisputeCreateParams: CardDisputeCreateParams) = apply { - body = cardDisputeCreateParams.body.toBuilder() - additionalHeaders = cardDisputeCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = cardDisputeCreateParams.additionalQueryParams.toBuilder() - } - - /** - * 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: - * - [disputedTransactionId] - * - [explanation] - * - [amount] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** - * The Transaction you wish to dispute. This Transaction must have a `source_type` of - * `card_settlement`. - */ - fun disputedTransactionId(disputedTransactionId: String) = apply { - body.disputedTransactionId(disputedTransactionId) - } - - /** - * Sets [Builder.disputedTransactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.disputedTransactionId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun disputedTransactionId(disputedTransactionId: JsonField) = apply { - body.disputedTransactionId(disputedTransactionId) - } - - /** Why you are disputing this Transaction. */ - 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 monetary amount of the part of the transaction that is being disputed. This is - * optional and will default to the full amount of the transaction if not provided. If - * provided, the amount must be less than or equal to the amount of the transaction. - */ - fun amount(amount: Long) = apply { body.amount(amount) } - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun amount(amount: JsonField) = apply { body.amount(amount) } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [CardDisputeCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .disputedTransactionId() - * .explanation() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDisputeCreateParams = - CardDisputeCreateParams( - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - private constructor( - private val disputedTransactionId: JsonField, - private val explanation: JsonField, - private val amount: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("disputed_transaction_id") - @ExcludeMissing - disputedTransactionId: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - ) : this(disputedTransactionId, explanation, amount, mutableMapOf()) - - /** - * The Transaction you wish to dispute. This Transaction must have a `source_type` 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). - */ - fun disputedTransactionId(): String = - disputedTransactionId.getRequired("disputed_transaction_id") - - /** - * Why you are disputing this Transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun explanation(): String = explanation.getRequired("explanation") - - /** - * The monetary amount of the part of the transaction that is being disputed. This is - * optional and will default to the full amount of the transaction if not provided. If - * provided, the amount must be less than or equal to the amount of the transaction. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun amount(): Optional = amount.getOptional("amount") - - /** - * Returns the raw JSON value of [disputedTransactionId]. - * - * Unlike [disputedTransactionId], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("disputed_transaction_id") - @ExcludeMissing - fun _disputedTransactionId(): JsonField = disputedTransactionId - - /** - * 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 [amount]. - * - * Unlike [amount], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .disputedTransactionId() - * .explanation() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var disputedTransactionId: JsonField? = null - private var explanation: JsonField? = null - private var amount: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - disputedTransactionId = body.disputedTransactionId - explanation = body.explanation - amount = body.amount - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** - * The Transaction you wish to dispute. This Transaction must have a `source_type` of - * `card_settlement`. - */ - fun disputedTransactionId(disputedTransactionId: String) = - disputedTransactionId(JsonField.of(disputedTransactionId)) - - /** - * Sets [Builder.disputedTransactionId] to an arbitrary JSON value. - * - * You should usually call [Builder.disputedTransactionId] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun disputedTransactionId(disputedTransactionId: JsonField) = apply { - this.disputedTransactionId = disputedTransactionId - } - - /** Why you are disputing this Transaction. */ - 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 monetary amount of the part of the transaction that is being disputed. This is - * optional and will default to the full amount of the transaction if not provided. If - * provided, the amount must be less than or equal to the amount of the transaction. - */ - fun amount(amount: Long) = amount(JsonField.of(amount)) - - /** - * Sets [Builder.amount] to an arbitrary JSON value. - * - * You should usually call [Builder.amount] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun amount(amount: JsonField) = apply { this.amount = amount } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .disputedTransactionId() - * .explanation() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("disputedTransactionId", disputedTransactionId), - checkRequired("explanation", explanation), - amount, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - disputedTransactionId() - explanation() - amount() - 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 (disputedTransactionId.asKnown().isPresent) 1 else 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + - (if (amount.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - disputedTransactionId == other.disputedTransactionId && - explanation == other.explanation && - amount == other.amount && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(disputedTransactionId, explanation, amount, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{disputedTransactionId=$disputedTransactionId, explanation=$explanation, amount=$amount, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeCreateParams && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "CardDisputeCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt deleted file mode 100644 index abea17ee5..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPage.kt +++ /dev/null @@ -1,132 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.increase.api.core.AutoPager -import com.increase.api.core.Page -import com.increase.api.core.checkRequired -import com.increase.api.services.blocking.CardDisputeService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see CardDisputeService.list */ -class CardDisputeListPage -private constructor( - private val service: CardDisputeService, - private val params: CardDisputeListParams, - private val response: CardDisputeListPageResponse, -) : Page { - - /** - * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data. - * - * @see CardDisputeListPageResponse.data - */ - fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data. - * - * @see CardDisputeListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): CardDisputeListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): CardDisputeListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): CardDisputeListParams = params - - /** The response that this page was parsed from. */ - fun response(): CardDisputeListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [CardDisputeListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeListPage]. */ - class Builder internal constructor() { - - private var service: CardDisputeService? = null - private var params: CardDisputeListParams? = null - private var response: CardDisputeListPageResponse? = null - - @JvmSynthetic - internal fun from(cardDisputeListPage: CardDisputeListPage) = apply { - service = cardDisputeListPage.service - params = cardDisputeListPage.params - response = cardDisputeListPage.response - } - - fun service(service: CardDisputeService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: CardDisputeListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: CardDisputeListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [CardDisputeListPage]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDisputeListPage = - CardDisputeListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = - "CardDisputeListPage{service=$service, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt deleted file mode 100644 index a7c681639..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageAsync.kt +++ /dev/null @@ -1,146 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.increase.api.core.AutoPagerAsync -import com.increase.api.core.PageAsync -import com.increase.api.core.checkRequired -import com.increase.api.services.async.CardDisputeServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see CardDisputeServiceAsync.list */ -class CardDisputeListPageAsync -private constructor( - private val service: CardDisputeServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: CardDisputeListParams, - private val response: CardDisputeListPageResponse, -) : PageAsync { - - /** - * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data. - * - * @see CardDisputeListPageResponse.data - */ - fun data(): List = response._data().getOptional("data").getOrNull() ?: emptyList() - - /** - * Delegates to [CardDisputeListPageResponse], but gracefully handles missing data. - * - * @see CardDisputeListPageResponse.nextCursor - */ - fun nextCursor(): Optional = response._nextCursor().getOptional("next_cursor") - - override fun items(): List = data() - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextCursor().isPresent - - fun nextPageParams(): CardDisputeListParams { - val nextCursor = - nextCursor().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().cursor(nextCursor).build() - } - - override fun nextPage(): CompletableFuture = - service.list(nextPageParams()) - - fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) - - /** The parameters that were used to request this page. */ - fun params(): CardDisputeListParams = params - - /** The response that this page was parsed from. */ - fun response(): CardDisputeListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [CardDisputeListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeListPageAsync]. */ - class Builder internal constructor() { - - private var service: CardDisputeServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: CardDisputeListParams? = null - private var response: CardDisputeListPageResponse? = null - - @JvmSynthetic - internal fun from(cardDisputeListPageAsync: CardDisputeListPageAsync) = apply { - service = cardDisputeListPageAsync.service - streamHandlerExecutor = cardDisputeListPageAsync.streamHandlerExecutor - params = cardDisputeListPageAsync.params - response = cardDisputeListPageAsync.response - } - - fun service(service: CardDisputeServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: CardDisputeListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: CardDisputeListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [CardDisputeListPageAsync]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDisputeListPageAsync = - CardDisputeListPageAsync( - checkRequired("service", service), - checkRequired("streamHandlerExecutor", streamHandlerExecutor), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeListPageAsync && - service == other.service && - streamHandlerExecutor == other.streamHandlerExecutor && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) - - override fun toString() = - "CardDisputeListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt deleted file mode 100644 index 7e3106976..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponse.kt +++ /dev/null @@ -1,236 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -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.checkKnown -import com.increase.api.core.checkRequired -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 - -/** A list of Card Dispute objects. */ -class CardDisputeListPageResponse -private constructor( - private val data: JsonField>, - private val nextCursor: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("data") @ExcludeMissing data: JsonField> = JsonMissing.of(), - @JsonProperty("next_cursor") - @ExcludeMissing - nextCursor: JsonField = JsonMissing.of(), - ) : this(data, nextCursor, mutableMapOf()) - - /** - * The contents of the list. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun data(): List = data.getRequired("data") - - /** - * A pointer to a place in the list. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun nextCursor(): Optional = nextCursor.getOptional("next_cursor") - - /** - * Returns the raw JSON value of [data]. - * - * Unlike [data], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("data") @ExcludeMissing fun _data(): JsonField> = data - - /** - * Returns the raw JSON value of [nextCursor]. - * - * Unlike [nextCursor], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("next_cursor") @ExcludeMissing fun _nextCursor(): JsonField = nextCursor - - @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 [CardDisputeListPageResponse]. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeListPageResponse]. */ - class Builder internal constructor() { - - private var data: JsonField>? = null - private var nextCursor: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(cardDisputeListPageResponse: CardDisputeListPageResponse) = apply { - data = cardDisputeListPageResponse.data.map { it.toMutableList() } - nextCursor = cardDisputeListPageResponse.nextCursor - additionalProperties = cardDisputeListPageResponse.additionalProperties.toMutableMap() - } - - /** The contents of the list. */ - fun data(data: List) = data(JsonField.of(data)) - - /** - * Sets [Builder.data] to an arbitrary JSON value. - * - * You should usually call [Builder.data] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun data(data: JsonField>) = apply { - this.data = data.map { it.toMutableList() } - } - - /** - * Adds a single [CardDispute] to [Builder.data]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addData(data: CardDispute) = apply { - this.data = - (this.data ?: JsonField.of(mutableListOf())).also { - checkKnown("data", it).add(data) - } - } - - /** A pointer to a place in the list. */ - fun nextCursor(nextCursor: String?) = nextCursor(JsonField.ofNullable(nextCursor)) - - /** Alias for calling [Builder.nextCursor] with `nextCursor.orElse(null)`. */ - fun nextCursor(nextCursor: Optional) = nextCursor(nextCursor.getOrNull()) - - /** - * Sets [Builder.nextCursor] to an arbitrary JSON value. - * - * You should usually call [Builder.nextCursor] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun nextCursor(nextCursor: JsonField) = apply { this.nextCursor = nextCursor } - - 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 [CardDisputeListPageResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .data() - * .nextCursor() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDisputeListPageResponse = - CardDisputeListPageResponse( - checkRequired("data", data).map { it.toImmutable() }, - checkRequired("nextCursor", nextCursor), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): CardDisputeListPageResponse = apply { - if (validated) { - return@apply - } - - data().forEach { it.validate() } - nextCursor() - 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 = - (data.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (nextCursor.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeListPageResponse && - data == other.data && - nextCursor == other.nextCursor && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(data, nextCursor, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CardDisputeListPageResponse{data=$data, nextCursor=$nextCursor, additionalProperties=$additionalProperties}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListParams.kt deleted file mode 100644 index 9f7962746..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeListParams.kt +++ /dev/null @@ -1,807 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.fasterxml.jackson.annotation.JsonCreator -import com.increase.api.core.Enum -import com.increase.api.core.JsonField -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.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** List Card Disputes */ -class CardDisputeListParams -private constructor( - private val createdAt: CreatedAt?, - private val cursor: String?, - private val idempotencyKey: String?, - private val limit: Long?, - private val status: Status?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun createdAt(): Optional = Optional.ofNullable(createdAt) - - /** Return the page of entries after this one. */ - fun cursor(): Optional = Optional.ofNullable(cursor) - - /** - * Filter records to the one with the specified `idempotency_key` you chose for that object. - * This value is unique across Increase and is used to ensure that a request is only processed - * once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(): Optional = Optional.ofNullable(idempotencyKey) - - /** Limit the size of the list that is returned. The default (and maximum) is 100 objects. */ - fun limit(): Optional = Optional.ofNullable(limit) - - fun status(): Optional = Optional.ofNullable(status) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): CardDisputeListParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [CardDisputeListParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeListParams]. */ - class Builder internal constructor() { - - private var createdAt: CreatedAt? = null - private var cursor: String? = null - private var idempotencyKey: String? = null - private var limit: Long? = null - private var status: Status? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(cardDisputeListParams: CardDisputeListParams) = apply { - createdAt = cardDisputeListParams.createdAt - cursor = cardDisputeListParams.cursor - idempotencyKey = cardDisputeListParams.idempotencyKey - limit = cardDisputeListParams.limit - status = cardDisputeListParams.status - additionalHeaders = cardDisputeListParams.additionalHeaders.toBuilder() - additionalQueryParams = cardDisputeListParams.additionalQueryParams.toBuilder() - } - - fun createdAt(createdAt: CreatedAt?) = apply { this.createdAt = createdAt } - - /** Alias for calling [Builder.createdAt] with `createdAt.orElse(null)`. */ - fun createdAt(createdAt: Optional) = createdAt(createdAt.getOrNull()) - - /** Return the page of entries after this one. */ - fun cursor(cursor: String?) = apply { this.cursor = cursor } - - /** Alias for calling [Builder.cursor] with `cursor.orElse(null)`. */ - fun cursor(cursor: Optional) = cursor(cursor.getOrNull()) - - /** - * Filter records to the one with the specified `idempotency_key` you chose for that object. - * This value is unique across Increase and is used to ensure that a request is only - * processed once. Learn more about - * [idempotency](https://increase.com/documentation/idempotency-keys). - */ - fun idempotencyKey(idempotencyKey: String?) = apply { this.idempotencyKey = idempotencyKey } - - /** Alias for calling [Builder.idempotencyKey] with `idempotencyKey.orElse(null)`. */ - fun idempotencyKey(idempotencyKey: Optional) = - idempotencyKey(idempotencyKey.getOrNull()) - - /** - * Limit the size of the list that is returned. The default (and maximum) is 100 objects. - */ - fun limit(limit: Long?) = apply { this.limit = limit } - - /** - * Alias for [Builder.limit]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun limit(limit: Long) = limit(limit as Long?) - - /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */ - fun limit(limit: Optional) = limit(limit.getOrNull()) - - fun status(status: Status?) = apply { this.status = status } - - /** Alias for calling [Builder.status] with `status.orElse(null)`. */ - fun status(status: Optional) = status(status.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [CardDisputeListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CardDisputeListParams = - CardDisputeListParams( - createdAt, - cursor, - idempotencyKey, - limit, - status, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - createdAt?.let { - it.after().ifPresent { - put("created_at.after", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - it.before().ifPresent { - put("created_at.before", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - it.onOrAfter().ifPresent { - put( - "created_at.on_or_after", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - it.onOrBefore().ifPresent { - put( - "created_at.on_or_before", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("created_at.$key", value) - } - } - } - cursor?.let { put("cursor", it) } - idempotencyKey?.let { put("idempotency_key", it) } - limit?.let { put("limit", it.toString()) } - status?.let { - it.in_().ifPresent { put("status.in", it.joinToString(",") { it.toString() }) } - it._additionalProperties().keys().forEach { key -> - it._additionalProperties().values(key).forEach { value -> - put("status.$key", value) - } - } - } - putAll(additionalQueryParams) - } - .build() - - class CreatedAt - private constructor( - private val after: OffsetDateTime?, - private val before: OffsetDateTime?, - private val onOrAfter: OffsetDateTime?, - private val onOrBefore: OffsetDateTime?, - private val additionalProperties: QueryParams, - ) { - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun after(): Optional = Optional.ofNullable(after) - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. - */ - fun before(): Optional = Optional.ofNullable(before) - - /** - * Return results on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrAfter(): Optional = Optional.ofNullable(onOrAfter) - - /** - * Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrBefore(): Optional = Optional.ofNullable(onOrBefore) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [CreatedAt]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CreatedAt]. */ - class Builder internal constructor() { - - private var after: OffsetDateTime? = null - private var before: OffsetDateTime? = null - private var onOrAfter: OffsetDateTime? = null - private var onOrBefore: OffsetDateTime? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(createdAt: CreatedAt) = apply { - after = createdAt.after - before = createdAt.before - onOrAfter = createdAt.onOrAfter - onOrBefore = createdAt.onOrBefore - additionalProperties = createdAt.additionalProperties.toBuilder() - } - - /** - * Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun after(after: OffsetDateTime?) = apply { this.after = after } - - /** Alias for calling [Builder.after] with `after.orElse(null)`. */ - fun after(after: Optional) = after(after.getOrNull()) - - /** - * Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun before(before: OffsetDateTime?) = apply { this.before = before } - - /** Alias for calling [Builder.before] with `before.orElse(null)`. */ - fun before(before: Optional) = before(before.getOrNull()) - - /** - * Return results on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrAfter(onOrAfter: OffsetDateTime?) = apply { this.onOrAfter = onOrAfter } - - /** Alias for calling [Builder.onOrAfter] with `onOrAfter.orElse(null)`. */ - fun onOrAfter(onOrAfter: Optional) = onOrAfter(onOrAfter.getOrNull()) - - /** - * Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) - * timestamp. - */ - fun onOrBefore(onOrBefore: OffsetDateTime?) = apply { this.onOrBefore = onOrBefore } - - /** Alias for calling [Builder.onOrBefore] with `onOrBefore.orElse(null)`. */ - fun onOrBefore(onOrBefore: Optional) = - onOrBefore(onOrBefore.getOrNull()) - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [CreatedAt]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CreatedAt = - CreatedAt(after, before, onOrAfter, onOrBefore, additionalProperties.build()) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CreatedAt && - after == other.after && - before == other.before && - onOrAfter == other.onOrAfter && - onOrBefore == other.onOrBefore && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(after, before, onOrAfter, onOrBefore, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "CreatedAt{after=$after, before=$before, onOrAfter=$onOrAfter, onOrBefore=$onOrBefore, additionalProperties=$additionalProperties}" - } - - class Status - private constructor(private val in_: List?, private val additionalProperties: QueryParams) { - - /** - * Filter Card Disputes for those with the specified status or statuses. For GET requests, - * this should be encoded as a comma-delimited string, such as `?in=one,two,three`. - */ - fun in_(): Optional> = Optional.ofNullable(in_) - - /** Query params to send with the request. */ - fun _additionalProperties(): QueryParams = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Status]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Status]. */ - class Builder internal constructor() { - - private var in_: MutableList? = null - private var additionalProperties: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(status: Status) = apply { - in_ = status.in_?.toMutableList() - additionalProperties = status.additionalProperties.toBuilder() - } - - /** - * Filter Card Disputes for those with the specified status or statuses. For GET - * requests, this should be encoded as a comma-delimited string, such as - * `?in=one,two,three`. - */ - fun in_(in_: List?) = apply { this.in_ = in_?.toMutableList() } - - /** Alias for calling [Builder.in_] with `in_.orElse(null)`. */ - fun in_(in_: Optional>) = in_(in_.getOrNull()) - - /** - * Adds a single [In] to [Builder.in_]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addIn(in_: In) = apply { - this.in_ = (this.in_ ?: mutableListOf()).apply { add(in_) } - } - - fun additionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun additionalProperties(additionalProperties: Map>) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: String) = apply { - additionalProperties.put(key, value) - } - - fun putAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.put(key, values) - } - - fun putAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun putAllAdditionalProperties(additionalProperties: Map>) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun replaceAdditionalProperties(key: String, value: String) = apply { - additionalProperties.replace(key, value) - } - - fun replaceAdditionalProperties(key: String, values: Iterable) = apply { - additionalProperties.replace(key, values) - } - - fun replaceAllAdditionalProperties(additionalProperties: QueryParams) = apply { - this.additionalProperties.replaceAll(additionalProperties) - } - - fun replaceAllAdditionalProperties( - additionalProperties: Map> - ) = apply { this.additionalProperties.replaceAll(additionalProperties) } - - fun removeAdditionalProperties(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - additionalProperties.removeAll(keys) - } - - /** - * Returns an immutable instance of [Status]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Status = Status(in_?.toImmutable(), additionalProperties.build()) - } - - class In @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** The Card Dispute is pending review. */ - @JvmField val PENDING_REVIEWING = of("pending_reviewing") - - /** Increase has requested more information related to the Card Dispute from you. */ - @JvmField val PENDING_USER_INFORMATION = of("pending_user_information") - - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - @JvmField val ACCEPTED = of("accepted") - - /** The Card Dispute has been rejected. */ - @JvmField val REJECTED = of("rejected") - - /** - * The Card Dispute has been lost and funds previously credited from the acceptance - * have been debited. - */ - @JvmField val LOST = of("lost") - - /** The Card Dispute has been won and no further action can be taken. */ - @JvmField val WON = of("won") - - @JvmStatic fun of(value: String) = In(JsonField.of(value)) - } - - /** An enum containing [In]'s known values. */ - enum class Known { - /** The Card Dispute is pending review. */ - PENDING_REVIEWING, - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance - * have been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - } - - /** - * An enum containing [In]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [In] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** The Card Dispute is pending review. */ - PENDING_REVIEWING, - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance - * have been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - /** An enum member indicating that [In] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PENDING_REVIEWING -> Value.PENDING_REVIEWING - PENDING_USER_INFORMATION -> Value.PENDING_USER_INFORMATION - ACCEPTED -> Value.ACCEPTED - REJECTED -> Value.REJECTED - LOST -> Value.LOST - WON -> Value.WON - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING_REVIEWING -> Known.PENDING_REVIEWING - PENDING_USER_INFORMATION -> Known.PENDING_USER_INFORMATION - ACCEPTED -> Known.ACCEPTED - REJECTED -> Known.REJECTED - LOST -> Known.LOST - WON -> Known.WON - else -> throw IncreaseInvalidDataException("Unknown In: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): In = apply { - if (validated) { - return@apply - } - - known() - 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 (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is In && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && - in_ == other.in_ && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(in_, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "Status{in_=$in_, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeListParams && - createdAt == other.createdAt && - cursor == other.cursor && - idempotencyKey == other.idempotencyKey && - limit == other.limit && - status == other.status && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - createdAt, - cursor, - idempotencyKey, - limit, - status, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "CardDisputeListParams{createdAt=$createdAt, cursor=$cursor, idempotencyKey=$idempotencyKey, limit=$limit, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParams.kt deleted file mode 100644 index 2c014dad0..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParams.kt +++ /dev/null @@ -1,199 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.increase.api.core.Params -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Retrieve a Card Dispute */ -class CardDisputeRetrieveParams -private constructor( - private val cardDisputeId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The identifier of the Card Dispute. */ - fun cardDisputeId(): Optional = Optional.ofNullable(cardDisputeId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): CardDisputeRetrieveParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of [CardDisputeRetrieveParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeRetrieveParams]. */ - class Builder internal constructor() { - - private var cardDisputeId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(cardDisputeRetrieveParams: CardDisputeRetrieveParams) = apply { - cardDisputeId = cardDisputeRetrieveParams.cardDisputeId - additionalHeaders = cardDisputeRetrieveParams.additionalHeaders.toBuilder() - additionalQueryParams = cardDisputeRetrieveParams.additionalQueryParams.toBuilder() - } - - /** The identifier of the Card Dispute. */ - fun cardDisputeId(cardDisputeId: String?) = apply { this.cardDisputeId = cardDisputeId } - - /** Alias for calling [Builder.cardDisputeId] with `cardDisputeId.orElse(null)`. */ - fun cardDisputeId(cardDisputeId: Optional) = - cardDisputeId(cardDisputeId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [CardDisputeRetrieveParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): CardDisputeRetrieveParams = - CardDisputeRetrieveParams( - cardDisputeId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> cardDisputeId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeRetrieveParams && - cardDisputeId == other.cardDisputeId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(cardDisputeId, additionalHeaders, additionalQueryParams) - - override fun toString() = - "CardDisputeRetrieveParams{cardDisputeId=$cardDisputeId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParams.kt deleted file mode 100644 index 47c5c0645..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParams.kt +++ /dev/null @@ -1,699 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.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.Enum -import com.increase.api.core.ExcludeMissing -import com.increase.api.core.JsonField -import com.increase.api.core.JsonMissing -import com.increase.api.core.JsonValue -import com.increase.api.core.Params -import com.increase.api.core.checkRequired -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.errors.IncreaseInvalidDataException -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * After a [Card Dispute](#card-disputes) is created in production, the dispute will be reviewed. - * Since no review happens in sandbox, this endpoint simulates moving a Card Dispute into a rejected - * or accepted state. A Card Dispute can only be actioned one time and must have a status of - * `pending_reviewing`. - */ -class CardDisputeActionParams -private constructor( - private val cardDisputeId: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** The dispute you would like to action. */ - fun cardDisputeId(): Optional = Optional.ofNullable(cardDisputeId) - - /** - * The status to move the dispute to. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Status = body.status() - - /** - * Why the dispute was rejected. Not required for accepting disputes. - * - * @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 [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _status(): JsonField = body._status() - - /** - * 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 - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [CardDisputeActionParams]. - * - * The following fields are required: - * ```java - * .status() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [CardDisputeActionParams]. */ - 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() - - @JvmSynthetic - internal fun from(cardDisputeActionParams: CardDisputeActionParams) = apply { - cardDisputeId = cardDisputeActionParams.cardDisputeId - body = cardDisputeActionParams.body.toBuilder() - additionalHeaders = cardDisputeActionParams.additionalHeaders.toBuilder() - additionalQueryParams = cardDisputeActionParams.additionalQueryParams.toBuilder() - } - - /** The dispute you would like to action. */ - fun cardDisputeId(cardDisputeId: String?) = apply { this.cardDisputeId = cardDisputeId } - - /** Alias for calling [Builder.cardDisputeId] with `cardDisputeId.orElse(null)`. */ - 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: - * - [status] - * - [explanation] - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The status to move the dispute to. */ - fun status(status: Status) = apply { body.status(status) } - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { body.status(status) } - - /** Why the dispute was rejected. Not required for accepting disputes. */ - 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) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [CardDisputeActionParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .status() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): CardDisputeActionParams = - CardDisputeActionParams( - cardDisputeId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - fun _pathParam(index: Int): String = - when (index) { - 0 -> cardDisputeId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = additionalQueryParams - - class Body - private constructor( - private val status: JsonField, - private val explanation: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("explanation") - @ExcludeMissing - explanation: JsonField = JsonMissing.of(), - ) : this(status, explanation, mutableMapOf()) - - /** - * The status to move the dispute to. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Status = status.getRequired("status") - - /** - * Why the dispute was rejected. Not required for accepting disputes. - * - * @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 [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * 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]. - * - * The following fields are required: - * ```java - * .status() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var status: JsonField? = null - private var explanation: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - status = body.status - explanation = body.explanation - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The status to move the dispute to. */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** Why the dispute was rejected. Not required for accepting disputes. */ - 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. - * - * The following fields are required: - * ```java - * .status() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("status", status), - explanation, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): Body = apply { - if (validated) { - return@apply - } - - status().validate() - 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 = - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (explanation.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - status == other.status && - explanation == other.explanation && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(status, explanation, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{status=$status, explanation=$explanation, additionalProperties=$additionalProperties}" - } - - /** The status to move the dispute to. */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - /** Increase has requested more information related to the Card Dispute from you. */ - @JvmField val PENDING_USER_INFORMATION = of("pending_user_information") - - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - @JvmField val ACCEPTED = of("accepted") - - /** The Card Dispute has been rejected. */ - @JvmField val REJECTED = of("rejected") - - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - @JvmField val LOST = of("lost") - - /** The Card Dispute has been won and no further action can be taken. */ - @JvmField val WON = of("won") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - } - - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - /** Increase has requested more information related to the Card Dispute from you. */ - PENDING_USER_INFORMATION, - /** - * The Card Dispute has been accepted and your funds have been returned. The card - * dispute will eventually transition into `won` or `lost` depending on the outcome. - */ - ACCEPTED, - /** The Card Dispute has been rejected. */ - REJECTED, - /** - * The Card Dispute has been lost and funds previously credited from the acceptance have - * been debited. - */ - LOST, - /** The Card Dispute has been won and no further action can be taken. */ - WON, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - PENDING_USER_INFORMATION -> Value.PENDING_USER_INFORMATION - ACCEPTED -> Value.ACCEPTED - REJECTED -> Value.REJECTED - LOST -> Value.LOST - WON -> Value.WON - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws IncreaseInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - PENDING_USER_INFORMATION -> Known.PENDING_USER_INFORMATION - ACCEPTED -> Known.ACCEPTED - REJECTED -> Known.REJECTED - LOST -> Known.LOST - WON -> Known.WON - else -> throw IncreaseInvalidDataException("Unknown Status: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws IncreaseInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - IncreaseInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - fun validate(): Status = apply { - if (validated) { - return@apply - } - - known() - 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 (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is CardDisputeActionParams && - cardDisputeId == other.cardDisputeId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(cardDisputeId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "CardDisputeActionParams{cardDisputeId=$cardDisputeId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt index 76a157fd3..c19e76bc3 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/transactions/Transaction.kt @@ -6361,7 +6361,6 @@ private constructor( class CardDisputeAcceptance private constructor( private val acceptedAt: JsonField, - private val cardDisputeId: JsonField, private val transactionId: JsonField, private val additionalProperties: MutableMap, ) { @@ -6371,13 +6370,10 @@ private constructor( @JsonProperty("accepted_at") @ExcludeMissing acceptedAt: JsonField = JsonMissing.of(), - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), @JsonProperty("transaction_id") @ExcludeMissing transactionId: JsonField = JsonMissing.of(), - ) : this(acceptedAt, cardDisputeId, transactionId, mutableMapOf()) + ) : this(acceptedAt, transactionId, mutableMapOf()) /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the @@ -6389,15 +6385,6 @@ private constructor( */ fun acceptedAt(): OffsetDateTime = acceptedAt.getRequired("accepted_at") - /** - * The identifier of the Card Dispute that was accepted. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - /** * The identifier of the Transaction that was created to return the disputed funds to * your account. @@ -6418,16 +6405,6 @@ private constructor( @ExcludeMissing fun _acceptedAt(): JsonField = acceptedAt - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - /** * Returns the raw JSON value of [transactionId]. * @@ -6459,7 +6436,6 @@ private constructor( * The following fields are required: * ```java * .acceptedAt() - * .cardDisputeId() * .transactionId() * ``` */ @@ -6470,14 +6446,12 @@ private constructor( class Builder internal constructor() { private var acceptedAt: JsonField? = null - private var cardDisputeId: JsonField? = null private var transactionId: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(cardDisputeAcceptance: CardDisputeAcceptance) = apply { acceptedAt = cardDisputeAcceptance.acceptedAt - cardDisputeId = cardDisputeAcceptance.cardDisputeId transactionId = cardDisputeAcceptance.transactionId additionalProperties = cardDisputeAcceptance.additionalProperties.toMutableMap() } @@ -6499,21 +6473,6 @@ private constructor( this.acceptedAt = acceptedAt } - /** The identifier of the Card Dispute that was accepted. */ - fun cardDisputeId(cardDisputeId: String) = - cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - /** * The identifier of the Transaction that was created to return the disputed funds * to your account. @@ -6562,7 +6521,6 @@ private constructor( * The following fields are required: * ```java * .acceptedAt() - * .cardDisputeId() * .transactionId() * ``` * @@ -6571,7 +6529,6 @@ private constructor( fun build(): CardDisputeAcceptance = CardDisputeAcceptance( checkRequired("acceptedAt", acceptedAt), - checkRequired("cardDisputeId", cardDisputeId), checkRequired("transactionId", transactionId), additionalProperties.toMutableMap(), ) @@ -6585,7 +6542,6 @@ private constructor( } acceptedAt() - cardDisputeId() transactionId() validated = true } @@ -6607,7 +6563,6 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (acceptedAt.asKnown().isPresent) 1 else 0) + - (if (cardDisputeId.asKnown().isPresent) 1 else 0) + (if (transactionId.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { @@ -6617,19 +6572,18 @@ private constructor( return other is CardDisputeAcceptance && acceptedAt == other.acceptedAt && - cardDisputeId == other.cardDisputeId && transactionId == other.transactionId && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash(acceptedAt, cardDisputeId, transactionId, additionalProperties) + Objects.hash(acceptedAt, transactionId, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "CardDisputeAcceptance{acceptedAt=$acceptedAt, cardDisputeId=$cardDisputeId, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "CardDisputeAcceptance{acceptedAt=$acceptedAt, transactionId=$transactionId, additionalProperties=$additionalProperties}" } /** @@ -6640,7 +6594,6 @@ private constructor( class CardDisputeFinancial private constructor( private val amount: JsonField, - private val cardDisputeId: JsonField, private val network: JsonField, private val transactionId: JsonField, private val visa: JsonField, @@ -6650,9 +6603,6 @@ private constructor( @JsonCreator private constructor( @JsonProperty("amount") @ExcludeMissing amount: JsonField = JsonMissing.of(), - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), @JsonProperty("network") @ExcludeMissing network: JsonField = JsonMissing.of(), @@ -6660,7 +6610,7 @@ private constructor( @ExcludeMissing transactionId: JsonField = JsonMissing.of(), @JsonProperty("visa") @ExcludeMissing visa: JsonField = JsonMissing.of(), - ) : this(amount, cardDisputeId, network, transactionId, visa, mutableMapOf()) + ) : this(amount, network, transactionId, visa, mutableMapOf()) /** * The amount of the financial event. @@ -6671,15 +6621,6 @@ private constructor( */ fun amount(): Long = amount.getRequired("amount") - /** - * The identifier of the Card Dispute the financial event is associated with. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") - /** * The network that the Card Dispute is associated with. * @@ -6716,16 +6657,6 @@ private constructor( */ @JsonProperty("amount") @ExcludeMissing fun _amount(): JsonField = amount - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - /** * Returns the raw JSON value of [network]. * @@ -6770,7 +6701,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .cardDisputeId() * .network() * .transactionId() * .visa() @@ -6783,7 +6713,6 @@ private constructor( class Builder internal constructor() { private var amount: JsonField? = null - private var cardDisputeId: JsonField? = null private var network: JsonField? = null private var transactionId: JsonField? = null private var visa: JsonField? = null @@ -6792,7 +6721,6 @@ private constructor( @JvmSynthetic internal fun from(cardDisputeFinancial: CardDisputeFinancial) = apply { amount = cardDisputeFinancial.amount - cardDisputeId = cardDisputeFinancial.cardDisputeId network = cardDisputeFinancial.network transactionId = cardDisputeFinancial.transactionId visa = cardDisputeFinancial.visa @@ -6811,21 +6739,6 @@ private constructor( */ fun amount(amount: JsonField) = apply { this.amount = amount } - /** The identifier of the Card Dispute the financial event is associated with. */ - fun cardDisputeId(cardDisputeId: String) = - cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - /** The network that the Card Dispute is associated with. */ fun network(network: Network) = network(JsonField.of(network)) @@ -6905,7 +6818,6 @@ private constructor( * The following fields are required: * ```java * .amount() - * .cardDisputeId() * .network() * .transactionId() * .visa() @@ -6916,7 +6828,6 @@ private constructor( fun build(): CardDisputeFinancial = CardDisputeFinancial( checkRequired("amount", amount), - checkRequired("cardDisputeId", cardDisputeId), checkRequired("network", network), checkRequired("transactionId", transactionId), checkRequired("visa", visa), @@ -6932,7 +6843,6 @@ private constructor( } amount() - cardDisputeId() network().validate() transactionId() visa().ifPresent { it.validate() } @@ -6956,7 +6866,6 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (if (cardDisputeId.asKnown().isPresent) 1 else 0) + (network.asKnown().getOrNull()?.validity() ?: 0) + (if (transactionId.asKnown().isPresent) 1 else 0) + (visa.asKnown().getOrNull()?.validity() ?: 0) @@ -7472,7 +7381,6 @@ private constructor( return other is CardDisputeFinancial && amount == other.amount && - cardDisputeId == other.cardDisputeId && network == other.network && transactionId == other.transactionId && visa == other.visa && @@ -7480,20 +7388,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash( - amount, - cardDisputeId, - network, - transactionId, - visa, - additionalProperties, - ) + Objects.hash(amount, network, transactionId, visa, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "CardDisputeFinancial{amount=$amount, cardDisputeId=$cardDisputeId, network=$network, transactionId=$transactionId, visa=$visa, additionalProperties=$additionalProperties}" + "CardDisputeFinancial{amount=$amount, network=$network, transactionId=$transactionId, visa=$visa, additionalProperties=$additionalProperties}" } /** @@ -7503,7 +7404,6 @@ private constructor( */ class CardDisputeLoss private constructor( - private val cardDisputeId: JsonField, private val explanation: JsonField, private val lostAt: JsonField, private val transactionId: JsonField, @@ -7512,9 +7412,6 @@ private constructor( @JsonCreator private constructor( - @JsonProperty("card_dispute_id") - @ExcludeMissing - cardDisputeId: JsonField = JsonMissing.of(), @JsonProperty("explanation") @ExcludeMissing explanation: JsonField = JsonMissing.of(), @@ -7524,16 +7421,7 @@ private constructor( @JsonProperty("transaction_id") @ExcludeMissing transactionId: JsonField = JsonMissing.of(), - ) : this(cardDisputeId, explanation, lostAt, transactionId, mutableMapOf()) - - /** - * The identifier of the Card Dispute that was lost. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). - */ - fun cardDisputeId(): String = cardDisputeId.getRequired("card_dispute_id") + ) : this(explanation, lostAt, transactionId, mutableMapOf()) /** * Why the Card Dispute was lost. @@ -7564,16 +7452,6 @@ private constructor( */ fun transactionId(): String = transactionId.getRequired("transaction_id") - /** - * Returns the raw JSON value of [cardDisputeId]. - * - * Unlike [cardDisputeId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("card_dispute_id") - @ExcludeMissing - fun _cardDisputeId(): JsonField = cardDisputeId - /** * Returns the raw JSON value of [explanation]. * @@ -7622,7 +7500,6 @@ private constructor( * * The following fields are required: * ```java - * .cardDisputeId() * .explanation() * .lostAt() * .transactionId() @@ -7634,7 +7511,6 @@ private constructor( /** A builder for [CardDisputeLoss]. */ class Builder internal constructor() { - private var cardDisputeId: JsonField? = null private var explanation: JsonField? = null private var lostAt: JsonField? = null private var transactionId: JsonField? = null @@ -7642,28 +7518,12 @@ private constructor( @JvmSynthetic internal fun from(cardDisputeLoss: CardDisputeLoss) = apply { - cardDisputeId = cardDisputeLoss.cardDisputeId explanation = cardDisputeLoss.explanation lostAt = cardDisputeLoss.lostAt transactionId = cardDisputeLoss.transactionId additionalProperties = cardDisputeLoss.additionalProperties.toMutableMap() } - /** The identifier of the Card Dispute that was lost. */ - fun cardDisputeId(cardDisputeId: String) = - cardDisputeId(JsonField.of(cardDisputeId)) - - /** - * Sets [Builder.cardDisputeId] to an arbitrary JSON value. - * - * You should usually call [Builder.cardDisputeId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun cardDisputeId(cardDisputeId: JsonField) = apply { - this.cardDisputeId = cardDisputeId - } - /** Why the Card Dispute was lost. */ fun explanation(explanation: String) = explanation(JsonField.of(explanation)) @@ -7740,7 +7600,6 @@ private constructor( * * The following fields are required: * ```java - * .cardDisputeId() * .explanation() * .lostAt() * .transactionId() @@ -7750,7 +7609,6 @@ private constructor( */ fun build(): CardDisputeLoss = CardDisputeLoss( - checkRequired("cardDisputeId", cardDisputeId), checkRequired("explanation", explanation), checkRequired("lostAt", lostAt), checkRequired("transactionId", transactionId), @@ -7765,7 +7623,6 @@ private constructor( return@apply } - cardDisputeId() explanation() lostAt() transactionId() @@ -7788,8 +7645,7 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (cardDisputeId.asKnown().isPresent) 1 else 0) + - (if (explanation.asKnown().isPresent) 1 else 0) + + (if (explanation.asKnown().isPresent) 1 else 0) + (if (lostAt.asKnown().isPresent) 1 else 0) + (if (transactionId.asKnown().isPresent) 1 else 0) @@ -7799,7 +7655,6 @@ private constructor( } return other is CardDisputeLoss && - cardDisputeId == other.cardDisputeId && explanation == other.explanation && lostAt == other.lostAt && transactionId == other.transactionId && @@ -7807,19 +7662,13 @@ private constructor( } private val hashCode: Int by lazy { - Objects.hash( - cardDisputeId, - explanation, - lostAt, - transactionId, - additionalProperties, - ) + Objects.hash(explanation, lostAt, transactionId, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "CardDisputeLoss{cardDisputeId=$cardDisputeId, explanation=$explanation, lostAt=$lostAt, transactionId=$transactionId, additionalProperties=$additionalProperties}" + "CardDisputeLoss{explanation=$explanation, lostAt=$lostAt, transactionId=$transactionId, additionalProperties=$additionalProperties}" } /** diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsync.kt deleted file mode 100644 index 4fc9e76da..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsync.kt +++ /dev/null @@ -1,187 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import com.increase.api.models.carddisputes.CardDisputeListPageAsync -import com.increase.api.models.carddisputes.CardDisputeListParams -import com.increase.api.models.carddisputes.CardDisputeRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface CardDisputeServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): CardDisputeServiceAsync - - /** Create a Card Dispute */ - fun create(params: CardDisputeCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** Retrieve a Card Dispute */ - fun retrieve(cardDisputeId: String): CompletableFuture = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - retrieve(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - ): CompletableFuture = retrieve(cardDisputeId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see retrieve */ - fun retrieve(params: CardDisputeRetrieveParams): CompletableFuture = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none(), requestOptions) - - /** List Card Disputes */ - fun list(): CompletableFuture = list(CardDisputeListParams.none()) - - /** @see list */ - fun list( - params: CardDisputeListParams = CardDisputeListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: CardDisputeListParams = CardDisputeListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(CardDisputeListParams.none(), requestOptions) - - /** - * A view of [CardDisputeServiceAsync] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): CardDisputeServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /card_disputes`, but is otherwise the same as - * [CardDisputeServiceAsync.create]. - */ - fun create( - params: CardDisputeCreateParams - ): CompletableFuture> = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /card_disputes/{card_dispute_id}`, but is otherwise - * the same as [CardDisputeServiceAsync.retrieve]. - */ - fun retrieve(cardDisputeId: String): CompletableFuture> = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - retrieve(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - ): CompletableFuture> = - retrieve(cardDisputeId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see retrieve */ - fun retrieve( - params: CardDisputeRetrieveParams - ): CompletableFuture> = retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /card_disputes`, but is otherwise the same as - * [CardDisputeServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(CardDisputeListParams.none()) - - /** @see list */ - fun list( - params: CardDisputeListParams = CardDisputeListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: CardDisputeListParams = CardDisputeListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(CardDisputeListParams.none(), requestOptions) - } -} 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 deleted file mode 100644 index 820c35e64..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncImpl.kt +++ /dev/null @@ -1,177 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepareAsync -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import com.increase.api.models.carddisputes.CardDisputeListPageAsync -import com.increase.api.models.carddisputes.CardDisputeListPageResponse -import com.increase.api.models.carddisputes.CardDisputeListParams -import com.increase.api.models.carddisputes.CardDisputeRetrieveParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class CardDisputeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeServiceAsync { - - private val withRawResponse: CardDisputeServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): CardDisputeServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): CardDisputeServiceAsync = - CardDisputeServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /card_disputes - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /card_disputes/{card_dispute_id} - withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: CardDisputeListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /card_disputes - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): CardDisputeServiceAsync.WithRawResponse = - CardDisputeServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("cardDisputeId", params.cardDisputeId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes", params._pathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: CardDisputeListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - CardDisputeListPageAsync.builder() - .service(CardDisputeServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt index 1ea163761..55ddca977 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsync.kt @@ -8,7 +8,6 @@ import com.increase.api.services.async.simulations.AccountTransferServiceAsync import com.increase.api.services.async.simulations.AchTransferServiceAsync import com.increase.api.services.async.simulations.CardAuthorizationExpirationServiceAsync import com.increase.api.services.async.simulations.CardAuthorizationServiceAsync -import com.increase.api.services.async.simulations.CardDisputeServiceAsync import com.increase.api.services.async.simulations.CardFuelConfirmationServiceAsync import com.increase.api.services.async.simulations.CardIncrementServiceAsync import com.increase.api.services.async.simulations.CardRefundServiceAsync @@ -66,8 +65,6 @@ interface SimulationServiceAsync { fun cardRefunds(): CardRefundServiceAsync - fun cardDisputes(): CardDisputeServiceAsync - fun physicalCards(): PhysicalCardServiceAsync fun digitalWalletTokenRequests(): DigitalWalletTokenRequestServiceAsync @@ -139,8 +136,6 @@ interface SimulationServiceAsync { fun cardRefunds(): CardRefundServiceAsync.WithRawResponse - fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse - fun physicalCards(): PhysicalCardServiceAsync.WithRawResponse fun digitalWalletTokenRequests(): DigitalWalletTokenRequestServiceAsync.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt index 8aa019ed2..b16929383 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/SimulationServiceAsyncImpl.kt @@ -13,8 +13,6 @@ import com.increase.api.services.async.simulations.CardAuthorizationExpirationSe import com.increase.api.services.async.simulations.CardAuthorizationExpirationServiceAsyncImpl import com.increase.api.services.async.simulations.CardAuthorizationServiceAsync import com.increase.api.services.async.simulations.CardAuthorizationServiceAsyncImpl -import com.increase.api.services.async.simulations.CardDisputeServiceAsync -import com.increase.api.services.async.simulations.CardDisputeServiceAsyncImpl import com.increase.api.services.async.simulations.CardFuelConfirmationServiceAsync import com.increase.api.services.async.simulations.CardFuelConfirmationServiceAsyncImpl import com.increase.api.services.async.simulations.CardIncrementServiceAsync @@ -106,10 +104,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: CardRefundServiceAsyncImpl(clientOptions) } - private val cardDisputes: CardDisputeServiceAsync by lazy { - CardDisputeServiceAsyncImpl(clientOptions) - } - private val physicalCards: PhysicalCardServiceAsync by lazy { PhysicalCardServiceAsyncImpl(clientOptions) } @@ -207,8 +201,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun cardRefunds(): CardRefundServiceAsync = cardRefunds - override fun cardDisputes(): CardDisputeServiceAsync = cardDisputes - override fun physicalCards(): PhysicalCardServiceAsync = physicalCards override fun digitalWalletTokenRequests(): DigitalWalletTokenRequestServiceAsync = @@ -292,10 +284,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: CardRefundServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val cardDisputes: CardDisputeServiceAsync.WithRawResponse by lazy { - CardDisputeServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val physicalCards: PhysicalCardServiceAsync.WithRawResponse by lazy { PhysicalCardServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -406,8 +394,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun cardRefunds(): CardRefundServiceAsync.WithRawResponse = cardRefunds - override fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse = cardDisputes - override fun physicalCards(): PhysicalCardServiceAsync.WithRawResponse = physicalCards override fun digitalWalletTokenRequests(): diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsync.kt deleted file mode 100644 index 80602e383..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsync.kt +++ /dev/null @@ -1,101 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface CardDisputeServiceAsync { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): CardDisputeServiceAsync - - /** - * After a [Card Dispute](#card-disputes) is created in production, the dispute will be - * reviewed. Since no review happens in sandbox, this endpoint simulates moving a Card Dispute - * into a rejected or accepted state. A Card Dispute can only be actioned one time and must have - * a status of `pending_reviewing`. - */ - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - ): CompletableFuture = action(cardDisputeId, params, RequestOptions.none()) - - /** @see action */ - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - action(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see action */ - fun action(params: CardDisputeActionParams): CompletableFuture = - action(params, RequestOptions.none()) - - /** @see action */ - fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** - * A view of [CardDisputeServiceAsync] that provides access to raw HTTP responses for each - * method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): CardDisputeServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post - * /simulations/card_disputes/{card_dispute_id}/action`, but is otherwise the same as - * [CardDisputeServiceAsync.action]. - */ - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - ): CompletableFuture> = - action(cardDisputeId, params, RequestOptions.none()) - - /** @see action */ - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - action(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see action */ - fun action( - params: CardDisputeActionParams - ): CompletableFuture> = action(params, RequestOptions.none()) - - /** @see action */ - fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncImpl.kt deleted file mode 100644 index 5e89a745e..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncImpl.kt +++ /dev/null @@ -1,91 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepareAsync -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class CardDisputeServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeServiceAsync { - - private val withRawResponse: CardDisputeServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): CardDisputeServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): CardDisputeServiceAsync = - CardDisputeServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /simulations/card_disputes/{card_dispute_id}/action - withRawResponse().action(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): CardDisputeServiceAsync.WithRawResponse = - CardDisputeServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val actionHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("cardDisputeId", params.cardDisputeId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("simulations", "card_disputes", params._pathParam(0), "action") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { actionHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeService.kt deleted file mode 100644 index 84bc2c55c..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeService.kt +++ /dev/null @@ -1,186 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.google.errorprone.annotations.MustBeClosed -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import com.increase.api.models.carddisputes.CardDisputeListPage -import com.increase.api.models.carddisputes.CardDisputeListParams -import com.increase.api.models.carddisputes.CardDisputeRetrieveParams -import java.util.function.Consumer - -interface CardDisputeService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): CardDisputeService - - /** Create a Card Dispute */ - fun create(params: CardDisputeCreateParams): CardDispute = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDispute - - /** Retrieve a Card Dispute */ - fun retrieve(cardDisputeId: String): CardDispute = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none()) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDispute = - retrieve(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see retrieve */ - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - ): CardDispute = retrieve(cardDisputeId, params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDispute - - /** @see retrieve */ - fun retrieve(params: CardDisputeRetrieveParams): CardDispute = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - fun retrieve(cardDisputeId: String, requestOptions: RequestOptions): CardDispute = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none(), requestOptions) - - /** List Card Disputes */ - fun list(): CardDisputeListPage = list(CardDisputeListParams.none()) - - /** @see list */ - fun list( - params: CardDisputeListParams = CardDisputeListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDisputeListPage - - /** @see list */ - fun list(params: CardDisputeListParams = CardDisputeListParams.none()): CardDisputeListPage = - list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CardDisputeListPage = - list(CardDisputeListParams.none(), requestOptions) - - /** - * A view of [CardDisputeService] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): CardDisputeService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /card_disputes`, but is otherwise the same as - * [CardDisputeService.create]. - */ - @MustBeClosed - fun create(params: CardDisputeCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /card_disputes/{card_dispute_id}`, but is otherwise - * the same as [CardDisputeService.retrieve]. - */ - @MustBeClosed - fun retrieve(cardDisputeId: String): HttpResponseFor = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - retrieve(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - cardDisputeId: String, - params: CardDisputeRetrieveParams = CardDisputeRetrieveParams.none(), - ): HttpResponseFor = retrieve(cardDisputeId, params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see retrieve */ - @MustBeClosed - fun retrieve(params: CardDisputeRetrieveParams): HttpResponseFor = - retrieve(params, RequestOptions.none()) - - /** @see retrieve */ - @MustBeClosed - fun retrieve( - cardDisputeId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - retrieve(cardDisputeId, CardDisputeRetrieveParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /card_disputes`, but is otherwise the same as - * [CardDisputeService.list]. - */ - @MustBeClosed - fun list(): HttpResponseFor = list(CardDisputeListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: CardDisputeListParams = CardDisputeListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list( - params: CardDisputeListParams = CardDisputeListParams.none() - ): HttpResponseFor = list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(CardDisputeListParams.none(), requestOptions) - } -} 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 deleted file mode 100644 index e104a0e80..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/CardDisputeServiceImpl.kt +++ /dev/null @@ -1,166 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepare -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import com.increase.api.models.carddisputes.CardDisputeListPage -import com.increase.api.models.carddisputes.CardDisputeListPageResponse -import com.increase.api.models.carddisputes.CardDisputeListParams -import com.increase.api.models.carddisputes.CardDisputeRetrieveParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class CardDisputeServiceImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeService { - - private val withRawResponse: CardDisputeService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): CardDisputeService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): CardDisputeService = - CardDisputeServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions, - ): CardDispute = - // post /card_disputes - withRawResponse().create(params, requestOptions).parse() - - override fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions, - ): CardDispute = - // get /card_disputes/{card_dispute_id} - withRawResponse().retrieve(params, requestOptions).parse() - - override fun list( - params: CardDisputeListParams, - requestOptions: RequestOptions, - ): CardDisputeListPage = - // get /card_disputes - withRawResponse().list(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): CardDisputeService.WithRawResponse = - CardDisputeServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: CardDisputeCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun retrieve( - params: CardDisputeRetrieveParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("cardDisputeId", params.cardDisputeId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes", params._pathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { retrieveHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: CardDisputeListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("card_disputes") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - CardDisputeListPage.builder() - .service(CardDisputeServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt index f124c5978..e61e51215 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationService.kt @@ -8,7 +8,6 @@ import com.increase.api.services.blocking.simulations.AccountTransferService import com.increase.api.services.blocking.simulations.AchTransferService import com.increase.api.services.blocking.simulations.CardAuthorizationExpirationService import com.increase.api.services.blocking.simulations.CardAuthorizationService -import com.increase.api.services.blocking.simulations.CardDisputeService import com.increase.api.services.blocking.simulations.CardFuelConfirmationService import com.increase.api.services.blocking.simulations.CardIncrementService import com.increase.api.services.blocking.simulations.CardRefundService @@ -66,8 +65,6 @@ interface SimulationService { fun cardRefunds(): CardRefundService - fun cardDisputes(): CardDisputeService - fun physicalCards(): PhysicalCardService fun digitalWalletTokenRequests(): DigitalWalletTokenRequestService @@ -136,8 +133,6 @@ interface SimulationService { fun cardRefunds(): CardRefundService.WithRawResponse - fun cardDisputes(): CardDisputeService.WithRawResponse - fun physicalCards(): PhysicalCardService.WithRawResponse fun digitalWalletTokenRequests(): DigitalWalletTokenRequestService.WithRawResponse diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt index e0b712f98..739566966 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/SimulationServiceImpl.kt @@ -13,8 +13,6 @@ import com.increase.api.services.blocking.simulations.CardAuthorizationExpiratio import com.increase.api.services.blocking.simulations.CardAuthorizationExpirationServiceImpl import com.increase.api.services.blocking.simulations.CardAuthorizationService import com.increase.api.services.blocking.simulations.CardAuthorizationServiceImpl -import com.increase.api.services.blocking.simulations.CardDisputeService -import com.increase.api.services.blocking.simulations.CardDisputeServiceImpl import com.increase.api.services.blocking.simulations.CardFuelConfirmationService import com.increase.api.services.blocking.simulations.CardFuelConfirmationServiceImpl import com.increase.api.services.blocking.simulations.CardIncrementService @@ -104,8 +102,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie private val cardRefunds: CardRefundService by lazy { CardRefundServiceImpl(clientOptions) } - private val cardDisputes: CardDisputeService by lazy { CardDisputeServiceImpl(clientOptions) } - private val physicalCards: PhysicalCardService by lazy { PhysicalCardServiceImpl(clientOptions) } @@ -198,8 +194,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun cardRefunds(): CardRefundService = cardRefunds - override fun cardDisputes(): CardDisputeService = cardDisputes - override fun physicalCards(): PhysicalCardService = physicalCards override fun digitalWalletTokenRequests(): DigitalWalletTokenRequestService = @@ -282,10 +276,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie CardRefundServiceImpl.WithRawResponseImpl(clientOptions) } - private val cardDisputes: CardDisputeService.WithRawResponse by lazy { - CardDisputeServiceImpl.WithRawResponseImpl(clientOptions) - } - private val physicalCards: PhysicalCardService.WithRawResponse by lazy { PhysicalCardServiceImpl.WithRawResponseImpl(clientOptions) } @@ -394,8 +384,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun cardRefunds(): CardRefundService.WithRawResponse = cardRefunds - override fun cardDisputes(): CardDisputeService.WithRawResponse = cardDisputes - override fun physicalCards(): PhysicalCardService.WithRawResponse = physicalCards override fun digitalWalletTokenRequests(): diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeService.kt deleted file mode 100644 index 32613d1bb..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeService.kt +++ /dev/null @@ -1,98 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.google.errorprone.annotations.MustBeClosed -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import java.util.function.Consumer - -interface CardDisputeService { - - /** - * Returns a view of this service that provides access to raw HTTP responses for each method. - */ - fun withRawResponse(): WithRawResponse - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions(modifier: Consumer): CardDisputeService - - /** - * After a [Card Dispute](#card-disputes) is created in production, the dispute will be - * reviewed. Since no review happens in sandbox, this endpoint simulates moving a Card Dispute - * into a rejected or accepted state. A Card Dispute can only be actioned one time and must have - * a status of `pending_reviewing`. - */ - fun action(cardDisputeId: String, params: CardDisputeActionParams): CardDispute = - action(cardDisputeId, params, RequestOptions.none()) - - /** @see action */ - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDispute = action(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see action */ - fun action(params: CardDisputeActionParams): CardDispute = action(params, RequestOptions.none()) - - /** @see action */ - fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CardDispute - - /** - * A view of [CardDisputeService] that provides access to raw HTTP responses for each method. - */ - interface WithRawResponse { - - /** - * Returns a view of this service with the given option modifications applied. - * - * The original service is not modified. - */ - fun withOptions( - modifier: Consumer - ): CardDisputeService.WithRawResponse - - /** - * Returns a raw HTTP response for `post - * /simulations/card_disputes/{card_dispute_id}/action`, but is otherwise the same as - * [CardDisputeService.action]. - */ - @MustBeClosed - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - ): HttpResponseFor = action(cardDisputeId, params, RequestOptions.none()) - - /** @see action */ - @MustBeClosed - fun action( - cardDisputeId: String, - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - action(params.toBuilder().cardDisputeId(cardDisputeId).build(), requestOptions) - - /** @see action */ - @MustBeClosed - fun action(params: CardDisputeActionParams): HttpResponseFor = - action(params, RequestOptions.none()) - - /** @see action */ - @MustBeClosed - fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceImpl.kt deleted file mode 100644 index a78487adb..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceImpl.kt +++ /dev/null @@ -1,87 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.increase.api.core.ClientOptions -import com.increase.api.core.RequestOptions -import com.increase.api.core.checkRequired -import com.increase.api.core.handlers.errorBodyHandler -import com.increase.api.core.handlers.errorHandler -import com.increase.api.core.handlers.jsonHandler -import com.increase.api.core.http.HttpMethod -import com.increase.api.core.http.HttpRequest -import com.increase.api.core.http.HttpResponse -import com.increase.api.core.http.HttpResponse.Handler -import com.increase.api.core.http.HttpResponseFor -import com.increase.api.core.http.json -import com.increase.api.core.http.parseable -import com.increase.api.core.prepare -import com.increase.api.models.carddisputes.CardDispute -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class CardDisputeServiceImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeService { - - private val withRawResponse: CardDisputeService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): CardDisputeService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): CardDisputeService = - CardDisputeServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions, - ): CardDispute = - // post /simulations/card_disputes/{card_dispute_id}/action - withRawResponse().action(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - CardDisputeService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): CardDisputeService.WithRawResponse = - CardDisputeServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val actionHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun action( - params: CardDisputeActionParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("cardDisputeId", params.cardDisputeId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("simulations", "card_disputes", params._pathParam(0), "action") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { actionHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} 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 deleted file mode 100644 index 4787663db..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeCreateParamsTest.kt +++ /dev/null @@ -1,48 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeCreateParamsTest { - - @Test - fun create() { - CardDisputeCreateParams.builder() - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring transaction.") - .amount(1L) - .build() - } - - @Test - fun body() { - val params = - CardDisputeCreateParams.builder() - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring transaction.") - .amount(1L) - .build() - - val body = params._body() - - assertThat(body.disputedTransactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") - assertThat(body.explanation()).isEqualTo("Unauthorized recurring transaction.") - assertThat(body.amount()).contains(1L) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - CardDisputeCreateParams.builder() - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring transaction.") - .build() - - val body = params._body() - - assertThat(body.disputedTransactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") - assertThat(body.explanation()).isEqualTo("Unauthorized recurring transaction.") - } -} 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 deleted file mode 100644 index 391f3027b..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListPageResponseTest.kt +++ /dev/null @@ -1,160 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeListPageResponseTest { - - @Test - fun create() { - val cardDisputeListPageResponse = - CardDisputeListPageResponse.builder() - .addData( - CardDispute.builder() - .id("card_dispute_h9sc95nbl1cgltpp7men") - .acceptance( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - .amount(null) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring purchase") - .idempotencyKey(null) - .loss( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - .rejection( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .status(CardDispute.Status.PENDING_REVIEWING) - .type(CardDispute.Type.CARD_DISPUTE) - .win( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .build() - ) - .nextCursor("v57w5d") - .build() - - assertThat(cardDisputeListPageResponse.data()) - .containsExactly( - CardDispute.builder() - .id("card_dispute_h9sc95nbl1cgltpp7men") - .acceptance( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - .amount(null) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring purchase") - .idempotencyKey(null) - .loss( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - .rejection( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .status(CardDispute.Status.PENDING_REVIEWING) - .type(CardDispute.Type.CARD_DISPUTE) - .win( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .build() - ) - assertThat(cardDisputeListPageResponse.nextCursor()).contains("v57w5d") - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val cardDisputeListPageResponse = - CardDisputeListPageResponse.builder() - .addData( - CardDispute.builder() - .id("card_dispute_h9sc95nbl1cgltpp7men") - .acceptance( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - .amount(null) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring purchase") - .idempotencyKey(null) - .loss( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - .rejection( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .status(CardDispute.Status.PENDING_REVIEWING) - .type(CardDispute.Type.CARD_DISPUTE) - .win( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .build() - ) - .nextCursor("v57w5d") - .build() - - val roundtrippedCardDisputeListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(cardDisputeListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedCardDisputeListPageResponse).isEqualTo(cardDisputeListPageResponse) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListParamsTest.kt deleted file mode 100644 index 4eca62a5e..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeListParamsTest.kt +++ /dev/null @@ -1,81 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.increase.api.core.http.QueryParams -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeListParamsTest { - - @Test - fun create() { - CardDisputeListParams.builder() - .createdAt( - CardDisputeListParams.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .status( - CardDisputeListParams.Status.builder() - .addIn(CardDisputeListParams.Status.In.PENDING_REVIEWING) - .build() - ) - .build() - } - - @Test - fun queryParams() { - val params = - CardDisputeListParams.builder() - .createdAt( - CardDisputeListParams.CreatedAt.builder() - .after(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .before(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .onOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .cursor("cursor") - .idempotencyKey("x") - .limit(1L) - .status( - CardDisputeListParams.Status.builder() - .addIn(CardDisputeListParams.Status.In.PENDING_REVIEWING) - .build() - ) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("created_at.after", "2019-12-27T18:11:19.117Z") - .put("created_at.before", "2019-12-27T18:11:19.117Z") - .put("created_at.on_or_after", "2019-12-27T18:11:19.117Z") - .put("created_at.on_or_before", "2019-12-27T18:11:19.117Z") - .put("cursor", "cursor") - .put("idempotency_key", "x") - .put("limit", "1") - .put("status.in", listOf("pending_reviewing").joinToString(",")) - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = CardDisputeListParams.builder().build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParamsTest.kt deleted file mode 100644 index e0aceffb3..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeRetrieveParamsTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeRetrieveParamsTest { - - @Test - fun create() { - CardDisputeRetrieveParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .build() - } - - @Test - fun pathParams() { - val params = - CardDisputeRetrieveParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .build() - - assertThat(params._pathParam(0)).isEqualTo("card_dispute_h9sc95nbl1cgltpp7men") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} 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 deleted file mode 100644 index d7dba7266..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/carddisputes/CardDisputeTest.kt +++ /dev/null @@ -1,148 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.carddisputes - -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import com.increase.api.core.jsonMapper -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeTest { - - @Test - fun create() { - val cardDispute = - CardDispute.builder() - .id("card_dispute_h9sc95nbl1cgltpp7men") - .acceptance( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - .amount(null) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring purchase") - .idempotencyKey(null) - .loss( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - .rejection( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .status(CardDispute.Status.PENDING_REVIEWING) - .type(CardDispute.Type.CARD_DISPUTE) - .win( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .build() - - assertThat(cardDispute.id()).isEqualTo("card_dispute_h9sc95nbl1cgltpp7men") - assertThat(cardDispute.acceptance()) - .contains( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - assertThat(cardDispute.amount()).isEmpty - assertThat(cardDispute.createdAt()).isEqualTo(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - assertThat(cardDispute.disputedTransactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") - assertThat(cardDispute.explanation()).isEqualTo("Unauthorized recurring purchase") - assertThat(cardDispute.idempotencyKey()).isEmpty - assertThat(cardDispute.loss()) - .contains( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - assertThat(cardDispute.rejection()) - .contains( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - assertThat(cardDispute.status()).isEqualTo(CardDispute.Status.PENDING_REVIEWING) - assertThat(cardDispute.type()).isEqualTo(CardDispute.Type.CARD_DISPUTE) - assertThat(cardDispute.win()) - .contains( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val cardDispute = - CardDispute.builder() - .id("card_dispute_h9sc95nbl1cgltpp7men") - .acceptance( - CardDispute.Acceptance.builder() - .acceptedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .cardDisputeId("card_dispute_id") - .transactionId("transaction_id") - .build() - ) - .amount(null) - .createdAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring purchase") - .idempotencyKey(null) - .loss( - CardDispute.Loss.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .lostAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .transactionId("transaction_id") - .build() - ) - .rejection( - CardDispute.Rejection.builder() - .cardDisputeId("card_dispute_id") - .explanation("explanation") - .rejectedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .status(CardDispute.Status.PENDING_REVIEWING) - .type(CardDispute.Type.CARD_DISPUTE) - .win( - CardDispute.Win.builder() - .cardDisputeId("card_dispute_id") - .wonAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .build() - - val roundtrippedCardDispute = - jsonMapper.readValue( - jsonMapper.writeValueAsString(cardDispute), - jacksonTypeRef(), - ) - - assertThat(roundtrippedCardDispute).isEqualTo(cardDispute) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParamsTest.kt deleted file mode 100644 index 5cdb85ca7..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/carddisputes/CardDisputeActionParamsTest.kt +++ /dev/null @@ -1,59 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.carddisputes - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class CardDisputeActionParamsTest { - - @Test - fun create() { - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .explanation("This was a valid recurring transaction") - .build() - } - - @Test - fun pathParams() { - val params = - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .build() - - assertThat(params._pathParam(0)).isEqualTo("card_dispute_h9sc95nbl1cgltpp7men") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun body() { - val params = - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .explanation("This was a valid recurring transaction") - .build() - - val body = params._body() - - assertThat(body.status()).isEqualTo(CardDisputeActionParams.Status.REJECTED) - assertThat(body.explanation()).contains("This was a valid recurring transaction") - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .build() - - val body = params._body() - - assertThat(body.status()).isEqualTo(CardDisputeActionParams.Status.REJECTED) - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt index e4790fdab..a4f6a258b 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionListPageResponseTest.kt @@ -81,14 +81,12 @@ internal class TransactionListPageResponseTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network( Transaction.Source.CardDisputeFinancial.Network.VISA ) @@ -106,7 +104,6 @@ internal class TransactionListPageResponseTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") @@ -985,14 +982,12 @@ internal class TransactionListPageResponseTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network(Transaction.Source.CardDisputeFinancial.Network.VISA) .transactionId("transaction_uyrp7fld2ium70oa7oi") .visa( @@ -1008,7 +1003,6 @@ internal class TransactionListPageResponseTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") @@ -1848,14 +1842,12 @@ internal class TransactionListPageResponseTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network( Transaction.Source.CardDisputeFinancial.Network.VISA ) @@ -1873,7 +1865,6 @@ internal class TransactionListPageResponseTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt index cfc3597da..8a4536fb5 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/transactions/TransactionTest.kt @@ -73,14 +73,12 @@ internal class TransactionTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network(Transaction.Source.CardDisputeFinancial.Network.VISA) .transactionId("transaction_uyrp7fld2ium70oa7oi") .visa( @@ -95,7 +93,6 @@ internal class TransactionTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") @@ -884,14 +881,12 @@ internal class TransactionTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network(Transaction.Source.CardDisputeFinancial.Network.VISA) .transactionId("transaction_uyrp7fld2ium70oa7oi") .visa( @@ -906,7 +901,6 @@ internal class TransactionTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") @@ -1658,14 +1652,12 @@ internal class TransactionTest { .cardDisputeAcceptance( Transaction.Source.CardDisputeAcceptance.builder() .acceptedAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .transactionId("transaction_uyrp7fld2ium70oa7oi") .build() ) .cardDisputeFinancial( Transaction.Source.CardDisputeFinancial.builder() .amount(1000L) - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .network(Transaction.Source.CardDisputeFinancial.Network.VISA) .transactionId("transaction_uyrp7fld2ium70oa7oi") .visa( @@ -1680,7 +1672,6 @@ internal class TransactionTest { ) .cardDisputeLoss( Transaction.Source.CardDisputeLoss.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") .explanation("The card dispute was lost.") .lostAt(OffsetDateTime.parse("2020-01-31T23:59:59Z")) .transactionId("transaction_uyrp7fld2ium70oa7oi") 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 deleted file mode 100644 index 7281e0948..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardDisputeServiceAsyncTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class CardDisputeServiceAsyncTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeServiceAsync = client.cardDisputes() - - val cardDisputeFuture = - cardDisputeServiceAsync.create( - CardDisputeCreateParams.builder() - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring transaction.") - .amount(1L) - .build() - ) - - val cardDispute = cardDisputeFuture.get() - cardDispute.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeServiceAsync = client.cardDisputes() - - val cardDisputeFuture = - cardDisputeServiceAsync.retrieve("card_dispute_h9sc95nbl1cgltpp7men") - - val cardDispute = cardDisputeFuture.get() - cardDispute.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeServiceAsync = client.cardDisputes() - - val pageFuture = cardDisputeServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncTest.kt deleted file mode 100644 index 5527c3776..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardDisputeServiceAsyncTest.kt +++ /dev/null @@ -1,35 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.async.simulations - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClientAsync -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class CardDisputeServiceAsyncTest { - - @Test - fun action() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeServiceAsync = client.simulations().cardDisputes() - - val cardDisputeFuture = - cardDisputeServiceAsync.action( - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .explanation("This was a valid recurring transaction") - .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 deleted file mode 100644 index 816da6970..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardDisputeServiceTest.kt +++ /dev/null @@ -1,62 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClient -import com.increase.api.models.carddisputes.CardDisputeCreateParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class CardDisputeServiceTest { - - @Test - fun create() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeService = client.cardDisputes() - - val cardDispute = - cardDisputeService.create( - CardDisputeCreateParams.builder() - .disputedTransactionId("transaction_uyrp7fld2ium70oa7oi") - .explanation("Unauthorized recurring transaction.") - .amount(1L) - .build() - ) - - cardDispute.validate() - } - - @Test - fun retrieve() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeService = client.cardDisputes() - - val cardDispute = cardDisputeService.retrieve("card_dispute_h9sc95nbl1cgltpp7men") - - cardDispute.validate() - } - - @Test - fun list() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeService = client.cardDisputes() - - val page = cardDisputeService.list() - - page.response().validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceTest.kt deleted file mode 100644 index 7bfca7b8e..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardDisputeServiceTest.kt +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.services.blocking.simulations - -import com.increase.api.TestServerExtension -import com.increase.api.client.okhttp.IncreaseOkHttpClient -import com.increase.api.models.simulations.carddisputes.CardDisputeActionParams -import org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class CardDisputeServiceTest { - - @Test - fun action() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val cardDisputeService = client.simulations().cardDisputes() - - val cardDispute = - cardDisputeService.action( - CardDisputeActionParams.builder() - .cardDisputeId("card_dispute_h9sc95nbl1cgltpp7men") - .status(CardDisputeActionParams.Status.REJECTED) - .explanation("This was a valid recurring transaction") - .build() - ) - - cardDispute.validate() - } -} diff --git a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt index 5ac6a9ae2..3e72bd6f1 100644 --- a/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt +++ b/increase-java-proguard-test/src/test/kotlin/com/increase/api/proguard/ProGuardCompatibilityTest.kt @@ -55,7 +55,6 @@ internal class ProGuardCompatibilityTest { assertThat(client.cards()).isNotNull() assertThat(client.cardPayments()).isNotNull() assertThat(client.cardPurchaseSupplements()).isNotNull() - assertThat(client.cardDisputes()).isNotNull() assertThat(client.physicalCards()).isNotNull() assertThat(client.digitalCardProfiles()).isNotNull() assertThat(client.physicalCardProfiles()).isNotNull()