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/.stats.yml b/.stats.yml
index 5fef959d3..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-c73835a51350d0f42d529d2731b0d4da4487f55b1c98a6e0a322c21b1264f209.yml
-openapi_spec_hash: 23561aff9285210e32b4e15e1486a01a
+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/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 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.504.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.504.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.505.0)
+[](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 {
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..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)
@@ -736,19 +737,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 +755,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 +795,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 +834,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 +859,10 @@ private constructor(
*
* The following fields are required:
* ```java
- * .maximumAuthorizationCount()
* .merchantAcceptorIdentifier()
* .merchantCategoryCode()
* .merchantCountry()
- * .spendingLimits()
+ * .usage()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -903,46 +871,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 +961,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 +1002,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 +1027,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 +1050,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 +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 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 +2897,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 +2997,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 +3048,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 +3068,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 +3115,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 +3131,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 +3152,7 @@ private constructor(
private var validated: Boolean = false
- fun validate(): Interval = apply {
+ fun validate(): Category = apply {
if (validated) {
return@apply
}
@@ -3514,7 +3182,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 +3190,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 +3240,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 +3322,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 +3368,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 +4629,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 +4652,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 +4672,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