diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 25b00795d..2c7ce2d54 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.501.0"
+ ".": "0.502.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 3e05b57f8..5c2b86552 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-e3103e9bb8480e11581841c322e0bd0255b64413d401873c96cd00a3e6d6c3f7.yml
-openapi_spec_hash: 962e1efe27066cf84b405a6695dd8288
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-31046e3fe86098c429a87dc861cf42dae0252314abf90021a804e748f9c16417.yml
+openapi_spec_hash: 78fe78704879172326e842c27ee09a3a
config_hash: 4945e03affdf289484733306e4797f81
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9c1a995fe..a88f8abc3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.502.0 (2026-04-03)
+
+Full Changelog: [v0.501.0...v0.502.0](https://github.com/Increase/increase-java/compare/v0.501.0...v0.502.0)
+
+### Features
+
+* **api:** api update ([fca194b](https://github.com/Increase/increase-java/commit/fca194b283ed94517b390e14ce5879549cdcbf51))
+
## 0.501.0 (2026-04-02)
Full Changelog: [v0.500.0...v0.501.0](https://github.com/Increase/increase-java/compare/v0.500.0...v0.501.0)
diff --git a/README.md b/README.md
index 733951020..d637a0d47 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.501.0)
-[](https://javadoc.io/doc/com.increase.api/increase-java/0.501.0)
+[](https://central.sonatype.com/artifact/com.increase.api/increase-java/0.502.0)
+[](https://javadoc.io/doc/com.increase.api/increase-java/0.502.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.501.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.502.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.501.0")
+implementation("com.increase.api:increase-java:0.502.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.increase.api:increase-java:0.501.0")
com.increase.api
increase-java
- 0.501.0
+ 0.502.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index fa9d63672..47043d8d2 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.increase.api"
- version = "0.501.0" // x-release-please-version
+ version = "0.502.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 1b2d3ea8c..dd27c80be 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
@@ -11,7 +11,9 @@ import com.increase.api.core.ExcludeMissing
import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
+import com.increase.api.core.checkKnown
import com.increase.api.core.checkRequired
+import com.increase.api.core.toImmutable
import com.increase.api.errors.IncreaseInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -29,6 +31,7 @@ class Card
private constructor(
private val id: JsonField,
private val accountId: JsonField,
+ private val authorizationControls: JsonField,
private val billingAddress: JsonField,
private val createdAt: JsonField,
private val description: JsonField,
@@ -47,6 +50,9 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
@JsonProperty("account_id") @ExcludeMissing accountId: JsonField = JsonMissing.of(),
+ @JsonProperty("authorization_controls")
+ @ExcludeMissing
+ authorizationControls: JsonField = JsonMissing.of(),
@JsonProperty("billing_address")
@ExcludeMissing
billingAddress: JsonField = JsonMissing.of(),
@@ -75,6 +81,7 @@ private constructor(
) : this(
id,
accountId,
+ authorizationControls,
billingAddress,
createdAt,
description,
@@ -105,6 +112,15 @@ private constructor(
*/
fun accountId(): String = accountId.getRequired("account_id")
+ /**
+ * Controls that restrict how 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 authorizationControls(): Optional =
+ authorizationControls.getOptional("authorization_controls")
+
/**
* The Card's billing address.
*
@@ -211,6 +227,16 @@ private constructor(
*/
@JsonProperty("account_id") @ExcludeMissing fun _accountId(): JsonField = accountId
+ /**
+ * Returns the raw JSON value of [authorizationControls].
+ *
+ * Unlike [authorizationControls], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("authorization_controls")
+ @ExcludeMissing
+ fun _authorizationControls(): JsonField = authorizationControls
+
/**
* Returns the raw JSON value of [billingAddress].
*
@@ -321,6 +347,7 @@ private constructor(
* ```java
* .id()
* .accountId()
+ * .authorizationControls()
* .billingAddress()
* .createdAt()
* .description()
@@ -342,6 +369,7 @@ private constructor(
private var id: JsonField? = null
private var accountId: JsonField? = null
+ private var authorizationControls: JsonField? = null
private var billingAddress: JsonField? = null
private var createdAt: JsonField? = null
private var description: JsonField? = null
@@ -359,6 +387,7 @@ private constructor(
internal fun from(card: Card) = apply {
id = card.id
accountId = card.accountId
+ authorizationControls = card.authorizationControls
billingAddress = card.billingAddress
createdAt = card.createdAt
description = card.description
@@ -396,6 +425,28 @@ private constructor(
*/
fun accountId(accountId: JsonField) = apply { this.accountId = accountId }
+ /** Controls that restrict how this card can be used. */
+ fun authorizationControls(authorizationControls: AuthorizationControls?) =
+ authorizationControls(JsonField.ofNullable(authorizationControls))
+
+ /**
+ * Alias for calling [Builder.authorizationControls] with
+ * `authorizationControls.orElse(null)`.
+ */
+ fun authorizationControls(authorizationControls: Optional) =
+ authorizationControls(authorizationControls.getOrNull())
+
+ /**
+ * Sets [Builder.authorizationControls] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.authorizationControls] with a well-typed
+ * [AuthorizationControls] value instead. This method is primarily for setting the field to
+ * an undocumented or not yet supported value.
+ */
+ fun authorizationControls(authorizationControls: JsonField) = apply {
+ this.authorizationControls = authorizationControls
+ }
+
/** The Card's billing address. */
fun billingAddress(billingAddress: BillingAddress) =
billingAddress(JsonField.of(billingAddress))
@@ -591,6 +642,7 @@ private constructor(
* ```java
* .id()
* .accountId()
+ * .authorizationControls()
* .billingAddress()
* .createdAt()
* .description()
@@ -610,6 +662,7 @@ private constructor(
Card(
checkRequired("id", id),
checkRequired("accountId", accountId),
+ checkRequired("authorizationControls", authorizationControls),
checkRequired("billingAddress", billingAddress),
checkRequired("createdAt", createdAt),
checkRequired("description", description),
@@ -634,6 +687,7 @@ private constructor(
id()
accountId()
+ authorizationControls().ifPresent { it.validate() }
billingAddress().validate()
createdAt()
description()
@@ -665,6 +719,7 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (accountId.asKnown().isPresent) 1 else 0) +
+ (authorizationControls.asKnown().getOrNull()?.validity() ?: 0) +
(billingAddress.asKnown().getOrNull()?.validity() ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
@@ -677,6 +732,3021 @@ private constructor(
(status.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
+ /** Controls that restrict how this card can be used. */
+ 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 additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("maximum_authorization_count")
+ @ExcludeMissing
+ maximumAuthorizationCount: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_acceptor_identifier")
+ @ExcludeMissing
+ merchantAcceptorIdentifier: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_category_code")
+ @ExcludeMissing
+ merchantCategoryCode: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_country")
+ @ExcludeMissing
+ merchantCountry: JsonField = JsonMissing.of(),
+ @JsonProperty("spending_limits")
+ @ExcludeMissing
+ spendingLimits: JsonField> = JsonMissing.of(),
+ ) : this(
+ maximumAuthorizationCount,
+ merchantAcceptorIdentifier,
+ merchantCategoryCode,
+ merchantCountry,
+ spendingLimits,
+ 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.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun merchantAcceptorIdentifier(): Optional =
+ merchantAcceptorIdentifier.getOptional("merchant_acceptor_identifier")
+
+ /**
+ * Restricts which Merchant Category Codes are allowed or blocked for authorizations on this
+ * card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun merchantCategoryCode(): Optional =
+ merchantCategoryCode.getOptional("merchant_category_code")
+
+ /**
+ * Restricts which merchant countries are allowed or blocked for authorizations on this
+ * card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun merchantCountry(): Optional =
+ merchantCountry.getOptional("merchant_country")
+
+ /**
+ * Spending limits for this card. The most restrictive limit is applied if multiple limits
+ * match.
+ *
+ * @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
+
+ /**
+ * Returns the raw JSON value of [merchantAcceptorIdentifier].
+ *
+ * Unlike [merchantAcceptorIdentifier], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_acceptor_identifier")
+ @ExcludeMissing
+ fun _merchantAcceptorIdentifier(): JsonField =
+ merchantAcceptorIdentifier
+
+ /**
+ * Returns the raw JSON value of [merchantCategoryCode].
+ *
+ * Unlike [merchantCategoryCode], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_category_code")
+ @ExcludeMissing
+ fun _merchantCategoryCode(): JsonField = merchantCategoryCode
+
+ /**
+ * Returns the raw JSON value of [merchantCountry].
+ *
+ * Unlike [merchantCountry], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("merchant_country")
+ @ExcludeMissing
+ fun _merchantCountry(): JsonField = merchantCountry
+
+ /**
+ * Returns the raw JSON value of [spendingLimits].
+ *
+ * Unlike [spendingLimits], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("spending_limits")
+ @ExcludeMissing
+ fun _spendingLimits(): JsonField> = spendingLimits
+
+ @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 [AuthorizationControls].
+ *
+ * The following fields are required:
+ * ```java
+ * .maximumAuthorizationCount()
+ * .merchantAcceptorIdentifier()
+ * .merchantCategoryCode()
+ * .merchantCountry()
+ * .spendingLimits()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** 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 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() }
+ 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.
+ */
+ fun merchantAcceptorIdentifier(
+ merchantAcceptorIdentifier: MerchantAcceptorIdentifier?
+ ) = merchantAcceptorIdentifier(JsonField.ofNullable(merchantAcceptorIdentifier))
+
+ /**
+ * Alias for calling [Builder.merchantAcceptorIdentifier] with
+ * `merchantAcceptorIdentifier.orElse(null)`.
+ */
+ fun merchantAcceptorIdentifier(
+ merchantAcceptorIdentifier: Optional
+ ) = merchantAcceptorIdentifier(merchantAcceptorIdentifier.getOrNull())
+
+ /**
+ * Sets [Builder.merchantAcceptorIdentifier] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantAcceptorIdentifier] with a well-typed
+ * [MerchantAcceptorIdentifier] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchantAcceptorIdentifier(
+ merchantAcceptorIdentifier: JsonField
+ ) = apply { this.merchantAcceptorIdentifier = merchantAcceptorIdentifier }
+
+ /**
+ * Restricts which Merchant Category Codes are allowed or blocked for authorizations on
+ * this card.
+ */
+ fun merchantCategoryCode(merchantCategoryCode: MerchantCategoryCode?) =
+ merchantCategoryCode(JsonField.ofNullable(merchantCategoryCode))
+
+ /**
+ * Alias for calling [Builder.merchantCategoryCode] with
+ * `merchantCategoryCode.orElse(null)`.
+ */
+ fun merchantCategoryCode(merchantCategoryCode: Optional) =
+ merchantCategoryCode(merchantCategoryCode.getOrNull())
+
+ /**
+ * Sets [Builder.merchantCategoryCode] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantCategoryCode] with a well-typed
+ * [MerchantCategoryCode] value instead. This method is primarily for setting the field
+ * to an undocumented or not yet supported value.
+ */
+ fun merchantCategoryCode(merchantCategoryCode: JsonField) =
+ apply {
+ this.merchantCategoryCode = merchantCategoryCode
+ }
+
+ /**
+ * Restricts which merchant countries are allowed or blocked for authorizations on this
+ * card.
+ */
+ fun merchantCountry(merchantCountry: MerchantCountry?) =
+ merchantCountry(JsonField.ofNullable(merchantCountry))
+
+ /** Alias for calling [Builder.merchantCountry] with `merchantCountry.orElse(null)`. */
+ fun merchantCountry(merchantCountry: Optional) =
+ merchantCountry(merchantCountry.getOrNull())
+
+ /**
+ * Sets [Builder.merchantCountry] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantCountry] with a well-typed [MerchantCountry]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun merchantCountry(merchantCountry: JsonField) = apply {
+ this.merchantCountry = merchantCountry
+ }
+
+ /**
+ * Spending limits for this card. The most restrictive limit is applied 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())
+
+ /**
+ * 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() }
+ }
+
+ /**
+ * 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()
+ 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 [AuthorizationControls].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .maximumAuthorizationCount()
+ * .merchantAcceptorIdentifier()
+ * .merchantCategoryCode()
+ * .merchantCountry()
+ * .spendingLimits()
+ * ```
+ *
+ * @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() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AuthorizationControls = apply {
+ if (validated) {
+ return@apply
+ }
+
+ maximumAuthorizationCount().ifPresent { it.validate() }
+ merchantAcceptorIdentifier().ifPresent { it.validate() }
+ merchantCategoryCode().ifPresent { it.validate() }
+ merchantCountry().ifPresent { it.validate() }
+ spendingLimits().ifPresent { it.forEach { it.validate() } }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (maximumAuthorizationCount.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}"
+ }
+
+ /**
+ * Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this
+ * card.
+ */
+ class MerchantAcceptorIdentifier
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val allowed: JsonField>,
+ private val blocked: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ allowed: JsonField> = JsonMissing.of(),
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ blocked: JsonField> = JsonMissing.of(),
+ ) : this(allowed, blocked, mutableMapOf())
+
+ /**
+ * The Merchant Acceptor IDs that are allowed for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun allowed(): Optional> = allowed.getOptional("allowed")
+
+ /**
+ * The Merchant Acceptor IDs that are blocked for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun blocked(): Optional> = blocked.getOptional("blocked")
+
+ /**
+ * Returns the raw JSON value of [allowed].
+ *
+ * Unlike [allowed], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ fun _allowed(): JsonField> = allowed
+
+ /**
+ * Returns the raw JSON value of [blocked].
+ *
+ * Unlike [blocked], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ fun _blocked(): JsonField> = blocked
+
+ @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
+ * [MerchantAcceptorIdentifier].
+ *
+ * The following fields are required:
+ * ```java
+ * .allowed()
+ * .blocked()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantAcceptorIdentifier]. */
+ class Builder internal constructor() {
+
+ private var allowed: JsonField>? = null
+ private var blocked: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantAcceptorIdentifier: MerchantAcceptorIdentifier) = apply {
+ allowed = merchantAcceptorIdentifier.allowed.map { it.toMutableList() }
+ blocked = merchantAcceptorIdentifier.blocked.map { it.toMutableList() }
+ additionalProperties =
+ merchantAcceptorIdentifier.additionalProperties.toMutableMap()
+ }
+
+ /** The Merchant Acceptor IDs that are allowed for authorizations on this card. */
+ fun allowed(allowed: List?) = allowed(JsonField.ofNullable(allowed))
+
+ /** Alias for calling [Builder.allowed] with `allowed.orElse(null)`. */
+ fun allowed(allowed: Optional>) = allowed(allowed.getOrNull())
+
+ /**
+ * Sets [Builder.allowed] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.allowed] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun allowed(allowed: JsonField>) = apply {
+ this.allowed = allowed.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Allowed] to [Builder.allowed].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAllowed(allowed: Allowed) = apply {
+ this.allowed =
+ (this.allowed ?: JsonField.of(mutableListOf())).also {
+ checkKnown("allowed", it).add(allowed)
+ }
+ }
+
+ /** The Merchant Acceptor IDs that are blocked for authorizations on this card. */
+ fun blocked(blocked: List?) = blocked(JsonField.ofNullable(blocked))
+
+ /** Alias for calling [Builder.blocked] with `blocked.orElse(null)`. */
+ fun blocked(blocked: Optional>) = blocked(blocked.getOrNull())
+
+ /**
+ * Sets [Builder.blocked] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.blocked] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun blocked(blocked: JsonField>) = apply {
+ this.blocked = blocked.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Blocked] to [Builder.blocked].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addBlocked(blocked: Blocked) = apply {
+ this.blocked =
+ (this.blocked ?: JsonField.of(mutableListOf())).also {
+ checkKnown("blocked", it).add(blocked)
+ }
+ }
+
+ 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 [MerchantAcceptorIdentifier].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .allowed()
+ * .blocked()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantAcceptorIdentifier =
+ MerchantAcceptorIdentifier(
+ checkRequired("allowed", allowed).map { it.toImmutable() },
+ checkRequired("blocked", blocked).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantAcceptorIdentifier = apply {
+ if (validated) {
+ return@apply
+ }
+
+ allowed().ifPresent { it.forEach { it.validate() } }
+ blocked().ifPresent { it.forEach { it.validate() } }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (allowed.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (blocked.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ class Allowed
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val identifier: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("identifier")
+ @ExcludeMissing
+ identifier: JsonField = JsonMissing.of()
+ ) : this(identifier, mutableMapOf())
+
+ /**
+ * The Merchant Acceptor ID.
+ *
+ * @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 identifier(): String = identifier.getRequired("identifier")
+
+ /**
+ * Returns the raw JSON value of [identifier].
+ *
+ * Unlike [identifier], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("identifier")
+ @ExcludeMissing
+ fun _identifier(): JsonField = identifier
+
+ @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 [Allowed].
+ *
+ * The following fields are required:
+ * ```java
+ * .identifier()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Allowed]. */
+ class Builder internal constructor() {
+
+ private var identifier: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(allowed: Allowed) = apply {
+ identifier = allowed.identifier
+ additionalProperties = allowed.additionalProperties.toMutableMap()
+ }
+
+ /** The Merchant Acceptor ID. */
+ fun identifier(identifier: String) = identifier(JsonField.of(identifier))
+
+ /**
+ * Sets [Builder.identifier] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.identifier] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun identifier(identifier: JsonField) = apply {
+ this.identifier = identifier
+ }
+
+ 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 [Allowed].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .identifier()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Allowed =
+ Allowed(
+ checkRequired("identifier", identifier),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Allowed = apply {
+ if (validated) {
+ return@apply
+ }
+
+ identifier()
+ 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 (identifier.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Allowed &&
+ identifier == other.identifier &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(identifier, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Allowed{identifier=$identifier, additionalProperties=$additionalProperties}"
+ }
+
+ class Blocked
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val identifier: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("identifier")
+ @ExcludeMissing
+ identifier: JsonField = JsonMissing.of()
+ ) : this(identifier, mutableMapOf())
+
+ /**
+ * The Merchant Acceptor ID.
+ *
+ * @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 identifier(): String = identifier.getRequired("identifier")
+
+ /**
+ * Returns the raw JSON value of [identifier].
+ *
+ * Unlike [identifier], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("identifier")
+ @ExcludeMissing
+ fun _identifier(): JsonField = identifier
+
+ @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 [Blocked].
+ *
+ * The following fields are required:
+ * ```java
+ * .identifier()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Blocked]. */
+ class Builder internal constructor() {
+
+ private var identifier: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(blocked: Blocked) = apply {
+ identifier = blocked.identifier
+ additionalProperties = blocked.additionalProperties.toMutableMap()
+ }
+
+ /** The Merchant Acceptor ID. */
+ fun identifier(identifier: String) = identifier(JsonField.of(identifier))
+
+ /**
+ * Sets [Builder.identifier] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.identifier] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun identifier(identifier: JsonField) = apply {
+ this.identifier = identifier
+ }
+
+ 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 [Blocked].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .identifier()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Blocked =
+ Blocked(
+ checkRequired("identifier", identifier),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Blocked = apply {
+ if (validated) {
+ return@apply
+ }
+
+ identifier()
+ 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 (identifier.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Blocked &&
+ identifier == other.identifier &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(identifier, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Blocked{identifier=$identifier, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is MerchantAcceptorIdentifier &&
+ allowed == other.allowed &&
+ blocked == other.blocked &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(allowed, blocked, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantAcceptorIdentifier{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}"
+ }
+
+ /**
+ * Restricts which Merchant Category Codes are allowed or blocked for authorizations on this
+ * card.
+ */
+ class MerchantCategoryCode
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val allowed: JsonField>,
+ private val blocked: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ allowed: JsonField> = JsonMissing.of(),
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ blocked: JsonField> = JsonMissing.of(),
+ ) : this(allowed, blocked, mutableMapOf())
+
+ /**
+ * The Merchant Category Codes that are allowed for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun allowed(): Optional> = allowed.getOptional("allowed")
+
+ /**
+ * The Merchant Category Codes that are blocked for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun blocked(): Optional> = blocked.getOptional("blocked")
+
+ /**
+ * Returns the raw JSON value of [allowed].
+ *
+ * Unlike [allowed], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ fun _allowed(): JsonField> = allowed
+
+ /**
+ * Returns the raw JSON value of [blocked].
+ *
+ * Unlike [blocked], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ fun _blocked(): JsonField> = blocked
+
+ @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
+ * .allowed()
+ * .blocked()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantCategoryCode]. */
+ class Builder internal constructor() {
+
+ private var allowed: JsonField>? = null
+ private var blocked: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantCategoryCode: MerchantCategoryCode) = apply {
+ allowed = merchantCategoryCode.allowed.map { it.toMutableList() }
+ blocked = merchantCategoryCode.blocked.map { it.toMutableList() }
+ additionalProperties = merchantCategoryCode.additionalProperties.toMutableMap()
+ }
+
+ /** The Merchant Category Codes that are allowed for authorizations on this card. */
+ fun allowed(allowed: List?) = allowed(JsonField.ofNullable(allowed))
+
+ /** Alias for calling [Builder.allowed] with `allowed.orElse(null)`. */
+ fun allowed(allowed: Optional>) = allowed(allowed.getOrNull())
+
+ /**
+ * Sets [Builder.allowed] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.allowed] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun allowed(allowed: JsonField>) = apply {
+ this.allowed = allowed.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Allowed] to [Builder.allowed].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAllowed(allowed: Allowed) = apply {
+ this.allowed =
+ (this.allowed ?: JsonField.of(mutableListOf())).also {
+ checkKnown("allowed", it).add(allowed)
+ }
+ }
+
+ /** The Merchant Category Codes that are blocked for authorizations on this card. */
+ fun blocked(blocked: List?) = blocked(JsonField.ofNullable(blocked))
+
+ /** Alias for calling [Builder.blocked] with `blocked.orElse(null)`. */
+ fun blocked(blocked: Optional>) = blocked(blocked.getOrNull())
+
+ /**
+ * Sets [Builder.blocked] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.blocked] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun blocked(blocked: JsonField>) = apply {
+ this.blocked = blocked.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Blocked] to [Builder.blocked].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addBlocked(blocked: Blocked) = apply {
+ this.blocked =
+ (this.blocked ?: JsonField.of(mutableListOf())).also {
+ checkKnown("blocked", it).add(blocked)
+ }
+ }
+
+ 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
+ * .allowed()
+ * .blocked()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantCategoryCode =
+ MerchantCategoryCode(
+ checkRequired("allowed", allowed).map { it.toImmutable() },
+ checkRequired("blocked", blocked).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantCategoryCode = apply {
+ if (validated) {
+ return@apply
+ }
+
+ allowed().ifPresent { it.forEach { it.validate() } }
+ blocked().ifPresent { it.forEach { it.validate() } }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (allowed.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (blocked.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ class Allowed
+ @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 [Allowed].
+ *
+ * The following fields are required:
+ * ```java
+ * .code()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Allowed]. */
+ class Builder internal constructor() {
+
+ private var code: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(allowed: Allowed) = apply {
+ code = allowed.code
+ additionalProperties = allowed.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 [Allowed].
+ *
+ * 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(): Allowed =
+ Allowed(checkRequired("code", code), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Allowed = 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 Allowed &&
+ code == other.code &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(code, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Allowed{code=$code, additionalProperties=$additionalProperties}"
+ }
+
+ class Blocked
+ @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 [Blocked].
+ *
+ * The following fields are required:
+ * ```java
+ * .code()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Blocked]. */
+ class Builder internal constructor() {
+
+ private var code: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(blocked: Blocked) = apply {
+ code = blocked.code
+ additionalProperties = blocked.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 [Blocked].
+ *
+ * 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(): Blocked =
+ Blocked(checkRequired("code", code), additionalProperties.toMutableMap())
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Blocked = 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 Blocked &&
+ code == other.code &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(code, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Blocked{code=$code, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is MerchantCategoryCode &&
+ allowed == other.allowed &&
+ blocked == other.blocked &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(allowed, blocked, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantCategoryCode{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}"
+ }
+
+ /**
+ * Restricts which merchant countries are allowed or blocked for authorizations on this
+ * card.
+ */
+ class MerchantCountry
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val allowed: JsonField>,
+ private val blocked: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ allowed: JsonField> = JsonMissing.of(),
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ blocked: JsonField> = JsonMissing.of(),
+ ) : this(allowed, blocked, mutableMapOf())
+
+ /**
+ * The merchant countries that are allowed for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun allowed(): Optional> = allowed.getOptional("allowed")
+
+ /**
+ * The merchant countries that are blocked for authorizations on this card.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun blocked(): Optional> = blocked.getOptional("blocked")
+
+ /**
+ * Returns the raw JSON value of [allowed].
+ *
+ * Unlike [allowed], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("allowed")
+ @ExcludeMissing
+ fun _allowed(): JsonField> = allowed
+
+ /**
+ * Returns the raw JSON value of [blocked].
+ *
+ * Unlike [blocked], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("blocked")
+ @ExcludeMissing
+ fun _blocked(): JsonField> = blocked
+
+ @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 [MerchantCountry].
+ *
+ * The following fields are required:
+ * ```java
+ * .allowed()
+ * .blocked()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantCountry]. */
+ class Builder internal constructor() {
+
+ private var allowed: JsonField>? = null
+ private var blocked: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantCountry: MerchantCountry) = apply {
+ allowed = merchantCountry.allowed.map { it.toMutableList() }
+ blocked = merchantCountry.blocked.map { it.toMutableList() }
+ additionalProperties = merchantCountry.additionalProperties.toMutableMap()
+ }
+
+ /** The merchant countries that are allowed for authorizations on this card. */
+ fun allowed(allowed: List?) = allowed(JsonField.ofNullable(allowed))
+
+ /** Alias for calling [Builder.allowed] with `allowed.orElse(null)`. */
+ fun allowed(allowed: Optional>) = allowed(allowed.getOrNull())
+
+ /**
+ * Sets [Builder.allowed] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.allowed] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun allowed(allowed: JsonField>) = apply {
+ this.allowed = allowed.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Allowed] to [Builder.allowed].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addAllowed(allowed: Allowed) = apply {
+ this.allowed =
+ (this.allowed ?: JsonField.of(mutableListOf())).also {
+ checkKnown("allowed", it).add(allowed)
+ }
+ }
+
+ /** The merchant countries that are blocked for authorizations on this card. */
+ fun blocked(blocked: List?) = blocked(JsonField.ofNullable(blocked))
+
+ /** Alias for calling [Builder.blocked] with `blocked.orElse(null)`. */
+ fun blocked(blocked: Optional>) = blocked(blocked.getOrNull())
+
+ /**
+ * Sets [Builder.blocked] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.blocked] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun blocked(blocked: JsonField>) = apply {
+ this.blocked = blocked.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Blocked] to [Builder.blocked].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addBlocked(blocked: Blocked) = apply {
+ this.blocked =
+ (this.blocked ?: JsonField.of(mutableListOf())).also {
+ checkKnown("blocked", it).add(blocked)
+ }
+ }
+
+ 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 [MerchantCountry].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .allowed()
+ * .blocked()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantCountry =
+ MerchantCountry(
+ checkRequired("allowed", allowed).map { it.toImmutable() },
+ checkRequired("blocked", blocked).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantCountry = apply {
+ if (validated) {
+ return@apply
+ }
+
+ allowed().ifPresent { it.forEach { it.validate() } }
+ blocked().ifPresent { it.forEach { it.validate() } }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: IncreaseInvalidDataException) {
+ false
+ }
+
+ /**
+ * Returns a score indicating how many valid values are contained in this object
+ * recursively.
+ *
+ * Used for best match union deserialization.
+ */
+ @JvmSynthetic
+ internal fun validity(): Int =
+ (allowed.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (blocked.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ class Allowed
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val country: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("country")
+ @ExcludeMissing
+ country: JsonField = JsonMissing.of()
+ ) : this(country, mutableMapOf())
+
+ /**
+ * The ISO 3166-1 alpha-2 country code.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
+ * is unexpectedly missing or null (e.g. if the server responded with an
+ * unexpected value).
+ */
+ fun country(): String = country.getRequired("country")
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country
+
+ @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 [Allowed].
+ *
+ * The following fields are required:
+ * ```java
+ * .country()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Allowed]. */
+ class Builder internal constructor() {
+
+ private var country: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(allowed: Allowed) = apply {
+ country = allowed.country
+ additionalProperties = allowed.additionalProperties.toMutableMap()
+ }
+
+ /** The ISO 3166-1 alpha-2 country code. */
+ fun country(country: String) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ 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 [Allowed].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .country()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Allowed =
+ Allowed(
+ checkRequired("country", country),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Allowed = apply {
+ if (validated) {
+ return@apply
+ }
+
+ country()
+ 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 (country.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Allowed &&
+ country == other.country &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(country, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Allowed{country=$country, additionalProperties=$additionalProperties}"
+ }
+
+ class Blocked
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val country: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("country")
+ @ExcludeMissing
+ country: JsonField = JsonMissing.of()
+ ) : this(country, mutableMapOf())
+
+ /**
+ * The ISO 3166-1 alpha-2 country code.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or
+ * is unexpectedly missing or null (e.g. if the server responded with an
+ * unexpected value).
+ */
+ fun country(): String = country.getRequired("country")
+
+ /**
+ * Returns the raw JSON value of [country].
+ *
+ * Unlike [country], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("country") @ExcludeMissing fun _country(): JsonField = country
+
+ @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 [Blocked].
+ *
+ * The following fields are required:
+ * ```java
+ * .country()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Blocked]. */
+ class Builder internal constructor() {
+
+ private var country: JsonField? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(blocked: Blocked) = apply {
+ country = blocked.country
+ additionalProperties = blocked.additionalProperties.toMutableMap()
+ }
+
+ /** The ISO 3166-1 alpha-2 country code. */
+ fun country(country: String) = country(JsonField.of(country))
+
+ /**
+ * Sets [Builder.country] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.country] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun country(country: JsonField) = apply { this.country = country }
+
+ 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 [Blocked].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .country()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Blocked =
+ Blocked(
+ checkRequired("country", country),
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Blocked = apply {
+ if (validated) {
+ return@apply
+ }
+
+ country()
+ 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 (country.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Blocked &&
+ country == other.country &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy { Objects.hash(country, additionalProperties) }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Blocked{country=$country, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is MerchantCountry &&
+ allowed == other.allowed &&
+ blocked == other.blocked &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(allowed, blocked, additionalProperties)
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantCountry{allowed=$allowed, blocked=$blocked, additionalProperties=$additionalProperties}"
+ }
+
+ 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())
+
+ /**
+ * The interval at which the spending limit is enforced.
+ *
+ * @throws IncreaseInvalidDataException if the JSON field has an unexpected type or is
+ * unexpectedly missing or null (e.g. if the server responded with an unexpected
+ * value).
+ */
+ fun interval(): Interval = interval.getRequired("interval")
+
+ /**
+ * The 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 AuthorizationControls &&
+ maximumAuthorizationCount == other.maximumAuthorizationCount &&
+ merchantAcceptorIdentifier == other.merchantAcceptorIdentifier &&
+ merchantCategoryCode == other.merchantCategoryCode &&
+ merchantCountry == other.merchantCountry &&
+ spendingLimits == other.spendingLimits &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ maximumAuthorizationCount,
+ merchantAcceptorIdentifier,
+ merchantCategoryCode,
+ merchantCountry,
+ spendingLimits,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AuthorizationControls{maximumAuthorizationCount=$maximumAuthorizationCount, merchantAcceptorIdentifier=$merchantAcceptorIdentifier, merchantCategoryCode=$merchantCategoryCode, merchantCountry=$merchantCountry, spendingLimits=$spendingLimits, additionalProperties=$additionalProperties}"
+ }
+
/** The Card's billing address. */
class BillingAddress
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -1555,6 +4625,7 @@ private constructor(
return other is Card &&
id == other.id &&
accountId == other.accountId &&
+ authorizationControls == other.authorizationControls &&
billingAddress == other.billingAddress &&
createdAt == other.createdAt &&
description == other.description &&
@@ -1573,6 +4644,7 @@ private constructor(
Objects.hash(
id,
accountId,
+ authorizationControls,
billingAddress,
createdAt,
description,
@@ -1591,5 +4663,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Card{id=$id, accountId=$accountId, billingAddress=$billingAddress, createdAt=$createdAt, description=$description, digitalWallet=$digitalWallet, entityId=$entityId, expirationMonth=$expirationMonth, expirationYear=$expirationYear, idempotencyKey=$idempotencyKey, last4=$last4, status=$status, type=$type, additionalProperties=$additionalProperties}"
+ "Card{id=$id, accountId=$accountId, authorizationControls=$authorizationControls, billingAddress=$billingAddress, createdAt=$createdAt, description=$description, digitalWallet=$digitalWallet, entityId=$entityId, expirationMonth=$expirationMonth, expirationYear=$expirationYear, idempotencyKey=$idempotencyKey, last4=$last4, status=$status, type=$type, additionalProperties=$additionalProperties}"
}
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 f4ee6b0be..e16e03975 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
@@ -6,14 +6,17 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
+import com.increase.api.core.Enum
import com.increase.api.core.ExcludeMissing
import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
import com.increase.api.core.Params
+import com.increase.api.core.checkKnown
import com.increase.api.core.checkRequired
import com.increase.api.core.http.Headers
import com.increase.api.core.http.QueryParams
+import com.increase.api.core.toImmutable
import com.increase.api.errors.IncreaseInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -36,6 +39,14 @@ private constructor(
*/
fun accountId(): String = body.accountId()
+ /**
+ * Controls that restrict how 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 authorizationControls(): Optional