From 41a701b352f547ae79f4210791155335019c345e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:09:04 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 8 +- .../AccountTransferCompleteParams.kt | 247 ------------------ .../services/async/SimulationServiceAsync.kt | 5 - .../async/SimulationServiceAsyncImpl.kt | 15 -- .../AccountTransferServiceAsync.kt | 130 --------- .../AccountTransferServiceAsyncImpl.kt | 98 ------- .../services/blocking/SimulationService.kt | 5 - .../blocking/SimulationServiceImpl.kt | 14 - .../simulations/AccountTransferService.kt | 128 --------- .../simulations/AccountTransferServiceImpl.kt | 92 ------- .../AccountTransferCompleteParamsTest.kt | 28 -- .../AccountTransferServiceAsyncTest.kt | 28 -- .../simulations/AccountTransferServiceTest.kt | 27 -- 13 files changed, 4 insertions(+), 821 deletions(-) delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParams.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsync.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncImpl.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferService.kt delete mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceImpl.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParamsTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncTest.kt delete mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceTest.kt diff --git a/.stats.yml b/.stats.yml index fcb6c732c..52a1884ef 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 241 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-ec147e2dbcccb835ada48a743903d43ab228330e476558ba74dc87f248345303.yml -openapi_spec_hash: 333fdaec2de515a123cc44401b432aa2 -config_hash: d48e9f65bcf642f92610034d6c43f07a +configured_endpoints: 240 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c9957e6ab1c9adef0dfb9a3956c8e7505a1661d22e79531eaee71b2a3a699b61.yml +openapi_spec_hash: 1190741469af674747df81908239a601 +config_hash: 82cb0fb1fae47b3467cd6da4273541de diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParams.kt deleted file mode 100644 index 94bf2cd1d..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParams.kt +++ /dev/null @@ -1,247 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.accounttransfers - -import com.increase.api.core.JsonValue -import com.increase.api.core.Params -import com.increase.api.core.http.Headers -import com.increase.api.core.http.QueryParams -import com.increase.api.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * If your account is configured to require approval for each transfer, this endpoint simulates the - * approval of an [Account Transfer](#account-transfers). You can also approve sandbox Account - * Transfers in the dashboard. This transfer must first have a `status` of `pending_approval`. - */ -class AccountTransferCompleteParams -private constructor( - private val accountTransferId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - /** The identifier of the Account Transfer you wish to complete. */ - fun accountTransferId(): Optional = Optional.ofNullable(accountTransferId) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** 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(): AccountTransferCompleteParams = builder().build() - - /** - * Returns a mutable builder for constructing an instance of - * [AccountTransferCompleteParams]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [AccountTransferCompleteParams]. */ - class Builder internal constructor() { - - private var accountTransferId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(accountTransferCompleteParams: AccountTransferCompleteParams) = apply { - accountTransferId = accountTransferCompleteParams.accountTransferId - additionalHeaders = accountTransferCompleteParams.additionalHeaders.toBuilder() - additionalQueryParams = accountTransferCompleteParams.additionalQueryParams.toBuilder() - additionalBodyProperties = - accountTransferCompleteParams.additionalBodyProperties.toMutableMap() - } - - /** The identifier of the Account Transfer you wish to complete. */ - fun accountTransferId(accountTransferId: String?) = apply { - this.accountTransferId = accountTransferId - } - - /** Alias for calling [Builder.accountTransferId] with `accountTransferId.orElse(null)`. */ - fun accountTransferId(accountTransferId: Optional) = - accountTransferId(accountTransferId.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) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [AccountTransferCompleteParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): AccountTransferCompleteParams = - AccountTransferCompleteParams( - accountTransferId, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> accountTransferId ?: "" - 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 AccountTransferCompleteParams && - accountTransferId == other.accountTransferId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash( - accountTransferId, - additionalHeaders, - additionalQueryParams, - additionalBodyProperties, - ) - - override fun toString() = - "AccountTransferCompleteParams{accountTransferId=$accountTransferId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} 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 b1bb758a0..ee21e8ec1 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 @@ -4,7 +4,6 @@ package com.increase.api.services.async import com.increase.api.core.ClientOptions import com.increase.api.services.async.simulations.AccountStatementServiceAsync -import com.increase.api.services.async.simulations.AccountTransferServiceAsync import com.increase.api.services.async.simulations.AchTransferServiceAsync import com.increase.api.services.async.simulations.CardAuthenticationServiceAsync import com.increase.api.services.async.simulations.CardAuthorizationExpirationServiceAsync @@ -54,8 +53,6 @@ interface SimulationServiceAsync { fun interestPayments(): InterestPaymentServiceAsync - fun accountTransfers(): AccountTransferServiceAsync - fun cardAuthorizations(): CardAuthorizationServiceAsync fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync @@ -135,8 +132,6 @@ interface SimulationServiceAsync { fun interestPayments(): InterestPaymentServiceAsync.WithRawResponse - fun accountTransfers(): AccountTransferServiceAsync.WithRawResponse - fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync.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 aea8bdfea..4c35dc1a7 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 @@ -5,8 +5,6 @@ package com.increase.api.services.async import com.increase.api.core.ClientOptions import com.increase.api.services.async.simulations.AccountStatementServiceAsync import com.increase.api.services.async.simulations.AccountStatementServiceAsyncImpl -import com.increase.api.services.async.simulations.AccountTransferServiceAsync -import com.increase.api.services.async.simulations.AccountTransferServiceAsyncImpl import com.increase.api.services.async.simulations.AchTransferServiceAsync import com.increase.api.services.async.simulations.AchTransferServiceAsyncImpl import com.increase.api.services.async.simulations.CardAuthenticationServiceAsync @@ -82,10 +80,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InterestPaymentServiceAsyncImpl(clientOptions) } - private val accountTransfers: AccountTransferServiceAsync by lazy { - AccountTransferServiceAsyncImpl(clientOptions) - } - private val cardAuthorizations: CardAuthorizationServiceAsync by lazy { CardAuthorizationServiceAsyncImpl(clientOptions) } @@ -214,8 +208,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun interestPayments(): InterestPaymentServiceAsync = interestPayments - override fun accountTransfers(): AccountTransferServiceAsync = accountTransfers - override fun cardAuthorizations(): CardAuthorizationServiceAsync = cardAuthorizations override fun cardBalanceInquiries(): CardBalanceInquiryServiceAsync = cardBalanceInquiries @@ -292,10 +284,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: InterestPaymentServiceAsyncImpl.WithRawResponseImpl(clientOptions) } - private val accountTransfers: AccountTransferServiceAsync.WithRawResponse by lazy { - AccountTransferServiceAsyncImpl.WithRawResponseImpl(clientOptions) - } - private val cardAuthorizations: CardAuthorizationServiceAsync.WithRawResponse by lazy { CardAuthorizationServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -438,9 +426,6 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun interestPayments(): InterestPaymentServiceAsync.WithRawResponse = interestPayments - override fun accountTransfers(): AccountTransferServiceAsync.WithRawResponse = - accountTransfers - override fun cardAuthorizations(): CardAuthorizationServiceAsync.WithRawResponse = cardAuthorizations diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsync.kt deleted file mode 100644 index 3420f0f88..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsync.kt +++ /dev/null @@ -1,130 +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.accounttransfers.AccountTransfer -import com.increase.api.models.simulations.accounttransfers.AccountTransferCompleteParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer - -interface AccountTransferServiceAsync { - - /** - * 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): AccountTransferServiceAsync - - /** - * If your account is configured to require approval for each transfer, this endpoint simulates - * the approval of an [Account Transfer](#account-transfers). You can also approve sandbox - * Account Transfers in the dashboard. This transfer must first have a `status` of - * `pending_approval`. - */ - fun complete(accountTransferId: String): CompletableFuture = - complete(accountTransferId, AccountTransferCompleteParams.none()) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - complete(params.toBuilder().accountTransferId(accountTransferId).build(), requestOptions) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - ): CompletableFuture = - complete(accountTransferId, params, RequestOptions.none()) - - /** @see complete */ - fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see complete */ - fun complete(params: AccountTransferCompleteParams): CompletableFuture = - complete(params, RequestOptions.none()) - - /** @see complete */ - fun complete( - accountTransferId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - complete(accountTransferId, AccountTransferCompleteParams.none(), requestOptions) - - /** - * A view of [AccountTransferServiceAsync] 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 - ): AccountTransferServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post - * /simulations/account_transfers/{account_transfer_id}/complete`, but is otherwise the same - * as [AccountTransferServiceAsync.complete]. - */ - fun complete( - accountTransferId: String - ): CompletableFuture> = - complete(accountTransferId, AccountTransferCompleteParams.none()) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - complete( - params.toBuilder().accountTransferId(accountTransferId).build(), - requestOptions, - ) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - ): CompletableFuture> = - complete(accountTransferId, params, RequestOptions.none()) - - /** @see complete */ - fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see complete */ - fun complete( - params: AccountTransferCompleteParams - ): CompletableFuture> = - complete(params, RequestOptions.none()) - - /** @see complete */ - fun complete( - accountTransferId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - complete(accountTransferId, AccountTransferCompleteParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncImpl.kt deleted file mode 100644 index 46889e9b8..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncImpl.kt +++ /dev/null @@ -1,98 +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.accounttransfers.AccountTransfer -import com.increase.api.models.simulations.accounttransfers.AccountTransferCompleteParams -import java.util.concurrent.CompletableFuture -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class AccountTransferServiceAsyncImpl -internal constructor(private val clientOptions: ClientOptions) : AccountTransferServiceAsync { - - private val withRawResponse: AccountTransferServiceAsync.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): AccountTransferServiceAsync.WithRawResponse = withRawResponse - - override fun withOptions( - modifier: Consumer - ): AccountTransferServiceAsync = - AccountTransferServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /simulations/account_transfers/{account_transfer_id}/complete - withRawResponse().complete(params, requestOptions).thenApply { it.parse() } - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - AccountTransferServiceAsync.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): AccountTransferServiceAsync.WithRawResponse = - AccountTransferServiceAsyncImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val completeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("accountTransferId", params.accountTransferId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "simulations", - "account_transfers", - params._pathParam(0), - "complete", - ) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .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 { completeHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - } -} 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 c1e7349aa..f4112db8b 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 @@ -4,7 +4,6 @@ package com.increase.api.services.blocking import com.increase.api.core.ClientOptions import com.increase.api.services.blocking.simulations.AccountStatementService -import com.increase.api.services.blocking.simulations.AccountTransferService import com.increase.api.services.blocking.simulations.AchTransferService import com.increase.api.services.blocking.simulations.CardAuthenticationService import com.increase.api.services.blocking.simulations.CardAuthorizationExpirationService @@ -54,8 +53,6 @@ interface SimulationService { fun interestPayments(): InterestPaymentService - fun accountTransfers(): AccountTransferService - fun cardAuthorizations(): CardAuthorizationService fun cardBalanceInquiries(): CardBalanceInquiryService @@ -132,8 +129,6 @@ interface SimulationService { fun interestPayments(): InterestPaymentService.WithRawResponse - fun accountTransfers(): AccountTransferService.WithRawResponse - fun cardAuthorizations(): CardAuthorizationService.WithRawResponse fun cardBalanceInquiries(): CardBalanceInquiryService.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 e304f068b..9dc2cbb65 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 @@ -5,8 +5,6 @@ package com.increase.api.services.blocking import com.increase.api.core.ClientOptions import com.increase.api.services.blocking.simulations.AccountStatementService import com.increase.api.services.blocking.simulations.AccountStatementServiceImpl -import com.increase.api.services.blocking.simulations.AccountTransferService -import com.increase.api.services.blocking.simulations.AccountTransferServiceImpl import com.increase.api.services.blocking.simulations.AchTransferService import com.increase.api.services.blocking.simulations.AchTransferServiceImpl import com.increase.api.services.blocking.simulations.CardAuthenticationService @@ -82,10 +80,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InterestPaymentServiceImpl(clientOptions) } - private val accountTransfers: AccountTransferService by lazy { - AccountTransferServiceImpl(clientOptions) - } - private val cardAuthorizations: CardAuthorizationService by lazy { CardAuthorizationServiceImpl(clientOptions) } @@ -205,8 +199,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun interestPayments(): InterestPaymentService = interestPayments - override fun accountTransfers(): AccountTransferService = accountTransfers - override fun cardAuthorizations(): CardAuthorizationService = cardAuthorizations override fun cardBalanceInquiries(): CardBalanceInquiryService = cardBalanceInquiries @@ -282,10 +274,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie InterestPaymentServiceImpl.WithRawResponseImpl(clientOptions) } - private val accountTransfers: AccountTransferService.WithRawResponse by lazy { - AccountTransferServiceImpl.WithRawResponseImpl(clientOptions) - } - private val cardAuthorizations: CardAuthorizationService.WithRawResponse by lazy { CardAuthorizationServiceImpl.WithRawResponseImpl(clientOptions) } @@ -425,8 +413,6 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun interestPayments(): InterestPaymentService.WithRawResponse = interestPayments - override fun accountTransfers(): AccountTransferService.WithRawResponse = accountTransfers - override fun cardAuthorizations(): CardAuthorizationService.WithRawResponse = cardAuthorizations diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferService.kt deleted file mode 100644 index 73859d145..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferService.kt +++ /dev/null @@ -1,128 +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.accounttransfers.AccountTransfer -import com.increase.api.models.simulations.accounttransfers.AccountTransferCompleteParams -import java.util.function.Consumer - -interface AccountTransferService { - - /** - * 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): AccountTransferService - - /** - * If your account is configured to require approval for each transfer, this endpoint simulates - * the approval of an [Account Transfer](#account-transfers). You can also approve sandbox - * Account Transfers in the dashboard. This transfer must first have a `status` of - * `pending_approval`. - */ - fun complete(accountTransferId: String): AccountTransfer = - complete(accountTransferId, AccountTransferCompleteParams.none()) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): AccountTransfer = - complete(params.toBuilder().accountTransferId(accountTransferId).build(), requestOptions) - - /** @see complete */ - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - ): AccountTransfer = complete(accountTransferId, params, RequestOptions.none()) - - /** @see complete */ - fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): AccountTransfer - - /** @see complete */ - fun complete(params: AccountTransferCompleteParams): AccountTransfer = - complete(params, RequestOptions.none()) - - /** @see complete */ - fun complete(accountTransferId: String, requestOptions: RequestOptions): AccountTransfer = - complete(accountTransferId, AccountTransferCompleteParams.none(), requestOptions) - - /** - * A view of [AccountTransferService] 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 - ): AccountTransferService.WithRawResponse - - /** - * Returns a raw HTTP response for `post - * /simulations/account_transfers/{account_transfer_id}/complete`, but is otherwise the same - * as [AccountTransferService.complete]. - */ - @MustBeClosed - fun complete(accountTransferId: String): HttpResponseFor = - complete(accountTransferId, AccountTransferCompleteParams.none()) - - /** @see complete */ - @MustBeClosed - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - complete( - params.toBuilder().accountTransferId(accountTransferId).build(), - requestOptions, - ) - - /** @see complete */ - @MustBeClosed - fun complete( - accountTransferId: String, - params: AccountTransferCompleteParams = AccountTransferCompleteParams.none(), - ): HttpResponseFor = - complete(accountTransferId, params, RequestOptions.none()) - - /** @see complete */ - @MustBeClosed - fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see complete */ - @MustBeClosed - fun complete(params: AccountTransferCompleteParams): HttpResponseFor = - complete(params, RequestOptions.none()) - - /** @see complete */ - @MustBeClosed - fun complete( - accountTransferId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - complete(accountTransferId, AccountTransferCompleteParams.none(), requestOptions) - } -} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceImpl.kt deleted file mode 100644 index 90b46d30e..000000000 --- a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceImpl.kt +++ /dev/null @@ -1,92 +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.accounttransfers.AccountTransfer -import com.increase.api.models.simulations.accounttransfers.AccountTransferCompleteParams -import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull - -class AccountTransferServiceImpl internal constructor(private val clientOptions: ClientOptions) : - AccountTransferService { - - private val withRawResponse: AccountTransferService.WithRawResponse by lazy { - WithRawResponseImpl(clientOptions) - } - - override fun withRawResponse(): AccountTransferService.WithRawResponse = withRawResponse - - override fun withOptions(modifier: Consumer): AccountTransferService = - AccountTransferServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - - override fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions, - ): AccountTransfer = - // post /simulations/account_transfers/{account_transfer_id}/complete - withRawResponse().complete(params, requestOptions).parse() - - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : - AccountTransferService.WithRawResponse { - - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - - override fun withOptions( - modifier: Consumer - ): AccountTransferService.WithRawResponse = - AccountTransferServiceImpl.WithRawResponseImpl( - clientOptions.toBuilder().apply(modifier::accept).build() - ) - - private val completeHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun complete( - params: AccountTransferCompleteParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("accountTransferId", params.accountTransferId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "simulations", - "account_transfers", - params._pathParam(0), - "complete", - ) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .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 { completeHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParamsTest.kt deleted file mode 100644 index 6049d6c26..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/accounttransfers/AccountTransferCompleteParamsTest.kt +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.increase.api.models.simulations.accounttransfers - -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class AccountTransferCompleteParamsTest { - - @Test - fun create() { - AccountTransferCompleteParams.builder() - .accountTransferId("account_transfer_7k9qe1ysdgqztnt63l7n") - .build() - } - - @Test - fun pathParams() { - val params = - AccountTransferCompleteParams.builder() - .accountTransferId("account_transfer_7k9qe1ysdgqztnt63l7n") - .build() - - assertThat(params._pathParam(0)).isEqualTo("account_transfer_7k9qe1ysdgqztnt63l7n") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncTest.kt deleted file mode 100644 index 53b71d0ae..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/AccountTransferServiceAsyncTest.kt +++ /dev/null @@ -1,28 +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 org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class AccountTransferServiceAsyncTest { - - @Test - fun complete() { - val client = - IncreaseOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val accountTransferServiceAsync = client.simulations().accountTransfers() - - val accountTransferFuture = - accountTransferServiceAsync.complete("account_transfer_7k9qe1ysdgqztnt63l7n") - - val accountTransfer = accountTransferFuture.get() - accountTransfer.validate() - } -} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceTest.kt deleted file mode 100644 index ac8dec10c..000000000 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/AccountTransferServiceTest.kt +++ /dev/null @@ -1,27 +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 org.junit.jupiter.api.Test -import org.junit.jupiter.api.extension.ExtendWith - -@ExtendWith(TestServerExtension::class) -internal class AccountTransferServiceTest { - - @Test - fun complete() { - val client = - IncreaseOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) - .apiKey("My API Key") - .build() - val accountTransferService = client.simulations().accountTransfers() - - val accountTransfer = - accountTransferService.complete("account_transfer_7k9qe1ysdgqztnt63l7n") - - accountTransfer.validate() - } -} From aea34699ae0d285570eb297d6cb1b0ee37a37422 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:18:36 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 8 +- .../CardPurchaseSupplementCreateParams.kt | 1731 +++++++++++++++++ .../services/async/SimulationServiceAsync.kt | 5 + .../async/SimulationServiceAsyncImpl.kt | 17 + .../CardPurchaseSupplementServiceAsync.kt | 72 + .../CardPurchaseSupplementServiceAsyncImpl.kt | 92 + .../services/blocking/SimulationService.kt | 5 + .../blocking/SimulationServiceImpl.kt | 15 + .../CardPurchaseSupplementService.kt | 72 + .../CardPurchaseSupplementServiceImpl.kt | 84 + .../CardPurchaseSupplementCreateParamsTest.kt | 128 ++ .../CardPurchaseSupplementServiceAsyncTest.kt | 62 + .../CardPurchaseSupplementServiceTest.kt | 61 + 13 files changed, 2348 insertions(+), 4 deletions(-) create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParams.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsync.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncImpl.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementService.kt create mode 100644 increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceImpl.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParamsTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncTest.kt create mode 100644 increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 52a1884ef..ebb831829 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 240 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c9957e6ab1c9adef0dfb9a3956c8e7505a1661d22e79531eaee71b2a3a699b61.yml -openapi_spec_hash: 1190741469af674747df81908239a601 -config_hash: 82cb0fb1fae47b3467cd6da4273541de +configured_endpoints: 241 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-ecd0cee565701f1d47c0db3efed2734f1195f60e5767c9c5f67ddb5de5e6abf1.yml +openapi_spec_hash: d9205bf9cc1ce52d0d046007318761a1 +config_hash: cb5b8736705c06b670f6a25484622d62 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParams.kt new file mode 100644 index 000000000..5fbb47db6 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParams.kt @@ -0,0 +1,1731 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.cardpurchasesupplements + +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.checkKnown +import com.increase.api.core.checkRequired +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.LocalDate +import java.util.Collections +import java.util.Objects +import java.util.Optional +import kotlin.jvm.optionals.getOrNull + +/** + * Simulates the creation of a Card Purchase Supplement (Level 3 data) for a card settlement. This + * happens asynchronously in production when Visa sends enhanced transaction data about a purchase. + */ +class CardPurchaseSupplementCreateParams +private constructor( + private val body: Body, + private val additionalHeaders: Headers, + private val additionalQueryParams: QueryParams, +) : Params { + + /** + * The identifier of the Transaction to create a Card Purchase Supplement for. The Transaction + * must have a source of type `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 transactionId(): String = body.transactionId() + + /** + * Invoice-level information about the payment. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun invoice(): Optional = body.invoice() + + /** + * Line item information, such as individual products purchased. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun lineItems(): Optional> = body.lineItems() + + /** + * Returns the raw JSON value of [transactionId]. + * + * Unlike [transactionId], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _transactionId(): JsonField = body._transactionId() + + /** + * Returns the raw JSON value of [invoice]. + * + * Unlike [invoice], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _invoice(): JsonField = body._invoice() + + /** + * Returns the raw JSON value of [lineItems]. + * + * Unlike [lineItems], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _lineItems(): JsonField> = body._lineItems() + + 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 + * [CardPurchaseSupplementCreateParams]. + * + * The following fields are required: + * ```java + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [CardPurchaseSupplementCreateParams]. */ + 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(cardPurchaseSupplementCreateParams: CardPurchaseSupplementCreateParams) = + apply { + body = cardPurchaseSupplementCreateParams.body.toBuilder() + additionalHeaders = cardPurchaseSupplementCreateParams.additionalHeaders.toBuilder() + additionalQueryParams = + cardPurchaseSupplementCreateParams.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: + * - [transactionId] + * - [invoice] + * - [lineItems] + */ + fun body(body: Body) = apply { this.body = body.toBuilder() } + + /** + * The identifier of the Transaction to create a Card Purchase Supplement for. The + * Transaction must have a source of type `card_settlement`. + */ + fun transactionId(transactionId: String) = apply { body.transactionId(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 { + body.transactionId(transactionId) + } + + /** Invoice-level information about the payment. */ + fun invoice(invoice: Invoice) = apply { body.invoice(invoice) } + + /** + * Sets [Builder.invoice] to an arbitrary JSON value. + * + * You should usually call [Builder.invoice] with a well-typed [Invoice] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported value. + */ + fun invoice(invoice: JsonField) = apply { body.invoice(invoice) } + + /** Line item information, such as individual products purchased. */ + fun lineItems(lineItems: List) = apply { body.lineItems(lineItems) } + + /** + * Sets [Builder.lineItems] to an arbitrary JSON value. + * + * You should usually call [Builder.lineItems] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun lineItems(lineItems: JsonField>) = apply { body.lineItems(lineItems) } + + /** + * Adds a single [LineItem] to [lineItems]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLineItem(lineItem: LineItem) = apply { body.addLineItem(lineItem) } + + 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 [CardPurchaseSupplementCreateParams]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): CardPurchaseSupplementCreateParams = + CardPurchaseSupplementCreateParams( + body.build(), + additionalHeaders.build(), + additionalQueryParams.build(), + ) + } + + fun _body(): Body = body + + override fun _headers(): Headers = additionalHeaders + + override fun _queryParams(): QueryParams = additionalQueryParams + + class Body + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val transactionId: JsonField, + private val invoice: JsonField, + private val lineItems: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("transaction_id") + @ExcludeMissing + transactionId: JsonField = JsonMissing.of(), + @JsonProperty("invoice") @ExcludeMissing invoice: JsonField = JsonMissing.of(), + @JsonProperty("line_items") + @ExcludeMissing + lineItems: JsonField> = JsonMissing.of(), + ) : this(transactionId, invoice, lineItems, mutableMapOf()) + + /** + * The identifier of the Transaction to create a Card Purchase Supplement for. The + * Transaction must have a source of type `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 transactionId(): String = transactionId.getRequired("transaction_id") + + /** + * Invoice-level information about the payment. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun invoice(): Optional = invoice.getOptional("invoice") + + /** + * Line item information, such as individual products purchased. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun lineItems(): Optional> = lineItems.getOptional("line_items") + + /** + * 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 + + /** + * Returns the raw JSON value of [invoice]. + * + * Unlike [invoice], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("invoice") @ExcludeMissing fun _invoice(): JsonField = invoice + + /** + * Returns the raw JSON value of [lineItems]. + * + * Unlike [lineItems], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("line_items") + @ExcludeMissing + fun _lineItems(): JsonField> = lineItems + + @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 + * .transactionId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Body]. */ + class Builder internal constructor() { + + private var transactionId: JsonField? = null + private var invoice: JsonField = JsonMissing.of() + private var lineItems: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(body: Body) = apply { + transactionId = body.transactionId + invoice = body.invoice + lineItems = body.lineItems.map { it.toMutableList() } + additionalProperties = body.additionalProperties.toMutableMap() + } + + /** + * The identifier of the Transaction to create a Card Purchase Supplement for. The + * Transaction must have a source of type `card_settlement`. + */ + 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 + } + + /** Invoice-level information about the payment. */ + fun invoice(invoice: Invoice) = invoice(JsonField.of(invoice)) + + /** + * Sets [Builder.invoice] to an arbitrary JSON value. + * + * You should usually call [Builder.invoice] with a well-typed [Invoice] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun invoice(invoice: JsonField) = apply { this.invoice = invoice } + + /** Line item information, such as individual products purchased. */ + fun lineItems(lineItems: List) = lineItems(JsonField.of(lineItems)) + + /** + * Sets [Builder.lineItems] to an arbitrary JSON value. + * + * You should usually call [Builder.lineItems] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun lineItems(lineItems: JsonField>) = apply { + this.lineItems = lineItems.map { it.toMutableList() } + } + + /** + * Adds a single [LineItem] to [lineItems]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLineItem(lineItem: LineItem) = apply { + lineItems = + (lineItems ?: JsonField.of(mutableListOf())).also { + checkKnown("lineItems", it).add(lineItem) + } + } + + 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 + * .transactionId() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Body = + Body( + checkRequired("transactionId", transactionId), + invoice, + (lineItems ?: JsonMissing.of()).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Body = apply { + if (validated) { + return@apply + } + + transactionId() + invoice().ifPresent { it.validate() } + lineItems().ifPresent { it.forEach { 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 (transactionId.asKnown().isPresent) 1 else 0) + + (invoice.asKnown().getOrNull()?.validity() ?: 0) + + (lineItems.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Body && + transactionId == other.transactionId && + invoice == other.invoice && + lineItems == other.lineItems && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(transactionId, invoice, lineItems, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Body{transactionId=$transactionId, invoice=$invoice, lineItems=$lineItems, additionalProperties=$additionalProperties}" + } + + /** Invoice-level information about the payment. */ + class Invoice + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val discountAmount: JsonField, + private val dutyTaxAmount: JsonField, + private val orderDate: JsonField, + private val shippingAmount: JsonField, + private val shippingDestinationCountryCode: JsonField, + private val shippingDestinationPostalCode: JsonField, + private val shippingSourcePostalCode: JsonField, + private val shippingTaxAmount: JsonField, + private val shippingTaxRate: JsonField, + private val uniqueValueAddedTaxInvoiceReference: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("discount_amount") + @ExcludeMissing + discountAmount: JsonField = JsonMissing.of(), + @JsonProperty("duty_tax_amount") + @ExcludeMissing + dutyTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("order_date") + @ExcludeMissing + orderDate: JsonField = JsonMissing.of(), + @JsonProperty("shipping_amount") + @ExcludeMissing + shippingAmount: JsonField = JsonMissing.of(), + @JsonProperty("shipping_destination_country_code") + @ExcludeMissing + shippingDestinationCountryCode: JsonField = JsonMissing.of(), + @JsonProperty("shipping_destination_postal_code") + @ExcludeMissing + shippingDestinationPostalCode: JsonField = JsonMissing.of(), + @JsonProperty("shipping_source_postal_code") + @ExcludeMissing + shippingSourcePostalCode: JsonField = JsonMissing.of(), + @JsonProperty("shipping_tax_amount") + @ExcludeMissing + shippingTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("shipping_tax_rate") + @ExcludeMissing + shippingTaxRate: JsonField = JsonMissing.of(), + @JsonProperty("unique_value_added_tax_invoice_reference") + @ExcludeMissing + uniqueValueAddedTaxInvoiceReference: JsonField = JsonMissing.of(), + ) : this( + discountAmount, + dutyTaxAmount, + orderDate, + shippingAmount, + shippingDestinationCountryCode, + shippingDestinationPostalCode, + shippingSourcePostalCode, + shippingTaxAmount, + shippingTaxRate, + uniqueValueAddedTaxInvoiceReference, + mutableMapOf(), + ) + + /** + * Discount given to cardholder. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun discountAmount(): Optional = discountAmount.getOptional("discount_amount") + + /** + * Amount of duty taxes. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun dutyTaxAmount(): Optional = dutyTaxAmount.getOptional("duty_tax_amount") + + /** + * Date the order was taken. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun orderDate(): Optional = orderDate.getOptional("order_date") + + /** + * The shipping cost. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingAmount(): Optional = shippingAmount.getOptional("shipping_amount") + + /** + * Country code of the shipping destination. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingDestinationCountryCode(): Optional = + shippingDestinationCountryCode.getOptional("shipping_destination_country_code") + + /** + * Postal code of the shipping destination. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingDestinationPostalCode(): Optional = + shippingDestinationPostalCode.getOptional("shipping_destination_postal_code") + + /** + * Postal code of the location being shipped from. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingSourcePostalCode(): Optional = + shippingSourcePostalCode.getOptional("shipping_source_postal_code") + + /** + * Taxes paid for freight and shipping. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingTaxAmount(): Optional = + shippingTaxAmount.getOptional("shipping_tax_amount") + + /** + * Tax rate for freight and shipping. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun shippingTaxRate(): Optional = shippingTaxRate.getOptional("shipping_tax_rate") + + /** + * Value added tax invoice reference number. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun uniqueValueAddedTaxInvoiceReference(): Optional = + uniqueValueAddedTaxInvoiceReference.getOptional( + "unique_value_added_tax_invoice_reference" + ) + + /** + * Returns the raw JSON value of [discountAmount]. + * + * Unlike [discountAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("discount_amount") + @ExcludeMissing + fun _discountAmount(): JsonField = discountAmount + + /** + * Returns the raw JSON value of [dutyTaxAmount]. + * + * Unlike [dutyTaxAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("duty_tax_amount") + @ExcludeMissing + fun _dutyTaxAmount(): JsonField = dutyTaxAmount + + /** + * Returns the raw JSON value of [orderDate]. + * + * Unlike [orderDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("order_date") + @ExcludeMissing + fun _orderDate(): JsonField = orderDate + + /** + * Returns the raw JSON value of [shippingAmount]. + * + * Unlike [shippingAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("shipping_amount") + @ExcludeMissing + fun _shippingAmount(): JsonField = shippingAmount + + /** + * Returns the raw JSON value of [shippingDestinationCountryCode]. + * + * Unlike [shippingDestinationCountryCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("shipping_destination_country_code") + @ExcludeMissing + fun _shippingDestinationCountryCode(): JsonField = shippingDestinationCountryCode + + /** + * Returns the raw JSON value of [shippingDestinationPostalCode]. + * + * Unlike [shippingDestinationPostalCode], this method doesn't throw if the JSON field has + * an unexpected type. + */ + @JsonProperty("shipping_destination_postal_code") + @ExcludeMissing + fun _shippingDestinationPostalCode(): JsonField = shippingDestinationPostalCode + + /** + * Returns the raw JSON value of [shippingSourcePostalCode]. + * + * Unlike [shippingSourcePostalCode], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("shipping_source_postal_code") + @ExcludeMissing + fun _shippingSourcePostalCode(): JsonField = shippingSourcePostalCode + + /** + * Returns the raw JSON value of [shippingTaxAmount]. + * + * Unlike [shippingTaxAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("shipping_tax_amount") + @ExcludeMissing + fun _shippingTaxAmount(): JsonField = shippingTaxAmount + + /** + * Returns the raw JSON value of [shippingTaxRate]. + * + * Unlike [shippingTaxRate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("shipping_tax_rate") + @ExcludeMissing + fun _shippingTaxRate(): JsonField = shippingTaxRate + + /** + * Returns the raw JSON value of [uniqueValueAddedTaxInvoiceReference]. + * + * Unlike [uniqueValueAddedTaxInvoiceReference], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("unique_value_added_tax_invoice_reference") + @ExcludeMissing + fun _uniqueValueAddedTaxInvoiceReference(): JsonField = + uniqueValueAddedTaxInvoiceReference + + @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 [Invoice]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Invoice]. */ + class Builder internal constructor() { + + private var discountAmount: JsonField = JsonMissing.of() + private var dutyTaxAmount: JsonField = JsonMissing.of() + private var orderDate: JsonField = JsonMissing.of() + private var shippingAmount: JsonField = JsonMissing.of() + private var shippingDestinationCountryCode: JsonField = JsonMissing.of() + private var shippingDestinationPostalCode: JsonField = JsonMissing.of() + private var shippingSourcePostalCode: JsonField = JsonMissing.of() + private var shippingTaxAmount: JsonField = JsonMissing.of() + private var shippingTaxRate: JsonField = JsonMissing.of() + private var uniqueValueAddedTaxInvoiceReference: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(invoice: Invoice) = apply { + discountAmount = invoice.discountAmount + dutyTaxAmount = invoice.dutyTaxAmount + orderDate = invoice.orderDate + shippingAmount = invoice.shippingAmount + shippingDestinationCountryCode = invoice.shippingDestinationCountryCode + shippingDestinationPostalCode = invoice.shippingDestinationPostalCode + shippingSourcePostalCode = invoice.shippingSourcePostalCode + shippingTaxAmount = invoice.shippingTaxAmount + shippingTaxRate = invoice.shippingTaxRate + uniqueValueAddedTaxInvoiceReference = invoice.uniqueValueAddedTaxInvoiceReference + additionalProperties = invoice.additionalProperties.toMutableMap() + } + + /** Discount given to cardholder. */ + fun discountAmount(discountAmount: Long) = discountAmount(JsonField.of(discountAmount)) + + /** + * Sets [Builder.discountAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.discountAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun discountAmount(discountAmount: JsonField) = apply { + this.discountAmount = discountAmount + } + + /** Amount of duty taxes. */ + fun dutyTaxAmount(dutyTaxAmount: Long) = dutyTaxAmount(JsonField.of(dutyTaxAmount)) + + /** + * Sets [Builder.dutyTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.dutyTaxAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun dutyTaxAmount(dutyTaxAmount: JsonField) = apply { + this.dutyTaxAmount = dutyTaxAmount + } + + /** Date the order was taken. */ + fun orderDate(orderDate: LocalDate) = orderDate(JsonField.of(orderDate)) + + /** + * Sets [Builder.orderDate] to an arbitrary JSON value. + * + * You should usually call [Builder.orderDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun orderDate(orderDate: JsonField) = apply { this.orderDate = orderDate } + + /** The shipping cost. */ + fun shippingAmount(shippingAmount: Long) = shippingAmount(JsonField.of(shippingAmount)) + + /** + * Sets [Builder.shippingAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun shippingAmount(shippingAmount: JsonField) = apply { + this.shippingAmount = shippingAmount + } + + /** Country code of the shipping destination. */ + fun shippingDestinationCountryCode(shippingDestinationCountryCode: String) = + shippingDestinationCountryCode(JsonField.of(shippingDestinationCountryCode)) + + /** + * Sets [Builder.shippingDestinationCountryCode] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingDestinationCountryCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun shippingDestinationCountryCode(shippingDestinationCountryCode: JsonField) = + apply { + this.shippingDestinationCountryCode = shippingDestinationCountryCode + } + + /** Postal code of the shipping destination. */ + fun shippingDestinationPostalCode(shippingDestinationPostalCode: String) = + shippingDestinationPostalCode(JsonField.of(shippingDestinationPostalCode)) + + /** + * Sets [Builder.shippingDestinationPostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingDestinationPostalCode] with a well-typed + * [String] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun shippingDestinationPostalCode(shippingDestinationPostalCode: JsonField) = + apply { + this.shippingDestinationPostalCode = shippingDestinationPostalCode + } + + /** Postal code of the location being shipped from. */ + fun shippingSourcePostalCode(shippingSourcePostalCode: String) = + shippingSourcePostalCode(JsonField.of(shippingSourcePostalCode)) + + /** + * Sets [Builder.shippingSourcePostalCode] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingSourcePostalCode] with a well-typed [String] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun shippingSourcePostalCode(shippingSourcePostalCode: JsonField) = apply { + this.shippingSourcePostalCode = shippingSourcePostalCode + } + + /** Taxes paid for freight and shipping. */ + fun shippingTaxAmount(shippingTaxAmount: Long) = + shippingTaxAmount(JsonField.of(shippingTaxAmount)) + + /** + * Sets [Builder.shippingTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingTaxAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun shippingTaxAmount(shippingTaxAmount: JsonField) = apply { + this.shippingTaxAmount = shippingTaxAmount + } + + /** Tax rate for freight and shipping. */ + fun shippingTaxRate(shippingTaxRate: String) = + shippingTaxRate(JsonField.of(shippingTaxRate)) + + /** + * Sets [Builder.shippingTaxRate] to an arbitrary JSON value. + * + * You should usually call [Builder.shippingTaxRate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun shippingTaxRate(shippingTaxRate: JsonField) = apply { + this.shippingTaxRate = shippingTaxRate + } + + /** Value added tax invoice reference number. */ + fun uniqueValueAddedTaxInvoiceReference(uniqueValueAddedTaxInvoiceReference: String) = + uniqueValueAddedTaxInvoiceReference( + JsonField.of(uniqueValueAddedTaxInvoiceReference) + ) + + /** + * Sets [Builder.uniqueValueAddedTaxInvoiceReference] to an arbitrary JSON value. + * + * You should usually call [Builder.uniqueValueAddedTaxInvoiceReference] with a + * well-typed [String] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun uniqueValueAddedTaxInvoiceReference( + uniqueValueAddedTaxInvoiceReference: JsonField + ) = apply { + this.uniqueValueAddedTaxInvoiceReference = uniqueValueAddedTaxInvoiceReference + } + + 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 [Invoice]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Invoice = + Invoice( + discountAmount, + dutyTaxAmount, + orderDate, + shippingAmount, + shippingDestinationCountryCode, + shippingDestinationPostalCode, + shippingSourcePostalCode, + shippingTaxAmount, + shippingTaxRate, + uniqueValueAddedTaxInvoiceReference, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Invoice = apply { + if (validated) { + return@apply + } + + discountAmount() + dutyTaxAmount() + orderDate() + shippingAmount() + shippingDestinationCountryCode() + shippingDestinationPostalCode() + shippingSourcePostalCode() + shippingTaxAmount() + shippingTaxRate() + uniqueValueAddedTaxInvoiceReference() + 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 (discountAmount.asKnown().isPresent) 1 else 0) + + (if (dutyTaxAmount.asKnown().isPresent) 1 else 0) + + (if (orderDate.asKnown().isPresent) 1 else 0) + + (if (shippingAmount.asKnown().isPresent) 1 else 0) + + (if (shippingDestinationCountryCode.asKnown().isPresent) 1 else 0) + + (if (shippingDestinationPostalCode.asKnown().isPresent) 1 else 0) + + (if (shippingSourcePostalCode.asKnown().isPresent) 1 else 0) + + (if (shippingTaxAmount.asKnown().isPresent) 1 else 0) + + (if (shippingTaxRate.asKnown().isPresent) 1 else 0) + + (if (uniqueValueAddedTaxInvoiceReference.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Invoice && + discountAmount == other.discountAmount && + dutyTaxAmount == other.dutyTaxAmount && + orderDate == other.orderDate && + shippingAmount == other.shippingAmount && + shippingDestinationCountryCode == other.shippingDestinationCountryCode && + shippingDestinationPostalCode == other.shippingDestinationPostalCode && + shippingSourcePostalCode == other.shippingSourcePostalCode && + shippingTaxAmount == other.shippingTaxAmount && + shippingTaxRate == other.shippingTaxRate && + uniqueValueAddedTaxInvoiceReference == other.uniqueValueAddedTaxInvoiceReference && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + discountAmount, + dutyTaxAmount, + orderDate, + shippingAmount, + shippingDestinationCountryCode, + shippingDestinationPostalCode, + shippingSourcePostalCode, + shippingTaxAmount, + shippingTaxRate, + uniqueValueAddedTaxInvoiceReference, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Invoice{discountAmount=$discountAmount, dutyTaxAmount=$dutyTaxAmount, orderDate=$orderDate, shippingAmount=$shippingAmount, shippingDestinationCountryCode=$shippingDestinationCountryCode, shippingDestinationPostalCode=$shippingDestinationPostalCode, shippingSourcePostalCode=$shippingSourcePostalCode, shippingTaxAmount=$shippingTaxAmount, shippingTaxRate=$shippingTaxRate, uniqueValueAddedTaxInvoiceReference=$uniqueValueAddedTaxInvoiceReference, additionalProperties=$additionalProperties}" + } + + class LineItem + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val discountAmount: JsonField, + private val itemCommodityCode: JsonField, + private val itemDescriptor: JsonField, + private val itemQuantity: JsonField, + private val productCode: JsonField, + private val salesTaxAmount: JsonField, + private val salesTaxRate: JsonField, + private val totalAmount: JsonField, + private val unitCost: JsonField, + private val unitOfMeasureCode: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("discount_amount") + @ExcludeMissing + discountAmount: JsonField = JsonMissing.of(), + @JsonProperty("item_commodity_code") + @ExcludeMissing + itemCommodityCode: JsonField = JsonMissing.of(), + @JsonProperty("item_descriptor") + @ExcludeMissing + itemDescriptor: JsonField = JsonMissing.of(), + @JsonProperty("item_quantity") + @ExcludeMissing + itemQuantity: JsonField = JsonMissing.of(), + @JsonProperty("product_code") + @ExcludeMissing + productCode: JsonField = JsonMissing.of(), + @JsonProperty("sales_tax_amount") + @ExcludeMissing + salesTaxAmount: JsonField = JsonMissing.of(), + @JsonProperty("sales_tax_rate") + @ExcludeMissing + salesTaxRate: JsonField = JsonMissing.of(), + @JsonProperty("total_amount") + @ExcludeMissing + totalAmount: JsonField = JsonMissing.of(), + @JsonProperty("unit_cost") + @ExcludeMissing + unitCost: JsonField = JsonMissing.of(), + @JsonProperty("unit_of_measure_code") + @ExcludeMissing + unitOfMeasureCode: JsonField = JsonMissing.of(), + ) : this( + discountAmount, + itemCommodityCode, + itemDescriptor, + itemQuantity, + productCode, + salesTaxAmount, + salesTaxRate, + totalAmount, + unitCost, + unitOfMeasureCode, + mutableMapOf(), + ) + + /** + * Discount amount for this specific line item. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun discountAmount(): Optional = discountAmount.getOptional("discount_amount") + + /** + * Code used to categorize the purchase item. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun itemCommodityCode(): Optional = + itemCommodityCode.getOptional("item_commodity_code") + + /** + * Description of the purchase item. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun itemDescriptor(): Optional = itemDescriptor.getOptional("item_descriptor") + + /** + * The number of units of the product being purchased. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun itemQuantity(): Optional = itemQuantity.getOptional("item_quantity") + + /** + * Code used to categorize the product being purchased. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun productCode(): Optional = productCode.getOptional("product_code") + + /** + * Sales tax amount for this line item. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun salesTaxAmount(): Optional = salesTaxAmount.getOptional("sales_tax_amount") + + /** + * Sales tax rate for this line item. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun salesTaxRate(): Optional = salesTaxRate.getOptional("sales_tax_rate") + + /** + * Total amount of all line items. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun totalAmount(): Optional = totalAmount.getOptional("total_amount") + + /** + * Cost of line item per unit of measure, in major units. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun unitCost(): Optional = unitCost.getOptional("unit_cost") + + /** + * Code indicating unit of measure (gallons, etc.). + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun unitOfMeasureCode(): Optional = + unitOfMeasureCode.getOptional("unit_of_measure_code") + + /** + * Returns the raw JSON value of [discountAmount]. + * + * Unlike [discountAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("discount_amount") + @ExcludeMissing + fun _discountAmount(): JsonField = discountAmount + + /** + * Returns the raw JSON value of [itemCommodityCode]. + * + * Unlike [itemCommodityCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("item_commodity_code") + @ExcludeMissing + fun _itemCommodityCode(): JsonField = itemCommodityCode + + /** + * Returns the raw JSON value of [itemDescriptor]. + * + * Unlike [itemDescriptor], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("item_descriptor") + @ExcludeMissing + fun _itemDescriptor(): JsonField = itemDescriptor + + /** + * Returns the raw JSON value of [itemQuantity]. + * + * Unlike [itemQuantity], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("item_quantity") + @ExcludeMissing + fun _itemQuantity(): JsonField = itemQuantity + + /** + * Returns the raw JSON value of [productCode]. + * + * Unlike [productCode], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("product_code") + @ExcludeMissing + fun _productCode(): JsonField = productCode + + /** + * Returns the raw JSON value of [salesTaxAmount]. + * + * Unlike [salesTaxAmount], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sales_tax_amount") + @ExcludeMissing + fun _salesTaxAmount(): JsonField = salesTaxAmount + + /** + * Returns the raw JSON value of [salesTaxRate]. + * + * Unlike [salesTaxRate], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("sales_tax_rate") + @ExcludeMissing + fun _salesTaxRate(): JsonField = salesTaxRate + + /** + * Returns the raw JSON value of [totalAmount]. + * + * Unlike [totalAmount], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("total_amount") + @ExcludeMissing + fun _totalAmount(): JsonField = totalAmount + + /** + * Returns the raw JSON value of [unitCost]. + * + * Unlike [unitCost], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("unit_cost") @ExcludeMissing fun _unitCost(): JsonField = unitCost + + /** + * Returns the raw JSON value of [unitOfMeasureCode]. + * + * Unlike [unitOfMeasureCode], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("unit_of_measure_code") + @ExcludeMissing + fun _unitOfMeasureCode(): JsonField = unitOfMeasureCode + + @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 [LineItem]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LineItem]. */ + class Builder internal constructor() { + + private var discountAmount: JsonField = JsonMissing.of() + private var itemCommodityCode: JsonField = JsonMissing.of() + private var itemDescriptor: JsonField = JsonMissing.of() + private var itemQuantity: JsonField = JsonMissing.of() + private var productCode: JsonField = JsonMissing.of() + private var salesTaxAmount: JsonField = JsonMissing.of() + private var salesTaxRate: JsonField = JsonMissing.of() + private var totalAmount: JsonField = JsonMissing.of() + private var unitCost: JsonField = JsonMissing.of() + private var unitOfMeasureCode: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(lineItem: LineItem) = apply { + discountAmount = lineItem.discountAmount + itemCommodityCode = lineItem.itemCommodityCode + itemDescriptor = lineItem.itemDescriptor + itemQuantity = lineItem.itemQuantity + productCode = lineItem.productCode + salesTaxAmount = lineItem.salesTaxAmount + salesTaxRate = lineItem.salesTaxRate + totalAmount = lineItem.totalAmount + unitCost = lineItem.unitCost + unitOfMeasureCode = lineItem.unitOfMeasureCode + additionalProperties = lineItem.additionalProperties.toMutableMap() + } + + /** Discount amount for this specific line item. */ + fun discountAmount(discountAmount: Long) = discountAmount(JsonField.of(discountAmount)) + + /** + * Sets [Builder.discountAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.discountAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun discountAmount(discountAmount: JsonField) = apply { + this.discountAmount = discountAmount + } + + /** Code used to categorize the purchase item. */ + fun itemCommodityCode(itemCommodityCode: String) = + itemCommodityCode(JsonField.of(itemCommodityCode)) + + /** + * Sets [Builder.itemCommodityCode] to an arbitrary JSON value. + * + * You should usually call [Builder.itemCommodityCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun itemCommodityCode(itemCommodityCode: JsonField) = apply { + this.itemCommodityCode = itemCommodityCode + } + + /** Description of the purchase item. */ + fun itemDescriptor(itemDescriptor: String) = + itemDescriptor(JsonField.of(itemDescriptor)) + + /** + * Sets [Builder.itemDescriptor] to an arbitrary JSON value. + * + * You should usually call [Builder.itemDescriptor] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun itemDescriptor(itemDescriptor: JsonField) = apply { + this.itemDescriptor = itemDescriptor + } + + /** The number of units of the product being purchased. */ + fun itemQuantity(itemQuantity: String) = itemQuantity(JsonField.of(itemQuantity)) + + /** + * Sets [Builder.itemQuantity] to an arbitrary JSON value. + * + * You should usually call [Builder.itemQuantity] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun itemQuantity(itemQuantity: JsonField) = apply { + this.itemQuantity = itemQuantity + } + + /** Code used to categorize the product being purchased. */ + fun productCode(productCode: String) = productCode(JsonField.of(productCode)) + + /** + * Sets [Builder.productCode] to an arbitrary JSON value. + * + * You should usually call [Builder.productCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun productCode(productCode: JsonField) = apply { + this.productCode = productCode + } + + /** Sales tax amount for this line item. */ + fun salesTaxAmount(salesTaxAmount: Long) = salesTaxAmount(JsonField.of(salesTaxAmount)) + + /** + * Sets [Builder.salesTaxAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.salesTaxAmount] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun salesTaxAmount(salesTaxAmount: JsonField) = apply { + this.salesTaxAmount = salesTaxAmount + } + + /** Sales tax rate for this line item. */ + fun salesTaxRate(salesTaxRate: String) = salesTaxRate(JsonField.of(salesTaxRate)) + + /** + * Sets [Builder.salesTaxRate] to an arbitrary JSON value. + * + * You should usually call [Builder.salesTaxRate] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun salesTaxRate(salesTaxRate: JsonField) = apply { + this.salesTaxRate = salesTaxRate + } + + /** Total amount of all line items. */ + fun totalAmount(totalAmount: Long) = totalAmount(JsonField.of(totalAmount)) + + /** + * Sets [Builder.totalAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.totalAmount] with a well-typed [Long] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun totalAmount(totalAmount: JsonField) = apply { this.totalAmount = totalAmount } + + /** Cost of line item per unit of measure, in major units. */ + fun unitCost(unitCost: String) = unitCost(JsonField.of(unitCost)) + + /** + * Sets [Builder.unitCost] to an arbitrary JSON value. + * + * You should usually call [Builder.unitCost] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun unitCost(unitCost: JsonField) = apply { this.unitCost = unitCost } + + /** Code indicating unit of measure (gallons, etc.). */ + fun unitOfMeasureCode(unitOfMeasureCode: String) = + unitOfMeasureCode(JsonField.of(unitOfMeasureCode)) + + /** + * Sets [Builder.unitOfMeasureCode] to an arbitrary JSON value. + * + * You should usually call [Builder.unitOfMeasureCode] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun unitOfMeasureCode(unitOfMeasureCode: JsonField) = apply { + this.unitOfMeasureCode = unitOfMeasureCode + } + + 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 [LineItem]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): LineItem = + LineItem( + discountAmount, + itemCommodityCode, + itemDescriptor, + itemQuantity, + productCode, + salesTaxAmount, + salesTaxRate, + totalAmount, + unitCost, + unitOfMeasureCode, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): LineItem = apply { + if (validated) { + return@apply + } + + discountAmount() + itemCommodityCode() + itemDescriptor() + itemQuantity() + productCode() + salesTaxAmount() + salesTaxRate() + totalAmount() + unitCost() + unitOfMeasureCode() + 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 (discountAmount.asKnown().isPresent) 1 else 0) + + (if (itemCommodityCode.asKnown().isPresent) 1 else 0) + + (if (itemDescriptor.asKnown().isPresent) 1 else 0) + + (if (itemQuantity.asKnown().isPresent) 1 else 0) + + (if (productCode.asKnown().isPresent) 1 else 0) + + (if (salesTaxAmount.asKnown().isPresent) 1 else 0) + + (if (salesTaxRate.asKnown().isPresent) 1 else 0) + + (if (totalAmount.asKnown().isPresent) 1 else 0) + + (if (unitCost.asKnown().isPresent) 1 else 0) + + (if (unitOfMeasureCode.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LineItem && + discountAmount == other.discountAmount && + itemCommodityCode == other.itemCommodityCode && + itemDescriptor == other.itemDescriptor && + itemQuantity == other.itemQuantity && + productCode == other.productCode && + salesTaxAmount == other.salesTaxAmount && + salesTaxRate == other.salesTaxRate && + totalAmount == other.totalAmount && + unitCost == other.unitCost && + unitOfMeasureCode == other.unitOfMeasureCode && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + discountAmount, + itemCommodityCode, + itemDescriptor, + itemQuantity, + productCode, + salesTaxAmount, + salesTaxRate, + totalAmount, + unitCost, + unitOfMeasureCode, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "LineItem{discountAmount=$discountAmount, itemCommodityCode=$itemCommodityCode, itemDescriptor=$itemDescriptor, itemQuantity=$itemQuantity, productCode=$productCode, salesTaxAmount=$salesTaxAmount, salesTaxRate=$salesTaxRate, totalAmount=$totalAmount, unitCost=$unitCost, unitOfMeasureCode=$unitOfMeasureCode, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is CardPurchaseSupplementCreateParams && + body == other.body && + additionalHeaders == other.additionalHeaders && + additionalQueryParams == other.additionalQueryParams + } + + override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams) + + override fun toString() = + "CardPurchaseSupplementCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" +} 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 ee21e8ec1..db21c187c 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 @@ -12,6 +12,7 @@ import com.increase.api.services.async.simulations.CardBalanceInquiryServiceAsyn 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.CardPurchaseSupplementServiceAsync import com.increase.api.services.async.simulations.CardRefundServiceAsync import com.increase.api.services.async.simulations.CardReversalServiceAsync import com.increase.api.services.async.simulations.CardSettlementServiceAsync @@ -71,6 +72,8 @@ interface SimulationServiceAsync { fun cardAuthentications(): CardAuthenticationServiceAsync + fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync + fun cardDisputes(): CardDisputeServiceAsync fun physicalCards(): PhysicalCardServiceAsync @@ -150,6 +153,8 @@ interface SimulationServiceAsync { fun cardAuthentications(): CardAuthenticationServiceAsync.WithRawResponse + fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse + fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse fun physicalCards(): PhysicalCardServiceAsync.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 4c35dc1a7..f6b7fe827 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 @@ -21,6 +21,8 @@ import com.increase.api.services.async.simulations.CardFuelConfirmationServiceAs import com.increase.api.services.async.simulations.CardFuelConfirmationServiceAsyncImpl import com.increase.api.services.async.simulations.CardIncrementServiceAsync import com.increase.api.services.async.simulations.CardIncrementServiceAsyncImpl +import com.increase.api.services.async.simulations.CardPurchaseSupplementServiceAsync +import com.increase.api.services.async.simulations.CardPurchaseSupplementServiceAsyncImpl import com.increase.api.services.async.simulations.CardRefundServiceAsync import com.increase.api.services.async.simulations.CardRefundServiceAsyncImpl import com.increase.api.services.async.simulations.CardReversalServiceAsync @@ -116,6 +118,10 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: CardAuthenticationServiceAsyncImpl(clientOptions) } + private val cardPurchaseSupplements: CardPurchaseSupplementServiceAsync by lazy { + CardPurchaseSupplementServiceAsyncImpl(clientOptions) + } + private val cardDisputes: CardDisputeServiceAsync by lazy { CardDisputeServiceAsyncImpl(clientOptions) } @@ -227,6 +233,9 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun cardAuthentications(): CardAuthenticationServiceAsync = cardAuthentications + override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync = + cardPurchaseSupplements + override fun cardDisputes(): CardDisputeServiceAsync = cardDisputes override fun physicalCards(): PhysicalCardServiceAsync = physicalCards @@ -322,6 +331,11 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: CardAuthenticationServiceAsyncImpl.WithRawResponseImpl(clientOptions) } + private val cardPurchaseSupplements: + CardPurchaseSupplementServiceAsync.WithRawResponse by lazy { + CardPurchaseSupplementServiceAsyncImpl.WithRawResponseImpl(clientOptions) + } + private val cardDisputes: CardDisputeServiceAsync.WithRawResponse by lazy { CardDisputeServiceAsyncImpl.WithRawResponseImpl(clientOptions) } @@ -449,6 +463,9 @@ class SimulationServiceAsyncImpl internal constructor(private val clientOptions: override fun cardAuthentications(): CardAuthenticationServiceAsync.WithRawResponse = cardAuthentications + override fun cardPurchaseSupplements(): CardPurchaseSupplementServiceAsync.WithRawResponse = + cardPurchaseSupplements + override fun cardDisputes(): CardDisputeServiceAsync.WithRawResponse = cardDisputes override fun physicalCards(): PhysicalCardServiceAsync.WithRawResponse = physicalCards diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsync.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsync.kt new file mode 100644 index 000000000..adc5da20c --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsync.kt @@ -0,0 +1,72 @@ +// 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.cardpurchasesupplements.CardPurchaseSupplement +import com.increase.api.models.simulations.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +interface CardPurchaseSupplementServiceAsync { + + /** + * 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): CardPurchaseSupplementServiceAsync + + /** + * Simulates the creation of a Card Purchase Supplement (Level 3 data) for a card settlement. + * This happens asynchronously in production when Visa sends enhanced transaction data about a + * purchase. + */ + fun create( + params: CardPurchaseSupplementCreateParams + ): CompletableFuture = create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture + + /** + * A view of [CardPurchaseSupplementServiceAsync] 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 + ): CardPurchaseSupplementServiceAsync.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/card_purchase_supplements`, but is + * otherwise the same as [CardPurchaseSupplementServiceAsync.create]. + */ + fun create( + params: CardPurchaseSupplementCreateParams + ): CompletableFuture> = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture> + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncImpl.kt new file mode 100644 index 000000000..550a96ea5 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncImpl.kt @@ -0,0 +1,92 @@ +// 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.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.cardpurchasesupplements.CardPurchaseSupplement +import com.increase.api.models.simulations.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.util.concurrent.CompletableFuture +import java.util.function.Consumer + +class CardPurchaseSupplementServiceAsyncImpl +internal constructor(private val clientOptions: ClientOptions) : + CardPurchaseSupplementServiceAsync { + + private val withRawResponse: CardPurchaseSupplementServiceAsync.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): CardPurchaseSupplementServiceAsync.WithRawResponse = + withRawResponse + + override fun withOptions( + modifier: Consumer + ): CardPurchaseSupplementServiceAsync = + CardPurchaseSupplementServiceAsyncImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + override fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture = + // post /simulations/card_purchase_supplements + withRawResponse().create(params, requestOptions).thenApply { it.parse() } + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CardPurchaseSupplementServiceAsync.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): CardPurchaseSupplementServiceAsync.WithRawResponse = + CardPurchaseSupplementServiceAsyncImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions, + ): CompletableFuture> { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "card_purchase_supplements") + .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() + } + } + } + } + } + } +} 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 f4112db8b..95deddf78 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 @@ -12,6 +12,7 @@ import com.increase.api.services.blocking.simulations.CardBalanceInquiryService 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.CardPurchaseSupplementService import com.increase.api.services.blocking.simulations.CardRefundService import com.increase.api.services.blocking.simulations.CardReversalService import com.increase.api.services.blocking.simulations.CardSettlementService @@ -71,6 +72,8 @@ interface SimulationService { fun cardAuthentications(): CardAuthenticationService + fun cardPurchaseSupplements(): CardPurchaseSupplementService + fun cardDisputes(): CardDisputeService fun physicalCards(): PhysicalCardService @@ -147,6 +150,8 @@ interface SimulationService { fun cardAuthentications(): CardAuthenticationService.WithRawResponse + fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse + fun cardDisputes(): CardDisputeService.WithRawResponse fun physicalCards(): PhysicalCardService.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 9dc2cbb65..149cec552 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 @@ -21,6 +21,8 @@ import com.increase.api.services.blocking.simulations.CardFuelConfirmationServic import com.increase.api.services.blocking.simulations.CardFuelConfirmationServiceImpl import com.increase.api.services.blocking.simulations.CardIncrementService import com.increase.api.services.blocking.simulations.CardIncrementServiceImpl +import com.increase.api.services.blocking.simulations.CardPurchaseSupplementService +import com.increase.api.services.blocking.simulations.CardPurchaseSupplementServiceImpl import com.increase.api.services.blocking.simulations.CardRefundService import com.increase.api.services.blocking.simulations.CardRefundServiceImpl import com.increase.api.services.blocking.simulations.CardReversalService @@ -114,6 +116,10 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie CardAuthenticationServiceImpl(clientOptions) } + private val cardPurchaseSupplements: CardPurchaseSupplementService by lazy { + CardPurchaseSupplementServiceImpl(clientOptions) + } + private val cardDisputes: CardDisputeService by lazy { CardDisputeServiceImpl(clientOptions) } private val physicalCards: PhysicalCardService by lazy { @@ -218,6 +224,8 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun cardAuthentications(): CardAuthenticationService = cardAuthentications + override fun cardPurchaseSupplements(): CardPurchaseSupplementService = cardPurchaseSupplements + override fun cardDisputes(): CardDisputeService = cardDisputes override fun physicalCards(): PhysicalCardService = physicalCards @@ -311,6 +319,10 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie CardAuthenticationServiceImpl.WithRawResponseImpl(clientOptions) } + private val cardPurchaseSupplements: CardPurchaseSupplementService.WithRawResponse by lazy { + CardPurchaseSupplementServiceImpl.WithRawResponseImpl(clientOptions) + } + private val cardDisputes: CardDisputeService.WithRawResponse by lazy { CardDisputeServiceImpl.WithRawResponseImpl(clientOptions) } @@ -436,6 +448,9 @@ class SimulationServiceImpl internal constructor(private val clientOptions: Clie override fun cardAuthentications(): CardAuthenticationService.WithRawResponse = cardAuthentications + override fun cardPurchaseSupplements(): CardPurchaseSupplementService.WithRawResponse = + cardPurchaseSupplements + override fun cardDisputes(): CardDisputeService.WithRawResponse = cardDisputes override fun physicalCards(): PhysicalCardService.WithRawResponse = physicalCards diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementService.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementService.kt new file mode 100644 index 000000000..c83a24216 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementService.kt @@ -0,0 +1,72 @@ +// 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.cardpurchasesupplements.CardPurchaseSupplement +import com.increase.api.models.simulations.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.util.function.Consumer + +interface CardPurchaseSupplementService { + + /** + * 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): CardPurchaseSupplementService + + /** + * Simulates the creation of a Card Purchase Supplement (Level 3 data) for a card settlement. + * This happens asynchronously in production when Visa sends enhanced transaction data about a + * purchase. + */ + fun create(params: CardPurchaseSupplementCreateParams): CardPurchaseSupplement = + create(params, RequestOptions.none()) + + /** @see create */ + fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CardPurchaseSupplement + + /** + * A view of [CardPurchaseSupplementService] 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 + ): CardPurchaseSupplementService.WithRawResponse + + /** + * Returns a raw HTTP response for `post /simulations/card_purchase_supplements`, but is + * otherwise the same as [CardPurchaseSupplementService.create]. + */ + @MustBeClosed + fun create( + params: CardPurchaseSupplementCreateParams + ): HttpResponseFor = create(params, RequestOptions.none()) + + /** @see create */ + @MustBeClosed + fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor + } +} diff --git a/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceImpl.kt b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceImpl.kt new file mode 100644 index 000000000..e33240528 --- /dev/null +++ b/increase-java-core/src/main/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceImpl.kt @@ -0,0 +1,84 @@ +// 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.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.cardpurchasesupplements.CardPurchaseSupplement +import com.increase.api.models.simulations.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.util.function.Consumer + +class CardPurchaseSupplementServiceImpl +internal constructor(private val clientOptions: ClientOptions) : CardPurchaseSupplementService { + + private val withRawResponse: CardPurchaseSupplementService.WithRawResponse by lazy { + WithRawResponseImpl(clientOptions) + } + + override fun withRawResponse(): CardPurchaseSupplementService.WithRawResponse = withRawResponse + + override fun withOptions( + modifier: Consumer + ): CardPurchaseSupplementService = + CardPurchaseSupplementServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) + + override fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions, + ): CardPurchaseSupplement = + // post /simulations/card_purchase_supplements + withRawResponse().create(params, requestOptions).parse() + + class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : + CardPurchaseSupplementService.WithRawResponse { + + private val errorHandler: Handler = + errorHandler(errorBodyHandler(clientOptions.jsonMapper)) + + override fun withOptions( + modifier: Consumer + ): CardPurchaseSupplementService.WithRawResponse = + CardPurchaseSupplementServiceImpl.WithRawResponseImpl( + clientOptions.toBuilder().apply(modifier::accept).build() + ) + + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper) + + override fun create( + params: CardPurchaseSupplementCreateParams, + requestOptions: RequestOptions, + ): HttpResponseFor { + val request = + HttpRequest.builder() + .method(HttpMethod.POST) + .baseUrl(clientOptions.baseUrl()) + .addPathSegments("simulations", "card_purchase_supplements") + .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() + } + } + } + } + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParamsTest.kt new file mode 100644 index 000000000..6570fb547 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/simulations/cardpurchasesupplements/CardPurchaseSupplementCreateParamsTest.kt @@ -0,0 +1,128 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.increase.api.models.simulations.cardpurchasesupplements + +import java.time.LocalDate +import kotlin.jvm.optionals.getOrNull +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +internal class CardPurchaseSupplementCreateParamsTest { + + @Test + fun create() { + CardPurchaseSupplementCreateParams.builder() + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .invoice( + CardPurchaseSupplementCreateParams.Invoice.builder() + .discountAmount(100L) + .dutyTaxAmount(200L) + .orderDate(LocalDate.parse("2023-07-20")) + .shippingAmount(300L) + .shippingDestinationCountryCode("US") + .shippingDestinationPostalCode("10045") + .shippingSourcePostalCode("10045") + .shippingTaxAmount(400L) + .shippingTaxRate("0.2") + .uniqueValueAddedTaxInvoiceReference("12302") + .build() + ) + .addLineItem( + CardPurchaseSupplementCreateParams.LineItem.builder() + .discountAmount(0L) + .itemCommodityCode("001") + .itemDescriptor("Coffee") + .itemQuantity("1") + .productCode("101") + .salesTaxAmount(0L) + .salesTaxRate("-16699") + .totalAmount(500L) + .unitCost("5") + .unitOfMeasureCode("NMB") + .build() + ) + .build() + } + + @Test + fun body() { + val params = + CardPurchaseSupplementCreateParams.builder() + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .invoice( + CardPurchaseSupplementCreateParams.Invoice.builder() + .discountAmount(100L) + .dutyTaxAmount(200L) + .orderDate(LocalDate.parse("2023-07-20")) + .shippingAmount(300L) + .shippingDestinationCountryCode("US") + .shippingDestinationPostalCode("10045") + .shippingSourcePostalCode("10045") + .shippingTaxAmount(400L) + .shippingTaxRate("0.2") + .uniqueValueAddedTaxInvoiceReference("12302") + .build() + ) + .addLineItem( + CardPurchaseSupplementCreateParams.LineItem.builder() + .discountAmount(0L) + .itemCommodityCode("001") + .itemDescriptor("Coffee") + .itemQuantity("1") + .productCode("101") + .salesTaxAmount(0L) + .salesTaxRate("-16699") + .totalAmount(500L) + .unitCost("5") + .unitOfMeasureCode("NMB") + .build() + ) + .build() + + val body = params._body() + + assertThat(body.transactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") + assertThat(body.invoice()) + .contains( + CardPurchaseSupplementCreateParams.Invoice.builder() + .discountAmount(100L) + .dutyTaxAmount(200L) + .orderDate(LocalDate.parse("2023-07-20")) + .shippingAmount(300L) + .shippingDestinationCountryCode("US") + .shippingDestinationPostalCode("10045") + .shippingSourcePostalCode("10045") + .shippingTaxAmount(400L) + .shippingTaxRate("0.2") + .uniqueValueAddedTaxInvoiceReference("12302") + .build() + ) + assertThat(body.lineItems().getOrNull()) + .containsExactly( + CardPurchaseSupplementCreateParams.LineItem.builder() + .discountAmount(0L) + .itemCommodityCode("001") + .itemDescriptor("Coffee") + .itemQuantity("1") + .productCode("101") + .salesTaxAmount(0L) + .salesTaxRate("-16699") + .totalAmount(500L) + .unitCost("5") + .unitOfMeasureCode("NMB") + .build() + ) + } + + @Test + fun bodyWithoutOptionalFields() { + val params = + CardPurchaseSupplementCreateParams.builder() + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .build() + + val body = params._body() + + assertThat(body.transactionId()).isEqualTo("transaction_uyrp7fld2ium70oa7oi") + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncTest.kt new file mode 100644 index 000000000..e78e36393 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/simulations/CardPurchaseSupplementServiceAsyncTest.kt @@ -0,0 +1,62 @@ +// 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.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.time.LocalDate +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class CardPurchaseSupplementServiceAsyncTest { + + @Test + fun create() { + val client = + IncreaseOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val cardPurchaseSupplementServiceAsync = client.simulations().cardPurchaseSupplements() + + val cardPurchaseSupplementFuture = + cardPurchaseSupplementServiceAsync.create( + CardPurchaseSupplementCreateParams.builder() + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .invoice( + CardPurchaseSupplementCreateParams.Invoice.builder() + .discountAmount(100L) + .dutyTaxAmount(200L) + .orderDate(LocalDate.parse("2023-07-20")) + .shippingAmount(300L) + .shippingDestinationCountryCode("US") + .shippingDestinationPostalCode("10045") + .shippingSourcePostalCode("10045") + .shippingTaxAmount(400L) + .shippingTaxRate("0.2") + .uniqueValueAddedTaxInvoiceReference("12302") + .build() + ) + .addLineItem( + CardPurchaseSupplementCreateParams.LineItem.builder() + .discountAmount(0L) + .itemCommodityCode("001") + .itemDescriptor("Coffee") + .itemQuantity("1") + .productCode("101") + .salesTaxAmount(0L) + .salesTaxRate("-16699") + .totalAmount(500L) + .unitCost("5") + .unitOfMeasureCode("NMB") + .build() + ) + .build() + ) + + val cardPurchaseSupplement = cardPurchaseSupplementFuture.get() + cardPurchaseSupplement.validate() + } +} diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceTest.kt new file mode 100644 index 000000000..0abb6b169 --- /dev/null +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/simulations/CardPurchaseSupplementServiceTest.kt @@ -0,0 +1,61 @@ +// 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.cardpurchasesupplements.CardPurchaseSupplementCreateParams +import java.time.LocalDate +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.extension.ExtendWith + +@ExtendWith(TestServerExtension::class) +internal class CardPurchaseSupplementServiceTest { + + @Test + fun create() { + val client = + IncreaseOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val cardPurchaseSupplementService = client.simulations().cardPurchaseSupplements() + + val cardPurchaseSupplement = + cardPurchaseSupplementService.create( + CardPurchaseSupplementCreateParams.builder() + .transactionId("transaction_uyrp7fld2ium70oa7oi") + .invoice( + CardPurchaseSupplementCreateParams.Invoice.builder() + .discountAmount(100L) + .dutyTaxAmount(200L) + .orderDate(LocalDate.parse("2023-07-20")) + .shippingAmount(300L) + .shippingDestinationCountryCode("US") + .shippingDestinationPostalCode("10045") + .shippingSourcePostalCode("10045") + .shippingTaxAmount(400L) + .shippingTaxRate("0.2") + .uniqueValueAddedTaxInvoiceReference("12302") + .build() + ) + .addLineItem( + CardPurchaseSupplementCreateParams.LineItem.builder() + .discountAmount(0L) + .itemCommodityCode("001") + .itemDescriptor("Coffee") + .itemQuantity("1") + .productCode("101") + .salesTaxAmount(0L) + .salesTaxRate("-16699") + .totalAmount(500L) + .unitCost("5") + .unitOfMeasureCode("NMB") + .build() + ) + .build() + ) + + cardPurchaseSupplement.validate() + } +} From b8de2a2e94463118e3724830769e86e3b1f8b9c9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Apr 2026 21:19:04 +0000 Subject: [PATCH 3/3] release: 0.515.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 9 +++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1014297ec..83946c948 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.514.0" + ".": "0.515.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ee955e001..86cd8b0a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.515.0 (2026-04-13) + +Full Changelog: [v0.514.0...v0.515.0](https://github.com/Increase/increase-java/compare/v0.514.0...v0.515.0) + +### Features + +* **api:** api update ([aea3469](https://github.com/Increase/increase-java/commit/aea34699ae0d285570eb297d6cb1b0ee37a37422)) +* **api:** api update ([41a701b](https://github.com/Increase/increase-java/commit/41a701b352f547ae79f4210791155335019c345e)) + ## 0.514.0 (2026-04-13) Full Changelog: [v0.513.0...v0.514.0](https://github.com/Increase/increase-java/compare/v0.513.0...v0.514.0) diff --git a/README.md b/README.md index 916e509ff..1c7e4aa94 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.514.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.514.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.514.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.515.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.515.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.515.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.514.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.515.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.514.0") +implementation("com.increase.api:increase-java:0.515.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.514.0") com.increase.api increase-java - 0.514.0 + 0.515.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 4f31d9c09..173b0236d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.514.0" // x-release-please-version + version = "0.515.0" // x-release-please-version } subprojects {