diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ebbaa260b..58bcf9e38 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,17 +1,19 @@
name: CI
on:
push:
- branches:
- - main
- pull_request:
- branches:
- - main
- - next
+ branches-ignore:
+ - 'generated'
+ - 'codegen/**'
+ - 'integrated/**'
+ - 'stl-preview-head/**'
+ - 'stl-preview-base/**'
jobs:
lint:
+ timeout-minutes: 10
name: lint
- runs-on: ubuntu-latest
+ runs-on: ${{ github.repository == 'stainless-sdks/lithic-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+
steps:
- uses: actions/checkout@v4
@@ -21,7 +23,7 @@ jobs:
distribution: temurin
java-version: |
8
- 17
+ 21
cache: gradle
- name: Set up Gradle
@@ -30,8 +32,9 @@ jobs:
- name: Run lints
run: ./scripts/lint
test:
+ timeout-minutes: 10
name: test
- runs-on: ubuntu-latest
+ runs-on: ${{ github.repository == 'stainless-sdks/lithic-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
@@ -41,7 +44,7 @@ jobs:
distribution: temurin
java-version: |
8
- 17
+ 21
cache: gradle
- name: Set up Gradle
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index d80a91e22..6af24e3d3 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.88.0"
+ ".": "0.89.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 18b034a6d..0ff2976ea 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 157
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-569e7dcb415398515370989172038db711642cd3b0bd7559bfd2b94e325a6086.yml
-openapi_spec_hash: ce1dae8c6eb50d4490e75357c5e520a7
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d44845cfc597e545a51450a62b2185d7a1ce76a3f9ac71145c3e74f99397d42a.yml
+openapi_spec_hash: 3339f9fd912f2eb8ba5efc3c73f5d030
config_hash: e9de93b19060a153a852f7c03f235162
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b6064b0ab..d3e4d9e65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,21 @@
# Changelog
+## 0.89.0 (2025-04-29)
+
+Full Changelog: [v0.88.0...v0.89.0](https://github.com/lithic-com/lithic-java/compare/v0.88.0...v0.89.0)
+
+### Features
+
+* **api:** adds new merchant lock Auth Rule ([f1d019d](https://github.com/lithic-com/lithic-java/commit/f1d019d60c5a70f92b505fed515eb3a027d352ec))
+
+
+### Chores
+
+* **ci:** add timeout thresholds for CI jobs ([5d9cd67](https://github.com/lithic-com/lithic-java/commit/5d9cd67de9c40b00277f461a40e46c98d84517ae))
+* **ci:** only use depot for staging repos ([52117b4](https://github.com/lithic-com/lithic-java/commit/52117b47e97c15bd98e2d3ca45a33014056ca56d))
+* **ci:** run on more branches and use depot runners ([05be33d](https://github.com/lithic-com/lithic-java/commit/05be33d42a287e2a7b8e32c341d442d9a650d7c8))
+* **internal:** java 17 -> 21 on ci ([4063f5f](https://github.com/lithic-com/lithic-java/commit/4063f5f55d47b8c4d0befbb5d3431de793568b11))
+
## 0.88.0 (2025-04-21)
Full Changelog: [v0.87.0...v0.88.0](https://github.com/lithic-com/lithic-java/compare/v0.87.0...v0.88.0)
diff --git a/README.md b/README.md
index 814951a9d..26030c079 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.88.0)
-[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.88.0)
+[](https://central.sonatype.com/artifact/com.lithic.api/lithic-java/0.89.0)
+[](https://javadoc.io/doc/com.lithic.api/lithic-java/0.89.0)
@@ -13,7 +13,7 @@ The Lithic Java SDK is similar to the Lithic Kotlin SDK but with minor differenc
-The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.88.0).
+The REST API documentation can be found on [docs.lithic.com](https://docs.lithic.com). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.lithic.api/lithic-java/0.89.0).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.lithic.com](https://docs.lithic
### Gradle
```kotlin
-implementation("com.lithic.api:lithic-java:0.88.0")
+implementation("com.lithic.api:lithic-java:0.89.0")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.lithic.api:lithic-java:0.88.0")
com.lithic.api
lithic-java
- 0.88.0
+ 0.89.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 7ab5a7ecb..8b5925714 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.lithic.api"
- version = "0.88.0" // x-release-please-version
+ version = "0.89.0" // x-release-please-version
}
subprojects {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
index 1020a74cc..36b099044 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2CreateParams.kt
@@ -677,6 +677,12 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /**
+ * Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`.
+ */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
/** The type of Auth Rule */
fun type(type: AuthRuleType) = type(JsonField.of(type))
@@ -775,6 +781,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -784,16 +791,24 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional =
+ Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters =
+ merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -801,6 +816,7 @@ private constructor(
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null ->
visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -824,6 +840,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -855,6 +875,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -864,16 +887,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -887,6 +911,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -899,6 +927,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -927,7 +957,11 @@ private constructor(
)
?.let { Parameters(conditionalBlock = it, _json = json) },
tryDeserialize(node, jacksonTypeRef())
- ?.let { Parameters(velocityLimitParams = it, _json = json) },
+ ?.let {
+ Parameters(velocityLimitParams = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Parameters(merchantLock = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -958,11 +992,469 @@ private constructor(
generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of
+ * merchants (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) =
+ merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a
+ * non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each
+ * merchant object allows transaction rules to work at a granular level and
+ * requires at least one of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField,
+ private val descriptor: JsonField,
+ private val merchantId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("comment")
+ @ExcludeMissing
+ comment: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ merchantId: JsonField = JsonMissing.of(),
+ ) : this(comment, descriptor, merchantId, mutableMapOf())
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun comment(): Optional = comment.getOptional("comment")
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is typically
+ * the name or label shown on transaction summaries.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun descriptor(): Optional = descriptor.getOptional("descriptor")
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant).
+ * This attribute specifies the merchant entity that will be locked or
+ * referenced for authorization rules.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun merchantId(): Optional = merchantId.getOptional("merchant_id")
+
+ /**
+ * Returns the raw JSON value of [comment].
+ *
+ * Unlike [comment], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("comment")
+ @ExcludeMissing
+ fun _comment(): JsonField = comment
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [merchantId].
+ *
+ * Unlike [merchantId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ fun _merchantId(): JsonField = merchantId
+
+ @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 [Merchant].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Merchant]. */
+ class Builder internal constructor() {
+
+ private var comment: JsonField = JsonMissing.of()
+ private var descriptor: JsonField = JsonMissing.of()
+ private var merchantId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchant: Merchant) = apply {
+ comment = merchant.comment
+ descriptor = merchant.descriptor
+ merchantId = merchant.merchantId
+ additionalProperties = merchant.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ */
+ fun comment(comment: String) = comment(JsonField.of(comment))
+
+ /**
+ * Sets [Builder.comment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comment] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun comment(comment: JsonField) = apply {
+ this.comment = comment
+ }
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is
+ * typically the name or label shown on transaction summaries.
+ */
+ fun descriptor(descriptor: String) =
+ descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply {
+ this.descriptor = descriptor
+ }
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor
+ * (merchant). This attribute specifies the merchant entity that will be
+ * locked or referenced for authorization rules.
+ */
+ fun merchantId(merchantId: String) =
+ merchantId(JsonField.of(merchantId))
+
+ /**
+ * Sets [Builder.merchantId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantId] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchantId(merchantId: JsonField) = apply {
+ this.merchantId = merchantId
+ }
+
+ 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 [Merchant].
+ *
+ * Further updates to this [Builder] will not mutate the returned
+ * instance.
+ */
+ fun build(): Merchant =
+ Merchant(
+ comment,
+ descriptor,
+ merchantId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Merchant = apply {
+ if (validated) {
+ return@apply
+ }
+
+ comment()
+ descriptor()
+ merchantId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 (comment.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (if (merchantId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Merchant && comment == other.comment && descriptor == other.descriptor && merchantId == other.merchantId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(comment, descriptor, merchantId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Merchant{comment=$comment, descriptor=$descriptor, merchantId=$merchantId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MerchantLockParameters && merchants == other.merchants && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(merchants, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantLockParameters{merchants=$merchants, additionalProperties=$additionalProperties}"
+ }
}
/** The type of Auth Rule */
@@ -986,6 +1478,8 @@ private constructor(
@JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT")
+ @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
+
@JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
}
@@ -993,6 +1487,7 @@ private constructor(
enum class Known {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
}
/**
@@ -1008,6 +1503,7 @@ private constructor(
enum class Value {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
/**
* An enum member indicating that [AuthRuleType] was instantiated with an
* unknown value.
@@ -1026,6 +1522,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Value.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Value.MERCHANT_LOCK
else -> Value._UNKNOWN
}
@@ -1042,6 +1539,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Known.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Known.MERCHANT_LOCK
else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value")
}
@@ -1324,6 +1822,12 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /**
+ * Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`.
+ */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
/** The type of Auth Rule */
fun type(type: AuthRuleType) = type(JsonField.of(type))
@@ -1422,6 +1926,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -1431,16 +1936,24 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional =
+ Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters =
+ merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -1448,6 +1961,7 @@ private constructor(
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null ->
visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -1471,6 +1985,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -1502,6 +2020,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -1511,16 +2032,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -1534,6 +2056,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -1546,6 +2072,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -1574,7 +2102,11 @@ private constructor(
)
?.let { Parameters(conditionalBlock = it, _json = json) },
tryDeserialize(node, jacksonTypeRef())
- ?.let { Parameters(velocityLimitParams = it, _json = json) },
+ ?.let {
+ Parameters(velocityLimitParams = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Parameters(merchantLock = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -1605,11 +2137,469 @@ private constructor(
generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of
+ * merchants (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) =
+ merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a
+ * non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each
+ * merchant object allows transaction rules to work at a granular level and
+ * requires at least one of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField,
+ private val descriptor: JsonField,
+ private val merchantId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("comment")
+ @ExcludeMissing
+ comment: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ merchantId: JsonField = JsonMissing.of(),
+ ) : this(comment, descriptor, merchantId, mutableMapOf())
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun comment(): Optional = comment.getOptional("comment")
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is typically
+ * the name or label shown on transaction summaries.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun descriptor(): Optional = descriptor.getOptional("descriptor")
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant).
+ * This attribute specifies the merchant entity that will be locked or
+ * referenced for authorization rules.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun merchantId(): Optional = merchantId.getOptional("merchant_id")
+
+ /**
+ * Returns the raw JSON value of [comment].
+ *
+ * Unlike [comment], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("comment")
+ @ExcludeMissing
+ fun _comment(): JsonField = comment
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [merchantId].
+ *
+ * Unlike [merchantId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ fun _merchantId(): JsonField = merchantId
+
+ @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 [Merchant].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Merchant]. */
+ class Builder internal constructor() {
+
+ private var comment: JsonField = JsonMissing.of()
+ private var descriptor: JsonField = JsonMissing.of()
+ private var merchantId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchant: Merchant) = apply {
+ comment = merchant.comment
+ descriptor = merchant.descriptor
+ merchantId = merchant.merchantId
+ additionalProperties = merchant.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ */
+ fun comment(comment: String) = comment(JsonField.of(comment))
+
+ /**
+ * Sets [Builder.comment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comment] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun comment(comment: JsonField) = apply {
+ this.comment = comment
+ }
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is
+ * typically the name or label shown on transaction summaries.
+ */
+ fun descriptor(descriptor: String) =
+ descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply {
+ this.descriptor = descriptor
+ }
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor
+ * (merchant). This attribute specifies the merchant entity that will be
+ * locked or referenced for authorization rules.
+ */
+ fun merchantId(merchantId: String) =
+ merchantId(JsonField.of(merchantId))
+
+ /**
+ * Sets [Builder.merchantId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantId] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchantId(merchantId: JsonField) = apply {
+ this.merchantId = merchantId
+ }
+
+ 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 [Merchant].
+ *
+ * Further updates to this [Builder] will not mutate the returned
+ * instance.
+ */
+ fun build(): Merchant =
+ Merchant(
+ comment,
+ descriptor,
+ merchantId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Merchant = apply {
+ if (validated) {
+ return@apply
+ }
+
+ comment()
+ descriptor()
+ merchantId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 (comment.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (if (merchantId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Merchant && comment == other.comment && descriptor == other.descriptor && merchantId == other.merchantId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(comment, descriptor, merchantId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Merchant{comment=$comment, descriptor=$descriptor, merchantId=$merchantId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MerchantLockParameters && merchants == other.merchants && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(merchants, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantLockParameters{merchants=$merchants, additionalProperties=$additionalProperties}"
+ }
}
/** The type of Auth Rule */
@@ -1633,6 +2623,8 @@ private constructor(
@JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT")
+ @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
+
@JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
}
@@ -1640,6 +2632,7 @@ private constructor(
enum class Known {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
}
/**
@@ -1655,6 +2648,7 @@ private constructor(
enum class Value {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
/**
* An enum member indicating that [AuthRuleType] was instantiated with an
* unknown value.
@@ -1673,6 +2667,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Value.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Value.MERCHANT_LOCK
else -> Value._UNKNOWN
}
@@ -1689,6 +2684,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Known.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Known.MERCHANT_LOCK
else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value")
}
@@ -2013,6 +3009,12 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /**
+ * Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`.
+ */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
/** The type of Auth Rule */
fun type(type: AuthRuleType) = type(JsonField.of(type))
@@ -2114,6 +3116,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -2123,16 +3126,24 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional =
+ Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters =
+ merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -2140,6 +3151,7 @@ private constructor(
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null ->
visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -2163,6 +3175,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -2194,6 +3210,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -2203,16 +3222,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -2226,6 +3246,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -2238,6 +3262,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -2266,7 +3292,11 @@ private constructor(
)
?.let { Parameters(conditionalBlock = it, _json = json) },
tryDeserialize(node, jacksonTypeRef())
- ?.let { Parameters(velocityLimitParams = it, _json = json) },
+ ?.let {
+ Parameters(velocityLimitParams = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Parameters(merchantLock = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -2297,11 +3327,469 @@ private constructor(
generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of
+ * merchants (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) =
+ merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a
+ * non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each
+ * merchant object allows transaction rules to work at a granular level and
+ * requires at least one of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField,
+ private val descriptor: JsonField,
+ private val merchantId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("comment")
+ @ExcludeMissing
+ comment: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ merchantId: JsonField = JsonMissing.of(),
+ ) : this(comment, descriptor, merchantId, mutableMapOf())
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun comment(): Optional = comment.getOptional("comment")
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is typically
+ * the name or label shown on transaction summaries.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun descriptor(): Optional = descriptor.getOptional("descriptor")
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant).
+ * This attribute specifies the merchant entity that will be locked or
+ * referenced for authorization rules.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected
+ * type (e.g. if the server responded with an unexpected value).
+ */
+ fun merchantId(): Optional = merchantId.getOptional("merchant_id")
+
+ /**
+ * Returns the raw JSON value of [comment].
+ *
+ * Unlike [comment], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("comment")
+ @ExcludeMissing
+ fun _comment(): JsonField = comment
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [merchantId].
+ *
+ * Unlike [merchantId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ fun _merchantId(): JsonField = merchantId
+
+ @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 [Merchant].
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Merchant]. */
+ class Builder internal constructor() {
+
+ private var comment: JsonField = JsonMissing.of()
+ private var descriptor: JsonField = JsonMissing.of()
+ private var merchantId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchant: Merchant) = apply {
+ comment = merchant.comment
+ descriptor = merchant.descriptor
+ merchantId = merchant.merchantId
+ additionalProperties = merchant.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ */
+ fun comment(comment: String) = comment(JsonField.of(comment))
+
+ /**
+ * Sets [Builder.comment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comment] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun comment(comment: JsonField) = apply {
+ this.comment = comment
+ }
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is
+ * typically the name or label shown on transaction summaries.
+ */
+ fun descriptor(descriptor: String) =
+ descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply {
+ this.descriptor = descriptor
+ }
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor
+ * (merchant). This attribute specifies the merchant entity that will be
+ * locked or referenced for authorization rules.
+ */
+ fun merchantId(merchantId: String) =
+ merchantId(JsonField.of(merchantId))
+
+ /**
+ * Sets [Builder.merchantId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantId] with a well-typed
+ * [String] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchantId(merchantId: JsonField) = apply {
+ this.merchantId = merchantId
+ }
+
+ 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 [Merchant].
+ *
+ * Further updates to this [Builder] will not mutate the returned
+ * instance.
+ */
+ fun build(): Merchant =
+ Merchant(
+ comment,
+ descriptor,
+ merchantId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Merchant = apply {
+ if (validated) {
+ return@apply
+ }
+
+ comment()
+ descriptor()
+ merchantId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 (comment.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (if (merchantId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Merchant && comment == other.comment && descriptor == other.descriptor && merchantId == other.merchantId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(comment, descriptor, merchantId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Merchant{comment=$comment, descriptor=$descriptor, merchantId=$merchantId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MerchantLockParameters && merchants == other.merchants && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(merchants, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantLockParameters{merchants=$merchants, additionalProperties=$additionalProperties}"
+ }
}
/** The type of Auth Rule */
@@ -2325,6 +3813,8 @@ private constructor(
@JvmField val VELOCITY_LIMIT = of("VELOCITY_LIMIT")
+ @JvmField val MERCHANT_LOCK = of("MERCHANT_LOCK")
+
@JvmStatic fun of(value: String) = AuthRuleType(JsonField.of(value))
}
@@ -2332,6 +3822,7 @@ private constructor(
enum class Known {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
}
/**
@@ -2347,6 +3838,7 @@ private constructor(
enum class Value {
CONDITIONAL_BLOCK,
VELOCITY_LIMIT,
+ MERCHANT_LOCK,
/**
* An enum member indicating that [AuthRuleType] was instantiated with an
* unknown value.
@@ -2365,6 +3857,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Value.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Value.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Value.MERCHANT_LOCK
else -> Value._UNKNOWN
}
@@ -2381,6 +3874,7 @@ private constructor(
when (this) {
CONDITIONAL_BLOCK -> Known.CONDITIONAL_BLOCK
VELOCITY_LIMIT -> Known.VELOCITY_LIMIT
+ MERCHANT_LOCK -> Known.MERCHANT_LOCK
else -> throw LithicInvalidDataException("Unknown AuthRuleType: $value")
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt
index 9d011a65b..56b8e5ec4 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2DraftParams.kt
@@ -21,10 +21,12 @@ import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.Params
import com.lithic.api.core.allMaxBy
+import com.lithic.api.core.checkKnown
import com.lithic.api.core.checkRequired
import com.lithic.api.core.getOrThrow
import com.lithic.api.core.http.Headers
import com.lithic.api.core.http.QueryParams
+import com.lithic.api.core.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -140,6 +142,11 @@ private constructor(
body.parameters(velocityLimitParams)
}
+ /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) = apply {
+ body.parameters(merchantLock)
+ }
+
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
}
@@ -381,6 +388,10 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -461,6 +472,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -470,22 +482,29 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional = Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
when {
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null -> visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -509,6 +528,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -540,6 +563,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -549,16 +575,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -572,6 +599,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -583,6 +614,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -610,6 +643,9 @@ private constructor(
tryDeserialize(node, jacksonTypeRef())?.let {
Parameters(velocityLimitParams = it, _json = json)
},
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Parameters(merchantLock = it, _json = json)
+ },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -638,11 +674,456 @@ private constructor(
value.conditionalBlock != null -> generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants (based on
+ * descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) = merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed `List`
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each merchant
+ * object allows transaction rules to work at a granular level and requires at least one
+ * of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField,
+ private val descriptor: JsonField,
+ private val merchantId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("comment")
+ @ExcludeMissing
+ comment: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ merchantId: JsonField = JsonMissing.of(),
+ ) : this(comment, descriptor, merchantId, mutableMapOf())
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule management
+ * purposes.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun comment(): Optional = comment.getOptional("comment")
+
+ /**
+ * Short description of the merchant, often used to provide more human-readable
+ * context about the transaction merchant. This is typically the name or label shown
+ * on transaction summaries.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun descriptor(): Optional = descriptor.getOptional("descriptor")
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant). This
+ * attribute specifies the merchant entity that will be locked or referenced for
+ * authorization rules.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun merchantId(): Optional = merchantId.getOptional("merchant_id")
+
+ /**
+ * Returns the raw JSON value of [comment].
+ *
+ * Unlike [comment], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("comment") @ExcludeMissing fun _comment(): JsonField = comment
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [merchantId].
+ *
+ * Unlike [merchantId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ fun _merchantId(): JsonField = merchantId
+
+ @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 [Merchant]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Merchant]. */
+ class Builder internal constructor() {
+
+ private var comment: JsonField = JsonMissing.of()
+ private var descriptor: JsonField = JsonMissing.of()
+ private var merchantId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchant: Merchant) = apply {
+ comment = merchant.comment
+ descriptor = merchant.descriptor
+ merchantId = merchant.merchantId
+ additionalProperties = merchant.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ */
+ fun comment(comment: String) = comment(JsonField.of(comment))
+
+ /**
+ * Sets [Builder.comment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comment] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun comment(comment: JsonField) = apply { this.comment = comment }
+
+ /**
+ * Short description of the merchant, often used to provide more human-readable
+ * context about the transaction merchant. This is typically the name or label
+ * shown on transaction summaries.
+ */
+ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply {
+ this.descriptor = descriptor
+ }
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant). This
+ * attribute specifies the merchant entity that will be locked or referenced for
+ * authorization rules.
+ */
+ fun merchantId(merchantId: String) = merchantId(JsonField.of(merchantId))
+
+ /**
+ * Sets [Builder.merchantId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun merchantId(merchantId: JsonField) = apply {
+ this.merchantId = merchantId
+ }
+
+ 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 [Merchant].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Merchant =
+ Merchant(
+ comment,
+ descriptor,
+ merchantId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Merchant = apply {
+ if (validated) {
+ return@apply
+ }
+
+ comment()
+ descriptor()
+ merchantId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 (comment.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (if (merchantId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Merchant && comment == other.comment && descriptor == other.descriptor && merchantId == other.merchantId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(comment, descriptor, merchantId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Merchant{comment=$comment, descriptor=$descriptor, merchantId=$merchantId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MerchantLockParameters && merchants == other.merchants && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(merchants, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantLockParameters{merchants=$merchants, additionalProperties=$additionalProperties}"
+ }
}
override fun equals(other: Any?): Boolean {
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt
index 639e32871..84f23166e 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/AuthRuleV2ListParams.kt
@@ -2,9 +2,13 @@
package com.lithic.api.models
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.lithic.api.core.Enum
+import com.lithic.api.core.JsonField
import com.lithic.api.core.Params
import com.lithic.api.core.http.Headers
import com.lithic.api.core.http.QueryParams
+import com.lithic.api.errors.LithicInvalidDataException
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -16,6 +20,7 @@ private constructor(
private val cardToken: String?,
private val endingBefore: String?,
private val pageSize: Long?,
+ private val scope: Scope?,
private val startingAfter: String?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
@@ -36,6 +41,9 @@ private constructor(
/** Page size (for pagination). */
fun pageSize(): Optional = Optional.ofNullable(pageSize)
+ /** Only return Authorization Rules that are bound to the provided scope; */
+ fun scope(): Optional = Optional.ofNullable(scope)
+
/**
* A cursor representing an item's token after which a page of results should begin. Used to
* retrieve the next page of results after this item.
@@ -63,6 +71,7 @@ private constructor(
private var cardToken: String? = null
private var endingBefore: String? = null
private var pageSize: Long? = null
+ private var scope: Scope? = null
private var startingAfter: String? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -73,6 +82,7 @@ private constructor(
cardToken = authRuleV2ListParams.cardToken
endingBefore = authRuleV2ListParams.endingBefore
pageSize = authRuleV2ListParams.pageSize
+ scope = authRuleV2ListParams.scope
startingAfter = authRuleV2ListParams.startingAfter
additionalHeaders = authRuleV2ListParams.additionalHeaders.toBuilder()
additionalQueryParams = authRuleV2ListParams.additionalQueryParams.toBuilder()
@@ -112,6 +122,12 @@ private constructor(
/** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */
fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull())
+ /** Only return Authorization Rules that are bound to the provided scope; */
+ fun scope(scope: Scope?) = apply { this.scope = scope }
+
+ /** Alias for calling [Builder.scope] with `scope.orElse(null)`. */
+ fun scope(scope: Optional) = scope(scope.getOrNull())
+
/**
* A cursor representing an item's token after which a page of results should begin. Used to
* retrieve the next page of results after this item.
@@ -231,6 +247,7 @@ private constructor(
cardToken,
endingBefore,
pageSize,
+ scope,
startingAfter,
additionalHeaders.build(),
additionalQueryParams.build(),
@@ -246,21 +263,154 @@ private constructor(
cardToken?.let { put("card_token", it) }
endingBefore?.let { put("ending_before", it) }
pageSize?.let { put("page_size", it.toString()) }
+ scope?.let { put("scope", it.toString()) }
startingAfter?.let { put("starting_after", it) }
putAll(additionalQueryParams)
}
.build()
+ /** Only return Authorization Rules that are bound to the provided scope; */
+ class Scope @JsonCreator private constructor(private val value: JsonField) : Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that doesn't
+ * match any known member, and you want to know that value. For example, if the SDK is on an
+ * older version than the API, then the API may respond with new members that the SDK is
+ * unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val PROGRAM = of("PROGRAM")
+
+ @JvmField val ACCOUNT = of("ACCOUNT")
+
+ @JvmField val CARD = of("CARD")
+
+ @JvmStatic fun of(value: String) = Scope(JsonField.of(value))
+ }
+
+ /** An enum containing [Scope]'s known values. */
+ enum class Known {
+ PROGRAM,
+ ACCOUNT,
+ CARD,
+ }
+
+ /**
+ * An enum containing [Scope]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Scope] 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 {
+ PROGRAM,
+ ACCOUNT,
+ CARD,
+ /** An enum member indicating that [Scope] 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) {
+ PROGRAM -> Value.PROGRAM
+ ACCOUNT -> Value.ACCOUNT
+ CARD -> Value.CARD
+ 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 LithicInvalidDataException if this class instance's value is a not a known
+ * member.
+ */
+ fun known(): Known =
+ when (this) {
+ PROGRAM -> Known.PROGRAM
+ ACCOUNT -> Known.ACCOUNT
+ CARD -> Known.CARD
+ else -> throw LithicInvalidDataException("Unknown Scope: $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 LithicInvalidDataException if this class instance's value does not have the
+ * expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow { LithicInvalidDataException("Value is not a String") }
+
+ private var validated: Boolean = false
+
+ fun validate(): Scope = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 /* spotless:off */ other is Scope && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
- return /* spotless:off */ other is AuthRuleV2ListParams && accountToken == other.accountToken && cardToken == other.cardToken && endingBefore == other.endingBefore && pageSize == other.pageSize && startingAfter == other.startingAfter && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
+ return /* spotless:off */ other is AuthRuleV2ListParams && accountToken == other.accountToken && cardToken == other.cardToken && endingBefore == other.endingBefore && pageSize == other.pageSize && scope == other.scope && startingAfter == other.startingAfter && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountToken, cardToken, endingBefore, pageSize, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(accountToken, cardToken, endingBefore, pageSize, scope, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */
override fun toString() =
- "AuthRuleV2ListParams{accountToken=$accountToken, cardToken=$cardToken, endingBefore=$endingBefore, pageSize=$pageSize, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "AuthRuleV2ListParams{accountToken=$accountToken, cardToken=$cardToken, endingBefore=$endingBefore, pageSize=$pageSize, scope=$scope, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferCreateParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferCreateParams.kt
index 273af3aa5..4c0d68a67 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferCreateParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/BookTransferCreateParams.kt
@@ -1155,6 +1155,8 @@ private constructor(
@JvmField val DISPUTE_WON = of("DISPUTE_WON")
+ @JvmField val SERVICE = of("SERVICE")
+
@JvmField val TRANSFER = of("TRANSFER")
@JvmStatic fun of(value: String) = Type(JsonField.of(value))
@@ -1193,6 +1195,7 @@ private constructor(
INACTIVITY_FEE_DOWN,
PROVISIONAL_CREDIT,
DISPUTE_WON,
+ SERVICE,
TRANSFER,
}
@@ -1237,6 +1240,7 @@ private constructor(
INACTIVITY_FEE_DOWN,
PROVISIONAL_CREDIT,
DISPUTE_WON,
+ SERVICE,
TRANSFER,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
@@ -1282,6 +1286,7 @@ private constructor(
INACTIVITY_FEE_DOWN -> Value.INACTIVITY_FEE_DOWN
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
DISPUTE_WON -> Value.DISPUTE_WON
+ SERVICE -> Value.SERVICE
TRANSFER -> Value.TRANSFER
else -> Value._UNKNOWN
}
@@ -1328,6 +1333,7 @@ private constructor(
INACTIVITY_FEE_DOWN -> Known.INACTIVITY_FEE_DOWN
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
DISPUTE_WON -> Known.DISPUTE_WON
+ SERVICE -> Known.SERVICE
TRANSFER -> Known.TRANSFER
else -> throw LithicInvalidDataException("Unknown Type: $value")
}
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt
index fdeea2d13..e7450a64c 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardReissueParams.kt
@@ -24,7 +24,7 @@ import kotlin.jvm.optionals.getOrNull
/**
* Initiate print and shipment of a duplicate physical card (e.g. card is physically damaged). The
* PAN, expiry, and CVC2 will remain the same and the original card can continue to be used until
- * the new card is activated. Only applies to cards of type `PHYSICAL`. A card can be replaced or
+ * the new card is activated. Only applies to cards of type `PHYSICAL`. A card can be reissued or
* renewed a total of 8 times.
*/
class CardReissueParams
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt
index 2ff4908ed..750b56816 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/CardRenewParams.kt
@@ -26,7 +26,7 @@ import kotlin.jvm.optionals.getOrNull
* card token and PAN, but updated expiry and CVC2 code. The original card will keep working for
* card-present transactions until the new card is activated. For card-not-present transactions, the
* original card details (expiry, CVC2) will also keep working until the new card is activated. A
- * `PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`, the card will
+ * `PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`, the card will
* retain the same card token and PAN and receive an updated expiry and CVC2 code. `product_id`,
* `shipping_method`, `shipping_address`, `carrier` are only relevant for renewing `PHYSICAL` cards.
*/
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt
index 34d826f4a..e10c75ba1 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/FinancialTransaction.kt
@@ -1292,6 +1292,8 @@ private constructor(
@JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
+ @JvmField val SERVICE = of("SERVICE")
+
@JvmField val RETURN = of("RETURN")
@JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
@@ -1370,6 +1372,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1450,6 +1453,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1532,6 +1536,7 @@ private constructor(
LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Value.SERVICE
RETURN -> Value.RETURN
RETURN_REVERSAL -> Value.RETURN_REVERSAL
TRANSFER -> Value.TRANSFER
@@ -1612,6 +1617,7 @@ private constructor(
LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Known.SERVICE
RETURN -> Known.RETURN
RETURN_REVERSAL -> Known.RETURN_REVERSAL
TRANSFER -> Known.TRANSFER
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt
index bd38b51bf..b7430d4d5 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/StatementLineItems.kt
@@ -1136,6 +1136,8 @@ private constructor(
@JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
+ @JvmField val SERVICE = of("SERVICE")
+
@JvmField val RETURN = of("RETURN")
@JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
@@ -1214,6 +1216,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1294,6 +1297,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1376,6 +1380,7 @@ private constructor(
LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Value.SERVICE
RETURN -> Value.RETURN
RETURN_REVERSAL -> Value.RETURN_REVERSAL
TRANSFER -> Value.TRANSFER
@@ -1456,6 +1461,7 @@ private constructor(
LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Known.SERVICE
RETURN -> Known.RETURN
RETURN_REVERSAL -> Known.RETURN_REVERSAL
TRANSFER -> Known.TRANSFER
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt
index 72b37743b..5180498b1 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/Transfer.kt
@@ -1331,6 +1331,8 @@ private constructor(
@JvmField val PROVISIONAL_CREDIT_REVERSAL = of("PROVISIONAL_CREDIT_REVERSAL")
+ @JvmField val SERVICE = of("SERVICE")
+
@JvmField val RETURN = of("RETURN")
@JvmField val RETURN_REVERSAL = of("RETURN_REVERSAL")
@@ -1409,6 +1411,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1489,6 +1492,7 @@ private constructor(
LOSS_WRITE_OFF,
PROVISIONAL_CREDIT,
PROVISIONAL_CREDIT_REVERSAL,
+ SERVICE,
RETURN,
RETURN_REVERSAL,
TRANSFER,
@@ -1571,6 +1575,7 @@ private constructor(
LOSS_WRITE_OFF -> Value.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Value.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Value.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Value.SERVICE
RETURN -> Value.RETURN
RETURN_REVERSAL -> Value.RETURN_REVERSAL
TRANSFER -> Value.TRANSFER
@@ -1651,6 +1656,7 @@ private constructor(
LOSS_WRITE_OFF -> Known.LOSS_WRITE_OFF
PROVISIONAL_CREDIT -> Known.PROVISIONAL_CREDIT
PROVISIONAL_CREDIT_REVERSAL -> Known.PROVISIONAL_CREDIT_REVERSAL
+ SERVICE -> Known.SERVICE
RETURN -> Known.RETURN
RETURN_REVERSAL -> Known.RETURN_REVERSAL
TRANSFER -> Known.TRANSFER
diff --git a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt
index 08bedfd2b..be908e0a2 100644
--- a/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt
+++ b/lithic-java-core/src/main/kotlin/com/lithic/api/models/V2ApplyResponse.kt
@@ -701,6 +701,10 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
/**
* The version of the rule, this is incremented whenever the rule's parameters change.
*/
@@ -793,6 +797,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -802,16 +807,22 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional = Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -819,6 +830,7 @@ private constructor(
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null ->
visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -842,6 +854,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -873,6 +889,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -882,16 +901,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -905,6 +925,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -917,6 +941,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -944,6 +970,8 @@ private constructor(
tryDeserialize(node, jacksonTypeRef())?.let {
Parameters(velocityLimitParams = it, _json = json)
},
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Parameters(merchantLock = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -973,11 +1001,459 @@ private constructor(
generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) = merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each
+ * merchant object allows transaction rules to work at a granular level and requires
+ * at least one of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField,
+ private val descriptor: JsonField,
+ private val merchantId: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("comment")
+ @ExcludeMissing
+ comment: JsonField = JsonMissing.of(),
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ descriptor: JsonField = JsonMissing.of(),
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ merchantId: JsonField = JsonMissing.of(),
+ ) : this(comment, descriptor, merchantId, mutableMapOf())
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun comment(): Optional = comment.getOptional("comment")
+
+ /**
+ * Short description of the merchant, often used to provide more human-readable
+ * context about the transaction merchant. This is typically the name or label
+ * shown on transaction summaries.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun descriptor(): Optional = descriptor.getOptional("descriptor")
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant). This
+ * attribute specifies the merchant entity that will be locked or referenced for
+ * authorization rules.
+ *
+ * @throws LithicInvalidDataException if the JSON field has an unexpected type
+ * (e.g. if the server responded with an unexpected value).
+ */
+ fun merchantId(): Optional = merchantId.getOptional("merchant_id")
+
+ /**
+ * Returns the raw JSON value of [comment].
+ *
+ * Unlike [comment], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("comment")
+ @ExcludeMissing
+ fun _comment(): JsonField = comment
+
+ /**
+ * Returns the raw JSON value of [descriptor].
+ *
+ * Unlike [descriptor], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("descriptor")
+ @ExcludeMissing
+ fun _descriptor(): JsonField = descriptor
+
+ /**
+ * Returns the raw JSON value of [merchantId].
+ *
+ * Unlike [merchantId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("merchant_id")
+ @ExcludeMissing
+ fun _merchantId(): JsonField = merchantId
+
+ @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 [Merchant]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Merchant]. */
+ class Builder internal constructor() {
+
+ private var comment: JsonField = JsonMissing.of()
+ private var descriptor: JsonField = JsonMissing.of()
+ private var merchantId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap =
+ mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchant: Merchant) = apply {
+ comment = merchant.comment
+ descriptor = merchant.descriptor
+ merchantId = merchant.merchantId
+ additionalProperties = merchant.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A comment or explanation about the merchant, used internally for rule
+ * management purposes.
+ */
+ fun comment(comment: String) = comment(JsonField.of(comment))
+
+ /**
+ * Sets [Builder.comment] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comment] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun comment(comment: JsonField) = apply { this.comment = comment }
+
+ /**
+ * Short description of the merchant, often used to provide more
+ * human-readable context about the transaction merchant. This is typically
+ * the name or label shown on transaction summaries.
+ */
+ fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor))
+
+ /**
+ * Sets [Builder.descriptor] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.descriptor] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun descriptor(descriptor: JsonField) = apply {
+ this.descriptor = descriptor
+ }
+
+ /**
+ * Unique alphanumeric identifier for the payment card acceptor (merchant).
+ * This attribute specifies the merchant entity that will be locked or
+ * referenced for authorization rules.
+ */
+ fun merchantId(merchantId: String) = merchantId(JsonField.of(merchantId))
+
+ /**
+ * Sets [Builder.merchantId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchantId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an
+ * undocumented or not yet supported value.
+ */
+ fun merchantId(merchantId: JsonField) = apply {
+ this.merchantId = merchantId
+ }
+
+ 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 [Merchant].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ */
+ fun build(): Merchant =
+ Merchant(
+ comment,
+ descriptor,
+ merchantId,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Merchant = apply {
+ if (validated) {
+ return@apply
+ }
+
+ comment()
+ descriptor()
+ merchantId()
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 (comment.asKnown().isPresent) 1 else 0) +
+ (if (descriptor.asKnown().isPresent) 1 else 0) +
+ (if (merchantId.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Merchant && comment == other.comment && descriptor == other.descriptor && merchantId == other.merchantId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(comment, descriptor, merchantId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Merchant{comment=$comment, descriptor=$descriptor, merchantId=$merchantId, additionalProperties=$additionalProperties}"
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MerchantLockParameters && merchants == other.merchants && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(merchants, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MerchantLockParameters{merchants=$merchants, additionalProperties=$additionalProperties}"
+ }
}
override fun equals(other: Any?): Boolean {
@@ -1113,6 +1589,10 @@ private constructor(
fun parameters(velocityLimitParams: VelocityLimitParams) =
parameters(Parameters.ofVelocityLimitParams(velocityLimitParams))
+ /** Alias for calling [parameters] with `Parameters.ofMerchantLock(merchantLock)`. */
+ fun parameters(merchantLock: Parameters.MerchantLockParameters) =
+ parameters(Parameters.ofMerchantLock(merchantLock))
+
/**
* The version of the rule, this is incremented whenever the rule's parameters change.
*/
@@ -1205,6 +1685,7 @@ private constructor(
private constructor(
private val conditionalBlock: ConditionalBlockParameters? = null,
private val velocityLimitParams: VelocityLimitParams? = null,
+ private val merchantLock: MerchantLockParameters? = null,
private val _json: JsonValue? = null,
) {
@@ -1214,16 +1695,22 @@ private constructor(
fun velocityLimitParams(): Optional =
Optional.ofNullable(velocityLimitParams)
+ fun merchantLock(): Optional = Optional.ofNullable(merchantLock)
+
fun isConditionalBlock(): Boolean = conditionalBlock != null
fun isVelocityLimitParams(): Boolean = velocityLimitParams != null
+ fun isMerchantLock(): Boolean = merchantLock != null
+
fun asConditionalBlock(): ConditionalBlockParameters =
conditionalBlock.getOrThrow("conditionalBlock")
fun asVelocityLimitParams(): VelocityLimitParams =
velocityLimitParams.getOrThrow("velocityLimitParams")
+ fun asMerchantLock(): MerchantLockParameters = merchantLock.getOrThrow("merchantLock")
+
fun _json(): Optional = Optional.ofNullable(_json)
fun accept(visitor: Visitor): T =
@@ -1231,6 +1718,7 @@ private constructor(
conditionalBlock != null -> visitor.visitConditionalBlock(conditionalBlock)
velocityLimitParams != null ->
visitor.visitVelocityLimitParams(velocityLimitParams)
+ merchantLock != null -> visitor.visitMerchantLock(merchantLock)
else -> visitor.unknown(_json)
}
@@ -1254,6 +1742,10 @@ private constructor(
) {
velocityLimitParams.validate()
}
+
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) {
+ merchantLock.validate()
+ }
}
)
validated = true
@@ -1285,6 +1777,9 @@ private constructor(
velocityLimitParams: VelocityLimitParams
) = velocityLimitParams.validity()
+ override fun visitMerchantLock(merchantLock: MerchantLockParameters) =
+ merchantLock.validity()
+
override fun unknown(json: JsonValue?) = 0
}
)
@@ -1294,16 +1789,17 @@ private constructor(
return true
}
- return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams /* spotless:on */
+ return /* spotless:off */ other is Parameters && conditionalBlock == other.conditionalBlock && velocityLimitParams == other.velocityLimitParams && merchantLock == other.merchantLock /* spotless:on */
}
- override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams) /* spotless:on */
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(conditionalBlock, velocityLimitParams, merchantLock) /* spotless:on */
override fun toString(): String =
when {
conditionalBlock != null -> "Parameters{conditionalBlock=$conditionalBlock}"
velocityLimitParams != null ->
"Parameters{velocityLimitParams=$velocityLimitParams}"
+ merchantLock != null -> "Parameters{merchantLock=$merchantLock}"
_json != null -> "Parameters{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Parameters")
}
@@ -1317,6 +1813,10 @@ private constructor(
@JvmStatic
fun ofVelocityLimitParams(velocityLimitParams: VelocityLimitParams) =
Parameters(velocityLimitParams = velocityLimitParams)
+
+ @JvmStatic
+ fun ofMerchantLock(merchantLock: MerchantLockParameters) =
+ Parameters(merchantLock = merchantLock)
}
/**
@@ -1329,6 +1829,8 @@ private constructor(
fun visitVelocityLimitParams(velocityLimitParams: VelocityLimitParams): T
+ fun visitMerchantLock(merchantLock: MerchantLockParameters): T
+
/**
* Maps an unknown variant of [Parameters] to a value of type [T].
*
@@ -1356,6 +1858,8 @@ private constructor(
tryDeserialize(node, jacksonTypeRef())?.let {
Parameters(velocityLimitParams = it, _json = json)
},
+ tryDeserialize(node, jacksonTypeRef())
+ ?.let { Parameters(merchantLock = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -1385,11 +1889,459 @@ private constructor(
generator.writeObject(value.conditionalBlock)
value.velocityLimitParams != null ->
generator.writeObject(value.velocityLimitParams)
+ value.merchantLock != null -> generator.writeObject(value.merchantLock)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Parameters")
}
}
}
+
+ class MerchantLockParameters
+ private constructor(
+ private val merchants: JsonField>,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ merchants: JsonField> = JsonMissing.of()
+ ) : this(merchants, mutableMapOf())
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ *
+ * @throws LithicInvalidDataException 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 merchants(): List = merchants.getRequired("merchants")
+
+ /**
+ * Returns the raw JSON value of [merchants].
+ *
+ * Unlike [merchants], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("merchants")
+ @ExcludeMissing
+ fun _merchants(): JsonField> = merchants
+
+ @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
+ * [MerchantLockParameters].
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [MerchantLockParameters]. */
+ class Builder internal constructor() {
+
+ private var merchants: JsonField>? = null
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(merchantLockParameters: MerchantLockParameters) = apply {
+ merchants = merchantLockParameters.merchants.map { it.toMutableList() }
+ additionalProperties =
+ merchantLockParameters.additionalProperties.toMutableMap()
+ }
+
+ /**
+ * A list of merchant locks defining specific merchants or groups of merchants
+ * (based on descriptors or IDs) that the lock applies to.
+ */
+ fun merchants(merchants: List) = merchants(JsonField.of(merchants))
+
+ /**
+ * Sets [Builder.merchants] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.merchants] with a well-typed
+ * `List` value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun merchants(merchants: JsonField>) = apply {
+ this.merchants = merchants.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [Merchant] to [merchants].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addMerchant(merchant: Merchant) = apply {
+ merchants =
+ (merchants ?: JsonField.of(mutableListOf())).also {
+ checkKnown("merchants", it).add(merchant)
+ }
+ }
+
+ 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 [MerchantLockParameters].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .merchants()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): MerchantLockParameters =
+ MerchantLockParameters(
+ checkRequired("merchants", merchants).map { it.toImmutable() },
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): MerchantLockParameters = apply {
+ if (validated) {
+ return@apply
+ }
+
+ merchants().forEach { it.validate() }
+ validated = true
+ }
+
+ fun isValid(): Boolean =
+ try {
+ validate()
+ true
+ } catch (e: LithicInvalidDataException) {
+ 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 =
+ (merchants.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+
+ /**
+ * Represents a specific merchant lock based on their ID or descriptor. Each
+ * merchant object allows transaction rules to work at a granular level and requires
+ * at least one of merchant_id or descriptor.
+ */
+ class Merchant
+ private constructor(
+ private val comment: JsonField