From b6cbb943fe26b6ba4dacf1b712994036fcc5bfe5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Apr 2026 22:44:30 +0000 Subject: [PATCH 1/3] feat(api): api update --- .stats.yml | 4 +- .../com/increase/api/models/cards/Card.kt | 1993 ++++++++++++----- .../api/models/cards/CardCreateParams.kt | 1939 +++++++++++----- .../api/models/cards/CardUpdateParams.kt | 1939 +++++++++++----- .../api/models/cards/CardCreateParamsTest.kt | 190 +- .../models/cards/CardListPageResponseTest.kt | 183 +- .../com/increase/api/models/cards/CardTest.kt | 164 +- .../api/models/cards/CardUpdateParamsTest.kt | 190 +- .../services/async/CardServiceAsyncTest.kt | 136 +- .../api/services/blocking/CardServiceTest.kt | 136 +- 10 files changed, 5061 insertions(+), 1813 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5fef959d3..59a5dddff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-c73835a51350d0f42d529d2731b0d4da4487f55b1c98a6e0a322c21b1264f209.yml -openapi_spec_hash: 23561aff9285210e32b4e15e1486a01a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-10b0412eb48b8e2b9720b29cf479448d246a9169c1937177f11a3d2ef80ae7f1.yml +openapi_spec_hash: ed688969255974736f3fbd4e6f30194e config_hash: 4945e03affdf289484733306e4797f81 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt index dc44319a4..f513d547c 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt @@ -736,19 +736,15 @@ private constructor( class AuthorizationControls @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val maximumAuthorizationCount: JsonField, private val merchantAcceptorIdentifier: JsonField, private val merchantCategoryCode: JsonField, private val merchantCountry: JsonField, - private val spendingLimits: JsonField>, + private val usage: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - maximumAuthorizationCount: JsonField = JsonMissing.of(), @JsonProperty("merchant_acceptor_identifier") @ExcludeMissing merchantAcceptorIdentifier: JsonField = JsonMissing.of(), @@ -758,27 +754,15 @@ private constructor( @JsonProperty("merchant_country") @ExcludeMissing merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("spending_limits") - @ExcludeMissing - spendingLimits: JsonField> = JsonMissing.of(), + @JsonProperty("usage") @ExcludeMissing usage: JsonField = JsonMissing.of(), ) : this( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, mutableMapOf(), ) - /** - * Limits the number of authorizations that can be approved on this card. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun maximumAuthorizationCount(): Optional = - maximumAuthorizationCount.getOptional("maximum_authorization_count") - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this * card. @@ -810,25 +794,12 @@ private constructor( merchantCountry.getOptional("merchant_country") /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. + * Controls how many times this card can be used. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun spendingLimits(): Optional> = - spendingLimits.getOptional("spending_limits") - - /** - * Returns the raw JSON value of [maximumAuthorizationCount]. - * - * Unlike [maximumAuthorizationCount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - fun _maximumAuthorizationCount(): JsonField = - maximumAuthorizationCount + fun usage(): Optional = usage.getOptional("usage") /** * Returns the raw JSON value of [merchantAcceptorIdentifier]. @@ -862,14 +833,11 @@ private constructor( fun _merchantCountry(): JsonField = merchantCountry /** - * Returns the raw JSON value of [spendingLimits]. + * Returns the raw JSON value of [usage]. * - * Unlike [spendingLimits], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [usage], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("spending_limits") - @ExcludeMissing - fun _spendingLimits(): JsonField> = spendingLimits + @JsonProperty("usage") @ExcludeMissing fun _usage(): JsonField = usage @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -890,11 +858,10 @@ private constructor( * * The following fields are required: * ```java - * .maximumAuthorizationCount() * .merchantAcceptorIdentifier() * .merchantCategoryCode() * .merchantCountry() - * .spendingLimits() + * .usage() * ``` */ @JvmStatic fun builder() = Builder() @@ -903,46 +870,21 @@ private constructor( /** A builder for [AuthorizationControls]. */ class Builder internal constructor() { - private var maximumAuthorizationCount: JsonField? = null private var merchantAcceptorIdentifier: JsonField? = null private var merchantCategoryCode: JsonField? = null private var merchantCountry: JsonField? = null - private var spendingLimits: JsonField>? = null + private var usage: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authorizationControls: AuthorizationControls) = apply { - maximumAuthorizationCount = authorizationControls.maximumAuthorizationCount merchantAcceptorIdentifier = authorizationControls.merchantAcceptorIdentifier merchantCategoryCode = authorizationControls.merchantCategoryCode merchantCountry = authorizationControls.merchantCountry - spendingLimits = authorizationControls.spendingLimits.map { it.toMutableList() } + usage = authorizationControls.usage additionalProperties = authorizationControls.additionalProperties.toMutableMap() } - /** Limits the number of authorizations that can be approved on this card. */ - fun maximumAuthorizationCount(maximumAuthorizationCount: MaximumAuthorizationCount?) = - maximumAuthorizationCount(JsonField.ofNullable(maximumAuthorizationCount)) - - /** - * Alias for calling [Builder.maximumAuthorizationCount] with - * `maximumAuthorizationCount.orElse(null)`. - */ - fun maximumAuthorizationCount( - maximumAuthorizationCount: Optional - ) = maximumAuthorizationCount(maximumAuthorizationCount.getOrNull()) - - /** - * Sets [Builder.maximumAuthorizationCount] to an arbitrary JSON value. - * - * You should usually call [Builder.maximumAuthorizationCount] with a well-typed - * [MaximumAuthorizationCount] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun maximumAuthorizationCount( - maximumAuthorizationCount: JsonField - ) = apply { this.maximumAuthorizationCount = maximumAuthorizationCount } - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on * this card. @@ -1018,39 +960,20 @@ private constructor( this.merchantCountry = merchantCountry } - /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. - */ - fun spendingLimits(spendingLimits: List?) = - spendingLimits(JsonField.ofNullable(spendingLimits)) - - /** Alias for calling [Builder.spendingLimits] with `spendingLimits.orElse(null)`. */ - fun spendingLimits(spendingLimits: Optional>) = - spendingLimits(spendingLimits.getOrNull()) + /** Controls how many times this card can be used. */ + fun usage(usage: Usage?) = usage(JsonField.ofNullable(usage)) - /** - * Sets [Builder.spendingLimits] to an arbitrary JSON value. - * - * You should usually call [Builder.spendingLimits] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun spendingLimits(spendingLimits: JsonField>) = apply { - this.spendingLimits = spendingLimits.map { it.toMutableList() } - } + /** Alias for calling [Builder.usage] with `usage.orElse(null)`. */ + fun usage(usage: Optional) = usage(usage.getOrNull()) /** - * Adds a single [SpendingLimit] to [spendingLimits]. + * Sets [Builder.usage] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.usage] with a well-typed [Usage] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { - spendingLimits = - (spendingLimits ?: JsonField.of(mutableListOf())).also { - checkKnown("spendingLimits", it).add(spendingLimit) - } - } + fun usage(usage: JsonField) = apply { this.usage = usage } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1078,22 +1001,20 @@ private constructor( * * The following fields are required: * ```java - * .maximumAuthorizationCount() * .merchantAcceptorIdentifier() * .merchantCategoryCode() * .merchantCountry() - * .spendingLimits() + * .usage() * ``` * * @throws IllegalStateException if any required field is unset. */ fun build(): AuthorizationControls = AuthorizationControls( - checkRequired("maximumAuthorizationCount", maximumAuthorizationCount), checkRequired("merchantAcceptorIdentifier", merchantAcceptorIdentifier), checkRequired("merchantCategoryCode", merchantCategoryCode), checkRequired("merchantCountry", merchantCountry), - checkRequired("spendingLimits", spendingLimits).map { it.toImmutable() }, + checkRequired("usage", usage), additionalProperties.toMutableMap(), ) } @@ -1105,11 +1026,10 @@ private constructor( return@apply } - maximumAuthorizationCount().ifPresent { it.validate() } merchantAcceptorIdentifier().ifPresent { it.validate() } merchantCategoryCode().ifPresent { it.validate() } merchantCountry().ifPresent { it.validate() } - spendingLimits().ifPresent { it.forEach { it.validate() } } + usage().ifPresent { it.validate() } validated = true } @@ -1129,192 +1049,10 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (maximumAuthorizationCount.asKnown().getOrNull()?.validity() ?: 0) + - (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + + (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + (merchantCategoryCode.asKnown().getOrNull()?.validity() ?: 0) + (merchantCountry.asKnown().getOrNull()?.validity() ?: 0) + - (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** Limits the number of authorizations that can be approved on this card. */ - class MaximumAuthorizationCount - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val allTime: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("all_time") - @ExcludeMissing - allTime: JsonField = JsonMissing.of() - ) : this(allTime, mutableMapOf()) - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun allTime(): Optional = allTime.getOptional("all_time") - - /** - * Returns the raw JSON value of [allTime]. - * - * Unlike [allTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("all_time") @ExcludeMissing fun _allTime(): JsonField = allTime - - @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 - * [MaximumAuthorizationCount]. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MaximumAuthorizationCount]. */ - class Builder internal constructor() { - - private var allTime: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(maximumAuthorizationCount: MaximumAuthorizationCount) = apply { - allTime = maximumAuthorizationCount.allTime - additionalProperties = - maximumAuthorizationCount.additionalProperties.toMutableMap() - } - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - */ - fun allTime(allTime: Long?) = allTime(JsonField.ofNullable(allTime)) - - /** - * Alias for [Builder.allTime]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun allTime(allTime: Long) = allTime(allTime as Long?) - - /** Alias for calling [Builder.allTime] with `allTime.orElse(null)`. */ - fun allTime(allTime: Optional) = allTime(allTime.getOrNull()) - - /** - * Sets [Builder.allTime] to an arbitrary JSON value. - * - * You should usually call [Builder.allTime] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun allTime(allTime: JsonField) = apply { this.allTime = allTime } - - 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 [MaximumAuthorizationCount]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): MaximumAuthorizationCount = - MaximumAuthorizationCount( - checkRequired("allTime", allTime), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): MaximumAuthorizationCount = apply { - if (validated) { - return@apply - } - - allTime() - 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 (allTime.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MaximumAuthorizationCount && - allTime == other.allTime && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(allTime, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "MaximumAuthorizationCount{allTime=$allTime, additionalProperties=$additionalProperties}" - } + (usage.asKnown().getOrNull()?.validity() ?: 0) /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this @@ -3065,86 +2803,83 @@ private constructor( "MerchantCountry{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}" } - class SpendingLimit + /** Controls how many times this card can be used. */ + class Usage @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val interval: JsonField, - private val merchantCategoryCodes: JsonField>, - private val settlementAmount: JsonField, + private val category: JsonField, + private val multiUse: JsonField, + private val singleUse: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - interval: JsonField = JsonMissing.of(), - @JsonProperty("merchant_category_codes") + category: JsonField = JsonMissing.of(), + @JsonProperty("multi_use") @ExcludeMissing - merchantCategoryCodes: JsonField> = JsonMissing.of(), - @JsonProperty("settlement_amount") + multiUse: JsonField = JsonMissing.of(), + @JsonProperty("single_use") @ExcludeMissing - settlementAmount: JsonField = JsonMissing.of(), - ) : this(interval, merchantCategoryCodes, settlementAmount, mutableMapOf()) + singleUse: JsonField = JsonMissing.of(), + ) : this(category, multiUse, singleUse, mutableMapOf()) /** - * The interval at which the spending limit is enforced. + * Whether the card is for a single use or multiple uses. * * @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 interval(): Interval = interval.getRequired("interval") + fun category(): Category = category.getRequired("category") /** - * The Merchant Category Codes (MCCs) this spending limit applies to. If not set, the - * limit applies to all transactions. + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun merchantCategoryCodes(): Optional> = - merchantCategoryCodes.getOptional("merchant_category_codes") + fun multiUse(): Optional = multiUse.getOptional("multi_use") /** - * The maximum settlement amount permitted in the given interval. + * Controls for single-use cards. Required if and only if `category` is `single_use`. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + fun singleUse(): Optional = singleUse.getOptional("single_use") /** - * Returns the raw JSON value of [interval]. + * Returns the raw JSON value of [category]. * - * Unlike [interval], this method doesn't throw if the JSON field has an unexpected + * Unlike [category], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - fun _interval(): JsonField = interval + fun _category(): JsonField = category /** - * Returns the raw JSON value of [merchantCategoryCodes]. + * Returns the raw JSON value of [multiUse]. * - * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [multiUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("merchant_category_codes") + @JsonProperty("multi_use") @ExcludeMissing - fun _merchantCategoryCodes(): JsonField> = - merchantCategoryCodes + fun _multiUse(): JsonField = multiUse /** - * Returns the raw JSON value of [settlementAmount]. + * Returns the raw JSON value of [singleUse]. * - * Unlike [settlementAmount], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [singleUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("settlement_amount") + @JsonProperty("single_use") @ExcludeMissing - fun _settlementAmount(): JsonField = settlementAmount + fun _singleUse(): JsonField = singleUse @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3161,101 +2896,81 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [SpendingLimit]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java - * .interval() - * .merchantCategoryCodes() - * .settlementAmount() + * .category() + * .multiUse() + * .singleUse() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [SpendingLimit]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { - private var interval: JsonField? = null - private var merchantCategoryCodes: JsonField>? = - null - private var settlementAmount: JsonField? = null + private var category: JsonField? = null + private var multiUse: JsonField? = null + private var singleUse: JsonField? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(spendingLimit: SpendingLimit) = apply { - interval = spendingLimit.interval - merchantCategoryCodes = - spendingLimit.merchantCategoryCodes.map { it.toMutableList() } - settlementAmount = spendingLimit.settlementAmount - additionalProperties = spendingLimit.additionalProperties.toMutableMap() + internal fun from(usage: Usage) = apply { + category = usage.category + multiUse = usage.multiUse + singleUse = usage.singleUse + additionalProperties = usage.additionalProperties.toMutableMap() } - /** The interval at which the spending limit is enforced. */ - fun interval(interval: Interval) = interval(JsonField.of(interval)) + /** Whether the card is for a single use or multiple uses. */ + fun category(category: Category) = category(JsonField.of(category)) /** - * Sets [Builder.interval] to an arbitrary JSON value. + * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.interval] with a well-typed [Interval] value + * You should usually call [Builder.category] with a well-typed [Category] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun interval(interval: JsonField) = apply { this.interval = interval } + fun category(category: JsonField) = apply { this.category = category } /** - * The Merchant Category Codes (MCCs) this spending limit applies to. If not set, - * the limit applies to all transactions. + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. */ - fun merchantCategoryCodes(merchantCategoryCodes: List?) = - merchantCategoryCodes(JsonField.ofNullable(merchantCategoryCodes)) + fun multiUse(multiUse: MultiUse?) = multiUse(JsonField.ofNullable(multiUse)) - /** - * Alias for calling [Builder.merchantCategoryCodes] with - * `merchantCategoryCodes.orElse(null)`. - */ - fun merchantCategoryCodes( - merchantCategoryCodes: Optional> - ) = merchantCategoryCodes(merchantCategoryCodes.getOrNull()) + /** Alias for calling [Builder.multiUse] with `multiUse.orElse(null)`. */ + fun multiUse(multiUse: Optional) = multiUse(multiUse.getOrNull()) /** - * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. + * Sets [Builder.multiUse] to an arbitrary JSON value. * - * You should usually call [Builder.merchantCategoryCodes] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * You should usually call [Builder.multiUse] with a well-typed [MultiUse] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun merchantCategoryCodes( - merchantCategoryCodes: JsonField> - ) = apply { - this.merchantCategoryCodes = merchantCategoryCodes.map { it.toMutableList() } - } + fun multiUse(multiUse: JsonField) = apply { this.multiUse = multiUse } /** - * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. - * - * @throws IllegalStateException if the field was previously set to a non-list. + * Controls for single-use cards. Required if and only if `category` is + * `single_use`. */ - fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = apply { - merchantCategoryCodes = - (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { - checkKnown("merchantCategoryCodes", it).add(merchantCategoryCode) - } - } + fun singleUse(singleUse: SingleUse?) = singleUse(JsonField.ofNullable(singleUse)) - /** The maximum settlement amount permitted in the given interval. */ - fun settlementAmount(settlementAmount: Long) = - settlementAmount(JsonField.of(settlementAmount)) + /** Alias for calling [Builder.singleUse] with `singleUse.orElse(null)`. */ + fun singleUse(singleUse: Optional) = singleUse(singleUse.getOrNull()) /** - * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * Sets [Builder.singleUse] to an arbitrary JSON value. * - * You should usually call [Builder.settlementAmount] with a well-typed [Long] value + * You should usually call [Builder.singleUse] with a well-typed [SingleUse] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun settlementAmount(settlementAmount: JsonField) = apply { - this.settlementAmount = settlementAmount + fun singleUse(singleUse: JsonField) = apply { + this.singleUse = singleUse } fun additionalProperties(additionalProperties: Map) = apply { @@ -3281,40 +2996,38 @@ private constructor( } /** - * Returns an immutable instance of [SpendingLimit]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .interval() - * .merchantCategoryCodes() - * .settlementAmount() + * .category() + * .multiUse() + * .singleUse() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): SpendingLimit = - SpendingLimit( - checkRequired("interval", interval), - checkRequired("merchantCategoryCodes", merchantCategoryCodes).map { - it.toImmutable() - }, - checkRequired("settlementAmount", settlementAmount), + fun build(): Usage = + Usage( + checkRequired("category", category), + checkRequired("multiUse", multiUse), + checkRequired("singleUse", singleUse), additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): SpendingLimit = apply { + fun validate(): Usage = apply { if (validated) { return@apply } - interval().validate() - merchantCategoryCodes().ifPresent { it.forEach { it.validate() } } - settlementAmount() + category().validate() + multiUse().ifPresent { it.validate() } + singleUse().ifPresent { it.validate() } validated = true } @@ -3334,13 +3047,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (interval.asKnown().getOrNull()?.validity() ?: 0) + - (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + - (if (settlementAmount.asKnown().isPresent) 1 else 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + + (multiUse.asKnown().getOrNull()?.validity() ?: 0) + + (singleUse.asKnown().getOrNull()?.validity() ?: 0) - /** The interval at which the spending limit is enforced. */ - class Interval @JsonCreator private constructor(private val value: JsonField) : + /** Whether the card is for a single use or multiple uses. */ + class Category @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3355,78 +3067,39 @@ private constructor( companion object { - /** The spending limit applies over the lifetime of the card. */ - @JvmField val ALL_TIME = of("all_time") - - /** The spending limit applies per transaction. */ - @JvmField val PER_TRANSACTION = of("per_transaction") + /** The card can only be used for a single authorization. */ + @JvmField val SINGLE_USE = of("single_use") - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - @JvmField val PER_DAY = of("per_day") + /** The card can be used for multiple authorizations. */ + @JvmField val MULTI_USE = of("multi_use") - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - @JvmField val PER_WEEK = of("per_week") - - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - @JvmField val PER_MONTH = of("per_month") - - @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) } - /** An enum containing [Interval]'s known values. */ + /** An enum containing [Category]'s known values. */ enum class Known { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, } /** - * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Interval] can contain an unknown value in a couple of cases: + * An instance of [Category] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, - /** - * An enum member indicating that [Interval] was instantiated with an unknown + * An enum member indicating that [Category] was instantiated with an unknown * value. */ _UNKNOWN, @@ -3441,11 +3114,8 @@ private constructor( */ fun value(): Value = when (this) { - ALL_TIME -> Value.ALL_TIME - PER_TRANSACTION -> Value.PER_TRANSACTION - PER_DAY -> Value.PER_DAY - PER_WEEK -> Value.PER_WEEK - PER_MONTH -> Value.PER_MONTH + SINGLE_USE -> Value.SINGLE_USE + MULTI_USE -> Value.MULTI_USE else -> Value._UNKNOWN } @@ -3460,12 +3130,9 @@ private constructor( */ fun known(): Known = when (this) { - ALL_TIME -> Known.ALL_TIME - PER_TRANSACTION -> Known.PER_TRANSACTION - PER_DAY -> Known.PER_DAY - PER_WEEK -> Known.PER_WEEK - PER_MONTH -> Known.PER_MONTH - else -> throw IncreaseInvalidDataException("Unknown Interval: $value") + SINGLE_USE -> Known.SINGLE_USE + MULTI_USE -> Known.MULTI_USE + else -> throw IncreaseInvalidDataException("Unknown Category: $value") } /** @@ -3484,7 +3151,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Interval = apply { + fun validate(): Category = apply { if (validated) { return@apply } @@ -3514,7 +3181,7 @@ private constructor( return true } - return other is Interval && value == other.value + return other is Category && value == other.value } override fun hashCode() = value.hashCode() @@ -3522,34 +3189,40 @@ private constructor( override fun toString() = value.toString() } - class MerchantCategoryCode + /** Controls for multi-use cards. Required if and only if `category` is `multi_use`. */ + class MultiUse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val code: JsonField, + private val spendingLimits: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of() - ) : this(code, mutableMapOf()) + @JsonProperty("spending_limits") + @ExcludeMissing + spendingLimits: JsonField> = JsonMissing.of() + ) : this(spendingLimits, mutableMapOf()) /** - * The Merchant Category Code (MCC). + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun code(): String = code.getRequired("code") + fun spendingLimits(): Optional> = + spendingLimits.getOptional("spending_limits") /** - * Returns the raw JSON value of [code]. + * Returns the raw JSON value of [spendingLimits]. * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [spendingLimits], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + @JsonProperty("spending_limits") + @ExcludeMissing + fun _spendingLimits(): JsonField> = spendingLimits @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3566,41 +3239,64 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of - * [MerchantCategoryCode]. + * Returns a mutable builder for constructing an instance of [MultiUse]. * * The following fields are required: * ```java - * .code() + * .spendingLimits() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [MerchantCategoryCode]. */ + /** A builder for [MultiUse]. */ class Builder internal constructor() { - private var code: JsonField? = null + private var spendingLimits: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { - code = merchantCategoryCode.code - additionalProperties = - merchantCategoryCode.additionalProperties.toMutableMap() + internal fun from(multiUse: MultiUse) = apply { + spendingLimits = multiUse.spendingLimits.map { it.toMutableList() } + additionalProperties = multiUse.additionalProperties.toMutableMap() } - /** The Merchant Category Code (MCC). */ - fun code(code: String) = code(JsonField.of(code)) + /** + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. + */ + fun spendingLimits(spendingLimits: List?) = + spendingLimits(JsonField.ofNullable(spendingLimits)) /** - * Sets [Builder.code] to an arbitrary JSON value. + * Alias for calling [Builder.spendingLimits] with + * `spendingLimits.orElse(null)`. + */ + fun spendingLimits(spendingLimits: Optional>) = + spendingLimits(spendingLimits.getOrNull()) + + /** + * Sets [Builder.spendingLimits] to an arbitrary JSON value. * - * You should usually call [Builder.code] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.spendingLimits] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun code(code: JsonField) = apply { this.code = code } + fun spendingLimits(spendingLimits: JsonField>) = apply { + this.spendingLimits = spendingLimits.map { it.toMutableList() } + } + + /** + * Adds a single [SpendingLimit] to [spendingLimits]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { + spendingLimits = + (spendingLimits ?: JsonField.of(mutableListOf())).also { + checkKnown("spendingLimits", it).add(spendingLimit) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3625,32 +3321,34 @@ private constructor( } /** - * Returns an immutable instance of [MerchantCategoryCode]. + * Returns an immutable instance of [MultiUse]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .code() + * .spendingLimits() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): MerchantCategoryCode = - MerchantCategoryCode( - checkRequired("code", code), + fun build(): MultiUse = + MultiUse( + checkRequired("spendingLimits", spendingLimits).map { + it.toImmutable() + }, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): MerchantCategoryCode = apply { + fun validate(): MultiUse = apply { if (validated) { return@apply } - code() + spendingLimits().ifPresent { it.forEach { it.validate() } } validated = true } @@ -3669,24 +3367,1260 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (code.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = + (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + class SpendingLimit + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val interval: JsonField, + private val merchantCategoryCodes: JsonField>, + private val settlementAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("interval") + @ExcludeMissing + interval: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_codes") + @ExcludeMissing + merchantCategoryCodes: JsonField> = + JsonMissing.of(), + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of(), + ) : this(interval, merchantCategoryCodes, settlementAmount, mutableMapOf()) - return other is MerchantCategoryCode && - code == other.code && - additionalProperties == other.additionalProperties - } + /** + * The interval at which the spending limit is enforced. + * + * @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 interval(): Interval = interval.getRequired("interval") - private val hashCode: Int by lazy { Objects.hash(code, additionalProperties) } + /** + * The Merchant Category Codes (MCCs) this spending limit applies to. If not + * set, the limit applies to all transactions. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun merchantCategoryCodes(): Optional> = + merchantCategoryCodes.getOptional("merchant_category_codes") + + /** + * The maximum settlement amount permitted in the given interval. + * + * @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 settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + + /** + * Returns the raw JSON value of [interval]. + * + * Unlike [interval], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("interval") + @ExcludeMissing + fun _interval(): JsonField = interval + + /** + * Returns the raw JSON value of [merchantCategoryCodes]. + * + * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("merchant_category_codes") + @ExcludeMissing + fun _merchantCategoryCodes(): JsonField> = + merchantCategoryCodes + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + @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 + * [SpendingLimit]. + * + * The following fields are required: + * ```java + * .interval() + * .merchantCategoryCodes() + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SpendingLimit]. */ + class Builder internal constructor() { + + private var interval: JsonField? = null + private var merchantCategoryCodes: + JsonField>? = + null + private var settlementAmount: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(spendingLimit: SpendingLimit) = apply { + interval = spendingLimit.interval + merchantCategoryCodes = + spendingLimit.merchantCategoryCodes.map { it.toMutableList() } + settlementAmount = spendingLimit.settlementAmount + additionalProperties = spendingLimit.additionalProperties.toMutableMap() + } + + /** The interval at which the spending limit is enforced. */ + fun interval(interval: Interval) = interval(JsonField.of(interval)) + + /** + * Sets [Builder.interval] to an arbitrary JSON value. + * + * You should usually call [Builder.interval] with a well-typed [Interval] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun interval(interval: JsonField) = apply { + this.interval = interval + } + + /** + * The Merchant Category Codes (MCCs) this spending limit applies to. If not + * set, the limit applies to all transactions. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: List? + ) = merchantCategoryCodes(JsonField.ofNullable(merchantCategoryCodes)) + + /** + * Alias for calling [Builder.merchantCategoryCodes] with + * `merchantCategoryCodes.orElse(null)`. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: Optional> + ) = merchantCategoryCodes(merchantCategoryCodes.getOrNull()) + + /** + * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCodes] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: JsonField> + ) = apply { + this.merchantCategoryCodes = + merchantCategoryCodes.map { it.toMutableList() } + } + + /** + * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = + apply { + merchantCategoryCodes = + (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { + checkKnown("merchantCategoryCodes", it) + .add(merchantCategoryCode) + } + } + + /** The maximum settlement amount permitted in the given interval. */ + fun settlementAmount(settlementAmount: Long) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + 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 [SpendingLimit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .interval() + * .merchantCategoryCodes() + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SpendingLimit = + SpendingLimit( + checkRequired("interval", interval), + checkRequired("merchantCategoryCodes", merchantCategoryCodes).map { + it.toImmutable() + }, + checkRequired("settlementAmount", settlementAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SpendingLimit = apply { + if (validated) { + return@apply + } + + interval().validate() + merchantCategoryCodes().ifPresent { it.forEach { it.validate() } } + settlementAmount() + 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 = + (interval.asKnown().getOrNull()?.validity() ?: 0) + + (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { + it.validity().toInt() + } ?: 0) + + (if (settlementAmount.asKnown().isPresent) 1 else 0) + + /** The interval at which the spending limit is enforced. */ + class Interval + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The spending limit applies over the lifetime of the card. */ + @JvmField val ALL_TIME = of("all_time") + + /** The spending limit applies per transaction. */ + @JvmField val PER_TRANSACTION = of("per_transaction") + + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + @JvmField val PER_DAY = of("per_day") + + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + @JvmField val PER_WEEK = of("per_week") + + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + @JvmField val PER_MONTH = of("per_month") + + @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + } + + /** An enum containing [Interval]'s known values. */ + enum class Known { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + } + + /** + * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Interval] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + /** + * An enum member indicating that [Interval] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ALL_TIME -> Value.ALL_TIME + PER_TRANSACTION -> Value.PER_TRANSACTION + PER_DAY -> Value.PER_DAY + PER_WEEK -> Value.PER_WEEK + PER_MONTH -> Value.PER_MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + ALL_TIME -> Known.ALL_TIME + PER_TRANSACTION -> Known.PER_TRANSACTION + PER_DAY -> Known.PER_DAY + PER_WEEK -> Known.PER_WEEK + PER_MONTH -> Known.PER_MONTH + else -> + throw IncreaseInvalidDataException("Unknown Interval: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Interval = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Interval && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class MerchantCategoryCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of() + ) : this(code, mutableMapOf()) + + /** + * The Merchant Category Code (MCC). + * + * @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 code(): String = code.getRequired("code") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + @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 + * [MerchantCategoryCode]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MerchantCategoryCode]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { + code = merchantCategoryCode.code + additionalProperties = + merchantCategoryCode.additionalProperties.toMutableMap() + } + + /** The Merchant Category Code (MCC). */ + fun code(code: String) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + 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 [MerchantCategoryCode]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): MerchantCategoryCode = + MerchantCategoryCode( + checkRequired("code", code), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): MerchantCategoryCode = apply { + if (validated) { + return@apply + } + + code() + 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 (code.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MerchantCategoryCode && + code == other.code && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpendingLimit && + interval == other.interval && + merchantCategoryCodes == other.merchantCategoryCodes && + settlementAmount == other.settlementAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + interval, + merchantCategoryCodes, + settlementAmount, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SpendingLimit{interval=$interval, merchantCategoryCodes=$merchantCategoryCodes, settlementAmount=$settlementAmount, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MultiUse && + spendingLimits == other.spendingLimits && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(spendingLimits, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MultiUse{spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + } + + /** + * Controls for single-use cards. Required if and only if `category` is `single_use`. + */ + class SingleUse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val settlementAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of() + ) : this(settlementAmount, mutableMapOf()) + + /** + * The settlement amount constraint for this single-use card. + * + * @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 settlementAmount(): SettlementAmount = + settlementAmount.getRequired("settlement_amount") + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + @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 [SingleUse]. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SingleUse]. */ + class Builder internal constructor() { + + private var settlementAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(singleUse: SingleUse) = apply { + settlementAmount = singleUse.settlementAmount + additionalProperties = singleUse.additionalProperties.toMutableMap() + } + + /** The settlement amount constraint for this single-use card. */ + fun settlementAmount(settlementAmount: SettlementAmount) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [SettlementAmount] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + 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 [SingleUse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SingleUse = + SingleUse( + checkRequired("settlementAmount", settlementAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SingleUse = apply { + if (validated) { + return@apply + } + + settlementAmount().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 = + (settlementAmount.asKnown().getOrNull()?.validity() ?: 0) + + /** The settlement amount constraint for this single-use card. */ + class SettlementAmount + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val comparison: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("comparison") + @ExcludeMissing + comparison: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(comparison, value, mutableMapOf()) + + /** + * The operator used to compare the settlement amount. + * + * @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 comparison(): Comparison = comparison.getRequired("comparison") + + /** + * The settlement amount value. + * + * @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 value(): Long = value.getRequired("value") + + /** + * Returns the raw JSON value of [comparison]. + * + * Unlike [comparison], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("comparison") + @ExcludeMissing + fun _comparison(): JsonField = comparison + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 + * [SettlementAmount]. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SettlementAmount]. */ + class Builder internal constructor() { + + private var comparison: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(settlementAmount: SettlementAmount) = apply { + comparison = settlementAmount.comparison + value = settlementAmount.value + additionalProperties = + settlementAmount.additionalProperties.toMutableMap() + } + + /** The operator used to compare the settlement amount. */ + fun comparison(comparison: Comparison) = + comparison(JsonField.of(comparison)) + + /** + * Sets [Builder.comparison] to an arbitrary JSON value. + * + * You should usually call [Builder.comparison] with a well-typed + * [Comparison] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun comparison(comparison: JsonField) = apply { + this.comparison = comparison + } + + /** The settlement amount value. */ + fun value(value: Long) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [SettlementAmount]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SettlementAmount = + SettlementAmount( + checkRequired("comparison", comparison), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SettlementAmount = apply { + if (validated) { + return@apply + } + + comparison().validate() + value() + 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 = + (comparison.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator used to compare the settlement amount. */ + class Comparison + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The settlement amount must be exactly the specified value. */ + @JvmField val EQUALS = of("equals") + + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + @JvmField val LESS_THAN_OR_EQUALS = of("less_than_or_equals") + + @JvmStatic fun of(value: String) = Comparison(JsonField.of(value)) + } + + /** An enum containing [Comparison]'s known values. */ + enum class Known { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + } + + /** + * An enum containing [Comparison]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Comparison] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + /** + * An enum member indicating that [Comparison] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EQUALS -> Value.EQUALS + LESS_THAN_OR_EQUALS -> Value.LESS_THAN_OR_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + EQUALS -> Known.EQUALS + LESS_THAN_OR_EQUALS -> Known.LESS_THAN_OR_EQUALS + else -> + throw IncreaseInvalidDataException("Unknown Comparison: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Comparison = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Comparison && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SettlementAmount && + comparison == other.comparison && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(comparison, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SettlementAmount{comparison=$comparison, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SingleUse && + settlementAmount == other.settlementAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(settlementAmount, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + "SingleUse{settlementAmount=$settlementAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3694,26 +4628,21 @@ private constructor( return true } - return other is SpendingLimit && - interval == other.interval && - merchantCategoryCodes == other.merchantCategoryCodes && - settlementAmount == other.settlementAmount && + return other is Usage && + category == other.category && + multiUse == other.multiUse && + singleUse == other.singleUse && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash( - interval, - merchantCategoryCodes, - settlementAmount, - additionalProperties, - ) + Objects.hash(category, multiUse, singleUse, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SpendingLimit{interval=$interval, merchantCategoryCodes=$merchantCategoryCodes, settlementAmount=$settlementAmount, additionalProperties=$additionalProperties}" + "Usage{category=$category, multiUse=$multiUse, singleUse=$singleUse, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3722,21 +4651,19 @@ private constructor( } return other is AuthorizationControls && - maximumAuthorizationCount == other.maximumAuthorizationCount && merchantAcceptorIdentifier == other.merchantAcceptorIdentifier && merchantCategoryCode == other.merchantCategoryCode && merchantCountry == other.merchantCountry && - spendingLimits == other.spendingLimits && + usage == other.usage && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, additionalProperties, ) } @@ -3744,7 +4671,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AuthorizationControls{maximumAuthorizationCount=$maximumAuthorizationCount, merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + "AuthorizationControls{merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, usage=$usage, additionalProperties=$additionalProperties}" } /** The Card's billing address. */ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateParams.kt index 77cfc4c1c..62d34ca4f 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardCreateParams.kt @@ -815,19 +815,15 @@ private constructor( class AuthorizationControls @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val maximumAuthorizationCount: JsonField, private val merchantAcceptorIdentifier: JsonField, private val merchantCategoryCode: JsonField, private val merchantCountry: JsonField, - private val spendingLimits: JsonField>, + private val usage: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - maximumAuthorizationCount: JsonField = JsonMissing.of(), @JsonProperty("merchant_acceptor_identifier") @ExcludeMissing merchantAcceptorIdentifier: JsonField = JsonMissing.of(), @@ -837,27 +833,15 @@ private constructor( @JsonProperty("merchant_country") @ExcludeMissing merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("spending_limits") - @ExcludeMissing - spendingLimits: JsonField> = JsonMissing.of(), + @JsonProperty("usage") @ExcludeMissing usage: JsonField = JsonMissing.of(), ) : this( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, mutableMapOf(), ) - /** - * Limits the number of authorizations that can be approved on this card. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun maximumAuthorizationCount(): Optional = - maximumAuthorizationCount.getOptional("maximum_authorization_count") - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this * card. @@ -889,25 +873,12 @@ private constructor( merchantCountry.getOptional("merchant_country") /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. + * Controls how many times this card can be used. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun spendingLimits(): Optional> = - spendingLimits.getOptional("spending_limits") - - /** - * Returns the raw JSON value of [maximumAuthorizationCount]. - * - * Unlike [maximumAuthorizationCount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - fun _maximumAuthorizationCount(): JsonField = - maximumAuthorizationCount + fun usage(): Optional = usage.getOptional("usage") /** * Returns the raw JSON value of [merchantAcceptorIdentifier]. @@ -941,14 +912,11 @@ private constructor( fun _merchantCountry(): JsonField = merchantCountry /** - * Returns the raw JSON value of [spendingLimits]. + * Returns the raw JSON value of [usage]. * - * Unlike [spendingLimits], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [usage], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("spending_limits") - @ExcludeMissing - fun _spendingLimits(): JsonField> = spendingLimits + @JsonProperty("usage") @ExcludeMissing fun _usage(): JsonField = usage @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -973,40 +941,22 @@ private constructor( /** A builder for [AuthorizationControls]. */ class Builder internal constructor() { - private var maximumAuthorizationCount: JsonField = - JsonMissing.of() private var merchantAcceptorIdentifier: JsonField = JsonMissing.of() private var merchantCategoryCode: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() - private var spendingLimits: JsonField>? = null + private var usage: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authorizationControls: AuthorizationControls) = apply { - maximumAuthorizationCount = authorizationControls.maximumAuthorizationCount merchantAcceptorIdentifier = authorizationControls.merchantAcceptorIdentifier merchantCategoryCode = authorizationControls.merchantCategoryCode merchantCountry = authorizationControls.merchantCountry - spendingLimits = authorizationControls.spendingLimits.map { it.toMutableList() } + usage = authorizationControls.usage additionalProperties = authorizationControls.additionalProperties.toMutableMap() } - /** Limits the number of authorizations that can be approved on this card. */ - fun maximumAuthorizationCount(maximumAuthorizationCount: MaximumAuthorizationCount) = - maximumAuthorizationCount(JsonField.of(maximumAuthorizationCount)) - - /** - * Sets [Builder.maximumAuthorizationCount] to an arbitrary JSON value. - * - * You should usually call [Builder.maximumAuthorizationCount] with a well-typed - * [MaximumAuthorizationCount] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun maximumAuthorizationCount( - maximumAuthorizationCount: JsonField - ) = apply { this.maximumAuthorizationCount = maximumAuthorizationCount } - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on * this card. @@ -1062,35 +1012,17 @@ private constructor( this.merchantCountry = merchantCountry } - /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. - */ - fun spendingLimits(spendingLimits: List) = - spendingLimits(JsonField.of(spendingLimits)) - - /** - * Sets [Builder.spendingLimits] to an arbitrary JSON value. - * - * You should usually call [Builder.spendingLimits] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun spendingLimits(spendingLimits: JsonField>) = apply { - this.spendingLimits = spendingLimits.map { it.toMutableList() } - } + /** Controls how many times this card can be used. */ + fun usage(usage: Usage) = usage(JsonField.of(usage)) /** - * Adds a single [SpendingLimit] to [spendingLimits]. + * Sets [Builder.usage] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.usage] with a well-typed [Usage] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { - spendingLimits = - (spendingLimits ?: JsonField.of(mutableListOf())).also { - checkKnown("spendingLimits", it).add(spendingLimit) - } - } + fun usage(usage: JsonField) = apply { this.usage = usage } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1118,11 +1050,10 @@ private constructor( */ fun build(): AuthorizationControls = AuthorizationControls( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - (spendingLimits ?: JsonMissing.of()).map { it.toImmutable() }, + usage, additionalProperties.toMutableMap(), ) } @@ -1134,11 +1065,10 @@ private constructor( return@apply } - maximumAuthorizationCount().ifPresent { it.validate() } merchantAcceptorIdentifier().ifPresent { it.validate() } merchantCategoryCode().ifPresent { it.validate() } merchantCountry().ifPresent { it.validate() } - spendingLimits().ifPresent { it.forEach { it.validate() } } + usage().ifPresent { it.validate() } validated = true } @@ -1158,183 +1088,10 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (maximumAuthorizationCount.asKnown().getOrNull()?.validity() ?: 0) + - (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + + (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + (merchantCategoryCode.asKnown().getOrNull()?.validity() ?: 0) + (merchantCountry.asKnown().getOrNull()?.validity() ?: 0) + - (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** Limits the number of authorizations that can be approved on this card. */ - class MaximumAuthorizationCount - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val allTime: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("all_time") - @ExcludeMissing - allTime: JsonField = JsonMissing.of() - ) : this(allTime, mutableMapOf()) - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - * - * @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 allTime(): Long = allTime.getRequired("all_time") - - /** - * Returns the raw JSON value of [allTime]. - * - * Unlike [allTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("all_time") @ExcludeMissing fun _allTime(): JsonField = allTime - - @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 - * [MaximumAuthorizationCount]. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MaximumAuthorizationCount]. */ - class Builder internal constructor() { - - private var allTime: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(maximumAuthorizationCount: MaximumAuthorizationCount) = apply { - allTime = maximumAuthorizationCount.allTime - additionalProperties = - maximumAuthorizationCount.additionalProperties.toMutableMap() - } - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - */ - fun allTime(allTime: Long) = allTime(JsonField.of(allTime)) - - /** - * Sets [Builder.allTime] to an arbitrary JSON value. - * - * You should usually call [Builder.allTime] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun allTime(allTime: JsonField) = apply { this.allTime = allTime } - - 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 [MaximumAuthorizationCount]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): MaximumAuthorizationCount = - MaximumAuthorizationCount( - checkRequired("allTime", allTime), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): MaximumAuthorizationCount = apply { - if (validated) { - return@apply - } - - allTime() - 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 (allTime.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MaximumAuthorizationCount && - allTime == other.allTime && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(allTime, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "MaximumAuthorizationCount{allTime=$allTime, additionalProperties=$additionalProperties}" - } + (usage.asKnown().getOrNull()?.validity() ?: 0) /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this @@ -3047,86 +2804,83 @@ private constructor( "MerchantCountry{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}" } - class SpendingLimit + /** Controls how many times this card can be used. */ + class Usage @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val interval: JsonField, - private val settlementAmount: JsonField, - private val merchantCategoryCodes: JsonField>, + private val category: JsonField, + private val multiUse: JsonField, + private val singleUse: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - interval: JsonField = JsonMissing.of(), - @JsonProperty("settlement_amount") + category: JsonField = JsonMissing.of(), + @JsonProperty("multi_use") @ExcludeMissing - settlementAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_category_codes") + multiUse: JsonField = JsonMissing.of(), + @JsonProperty("single_use") @ExcludeMissing - merchantCategoryCodes: JsonField> = JsonMissing.of(), - ) : this(interval, settlementAmount, merchantCategoryCodes, mutableMapOf()) + singleUse: JsonField = JsonMissing.of(), + ) : this(category, multiUse, singleUse, mutableMapOf()) /** - * The interval at which the spending limit is enforced. + * Whether the card is for a single use or multiple uses. * * @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 interval(): Interval = interval.getRequired("interval") + fun category(): Category = category.getRequired("category") /** - * The maximum settlement amount permitted in the given interval. + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + fun multiUse(): Optional = multiUse.getOptional("multi_use") /** - * The Merchant Category Codes this spending limit applies to. If not set, the limit - * applies to all transactions. + * Controls for single-use cards. Required if and only if `category` is `single_use`. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun merchantCategoryCodes(): Optional> = - merchantCategoryCodes.getOptional("merchant_category_codes") + fun singleUse(): Optional = singleUse.getOptional("single_use") /** - * Returns the raw JSON value of [interval]. + * Returns the raw JSON value of [category]. * - * Unlike [interval], this method doesn't throw if the JSON field has an unexpected + * Unlike [category], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - fun _interval(): JsonField = interval + fun _category(): JsonField = category /** - * Returns the raw JSON value of [settlementAmount]. + * Returns the raw JSON value of [multiUse]. * - * Unlike [settlementAmount], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [multiUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("settlement_amount") + @JsonProperty("multi_use") @ExcludeMissing - fun _settlementAmount(): JsonField = settlementAmount + fun _multiUse(): JsonField = multiUse /** - * Returns the raw JSON value of [merchantCategoryCodes]. + * Returns the raw JSON value of [singleUse]. * - * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [singleUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("merchant_category_codes") + @JsonProperty("single_use") @ExcludeMissing - fun _merchantCategoryCodes(): JsonField> = - merchantCategoryCodes + fun _singleUse(): JsonField = singleUse @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3143,92 +2897,73 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [SpendingLimit]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java - * .interval() - * .settlementAmount() + * .category() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [SpendingLimit]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { - private var interval: JsonField? = null - private var settlementAmount: JsonField? = null - private var merchantCategoryCodes: JsonField>? = - null + private var category: JsonField? = null + private var multiUse: JsonField = JsonMissing.of() + private var singleUse: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(spendingLimit: SpendingLimit) = apply { - interval = spendingLimit.interval - settlementAmount = spendingLimit.settlementAmount - merchantCategoryCodes = - spendingLimit.merchantCategoryCodes.map { it.toMutableList() } - additionalProperties = spendingLimit.additionalProperties.toMutableMap() + internal fun from(usage: Usage) = apply { + category = usage.category + multiUse = usage.multiUse + singleUse = usage.singleUse + additionalProperties = usage.additionalProperties.toMutableMap() } - /** The interval at which the spending limit is enforced. */ - fun interval(interval: Interval) = interval(JsonField.of(interval)) + /** Whether the card is for a single use or multiple uses. */ + fun category(category: Category) = category(JsonField.of(category)) /** - * Sets [Builder.interval] to an arbitrary JSON value. + * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.interval] with a well-typed [Interval] value + * You should usually call [Builder.category] with a well-typed [Category] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun interval(interval: JsonField) = apply { this.interval = interval } + fun category(category: JsonField) = apply { this.category = category } - /** The maximum settlement amount permitted in the given interval. */ - fun settlementAmount(settlementAmount: Long) = - settlementAmount(JsonField.of(settlementAmount)) + /** + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. + */ + fun multiUse(multiUse: MultiUse) = multiUse(JsonField.of(multiUse)) /** - * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * Sets [Builder.multiUse] to an arbitrary JSON value. * - * You should usually call [Builder.settlementAmount] with a well-typed [Long] value + * You should usually call [Builder.multiUse] with a well-typed [MultiUse] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun settlementAmount(settlementAmount: JsonField) = apply { - this.settlementAmount = settlementAmount - } - - /** - * The Merchant Category Codes this spending limit applies to. If not set, the limit - * applies to all transactions. - */ - fun merchantCategoryCodes(merchantCategoryCodes: List) = - merchantCategoryCodes(JsonField.of(merchantCategoryCodes)) + fun multiUse(multiUse: JsonField) = apply { this.multiUse = multiUse } /** - * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCategoryCodes] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * Controls for single-use cards. Required if and only if `category` is + * `single_use`. */ - fun merchantCategoryCodes( - merchantCategoryCodes: JsonField> - ) = apply { - this.merchantCategoryCodes = merchantCategoryCodes.map { it.toMutableList() } - } + fun singleUse(singleUse: SingleUse) = singleUse(JsonField.of(singleUse)) /** - * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. + * Sets [Builder.singleUse] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.singleUse] with a well-typed [SingleUse] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = apply { - merchantCategoryCodes = - (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { - checkKnown("merchantCategoryCodes", it).add(merchantCategoryCode) - } + fun singleUse(singleUse: JsonField) = apply { + this.singleUse = singleUse } fun additionalProperties(additionalProperties: Map) = apply { @@ -3254,37 +2989,36 @@ private constructor( } /** - * Returns an immutable instance of [SpendingLimit]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .interval() - * .settlementAmount() + * .category() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): SpendingLimit = - SpendingLimit( - checkRequired("interval", interval), - checkRequired("settlementAmount", settlementAmount), - (merchantCategoryCodes ?: JsonMissing.of()).map { it.toImmutable() }, + fun build(): Usage = + Usage( + checkRequired("category", category), + multiUse, + singleUse, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): SpendingLimit = apply { + fun validate(): Usage = apply { if (validated) { return@apply } - interval().validate() - settlementAmount() - merchantCategoryCodes().ifPresent { it.forEach { it.validate() } } + category().validate() + multiUse().ifPresent { it.validate() } + singleUse().ifPresent { it.validate() } validated = true } @@ -3304,13 +3038,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (interval.asKnown().getOrNull()?.validity() ?: 0) + - (if (settlementAmount.asKnown().isPresent) 1 else 0) + - (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + + (multiUse.asKnown().getOrNull()?.validity() ?: 0) + + (singleUse.asKnown().getOrNull()?.validity() ?: 0) - /** The interval at which the spending limit is enforced. */ - class Interval @JsonCreator private constructor(private val value: JsonField) : + /** Whether the card is for a single use or multiple uses. */ + class Category @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3325,78 +3058,39 @@ private constructor( companion object { - /** The spending limit applies over the lifetime of the card. */ - @JvmField val ALL_TIME = of("all_time") - - /** The spending limit applies per transaction. */ - @JvmField val PER_TRANSACTION = of("per_transaction") - - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - @JvmField val PER_DAY = of("per_day") - - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - @JvmField val PER_WEEK = of("per_week") + /** The card can only be used for a single authorization. */ + @JvmField val SINGLE_USE = of("single_use") - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - @JvmField val PER_MONTH = of("per_month") + /** The card can be used for multiple authorizations. */ + @JvmField val MULTI_USE = of("multi_use") - @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) } - /** An enum containing [Interval]'s known values. */ + /** An enum containing [Category]'s known values. */ enum class Known { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, } /** - * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Interval] can contain an unknown value in a couple of cases: + * An instance of [Category] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, /** - * An enum member indicating that [Interval] was instantiated with an unknown + * An enum member indicating that [Category] was instantiated with an unknown * value. */ _UNKNOWN, @@ -3411,11 +3105,8 @@ private constructor( */ fun value(): Value = when (this) { - ALL_TIME -> Value.ALL_TIME - PER_TRANSACTION -> Value.PER_TRANSACTION - PER_DAY -> Value.PER_DAY - PER_WEEK -> Value.PER_WEEK - PER_MONTH -> Value.PER_MONTH + SINGLE_USE -> Value.SINGLE_USE + MULTI_USE -> Value.MULTI_USE else -> Value._UNKNOWN } @@ -3430,12 +3121,9 @@ private constructor( */ fun known(): Known = when (this) { - ALL_TIME -> Known.ALL_TIME - PER_TRANSACTION -> Known.PER_TRANSACTION - PER_DAY -> Known.PER_DAY - PER_WEEK -> Known.PER_WEEK - PER_MONTH -> Known.PER_MONTH - else -> throw IncreaseInvalidDataException("Unknown Interval: $value") + SINGLE_USE -> Known.SINGLE_USE + MULTI_USE -> Known.MULTI_USE + else -> throw IncreaseInvalidDataException("Unknown Category: $value") } /** @@ -3454,7 +3142,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Interval = apply { + fun validate(): Category = apply { if (validated) { return@apply } @@ -3484,7 +3172,7 @@ private constructor( return true } - return other is Interval && value == other.value + return other is Category && value == other.value } override fun hashCode() = value.hashCode() @@ -3492,34 +3180,40 @@ private constructor( override fun toString() = value.toString() } - class MerchantCategoryCode + /** Controls for multi-use cards. Required if and only if `category` is `multi_use`. */ + class MultiUse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val code: JsonField, + private val spendingLimits: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of() - ) : this(code, mutableMapOf()) + @JsonProperty("spending_limits") + @ExcludeMissing + spendingLimits: JsonField> = JsonMissing.of() + ) : this(spendingLimits, mutableMapOf()) /** - * The Merchant Category Code. + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun code(): String = code.getRequired("code") + fun spendingLimits(): Optional> = + spendingLimits.getOptional("spending_limits") /** - * Returns the raw JSON value of [code]. + * Returns the raw JSON value of [spendingLimits]. * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [spendingLimits], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + @JsonProperty("spending_limits") + @ExcludeMissing + fun _spendingLimits(): JsonField> = spendingLimits @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3535,42 +3229,51 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of - * [MerchantCategoryCode]. - * - * The following fields are required: - * ```java - * .code() - * ``` - */ + /** Returns a mutable builder for constructing an instance of [MultiUse]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [MerchantCategoryCode]. */ + /** A builder for [MultiUse]. */ class Builder internal constructor() { - private var code: JsonField? = null + private var spendingLimits: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { - code = merchantCategoryCode.code - additionalProperties = - merchantCategoryCode.additionalProperties.toMutableMap() + internal fun from(multiUse: MultiUse) = apply { + spendingLimits = multiUse.spendingLimits.map { it.toMutableList() } + additionalProperties = multiUse.additionalProperties.toMutableMap() } - /** The Merchant Category Code. */ - fun code(code: String) = code(JsonField.of(code)) + /** + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. + */ + fun spendingLimits(spendingLimits: List) = + spendingLimits(JsonField.of(spendingLimits)) /** - * Sets [Builder.code] to an arbitrary JSON value. + * Sets [Builder.spendingLimits] to an arbitrary JSON value. * - * You should usually call [Builder.code] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.spendingLimits] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun code(code: JsonField) = apply { this.code = code } + fun spendingLimits(spendingLimits: JsonField>) = apply { + this.spendingLimits = spendingLimits.map { it.toMutableList() } + } + + /** + * Adds a single [SpendingLimit] to [spendingLimits]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { + spendingLimits = + (spendingLimits ?: JsonField.of(mutableListOf())).also { + checkKnown("spendingLimits", it).add(spendingLimit) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3595,32 +3298,25 @@ private constructor( } /** - * Returns an immutable instance of [MerchantCategoryCode]. + * Returns an immutable instance of [MultiUse]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .code() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ - fun build(): MerchantCategoryCode = - MerchantCategoryCode( - checkRequired("code", code), + fun build(): MultiUse = + MultiUse( + (spendingLimits ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): MerchantCategoryCode = apply { + fun validate(): MultiUse = apply { if (validated) { return@apply } - code() + spendingLimits().ifPresent { it.forEach { it.validate() } } validated = true } @@ -3639,24 +3335,1250 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (code.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = + (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + class SpendingLimit + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val interval: JsonField, + private val settlementAmount: JsonField, + private val merchantCategoryCodes: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("interval") + @ExcludeMissing + interval: JsonField = JsonMissing.of(), + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_codes") + @ExcludeMissing + merchantCategoryCodes: JsonField> = + JsonMissing.of(), + ) : this(interval, settlementAmount, merchantCategoryCodes, mutableMapOf()) - return other is MerchantCategoryCode && - code == other.code && + /** + * The interval at which the spending limit is enforced. + * + * @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 interval(): Interval = interval.getRequired("interval") + + /** + * The maximum settlement amount permitted in the given interval. + * + * @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 settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + + /** + * The Merchant Category Codes this spending limit applies to. If not set, the + * limit applies to all transactions. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun merchantCategoryCodes(): Optional> = + merchantCategoryCodes.getOptional("merchant_category_codes") + + /** + * Returns the raw JSON value of [interval]. + * + * Unlike [interval], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("interval") + @ExcludeMissing + fun _interval(): JsonField = interval + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + /** + * Returns the raw JSON value of [merchantCategoryCodes]. + * + * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("merchant_category_codes") + @ExcludeMissing + fun _merchantCategoryCodes(): JsonField> = + merchantCategoryCodes + + @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 + * [SpendingLimit]. + * + * The following fields are required: + * ```java + * .interval() + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SpendingLimit]. */ + class Builder internal constructor() { + + private var interval: JsonField? = null + private var settlementAmount: JsonField? = null + private var merchantCategoryCodes: + JsonField>? = + null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(spendingLimit: SpendingLimit) = apply { + interval = spendingLimit.interval + settlementAmount = spendingLimit.settlementAmount + merchantCategoryCodes = + spendingLimit.merchantCategoryCodes.map { it.toMutableList() } + additionalProperties = spendingLimit.additionalProperties.toMutableMap() + } + + /** The interval at which the spending limit is enforced. */ + fun interval(interval: Interval) = interval(JsonField.of(interval)) + + /** + * Sets [Builder.interval] to an arbitrary JSON value. + * + * You should usually call [Builder.interval] with a well-typed [Interval] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun interval(interval: JsonField) = apply { + this.interval = interval + } + + /** The maximum settlement amount permitted in the given interval. */ + fun settlementAmount(settlementAmount: Long) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + /** + * The Merchant Category Codes this spending limit applies to. If not set, + * the limit applies to all transactions. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: List + ) = merchantCategoryCodes(JsonField.of(merchantCategoryCodes)) + + /** + * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCodes] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: JsonField> + ) = apply { + this.merchantCategoryCodes = + merchantCategoryCodes.map { it.toMutableList() } + } + + /** + * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = + apply { + merchantCategoryCodes = + (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { + checkKnown("merchantCategoryCodes", it) + .add(merchantCategoryCode) + } + } + + 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 [SpendingLimit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .interval() + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SpendingLimit = + SpendingLimit( + checkRequired("interval", interval), + checkRequired("settlementAmount", settlementAmount), + (merchantCategoryCodes ?: JsonMissing.of()).map { + it.toImmutable() + }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SpendingLimit = apply { + if (validated) { + return@apply + } + + interval().validate() + settlementAmount() + merchantCategoryCodes().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 = + (interval.asKnown().getOrNull()?.validity() ?: 0) + + (if (settlementAmount.asKnown().isPresent) 1 else 0) + + (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { + it.validity().toInt() + } ?: 0) + + /** The interval at which the spending limit is enforced. */ + class Interval + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The spending limit applies over the lifetime of the card. */ + @JvmField val ALL_TIME = of("all_time") + + /** The spending limit applies per transaction. */ + @JvmField val PER_TRANSACTION = of("per_transaction") + + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + @JvmField val PER_DAY = of("per_day") + + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + @JvmField val PER_WEEK = of("per_week") + + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + @JvmField val PER_MONTH = of("per_month") + + @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + } + + /** An enum containing [Interval]'s known values. */ + enum class Known { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + } + + /** + * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Interval] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + /** + * An enum member indicating that [Interval] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ALL_TIME -> Value.ALL_TIME + PER_TRANSACTION -> Value.PER_TRANSACTION + PER_DAY -> Value.PER_DAY + PER_WEEK -> Value.PER_WEEK + PER_MONTH -> Value.PER_MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + ALL_TIME -> Known.ALL_TIME + PER_TRANSACTION -> Known.PER_TRANSACTION + PER_DAY -> Known.PER_DAY + PER_WEEK -> Known.PER_WEEK + PER_MONTH -> Known.PER_MONTH + else -> + throw IncreaseInvalidDataException("Unknown Interval: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Interval = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Interval && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class MerchantCategoryCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of() + ) : this(code, mutableMapOf()) + + /** + * The Merchant Category Code. + * + * @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 code(): String = code.getRequired("code") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + @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 + * [MerchantCategoryCode]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MerchantCategoryCode]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { + code = merchantCategoryCode.code + additionalProperties = + merchantCategoryCode.additionalProperties.toMutableMap() + } + + /** The Merchant Category Code. */ + fun code(code: String) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + 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 [MerchantCategoryCode]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): MerchantCategoryCode = + MerchantCategoryCode( + checkRequired("code", code), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): MerchantCategoryCode = apply { + if (validated) { + return@apply + } + + code() + 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 (code.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MerchantCategoryCode && + code == other.code && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpendingLimit && + interval == other.interval && + settlementAmount == other.settlementAmount && + merchantCategoryCodes == other.merchantCategoryCodes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + interval, + settlementAmount, + merchantCategoryCodes, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SpendingLimit{interval=$interval, settlementAmount=$settlementAmount, merchantCategoryCodes=$merchantCategoryCodes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MultiUse && + spendingLimits == other.spendingLimits && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(code, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(spendingLimits, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + "MultiUse{spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + } + + /** + * Controls for single-use cards. Required if and only if `category` is `single_use`. + */ + class SingleUse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val settlementAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of() + ) : this(settlementAmount, mutableMapOf()) + + /** + * The settlement amount constraint for this single-use card. + * + * @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 settlementAmount(): SettlementAmount = + settlementAmount.getRequired("settlement_amount") + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + @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 [SingleUse]. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SingleUse]. */ + class Builder internal constructor() { + + private var settlementAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(singleUse: SingleUse) = apply { + settlementAmount = singleUse.settlementAmount + additionalProperties = singleUse.additionalProperties.toMutableMap() + } + + /** The settlement amount constraint for this single-use card. */ + fun settlementAmount(settlementAmount: SettlementAmount) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [SettlementAmount] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + 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 [SingleUse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SingleUse = + SingleUse( + checkRequired("settlementAmount", settlementAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SingleUse = apply { + if (validated) { + return@apply + } + + settlementAmount().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 = + (settlementAmount.asKnown().getOrNull()?.validity() ?: 0) + + /** The settlement amount constraint for this single-use card. */ + class SettlementAmount + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val comparison: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("comparison") + @ExcludeMissing + comparison: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(comparison, value, mutableMapOf()) + + /** + * The operator used to compare the settlement amount. + * + * @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 comparison(): Comparison = comparison.getRequired("comparison") + + /** + * The settlement amount value. + * + * @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 value(): Long = value.getRequired("value") + + /** + * Returns the raw JSON value of [comparison]. + * + * Unlike [comparison], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("comparison") + @ExcludeMissing + fun _comparison(): JsonField = comparison + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 + * [SettlementAmount]. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SettlementAmount]. */ + class Builder internal constructor() { + + private var comparison: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(settlementAmount: SettlementAmount) = apply { + comparison = settlementAmount.comparison + value = settlementAmount.value + additionalProperties = + settlementAmount.additionalProperties.toMutableMap() + } + + /** The operator used to compare the settlement amount. */ + fun comparison(comparison: Comparison) = + comparison(JsonField.of(comparison)) + + /** + * Sets [Builder.comparison] to an arbitrary JSON value. + * + * You should usually call [Builder.comparison] with a well-typed + * [Comparison] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun comparison(comparison: JsonField) = apply { + this.comparison = comparison + } + + /** The settlement amount value. */ + fun value(value: Long) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [SettlementAmount]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SettlementAmount = + SettlementAmount( + checkRequired("comparison", comparison), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SettlementAmount = apply { + if (validated) { + return@apply + } + + comparison().validate() + value() + 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 = + (comparison.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator used to compare the settlement amount. */ + class Comparison + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The settlement amount must be exactly the specified value. */ + @JvmField val EQUALS = of("equals") + + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + @JvmField val LESS_THAN_OR_EQUALS = of("less_than_or_equals") + + @JvmStatic fun of(value: String) = Comparison(JsonField.of(value)) + } + + /** An enum containing [Comparison]'s known values. */ + enum class Known { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + } + + /** + * An enum containing [Comparison]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Comparison] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + /** + * An enum member indicating that [Comparison] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EQUALS -> Value.EQUALS + LESS_THAN_OR_EQUALS -> Value.LESS_THAN_OR_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + EQUALS -> Known.EQUALS + LESS_THAN_OR_EQUALS -> Known.LESS_THAN_OR_EQUALS + else -> + throw IncreaseInvalidDataException("Unknown Comparison: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Comparison = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Comparison && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SettlementAmount && + comparison == other.comparison && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(comparison, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SettlementAmount{comparison=$comparison, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SingleUse && + settlementAmount == other.settlementAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(settlementAmount, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SingleUse{settlementAmount=$settlementAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3664,26 +4586,21 @@ private constructor( return true } - return other is SpendingLimit && - interval == other.interval && - settlementAmount == other.settlementAmount && - merchantCategoryCodes == other.merchantCategoryCodes && + return other is Usage && + category == other.category && + multiUse == other.multiUse && + singleUse == other.singleUse && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash( - interval, - settlementAmount, - merchantCategoryCodes, - additionalProperties, - ) + Objects.hash(category, multiUse, singleUse, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SpendingLimit{interval=$interval, settlementAmount=$settlementAmount, merchantCategoryCodes=$merchantCategoryCodes, additionalProperties=$additionalProperties}" + "Usage{category=$category, multiUse=$multiUse, singleUse=$singleUse, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3692,21 +4609,19 @@ private constructor( } return other is AuthorizationControls && - maximumAuthorizationCount == other.maximumAuthorizationCount && merchantAcceptorIdentifier == other.merchantAcceptorIdentifier && merchantCategoryCode == other.merchantCategoryCode && merchantCountry == other.merchantCountry && - spendingLimits == other.spendingLimits && + usage == other.usage && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, additionalProperties, ) } @@ -3714,7 +4629,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AuthorizationControls{maximumAuthorizationCount=$maximumAuthorizationCount, merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + "AuthorizationControls{merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, usage=$usage, additionalProperties=$additionalProperties}" } /** The card's billing address. */ diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt index 6994f0cde..83700d5e6 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/CardUpdateParams.kt @@ -800,19 +800,15 @@ private constructor( class AuthorizationControls @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val maximumAuthorizationCount: JsonField, private val merchantAcceptorIdentifier: JsonField, private val merchantCategoryCode: JsonField, private val merchantCountry: JsonField, - private val spendingLimits: JsonField>, + private val usage: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - maximumAuthorizationCount: JsonField = JsonMissing.of(), @JsonProperty("merchant_acceptor_identifier") @ExcludeMissing merchantAcceptorIdentifier: JsonField = JsonMissing.of(), @@ -822,27 +818,15 @@ private constructor( @JsonProperty("merchant_country") @ExcludeMissing merchantCountry: JsonField = JsonMissing.of(), - @JsonProperty("spending_limits") - @ExcludeMissing - spendingLimits: JsonField> = JsonMissing.of(), + @JsonProperty("usage") @ExcludeMissing usage: JsonField = JsonMissing.of(), ) : this( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, mutableMapOf(), ) - /** - * Limits the number of authorizations that can be approved on this card. - * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun maximumAuthorizationCount(): Optional = - maximumAuthorizationCount.getOptional("maximum_authorization_count") - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this * card. @@ -874,25 +858,12 @@ private constructor( merchantCountry.getOptional("merchant_country") /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. + * Controls how many times this card can be used. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if * the server responded with an unexpected value). */ - fun spendingLimits(): Optional> = - spendingLimits.getOptional("spending_limits") - - /** - * Returns the raw JSON value of [maximumAuthorizationCount]. - * - * Unlike [maximumAuthorizationCount], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("maximum_authorization_count") - @ExcludeMissing - fun _maximumAuthorizationCount(): JsonField = - maximumAuthorizationCount + fun usage(): Optional = usage.getOptional("usage") /** * Returns the raw JSON value of [merchantAcceptorIdentifier]. @@ -926,14 +897,11 @@ private constructor( fun _merchantCountry(): JsonField = merchantCountry /** - * Returns the raw JSON value of [spendingLimits]. + * Returns the raw JSON value of [usage]. * - * Unlike [spendingLimits], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [usage], this method doesn't throw if the JSON field has an unexpected type. */ - @JsonProperty("spending_limits") - @ExcludeMissing - fun _spendingLimits(): JsonField> = spendingLimits + @JsonProperty("usage") @ExcludeMissing fun _usage(): JsonField = usage @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -958,40 +926,22 @@ private constructor( /** A builder for [AuthorizationControls]. */ class Builder internal constructor() { - private var maximumAuthorizationCount: JsonField = - JsonMissing.of() private var merchantAcceptorIdentifier: JsonField = JsonMissing.of() private var merchantCategoryCode: JsonField = JsonMissing.of() private var merchantCountry: JsonField = JsonMissing.of() - private var spendingLimits: JsonField>? = null + private var usage: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(authorizationControls: AuthorizationControls) = apply { - maximumAuthorizationCount = authorizationControls.maximumAuthorizationCount merchantAcceptorIdentifier = authorizationControls.merchantAcceptorIdentifier merchantCategoryCode = authorizationControls.merchantCategoryCode merchantCountry = authorizationControls.merchantCountry - spendingLimits = authorizationControls.spendingLimits.map { it.toMutableList() } + usage = authorizationControls.usage additionalProperties = authorizationControls.additionalProperties.toMutableMap() } - /** Limits the number of authorizations that can be approved on this card. */ - fun maximumAuthorizationCount(maximumAuthorizationCount: MaximumAuthorizationCount) = - maximumAuthorizationCount(JsonField.of(maximumAuthorizationCount)) - - /** - * Sets [Builder.maximumAuthorizationCount] to an arbitrary JSON value. - * - * You should usually call [Builder.maximumAuthorizationCount] with a well-typed - * [MaximumAuthorizationCount] value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun maximumAuthorizationCount( - maximumAuthorizationCount: JsonField - ) = apply { this.maximumAuthorizationCount = maximumAuthorizationCount } - /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on * this card. @@ -1047,35 +997,17 @@ private constructor( this.merchantCountry = merchantCountry } - /** - * Spending limits for this card. The most restrictive limit applies if multiple limits - * match. - */ - fun spendingLimits(spendingLimits: List) = - spendingLimits(JsonField.of(spendingLimits)) - - /** - * Sets [Builder.spendingLimits] to an arbitrary JSON value. - * - * You should usually call [Builder.spendingLimits] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun spendingLimits(spendingLimits: JsonField>) = apply { - this.spendingLimits = spendingLimits.map { it.toMutableList() } - } + /** Controls how many times this card can be used. */ + fun usage(usage: Usage) = usage(JsonField.of(usage)) /** - * Adds a single [SpendingLimit] to [spendingLimits]. + * Sets [Builder.usage] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.usage] with a well-typed [Usage] value instead. This + * method is primarily for setting the field to an undocumented or not yet supported + * value. */ - fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { - spendingLimits = - (spendingLimits ?: JsonField.of(mutableListOf())).also { - checkKnown("spendingLimits", it).add(spendingLimit) - } - } + fun usage(usage: JsonField) = apply { this.usage = usage } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -1103,11 +1035,10 @@ private constructor( */ fun build(): AuthorizationControls = AuthorizationControls( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - (spendingLimits ?: JsonMissing.of()).map { it.toImmutable() }, + usage, additionalProperties.toMutableMap(), ) } @@ -1119,11 +1050,10 @@ private constructor( return@apply } - maximumAuthorizationCount().ifPresent { it.validate() } merchantAcceptorIdentifier().ifPresent { it.validate() } merchantCategoryCode().ifPresent { it.validate() } merchantCountry().ifPresent { it.validate() } - spendingLimits().ifPresent { it.forEach { it.validate() } } + usage().ifPresent { it.validate() } validated = true } @@ -1143,183 +1073,10 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (maximumAuthorizationCount.asKnown().getOrNull()?.validity() ?: 0) + - (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + + (merchantAcceptorIdentifier.asKnown().getOrNull()?.validity() ?: 0) + (merchantCategoryCode.asKnown().getOrNull()?.validity() ?: 0) + (merchantCountry.asKnown().getOrNull()?.validity() ?: 0) + - (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** Limits the number of authorizations that can be approved on this card. */ - class MaximumAuthorizationCount - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val allTime: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("all_time") - @ExcludeMissing - allTime: JsonField = JsonMissing.of() - ) : this(allTime, mutableMapOf()) - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - * - * @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 allTime(): Long = allTime.getRequired("all_time") - - /** - * Returns the raw JSON value of [allTime]. - * - * Unlike [allTime], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("all_time") @ExcludeMissing fun _allTime(): JsonField = allTime - - @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 - * [MaximumAuthorizationCount]. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MaximumAuthorizationCount]. */ - class Builder internal constructor() { - - private var allTime: JsonField? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(maximumAuthorizationCount: MaximumAuthorizationCount) = apply { - allTime = maximumAuthorizationCount.allTime - additionalProperties = - maximumAuthorizationCount.additionalProperties.toMutableMap() - } - - /** - * The maximum number of authorizations that can be approved on this card over its - * lifetime. - */ - fun allTime(allTime: Long) = allTime(JsonField.of(allTime)) - - /** - * Sets [Builder.allTime] to an arbitrary JSON value. - * - * You should usually call [Builder.allTime] with a well-typed [Long] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun allTime(allTime: JsonField) = apply { this.allTime = allTime } - - 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 [MaximumAuthorizationCount]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .allTime() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): MaximumAuthorizationCount = - MaximumAuthorizationCount( - checkRequired("allTime", allTime), - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - fun validate(): MaximumAuthorizationCount = apply { - if (validated) { - return@apply - } - - allTime() - 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 (allTime.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MaximumAuthorizationCount && - allTime == other.allTime && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(allTime, additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "MaximumAuthorizationCount{allTime=$allTime, additionalProperties=$additionalProperties}" - } + (usage.asKnown().getOrNull()?.validity() ?: 0) /** * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this @@ -3032,86 +2789,83 @@ private constructor( "MerchantCountry{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}" } - class SpendingLimit + /** Controls how many times this card can be used. */ + class Usage @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val interval: JsonField, - private val settlementAmount: JsonField, - private val merchantCategoryCodes: JsonField>, + private val category: JsonField, + private val multiUse: JsonField, + private val singleUse: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - interval: JsonField = JsonMissing.of(), - @JsonProperty("settlement_amount") + category: JsonField = JsonMissing.of(), + @JsonProperty("multi_use") @ExcludeMissing - settlementAmount: JsonField = JsonMissing.of(), - @JsonProperty("merchant_category_codes") + multiUse: JsonField = JsonMissing.of(), + @JsonProperty("single_use") @ExcludeMissing - merchantCategoryCodes: JsonField> = JsonMissing.of(), - ) : this(interval, settlementAmount, merchantCategoryCodes, mutableMapOf()) + singleUse: JsonField = JsonMissing.of(), + ) : this(category, multiUse, singleUse, mutableMapOf()) /** - * The interval at which the spending limit is enforced. + * Whether the card is for a single use or multiple uses. * * @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 interval(): Interval = interval.getRequired("interval") + fun category(): Category = category.getRequired("category") /** - * The maximum settlement amount permitted in the given interval. + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected - * value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). */ - fun settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + fun multiUse(): Optional = multiUse.getOptional("multi_use") /** - * The Merchant Category Codes this spending limit applies to. If not set, the limit - * applies to all transactions. + * Controls for single-use cards. Required if and only if `category` is `single_use`. * * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. * if the server responded with an unexpected value). */ - fun merchantCategoryCodes(): Optional> = - merchantCategoryCodes.getOptional("merchant_category_codes") + fun singleUse(): Optional = singleUse.getOptional("single_use") /** - * Returns the raw JSON value of [interval]. + * Returns the raw JSON value of [category]. * - * Unlike [interval], this method doesn't throw if the JSON field has an unexpected + * Unlike [category], this method doesn't throw if the JSON field has an unexpected * type. */ - @JsonProperty("interval") + @JsonProperty("category") @ExcludeMissing - fun _interval(): JsonField = interval + fun _category(): JsonField = category /** - * Returns the raw JSON value of [settlementAmount]. + * Returns the raw JSON value of [multiUse]. * - * Unlike [settlementAmount], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [multiUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("settlement_amount") + @JsonProperty("multi_use") @ExcludeMissing - fun _settlementAmount(): JsonField = settlementAmount + fun _multiUse(): JsonField = multiUse /** - * Returns the raw JSON value of [merchantCategoryCodes]. + * Returns the raw JSON value of [singleUse]. * - * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field has an - * unexpected type. + * Unlike [singleUse], this method doesn't throw if the JSON field has an unexpected + * type. */ - @JsonProperty("merchant_category_codes") + @JsonProperty("single_use") @ExcludeMissing - fun _merchantCategoryCodes(): JsonField> = - merchantCategoryCodes + fun _singleUse(): JsonField = singleUse @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3128,92 +2882,73 @@ private constructor( companion object { /** - * Returns a mutable builder for constructing an instance of [SpendingLimit]. + * Returns a mutable builder for constructing an instance of [Usage]. * * The following fields are required: * ```java - * .interval() - * .settlementAmount() + * .category() * ``` */ @JvmStatic fun builder() = Builder() } - /** A builder for [SpendingLimit]. */ + /** A builder for [Usage]. */ class Builder internal constructor() { - private var interval: JsonField? = null - private var settlementAmount: JsonField? = null - private var merchantCategoryCodes: JsonField>? = - null + private var category: JsonField? = null + private var multiUse: JsonField = JsonMissing.of() + private var singleUse: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(spendingLimit: SpendingLimit) = apply { - interval = spendingLimit.interval - settlementAmount = spendingLimit.settlementAmount - merchantCategoryCodes = - spendingLimit.merchantCategoryCodes.map { it.toMutableList() } - additionalProperties = spendingLimit.additionalProperties.toMutableMap() + internal fun from(usage: Usage) = apply { + category = usage.category + multiUse = usage.multiUse + singleUse = usage.singleUse + additionalProperties = usage.additionalProperties.toMutableMap() } - /** The interval at which the spending limit is enforced. */ - fun interval(interval: Interval) = interval(JsonField.of(interval)) + /** Whether the card is for a single use or multiple uses. */ + fun category(category: Category) = category(JsonField.of(category)) /** - * Sets [Builder.interval] to an arbitrary JSON value. + * Sets [Builder.category] to an arbitrary JSON value. * - * You should usually call [Builder.interval] with a well-typed [Interval] value + * You should usually call [Builder.category] with a well-typed [Category] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun interval(interval: JsonField) = apply { this.interval = interval } + fun category(category: JsonField) = apply { this.category = category } - /** The maximum settlement amount permitted in the given interval. */ - fun settlementAmount(settlementAmount: Long) = - settlementAmount(JsonField.of(settlementAmount)) + /** + * Controls for multi-use cards. Required if and only if `category` is `multi_use`. + */ + fun multiUse(multiUse: MultiUse) = multiUse(JsonField.of(multiUse)) /** - * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * Sets [Builder.multiUse] to an arbitrary JSON value. * - * You should usually call [Builder.settlementAmount] with a well-typed [Long] value + * You should usually call [Builder.multiUse] with a well-typed [MultiUse] value * instead. This method is primarily for setting the field to an undocumented or not * yet supported value. */ - fun settlementAmount(settlementAmount: JsonField) = apply { - this.settlementAmount = settlementAmount - } - - /** - * The Merchant Category Codes this spending limit applies to. If not set, the limit - * applies to all transactions. - */ - fun merchantCategoryCodes(merchantCategoryCodes: List) = - merchantCategoryCodes(JsonField.of(merchantCategoryCodes)) + fun multiUse(multiUse: JsonField) = apply { this.multiUse = multiUse } /** - * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. - * - * You should usually call [Builder.merchantCategoryCodes] with a well-typed - * `List` value instead. This method is primarily for setting - * the field to an undocumented or not yet supported value. + * Controls for single-use cards. Required if and only if `category` is + * `single_use`. */ - fun merchantCategoryCodes( - merchantCategoryCodes: JsonField> - ) = apply { - this.merchantCategoryCodes = merchantCategoryCodes.map { it.toMutableList() } - } + fun singleUse(singleUse: SingleUse) = singleUse(JsonField.of(singleUse)) /** - * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. + * Sets [Builder.singleUse] to an arbitrary JSON value. * - * @throws IllegalStateException if the field was previously set to a non-list. + * You should usually call [Builder.singleUse] with a well-typed [SingleUse] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. */ - fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = apply { - merchantCategoryCodes = - (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { - checkKnown("merchantCategoryCodes", it).add(merchantCategoryCode) - } + fun singleUse(singleUse: JsonField) = apply { + this.singleUse = singleUse } fun additionalProperties(additionalProperties: Map) = apply { @@ -3239,37 +2974,36 @@ private constructor( } /** - * Returns an immutable instance of [SpendingLimit]. + * Returns an immutable instance of [Usage]. * * Further updates to this [Builder] will not mutate the returned instance. * * The following fields are required: * ```java - * .interval() - * .settlementAmount() + * .category() * ``` * * @throws IllegalStateException if any required field is unset. */ - fun build(): SpendingLimit = - SpendingLimit( - checkRequired("interval", interval), - checkRequired("settlementAmount", settlementAmount), - (merchantCategoryCodes ?: JsonMissing.of()).map { it.toImmutable() }, + fun build(): Usage = + Usage( + checkRequired("category", category), + multiUse, + singleUse, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): SpendingLimit = apply { + fun validate(): Usage = apply { if (validated) { return@apply } - interval().validate() - settlementAmount() - merchantCategoryCodes().ifPresent { it.forEach { it.validate() } } + category().validate() + multiUse().ifPresent { it.validate() } + singleUse().ifPresent { it.validate() } validated = true } @@ -3289,13 +3023,12 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (interval.asKnown().getOrNull()?.validity() ?: 0) + - (if (settlementAmount.asKnown().isPresent) 1 else 0) + - (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } - ?: 0) + (category.asKnown().getOrNull()?.validity() ?: 0) + + (multiUse.asKnown().getOrNull()?.validity() ?: 0) + + (singleUse.asKnown().getOrNull()?.validity() ?: 0) - /** The interval at which the spending limit is enforced. */ - class Interval @JsonCreator private constructor(private val value: JsonField) : + /** Whether the card is for a single use or multiple uses. */ + class Category @JsonCreator private constructor(private val value: JsonField) : Enum { /** @@ -3310,78 +3043,39 @@ private constructor( companion object { - /** The spending limit applies over the lifetime of the card. */ - @JvmField val ALL_TIME = of("all_time") - - /** The spending limit applies per transaction. */ - @JvmField val PER_TRANSACTION = of("per_transaction") - - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - @JvmField val PER_DAY = of("per_day") - - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - @JvmField val PER_WEEK = of("per_week") + /** The card can only be used for a single authorization. */ + @JvmField val SINGLE_USE = of("single_use") - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - @JvmField val PER_MONTH = of("per_month") + /** The card can be used for multiple authorizations. */ + @JvmField val MULTI_USE = of("multi_use") - @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + @JvmStatic fun of(value: String) = Category(JsonField.of(value)) } - /** An enum containing [Interval]'s known values. */ + /** An enum containing [Category]'s known values. */ enum class Known { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, } /** - * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] member. + * An enum containing [Category]'s known values, as well as an [_UNKNOWN] member. * - * An instance of [Interval] can contain an unknown value in a couple of cases: + * An instance of [Category] can contain an unknown value in a couple of cases: * - It was deserialized from data that doesn't match any known member. For example, * if the SDK is on an older version than the API, then the API may respond with * new members that the SDK is unaware of. * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - /** The spending limit applies over the lifetime of the card. */ - ALL_TIME, - /** The spending limit applies per transaction. */ - PER_TRANSACTION, - /** The spending limit applies per day. Resets nightly at midnight UTC. */ - PER_DAY, - /** - * The spending limit applies per week. Resets weekly on Mondays at midnight - * UTC. - */ - PER_WEEK, - /** - * The spending limit applies per month. Resets on the first of the month, - * midnight UTC. - */ - PER_MONTH, + /** The card can only be used for a single authorization. */ + SINGLE_USE, + /** The card can be used for multiple authorizations. */ + MULTI_USE, /** - * An enum member indicating that [Interval] was instantiated with an unknown + * An enum member indicating that [Category] was instantiated with an unknown * value. */ _UNKNOWN, @@ -3396,11 +3090,8 @@ private constructor( */ fun value(): Value = when (this) { - ALL_TIME -> Value.ALL_TIME - PER_TRANSACTION -> Value.PER_TRANSACTION - PER_DAY -> Value.PER_DAY - PER_WEEK -> Value.PER_WEEK - PER_MONTH -> Value.PER_MONTH + SINGLE_USE -> Value.SINGLE_USE + MULTI_USE -> Value.MULTI_USE else -> Value._UNKNOWN } @@ -3415,12 +3106,9 @@ private constructor( */ fun known(): Known = when (this) { - ALL_TIME -> Known.ALL_TIME - PER_TRANSACTION -> Known.PER_TRANSACTION - PER_DAY -> Known.PER_DAY - PER_WEEK -> Known.PER_WEEK - PER_MONTH -> Known.PER_MONTH - else -> throw IncreaseInvalidDataException("Unknown Interval: $value") + SINGLE_USE -> Known.SINGLE_USE + MULTI_USE -> Known.MULTI_USE + else -> throw IncreaseInvalidDataException("Unknown Category: $value") } /** @@ -3439,7 +3127,7 @@ private constructor( private var validated: Boolean = false - fun validate(): Interval = apply { + fun validate(): Category = apply { if (validated) { return@apply } @@ -3469,7 +3157,7 @@ private constructor( return true } - return other is Interval && value == other.value + return other is Category && value == other.value } override fun hashCode() = value.hashCode() @@ -3477,34 +3165,40 @@ private constructor( override fun toString() = value.toString() } - class MerchantCategoryCode + /** Controls for multi-use cards. Required if and only if `category` is `multi_use`. */ + class MultiUse @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( - private val code: JsonField, + private val spendingLimits: JsonField>, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("code") @ExcludeMissing code: JsonField = JsonMissing.of() - ) : this(code, mutableMapOf()) + @JsonProperty("spending_limits") + @ExcludeMissing + spendingLimits: JsonField> = JsonMissing.of() + ) : this(spendingLimits, mutableMapOf()) /** - * The Merchant Category Code. + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. * - * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or - * is unexpectedly missing or null (e.g. if the server responded with an - * unexpected value). + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). */ - fun code(): String = code.getRequired("code") + fun spendingLimits(): Optional> = + spendingLimits.getOptional("spending_limits") /** - * Returns the raw JSON value of [code]. + * Returns the raw JSON value of [spendingLimits]. * - * Unlike [code], this method doesn't throw if the JSON field has an unexpected - * type. + * Unlike [spendingLimits], this method doesn't throw if the JSON field has an + * unexpected type. */ - @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + @JsonProperty("spending_limits") + @ExcludeMissing + fun _spendingLimits(): JsonField> = spendingLimits @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { @@ -3520,42 +3214,51 @@ private constructor( companion object { - /** - * Returns a mutable builder for constructing an instance of - * [MerchantCategoryCode]. - * - * The following fields are required: - * ```java - * .code() - * ``` - */ + /** Returns a mutable builder for constructing an instance of [MultiUse]. */ @JvmStatic fun builder() = Builder() } - /** A builder for [MerchantCategoryCode]. */ + /** A builder for [MultiUse]. */ class Builder internal constructor() { - private var code: JsonField? = null + private var spendingLimits: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { - code = merchantCategoryCode.code - additionalProperties = - merchantCategoryCode.additionalProperties.toMutableMap() + internal fun from(multiUse: MultiUse) = apply { + spendingLimits = multiUse.spendingLimits.map { it.toMutableList() } + additionalProperties = multiUse.additionalProperties.toMutableMap() } - /** The Merchant Category Code. */ - fun code(code: String) = code(JsonField.of(code)) + /** + * Spending limits for this card. The most restrictive limit applies if multiple + * limits match. + */ + fun spendingLimits(spendingLimits: List) = + spendingLimits(JsonField.of(spendingLimits)) /** - * Sets [Builder.code] to an arbitrary JSON value. + * Sets [Builder.spendingLimits] to an arbitrary JSON value. * - * You should usually call [Builder.code] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. + * You should usually call [Builder.spendingLimits] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. */ - fun code(code: JsonField) = apply { this.code = code } + fun spendingLimits(spendingLimits: JsonField>) = apply { + this.spendingLimits = spendingLimits.map { it.toMutableList() } + } + + /** + * Adds a single [SpendingLimit] to [spendingLimits]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addSpendingLimit(spendingLimit: SpendingLimit) = apply { + spendingLimits = + (spendingLimits ?: JsonField.of(mutableListOf())).also { + checkKnown("spendingLimits", it).add(spendingLimit) + } + } fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() @@ -3580,32 +3283,25 @@ private constructor( } /** - * Returns an immutable instance of [MerchantCategoryCode]. + * Returns an immutable instance of [MultiUse]. * * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .code() - * ``` - * - * @throws IllegalStateException if any required field is unset. */ - fun build(): MerchantCategoryCode = - MerchantCategoryCode( - checkRequired("code", code), + fun build(): MultiUse = + MultiUse( + (spendingLimits ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } private var validated: Boolean = false - fun validate(): MerchantCategoryCode = apply { + fun validate(): MultiUse = apply { if (validated) { return@apply } - code() + spendingLimits().ifPresent { it.forEach { it.validate() } } validated = true } @@ -3624,24 +3320,1250 @@ private constructor( * Used for best match union deserialization. */ @JvmSynthetic - internal fun validity(): Int = (if (code.asKnown().isPresent) 1 else 0) + internal fun validity(): Int = + (spendingLimits.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + class SpendingLimit + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val interval: JsonField, + private val settlementAmount: JsonField, + private val merchantCategoryCodes: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("interval") + @ExcludeMissing + interval: JsonField = JsonMissing.of(), + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of(), + @JsonProperty("merchant_category_codes") + @ExcludeMissing + merchantCategoryCodes: JsonField> = + JsonMissing.of(), + ) : this(interval, settlementAmount, merchantCategoryCodes, mutableMapOf()) - return other is MerchantCategoryCode && - code == other.code && + /** + * The interval at which the spending limit is enforced. + * + * @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 interval(): Interval = interval.getRequired("interval") + + /** + * The maximum settlement amount permitted in the given interval. + * + * @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 settlementAmount(): Long = settlementAmount.getRequired("settlement_amount") + + /** + * The Merchant Category Codes this spending limit applies to. If not set, the + * limit applies to all transactions. + * + * @throws IncreaseInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun merchantCategoryCodes(): Optional> = + merchantCategoryCodes.getOptional("merchant_category_codes") + + /** + * Returns the raw JSON value of [interval]. + * + * Unlike [interval], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("interval") + @ExcludeMissing + fun _interval(): JsonField = interval + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + /** + * Returns the raw JSON value of [merchantCategoryCodes]. + * + * Unlike [merchantCategoryCodes], this method doesn't throw if the JSON field + * has an unexpected type. + */ + @JsonProperty("merchant_category_codes") + @ExcludeMissing + fun _merchantCategoryCodes(): JsonField> = + merchantCategoryCodes + + @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 + * [SpendingLimit]. + * + * The following fields are required: + * ```java + * .interval() + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SpendingLimit]. */ + class Builder internal constructor() { + + private var interval: JsonField? = null + private var settlementAmount: JsonField? = null + private var merchantCategoryCodes: + JsonField>? = + null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(spendingLimit: SpendingLimit) = apply { + interval = spendingLimit.interval + settlementAmount = spendingLimit.settlementAmount + merchantCategoryCodes = + spendingLimit.merchantCategoryCodes.map { it.toMutableList() } + additionalProperties = spendingLimit.additionalProperties.toMutableMap() + } + + /** The interval at which the spending limit is enforced. */ + fun interval(interval: Interval) = interval(JsonField.of(interval)) + + /** + * Sets [Builder.interval] to an arbitrary JSON value. + * + * You should usually call [Builder.interval] with a well-typed [Interval] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun interval(interval: JsonField) = apply { + this.interval = interval + } + + /** The maximum settlement amount permitted in the given interval. */ + fun settlementAmount(settlementAmount: Long) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [Long] value instead. This method is primarily for setting the field to + * an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + /** + * The Merchant Category Codes this spending limit applies to. If not set, + * the limit applies to all transactions. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: List + ) = merchantCategoryCodes(JsonField.of(merchantCategoryCodes)) + + /** + * Sets [Builder.merchantCategoryCodes] to an arbitrary JSON value. + * + * You should usually call [Builder.merchantCategoryCodes] with a well-typed + * `List` value instead. This method is primarily for + * setting the field to an undocumented or not yet supported value. + */ + fun merchantCategoryCodes( + merchantCategoryCodes: JsonField> + ) = apply { + this.merchantCategoryCodes = + merchantCategoryCodes.map { it.toMutableList() } + } + + /** + * Adds a single [MerchantCategoryCode] to [merchantCategoryCodes]. + * + * @throws IllegalStateException if the field was previously set to a + * non-list. + */ + fun addMerchantCategoryCode(merchantCategoryCode: MerchantCategoryCode) = + apply { + merchantCategoryCodes = + (merchantCategoryCodes ?: JsonField.of(mutableListOf())).also { + checkKnown("merchantCategoryCodes", it) + .add(merchantCategoryCode) + } + } + + 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 [SpendingLimit]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .interval() + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SpendingLimit = + SpendingLimit( + checkRequired("interval", interval), + checkRequired("settlementAmount", settlementAmount), + (merchantCategoryCodes ?: JsonMissing.of()).map { + it.toImmutable() + }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SpendingLimit = apply { + if (validated) { + return@apply + } + + interval().validate() + settlementAmount() + merchantCategoryCodes().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 = + (interval.asKnown().getOrNull()?.validity() ?: 0) + + (if (settlementAmount.asKnown().isPresent) 1 else 0) + + (merchantCategoryCodes.asKnown().getOrNull()?.sumOf { + it.validity().toInt() + } ?: 0) + + /** The interval at which the spending limit is enforced. */ + class Interval + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The spending limit applies over the lifetime of the card. */ + @JvmField val ALL_TIME = of("all_time") + + /** The spending limit applies per transaction. */ + @JvmField val PER_TRANSACTION = of("per_transaction") + + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + @JvmField val PER_DAY = of("per_day") + + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + @JvmField val PER_WEEK = of("per_week") + + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + @JvmField val PER_MONTH = of("per_month") + + @JvmStatic fun of(value: String) = Interval(JsonField.of(value)) + } + + /** An enum containing [Interval]'s known values. */ + enum class Known { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + } + + /** + * An enum containing [Interval]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Interval] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The spending limit applies over the lifetime of the card. */ + ALL_TIME, + /** The spending limit applies per transaction. */ + PER_TRANSACTION, + /** + * The spending limit applies per day. Resets nightly at midnight UTC. + */ + PER_DAY, + /** + * The spending limit applies per week. Resets weekly on Mondays at + * midnight UTC. + */ + PER_WEEK, + /** + * The spending limit applies per month. Resets on the first of the + * month, midnight UTC. + */ + PER_MONTH, + /** + * An enum member indicating that [Interval] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + ALL_TIME -> Value.ALL_TIME + PER_TRANSACTION -> Value.PER_TRANSACTION + PER_DAY -> Value.PER_DAY + PER_WEEK -> Value.PER_WEEK + PER_MONTH -> Value.PER_MONTH + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + ALL_TIME -> Known.ALL_TIME + PER_TRANSACTION -> Known.PER_TRANSACTION + PER_DAY -> Known.PER_DAY + PER_WEEK -> Known.PER_WEEK + PER_MONTH -> Known.PER_MONTH + else -> + throw IncreaseInvalidDataException("Unknown Interval: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Interval = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Interval && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + class MerchantCategoryCode + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val code: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("code") + @ExcludeMissing + code: JsonField = JsonMissing.of() + ) : this(code, mutableMapOf()) + + /** + * The Merchant Category Code. + * + * @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 code(): String = code.getRequired("code") + + /** + * Returns the raw JSON value of [code]. + * + * Unlike [code], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("code") @ExcludeMissing fun _code(): JsonField = code + + @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 + * [MerchantCategoryCode]. + * + * The following fields are required: + * ```java + * .code() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [MerchantCategoryCode]. */ + class Builder internal constructor() { + + private var code: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply { + code = merchantCategoryCode.code + additionalProperties = + merchantCategoryCode.additionalProperties.toMutableMap() + } + + /** The Merchant Category Code. */ + fun code(code: String) = code(JsonField.of(code)) + + /** + * Sets [Builder.code] to an arbitrary JSON value. + * + * You should usually call [Builder.code] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun code(code: JsonField) = apply { this.code = code } + + 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 [MerchantCategoryCode]. + * + * Further updates to this [Builder] will not mutate the returned + * instance. + * + * The following fields are required: + * ```java + * .code() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): MerchantCategoryCode = + MerchantCategoryCode( + checkRequired("code", code), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): MerchantCategoryCode = apply { + if (validated) { + return@apply + } + + code() + 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 (code.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MerchantCategoryCode && + code == other.code && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(code, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SpendingLimit && + interval == other.interval && + settlementAmount == other.settlementAmount && + merchantCategoryCodes == other.merchantCategoryCodes && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash( + interval, + settlementAmount, + merchantCategoryCodes, + additionalProperties, + ) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SpendingLimit{interval=$interval, settlementAmount=$settlementAmount, merchantCategoryCodes=$merchantCategoryCodes, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is MultiUse && + spendingLimits == other.spendingLimits && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(code, additionalProperties) } + private val hashCode: Int by lazy { + Objects.hash(spendingLimits, additionalProperties) + } override fun hashCode(): Int = hashCode override fun toString() = - "MerchantCategoryCode{code=$code, additionalProperties=$additionalProperties}" + "MultiUse{spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + } + + /** + * Controls for single-use cards. Required if and only if `category` is `single_use`. + */ + class SingleUse + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val settlementAmount: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("settlement_amount") + @ExcludeMissing + settlementAmount: JsonField = JsonMissing.of() + ) : this(settlementAmount, mutableMapOf()) + + /** + * The settlement amount constraint for this single-use card. + * + * @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 settlementAmount(): SettlementAmount = + settlementAmount.getRequired("settlement_amount") + + /** + * Returns the raw JSON value of [settlementAmount]. + * + * Unlike [settlementAmount], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("settlement_amount") + @ExcludeMissing + fun _settlementAmount(): JsonField = settlementAmount + + @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 [SingleUse]. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SingleUse]. */ + class Builder internal constructor() { + + private var settlementAmount: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(singleUse: SingleUse) = apply { + settlementAmount = singleUse.settlementAmount + additionalProperties = singleUse.additionalProperties.toMutableMap() + } + + /** The settlement amount constraint for this single-use card. */ + fun settlementAmount(settlementAmount: SettlementAmount) = + settlementAmount(JsonField.of(settlementAmount)) + + /** + * Sets [Builder.settlementAmount] to an arbitrary JSON value. + * + * You should usually call [Builder.settlementAmount] with a well-typed + * [SettlementAmount] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun settlementAmount(settlementAmount: JsonField) = apply { + this.settlementAmount = settlementAmount + } + + 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 [SingleUse]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .settlementAmount() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SingleUse = + SingleUse( + checkRequired("settlementAmount", settlementAmount), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SingleUse = apply { + if (validated) { + return@apply + } + + settlementAmount().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 = + (settlementAmount.asKnown().getOrNull()?.validity() ?: 0) + + /** The settlement amount constraint for this single-use card. */ + class SettlementAmount + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val comparison: JsonField, + private val value: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("comparison") + @ExcludeMissing + comparison: JsonField = JsonMissing.of(), + @JsonProperty("value") + @ExcludeMissing + value: JsonField = JsonMissing.of(), + ) : this(comparison, value, mutableMapOf()) + + /** + * The operator used to compare the settlement amount. + * + * @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 comparison(): Comparison = comparison.getRequired("comparison") + + /** + * The settlement amount value. + * + * @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 value(): Long = value.getRequired("value") + + /** + * Returns the raw JSON value of [comparison]. + * + * Unlike [comparison], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("comparison") + @ExcludeMissing + fun _comparison(): JsonField = comparison + + /** + * Returns the raw JSON value of [value]. + * + * Unlike [value], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("value") @ExcludeMissing fun _value(): JsonField = value + + @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 + * [SettlementAmount]. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [SettlementAmount]. */ + class Builder internal constructor() { + + private var comparison: JsonField? = null + private var value: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(settlementAmount: SettlementAmount) = apply { + comparison = settlementAmount.comparison + value = settlementAmount.value + additionalProperties = + settlementAmount.additionalProperties.toMutableMap() + } + + /** The operator used to compare the settlement amount. */ + fun comparison(comparison: Comparison) = + comparison(JsonField.of(comparison)) + + /** + * Sets [Builder.comparison] to an arbitrary JSON value. + * + * You should usually call [Builder.comparison] with a well-typed + * [Comparison] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun comparison(comparison: JsonField) = apply { + this.comparison = comparison + } + + /** The settlement amount value. */ + fun value(value: Long) = value(JsonField.of(value)) + + /** + * Sets [Builder.value] to an arbitrary JSON value. + * + * You should usually call [Builder.value] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun value(value: JsonField) = apply { this.value = value } + + 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 [SettlementAmount]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .comparison() + * .value() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): SettlementAmount = + SettlementAmount( + checkRequired("comparison", comparison), + checkRequired("value", value), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): SettlementAmount = apply { + if (validated) { + return@apply + } + + comparison().validate() + value() + 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 = + (comparison.asKnown().getOrNull()?.validity() ?: 0) + + (if (value.asKnown().isPresent) 1 else 0) + + /** The operator used to compare the settlement amount. */ + class Comparison + @JsonCreator + private constructor(private val value: JsonField) : Enum { + + /** + * Returns this class instance's raw value. + * + * This is usually only useful if this instance was deserialized from data + * that doesn't match any known member, and you want to know that value. For + * example, if the SDK is on an older version than the API, then the API may + * respond with new members that the SDK is unaware of. + */ + @com.fasterxml.jackson.annotation.JsonValue + fun _value(): JsonField = value + + companion object { + + /** The settlement amount must be exactly the specified value. */ + @JvmField val EQUALS = of("equals") + + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + @JvmField val LESS_THAN_OR_EQUALS = of("less_than_or_equals") + + @JvmStatic fun of(value: String) = Comparison(JsonField.of(value)) + } + + /** An enum containing [Comparison]'s known values. */ + enum class Known { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + } + + /** + * An enum containing [Comparison]'s known values, as well as an [_UNKNOWN] + * member. + * + * An instance of [Comparison] can contain an unknown value in a couple of + * cases: + * - It was deserialized from data that doesn't match any known member. For + * example, if the SDK is on an older version than the API, then the API + * may respond with new members that the SDK is unaware of. + * - It was constructed with an arbitrary value using the [of] method. + */ + enum class Value { + /** The settlement amount must be exactly the specified value. */ + EQUALS, + /** + * The settlement amount must be less than or equal to the specified + * value. + */ + LESS_THAN_OR_EQUALS, + /** + * An enum member indicating that [Comparison] was instantiated with an + * unknown value. + */ + _UNKNOWN, + } + + /** + * Returns an enum member corresponding to this class instance's value, or + * [Value._UNKNOWN] if the class was instantiated with an unknown value. + * + * Use the [known] method instead if you're certain the value is always + * known or if you want to throw for the unknown case. + */ + fun value(): Value = + when (this) { + EQUALS -> Value.EQUALS + LESS_THAN_OR_EQUALS -> Value.LESS_THAN_OR_EQUALS + else -> Value._UNKNOWN + } + + /** + * Returns an enum member corresponding to this class instance's value. + * + * Use the [value] method instead if you're uncertain the value is always + * known and don't want to throw for the unknown case. + * + * @throws IncreaseInvalidDataException if this class instance's value is a + * not a known member. + */ + fun known(): Known = + when (this) { + EQUALS -> Known.EQUALS + LESS_THAN_OR_EQUALS -> Known.LESS_THAN_OR_EQUALS + else -> + throw IncreaseInvalidDataException("Unknown Comparison: $value") + } + + /** + * Returns this class instance's primitive wire representation. + * + * This differs from the [toString] method because that method is primarily + * for debugging and generally doesn't throw. + * + * @throws IncreaseInvalidDataException if this class instance's value does + * not have the expected primitive type. + */ + fun asString(): String = + _value().asString().orElseThrow { + IncreaseInvalidDataException("Value is not a String") + } + + private var validated: Boolean = false + + fun validate(): Comparison = apply { + if (validated) { + return@apply + } + + known() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: IncreaseInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this + * object recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Comparison && value == other.value + } + + override fun hashCode() = value.hashCode() + + override fun toString() = value.toString() + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SettlementAmount && + comparison == other.comparison && + value == other.value && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(comparison, value, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SettlementAmount{comparison=$comparison, value=$value, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is SingleUse && + settlementAmount == other.settlementAmount && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(settlementAmount, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "SingleUse{settlementAmount=$settlementAmount, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3649,26 +4571,21 @@ private constructor( return true } - return other is SpendingLimit && - interval == other.interval && - settlementAmount == other.settlementAmount && - merchantCategoryCodes == other.merchantCategoryCodes && + return other is Usage && + category == other.category && + multiUse == other.multiUse && + singleUse == other.singleUse && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { - Objects.hash( - interval, - settlementAmount, - merchantCategoryCodes, - additionalProperties, - ) + Objects.hash(category, multiUse, singleUse, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "SpendingLimit{interval=$interval, settlementAmount=$settlementAmount, merchantCategoryCodes=$merchantCategoryCodes, additionalProperties=$additionalProperties}" + "Usage{category=$category, multiUse=$multiUse, singleUse=$singleUse, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { @@ -3677,21 +4594,19 @@ private constructor( } return other is AuthorizationControls && - maximumAuthorizationCount == other.maximumAuthorizationCount && merchantAcceptorIdentifier == other.merchantAcceptorIdentifier && merchantCategoryCode == other.merchantCategoryCode && merchantCountry == other.merchantCountry && - spendingLimits == other.spendingLimits && + usage == other.usage && additionalProperties == other.additionalProperties } private val hashCode: Int by lazy { Objects.hash( - maximumAuthorizationCount, merchantAcceptorIdentifier, merchantCategoryCode, merchantCountry, - spendingLimits, + usage, additionalProperties, ) } @@ -3699,7 +4614,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "AuthorizationControls{maximumAuthorizationCount=$maximumAuthorizationCount, merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}" + "AuthorizationControls{merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, usage=$usage, additionalProperties=$additionalProperties}" } /** The card's updated billing address. */ diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateParamsTest.kt index ffee8b784..c9d02927d 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardCreateParamsTest.kt @@ -13,11 +13,6 @@ internal class CardCreateParamsTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( CardCreateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardCreateParams.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardCreateParams.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -68,18 +63,54 @@ internal class CardCreateParamsTest { ) .build() ) - .addSpendingLimit( - CardCreateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardCreateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardCreateParams.AuthorizationControls.Usage.builder() + .category( + CardCreateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardCreateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardCreateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardCreateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardCreateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardCreateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -114,12 +145,6 @@ internal class CardCreateParamsTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( CardCreateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardCreateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardCreateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -175,18 +200,54 @@ internal class CardCreateParamsTest { ) .build() ) - .addSpendingLimit( - CardCreateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardCreateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardCreateParams.AuthorizationControls.Usage.builder() + .category( + CardCreateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardCreateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardCreateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardCreateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardCreateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardCreateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -219,11 +280,6 @@ internal class CardCreateParamsTest { assertThat(body.authorizationControls()) .contains( CardCreateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardCreateParams.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardCreateParams.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -274,18 +330,54 @@ internal class CardCreateParamsTest { ) .build() ) - .addSpendingLimit( - CardCreateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardCreateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardCreateParams.AuthorizationControls.Usage.builder() + .category( + CardCreateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardCreateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardCreateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardCreateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardCreateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardCreateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardListPageResponseTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardListPageResponseTest.kt index d33deb8d1..ec168fe2d 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardListPageResponseTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardListPageResponseTest.kt @@ -20,11 +20,6 @@ internal class CardListPageResponseTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -75,20 +70,56 @@ internal class CardListPageResponseTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval( - Card.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + Card.AuthorizationControls.Usage.builder() + .category( + Card.AuthorizationControls.Usage.Category.SINGLE_USE ) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("code") + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() + ) + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() @@ -130,11 +161,6 @@ internal class CardListPageResponseTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -183,19 +209,51 @@ internal class CardListPageResponseTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval( - Card.AuthorizationControls.SpendingLimit.Interval.ALL_TIME + .usage( + Card.AuthorizationControls.Usage.builder() + .category(Card.AuthorizationControls.Usage.Category.SINGLE_USE) + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() ) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("code") + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() @@ -241,11 +299,6 @@ internal class CardListPageResponseTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -296,20 +349,56 @@ internal class CardListPageResponseTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval( - Card.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + Card.AuthorizationControls.Usage.builder() + .category( + Card.AuthorizationControls.Usage.Category.SINGLE_USE ) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("code") + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() + ) + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardTest.kt index 1dbecd2f5..d10063c78 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardTest.kt @@ -18,11 +18,6 @@ internal class CardTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -69,18 +64,50 @@ internal class CardTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval( - Card.AuthorizationControls.SpendingLimit.Interval.ALL_TIME + .usage( + Card.AuthorizationControls.Usage.builder() + .category(Card.AuthorizationControls.Usage.Category.SINGLE_USE) + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse.SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() ) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit.MerchantCategoryCode - .builder() - .code("code") + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() @@ -117,11 +144,6 @@ internal class CardTest { assertThat(card.authorizationControls()) .contains( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -166,16 +188,49 @@ internal class CardTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval(Card.AuthorizationControls.SpendingLimit.Interval.ALL_TIME) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit.MerchantCategoryCode - .builder() - .code("code") + .usage( + Card.AuthorizationControls.Usage.builder() + .category(Card.AuthorizationControls.Usage.Category.SINGLE_USE) + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse.SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() + ) + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse.SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() @@ -218,11 +273,6 @@ internal class CardTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( Card.AuthorizationControls.builder() - .maximumAuthorizationCount( - Card.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( Card.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -269,18 +319,50 @@ internal class CardTest { ) .build() ) - .addSpendingLimit( - Card.AuthorizationControls.SpendingLimit.builder() - .interval( - Card.AuthorizationControls.SpendingLimit.Interval.ALL_TIME + .usage( + Card.AuthorizationControls.Usage.builder() + .category(Card.AuthorizationControls.Usage.Category.SINGLE_USE) + .multiUse( + Card.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + Card.AuthorizationControls.Usage.MultiUse.SpendingLimit + .builder() + .interval( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .addMerchantCategoryCode( + Card.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("code") + .build() + ) + .settlementAmount(0L) + .build() + ) + .build() ) - .addMerchantCategoryCode( - Card.AuthorizationControls.SpendingLimit.MerchantCategoryCode - .builder() - .code("code") + .singleUse( + Card.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + Card.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) - .settlementAmount(0L) .build() ) .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt index 6f856c9d3..dea11293e 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/models/cards/CardUpdateParamsTest.kt @@ -13,11 +13,6 @@ internal class CardUpdateParamsTest { .cardId("card_oubs0hwk5rn6knuecxg2") .authorizationControls( CardUpdateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardUpdateParams.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardUpdateParams.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -68,18 +63,54 @@ internal class CardUpdateParamsTest { ) .build() ) - .addSpendingLimit( - CardUpdateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardUpdateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardUpdateParams.AuthorizationControls.Usage.builder() + .category( + CardUpdateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardUpdateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardUpdateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardUpdateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardUpdateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardUpdateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -124,12 +155,6 @@ internal class CardUpdateParamsTest { .cardId("card_oubs0hwk5rn6knuecxg2") .authorizationControls( CardUpdateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardUpdateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardUpdateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -185,18 +210,54 @@ internal class CardUpdateParamsTest { ) .build() ) - .addSpendingLimit( - CardUpdateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardUpdateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardUpdateParams.AuthorizationControls.Usage.builder() + .category( + CardUpdateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardUpdateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardUpdateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardUpdateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardUpdateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardUpdateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -229,11 +290,6 @@ internal class CardUpdateParamsTest { assertThat(body.authorizationControls()) .contains( CardUpdateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardUpdateParams.AuthorizationControls.MaximumAuthorizationCount.builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardUpdateParams.AuthorizationControls.MerchantAcceptorIdentifier.builder() .addAllowed( @@ -284,18 +340,54 @@ internal class CardUpdateParamsTest { ) .build() ) - .addSpendingLimit( - CardUpdateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardUpdateParams.AuthorizationControls.SpendingLimit.Interval - .ALL_TIME + .usage( + CardUpdateParams.AuthorizationControls.Usage.builder() + .category( + CardUpdateParams.AuthorizationControls.Usage.Category.SINGLE_USE ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardUpdateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode - .builder() - .code("x") + .multiUse( + CardUpdateParams.AuthorizationControls.Usage.MultiUse.builder() + .addSpendingLimit( + CardUpdateParams.AuthorizationControls.Usage.MultiUse + .SpendingLimit + .builder() + .interval( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() + ) + .singleUse( + CardUpdateParams.AuthorizationControls.Usage.SingleUse.builder() + .settlementAmount( + CardUpdateParams.AuthorizationControls.Usage.SingleUse + .SettlementAmount + .builder() + .comparison( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt index 9609a8e4d..74b543380 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/async/CardServiceAsyncTest.kt @@ -29,12 +29,6 @@ internal class CardServiceAsyncTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( CardCreateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardCreateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardCreateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -93,19 +87,59 @@ internal class CardServiceAsyncTest { ) .build() ) - .addSpendingLimit( - CardCreateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardCreateParams.AuthorizationControls.SpendingLimit - .Interval - .ALL_TIME + .usage( + CardCreateParams.AuthorizationControls.Usage.builder() + .category( + CardCreateParams.AuthorizationControls.Usage.Category + .SINGLE_USE + ) + .multiUse( + CardCreateParams.AuthorizationControls.Usage.MultiUse + .builder() + .addSpendingLimit( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .builder() + .interval( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardCreateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode + .singleUse( + CardCreateParams.AuthorizationControls.Usage.SingleUse .builder() - .code("x") + .settlementAmount( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .builder() + .comparison( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -167,12 +201,6 @@ internal class CardServiceAsyncTest { .cardId("card_oubs0hwk5rn6knuecxg2") .authorizationControls( CardUpdateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardUpdateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardUpdateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -231,19 +259,59 @@ internal class CardServiceAsyncTest { ) .build() ) - .addSpendingLimit( - CardUpdateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardUpdateParams.AuthorizationControls.SpendingLimit - .Interval - .ALL_TIME + .usage( + CardUpdateParams.AuthorizationControls.Usage.builder() + .category( + CardUpdateParams.AuthorizationControls.Usage.Category + .SINGLE_USE + ) + .multiUse( + CardUpdateParams.AuthorizationControls.Usage.MultiUse + .builder() + .addSpendingLimit( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .builder() + .interval( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardUpdateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode + .singleUse( + CardUpdateParams.AuthorizationControls.Usage.SingleUse .builder() - .code("x") + .settlementAmount( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .builder() + .comparison( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() diff --git a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt index c01f08966..2babd7b88 100644 --- a/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt +++ b/increase-java-core/src/test/kotlin/com/increase/api/services/blocking/CardServiceTest.kt @@ -29,12 +29,6 @@ internal class CardServiceTest { .accountId("account_in71c4amph0vgo2qllky") .authorizationControls( CardCreateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardCreateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardCreateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -93,19 +87,59 @@ internal class CardServiceTest { ) .build() ) - .addSpendingLimit( - CardCreateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardCreateParams.AuthorizationControls.SpendingLimit - .Interval - .ALL_TIME + .usage( + CardCreateParams.AuthorizationControls.Usage.builder() + .category( + CardCreateParams.AuthorizationControls.Usage.Category + .SINGLE_USE + ) + .multiUse( + CardCreateParams.AuthorizationControls.Usage.MultiUse + .builder() + .addSpendingLimit( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .builder() + .interval( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardCreateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardCreateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode + .singleUse( + CardCreateParams.AuthorizationControls.Usage.SingleUse .builder() - .code("x") + .settlementAmount( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .builder() + .comparison( + CardCreateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() @@ -165,12 +199,6 @@ internal class CardServiceTest { .cardId("card_oubs0hwk5rn6knuecxg2") .authorizationControls( CardUpdateParams.AuthorizationControls.builder() - .maximumAuthorizationCount( - CardUpdateParams.AuthorizationControls.MaximumAuthorizationCount - .builder() - .allTime(0L) - .build() - ) .merchantAcceptorIdentifier( CardUpdateParams.AuthorizationControls.MerchantAcceptorIdentifier .builder() @@ -229,19 +257,59 @@ internal class CardServiceTest { ) .build() ) - .addSpendingLimit( - CardUpdateParams.AuthorizationControls.SpendingLimit.builder() - .interval( - CardUpdateParams.AuthorizationControls.SpendingLimit - .Interval - .ALL_TIME + .usage( + CardUpdateParams.AuthorizationControls.Usage.builder() + .category( + CardUpdateParams.AuthorizationControls.Usage.Category + .SINGLE_USE + ) + .multiUse( + CardUpdateParams.AuthorizationControls.Usage.MultiUse + .builder() + .addSpendingLimit( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .builder() + .interval( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .Interval + .ALL_TIME + ) + .settlementAmount(0L) + .addMerchantCategoryCode( + CardUpdateParams.AuthorizationControls.Usage + .MultiUse + .SpendingLimit + .MerchantCategoryCode + .builder() + .code("x") + .build() + ) + .build() + ) + .build() ) - .settlementAmount(0L) - .addMerchantCategoryCode( - CardUpdateParams.AuthorizationControls.SpendingLimit - .MerchantCategoryCode + .singleUse( + CardUpdateParams.AuthorizationControls.Usage.SingleUse .builder() - .code("x") + .settlementAmount( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .builder() + .comparison( + CardUpdateParams.AuthorizationControls.Usage + .SingleUse + .SettlementAmount + .Comparison + .EQUALS + ) + .value(0L) + .build() + ) .build() ) .build() From dbb507a426ea7cfb91bb983aee4774056acf0be1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 03:00:20 +0000 Subject: [PATCH 2/3] feat(api): api update --- .stats.yml | 4 ++-- .../src/main/kotlin/com/increase/api/models/cards/Card.kt | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 59a5dddff..8e99a7e66 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-10b0412eb48b8e2b9720b29cf479448d246a9169c1937177f11a3d2ef80ae7f1.yml -openapi_spec_hash: ed688969255974736f3fbd4e6f30194e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-07202bc3c027c441ab8829ab0e32c1547952d4cae1691fe00497ee3b056127d0.yml +openapi_spec_hash: 3c21b26cf5803678876c00c40e88c781 config_hash: 4945e03affdf289484733306e4797f81 diff --git a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt index f513d547c..340fa7039 100644 --- a/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt +++ b/increase-java-core/src/main/kotlin/com/increase/api/models/cards/Card.kt @@ -22,9 +22,10 @@ import java.util.Optional import kotlin.jvm.optionals.getOrNull /** - * Cards are commercial credit cards. They'll immediately work for online purchases after you create - * them. All cards maintain a credit limit of 100% of the Account’s available balance at the time of - * transaction. Funds are deducted from the Account upon transaction settlement. + * Cards may operate on credit, debit or prepaid BINs. They’ll immediately work for online purchases + * after you create them. All cards work on a good funds model, and maintain a maximum limit of 100% + * of the Account’s available balance at the time of transaction. Funds are deducted from the + * Account upon transaction settlement. */ class Card @JsonCreator(mode = JsonCreator.Mode.DISABLED) From 0e3ce91aae961edf12a06da9ac741257880b0e06 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 03:00:47 +0000 Subject: [PATCH 3/3] release: 0.505.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 12536a158..1eb441221 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.504.0" + ".": "0.505.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 959382f3d..cd0f1999d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.505.0 (2026-04-07) + +Full Changelog: [v0.504.0...v0.505.0](https://github.com/Increase/increase-java/compare/v0.504.0...v0.505.0) + +### Features + +* **api:** api update ([dbb507a](https://github.com/Increase/increase-java/commit/dbb507a426ea7cfb91bb983aee4774056acf0be1)) +* **api:** api update ([b6cbb94](https://github.com/Increase/increase-java/commit/b6cbb943fe26b6ba4dacf1b712994036fcc5bfe5)) + ## 0.504.0 (2026-04-04) Full Changelog: [v0.503.0...v0.504.0](https://github.com/Increase/increase-java/compare/v0.503.0...v0.504.0) diff --git a/README.md b/README.md index f5b3302e5..20c037e96 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.504.0) -[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.504.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.504.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.505.0) +[![javadoc](https://javadoc.io/badge2/com.increase.api/increase-java/0.505.0/javadoc.svg)](https://javadoc.io/doc/com.increase.api/increase-java/0.505.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.504.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.505.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.504.0") +implementation("com.increase.api:increase-java:0.505.0") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.504.0") com.increase.api increase-java - 0.504.0 + 0.505.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 25d7a7ddf..da7837d72 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.increase.api" - version = "0.504.0" // x-release-please-version + version = "0.505.0" // x-release-please-version } subprojects {