diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 6538ca91..6d78745c 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.8.0"
+ ".": "0.9.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 49b2f4a1..7d050298 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 97
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-40a4e23dd482299a046fb62fd2b5a1e03d455156cb8cd4573e92e4132d74b243.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-14d1c1e4560c65c7c62f23343268ece4476ae079cd01ba2e6b924efde5f97c3e.yml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6bddb226..107d24da 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+## 0.9.0 (2024-11-26)
+
+Full Changelog: [v0.8.0...v0.9.0](https://github.com/orbcorp/orb-java/compare/v0.8.0...v0.9.0)
+
+### Features
+
+* **api:** api update ([#131](https://github.com/orbcorp/orb-java/issues/131)) ([8ef1405](https://github.com/orbcorp/orb-java/commit/8ef140591b579e8bdec3ecdf25008b7995d5f3e0))
+
## 0.8.0 (2024-11-25)
Full Changelog: [v0.7.0...v0.8.0](https://github.com/orbcorp/orb-java/compare/v0.7.0...v0.8.0)
diff --git a/README.md b/README.md
index 78f853ab..3bfa76d6 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.8.0)
+[](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.9.0)
@@ -25,7 +25,7 @@ The REST API documentation can be foundĀ on [docs.withorb.com](https://docs.with
```kotlin
-implementation("com.withorb.api:orb-java:0.8.0")
+implementation("com.withorb.api:orb-java:0.9.0")
```
#### Maven
@@ -34,7 +34,7 @@ implementation("com.withorb.api:orb-java:0.8.0")
com.withorb.api
orb-java
- 0.8.0
+ 0.9.0
```
diff --git a/build.gradle.kts b/build.gradle.kts
index f9036d28..aeb5f91c 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -4,7 +4,7 @@ plugins {
allprojects {
group = "com.withorb.api"
- version = "0.8.0" // x-release-please-version
+ version = "0.9.0" // x-release-please-version
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt
index 1f5b3121..23d50530 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Plan.kt
@@ -6,18 +6,28 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.withorb.api.core.BaseDeserializer
+import com.withorb.api.core.BaseSerializer
import com.withorb.api.core.Enum
import com.withorb.api.core.ExcludeMissing
import com.withorb.api.core.JsonField
import com.withorb.api.core.JsonMissing
import com.withorb.api.core.JsonValue
import com.withorb.api.core.NoAutoDetect
+import com.withorb.api.core.getOrThrow
import com.withorb.api.core.toImmutable
import com.withorb.api.errors.OrbInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional
+import kotlin.jvm.optionals.getOrNull
/**
* The [Plan](../guides/core-concepts.mdx#plan-and-price) resource represents a plan that can be
@@ -51,6 +61,7 @@ private constructor(
private val netTerms: JsonField,
private val defaultInvoiceMemo: JsonField,
private val prices: JsonField>,
+ private val adjustments: JsonField>,
private val additionalProperties: Map,
) {
@@ -139,6 +150,12 @@ private constructor(
*/
fun prices(): List = prices.getRequired("prices")
+ /**
+ * Adjustments for this plan. If the plan has phases, this includes adjustments across all
+ * phases of the plan.
+ */
+ fun adjustments(): List = adjustments.getRequired("adjustments")
+
/**
* User specified key-value pairs for the resource. If not present, this defaults to an empty
* dictionary. Individual keys can be removed by setting the value to `null`, and the entire
@@ -219,6 +236,12 @@ private constructor(
*/
@JsonProperty("prices") @ExcludeMissing fun _prices() = prices
+ /**
+ * Adjustments for this plan. If the plan has phases, this includes adjustments across all
+ * phases of the plan.
+ */
+ @JsonProperty("adjustments") @ExcludeMissing fun _adjustments() = adjustments
+
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
@@ -248,6 +271,7 @@ private constructor(
netTerms()
defaultInvoiceMemo()
prices()
+ adjustments()
validated = true
}
}
@@ -284,6 +308,7 @@ private constructor(
private var netTerms: JsonField = JsonMissing.of()
private var defaultInvoiceMemo: JsonField = JsonMissing.of()
private var prices: JsonField> = JsonMissing.of()
+ private var adjustments: JsonField> = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -311,6 +336,7 @@ private constructor(
this.netTerms = plan.netTerms
this.defaultInvoiceMemo = plan.defaultInvoiceMemo
this.prices = plan.prices
+ this.adjustments = plan.adjustments
additionalProperties(plan.additionalProperties)
}
@@ -536,6 +562,22 @@ private constructor(
@ExcludeMissing
fun prices(prices: JsonField>) = apply { this.prices = prices }
+ /**
+ * Adjustments for this plan. If the plan has phases, this includes adjustments across all
+ * phases of the plan.
+ */
+ fun adjustments(adjustments: List) = adjustments(JsonField.of(adjustments))
+
+ /**
+ * Adjustments for this plan. If the plan has phases, this includes adjustments across all
+ * phases of the plan.
+ */
+ @JsonProperty("adjustments")
+ @ExcludeMissing
+ fun adjustments(adjustments: JsonField>) = apply {
+ this.adjustments = adjustments
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
@@ -575,10 +617,1731 @@ private constructor(
netTerms,
defaultInvoiceMemo,
prices.map { it.toImmutable() },
+ adjustments.map { it.toImmutable() },
additionalProperties.toImmutable(),
)
}
+ @JsonDeserialize(using = Adjustment.Deserializer::class)
+ @JsonSerialize(using = Adjustment.Serializer::class)
+ class Adjustment
+ private constructor(
+ private val amountDiscountAdjustment: AmountDiscountAdjustment? = null,
+ private val percentageDiscountAdjustment: PercentageDiscountAdjustment? = null,
+ private val usageDiscountAdjustment: UsageDiscountAdjustment? = null,
+ private val minimumAdjustment: MinimumAdjustment? = null,
+ private val maximumAdjustment: MaximumAdjustment? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun amountDiscountAdjustment(): Optional =
+ Optional.ofNullable(amountDiscountAdjustment)
+
+ fun percentageDiscountAdjustment(): Optional =
+ Optional.ofNullable(percentageDiscountAdjustment)
+
+ fun usageDiscountAdjustment(): Optional =
+ Optional.ofNullable(usageDiscountAdjustment)
+
+ fun minimumAdjustment(): Optional =
+ Optional.ofNullable(minimumAdjustment)
+
+ fun maximumAdjustment(): Optional =
+ Optional.ofNullable(maximumAdjustment)
+
+ fun isAmountDiscountAdjustment(): Boolean = amountDiscountAdjustment != null
+
+ fun isPercentageDiscountAdjustment(): Boolean = percentageDiscountAdjustment != null
+
+ fun isUsageDiscountAdjustment(): Boolean = usageDiscountAdjustment != null
+
+ fun isMinimumAdjustment(): Boolean = minimumAdjustment != null
+
+ fun isMaximumAdjustment(): Boolean = maximumAdjustment != null
+
+ fun asAmountDiscountAdjustment(): AmountDiscountAdjustment =
+ amountDiscountAdjustment.getOrThrow("amountDiscountAdjustment")
+
+ fun asPercentageDiscountAdjustment(): PercentageDiscountAdjustment =
+ percentageDiscountAdjustment.getOrThrow("percentageDiscountAdjustment")
+
+ fun asUsageDiscountAdjustment(): UsageDiscountAdjustment =
+ usageDiscountAdjustment.getOrThrow("usageDiscountAdjustment")
+
+ fun asMinimumAdjustment(): MinimumAdjustment =
+ minimumAdjustment.getOrThrow("minimumAdjustment")
+
+ fun asMaximumAdjustment(): MaximumAdjustment =
+ maximumAdjustment.getOrThrow("maximumAdjustment")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T {
+ return when {
+ amountDiscountAdjustment != null ->
+ visitor.visitAmountDiscountAdjustment(amountDiscountAdjustment)
+ percentageDiscountAdjustment != null ->
+ visitor.visitPercentageDiscountAdjustment(percentageDiscountAdjustment)
+ usageDiscountAdjustment != null ->
+ visitor.visitUsageDiscountAdjustment(usageDiscountAdjustment)
+ minimumAdjustment != null -> visitor.visitMinimumAdjustment(minimumAdjustment)
+ maximumAdjustment != null -> visitor.visitMaximumAdjustment(maximumAdjustment)
+ else -> visitor.unknown(_json)
+ }
+ }
+
+ fun validate(): Adjustment = apply {
+ if (!validated) {
+ if (
+ amountDiscountAdjustment == null &&
+ percentageDiscountAdjustment == null &&
+ usageDiscountAdjustment == null &&
+ minimumAdjustment == null &&
+ maximumAdjustment == null
+ ) {
+ throw OrbInvalidDataException("Unknown Adjustment: $_json")
+ }
+ amountDiscountAdjustment?.validate()
+ percentageDiscountAdjustment?.validate()
+ usageDiscountAdjustment?.validate()
+ minimumAdjustment?.validate()
+ maximumAdjustment?.validate()
+ validated = true
+ }
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is Adjustment && amountDiscountAdjustment == other.amountDiscountAdjustment && percentageDiscountAdjustment == other.percentageDiscountAdjustment && usageDiscountAdjustment == other.usageDiscountAdjustment && minimumAdjustment == other.minimumAdjustment && maximumAdjustment == other.maximumAdjustment /* spotless:on */
+ }
+
+ override fun hashCode(): Int = /* spotless:off */ Objects.hash(amountDiscountAdjustment, percentageDiscountAdjustment, usageDiscountAdjustment, minimumAdjustment, maximumAdjustment) /* spotless:on */
+
+ override fun toString(): String =
+ when {
+ amountDiscountAdjustment != null ->
+ "Adjustment{amountDiscountAdjustment=$amountDiscountAdjustment}"
+ percentageDiscountAdjustment != null ->
+ "Adjustment{percentageDiscountAdjustment=$percentageDiscountAdjustment}"
+ usageDiscountAdjustment != null ->
+ "Adjustment{usageDiscountAdjustment=$usageDiscountAdjustment}"
+ minimumAdjustment != null -> "Adjustment{minimumAdjustment=$minimumAdjustment}"
+ maximumAdjustment != null -> "Adjustment{maximumAdjustment=$maximumAdjustment}"
+ _json != null -> "Adjustment{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Adjustment")
+ }
+
+ companion object {
+
+ @JvmStatic
+ fun ofAmountDiscountAdjustment(amountDiscountAdjustment: AmountDiscountAdjustment) =
+ Adjustment(amountDiscountAdjustment = amountDiscountAdjustment)
+
+ @JvmStatic
+ fun ofPercentageDiscountAdjustment(
+ percentageDiscountAdjustment: PercentageDiscountAdjustment
+ ) = Adjustment(percentageDiscountAdjustment = percentageDiscountAdjustment)
+
+ @JvmStatic
+ fun ofUsageDiscountAdjustment(usageDiscountAdjustment: UsageDiscountAdjustment) =
+ Adjustment(usageDiscountAdjustment = usageDiscountAdjustment)
+
+ @JvmStatic
+ fun ofMinimumAdjustment(minimumAdjustment: MinimumAdjustment) =
+ Adjustment(minimumAdjustment = minimumAdjustment)
+
+ @JvmStatic
+ fun ofMaximumAdjustment(maximumAdjustment: MaximumAdjustment) =
+ Adjustment(maximumAdjustment = maximumAdjustment)
+ }
+
+ interface Visitor {
+
+ fun visitAmountDiscountAdjustment(amountDiscountAdjustment: AmountDiscountAdjustment): T
+
+ fun visitPercentageDiscountAdjustment(
+ percentageDiscountAdjustment: PercentageDiscountAdjustment
+ ): T
+
+ fun visitUsageDiscountAdjustment(usageDiscountAdjustment: UsageDiscountAdjustment): T
+
+ fun visitMinimumAdjustment(minimumAdjustment: MinimumAdjustment): T
+
+ fun visitMaximumAdjustment(maximumAdjustment: MaximumAdjustment): T
+
+ fun unknown(json: JsonValue?): T {
+ throw OrbInvalidDataException("Unknown Adjustment: $json")
+ }
+ }
+
+ class Deserializer : BaseDeserializer(Adjustment::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Adjustment {
+ val json = JsonValue.fromJsonNode(node)
+ val adjustmentType =
+ json.asObject().getOrNull()?.get("adjustment_type")?.asString()?.getOrNull()
+
+ when (adjustmentType) {
+ "amount_discount" -> {
+ tryDeserialize(node, jacksonTypeRef()) {
+ it.validate()
+ }
+ ?.let {
+ return Adjustment(amountDiscountAdjustment = it, _json = json)
+ }
+ }
+ "percentage_discount" -> {
+ tryDeserialize(node, jacksonTypeRef()) {
+ it.validate()
+ }
+ ?.let {
+ return Adjustment(percentageDiscountAdjustment = it, _json = json)
+ }
+ }
+ "usage_discount" -> {
+ tryDeserialize(node, jacksonTypeRef()) {
+ it.validate()
+ }
+ ?.let {
+ return Adjustment(usageDiscountAdjustment = it, _json = json)
+ }
+ }
+ "minimum" -> {
+ tryDeserialize(node, jacksonTypeRef()) { it.validate() }
+ ?.let {
+ return Adjustment(minimumAdjustment = it, _json = json)
+ }
+ }
+ "maximum" -> {
+ tryDeserialize(node, jacksonTypeRef()) { it.validate() }
+ ?.let {
+ return Adjustment(maximumAdjustment = it, _json = json)
+ }
+ }
+ }
+
+ return Adjustment(_json = json)
+ }
+ }
+
+ class Serializer : BaseSerializer(Adjustment::class) {
+
+ override fun serialize(
+ value: Adjustment,
+ generator: JsonGenerator,
+ provider: SerializerProvider
+ ) {
+ when {
+ value.amountDiscountAdjustment != null ->
+ generator.writeObject(value.amountDiscountAdjustment)
+ value.percentageDiscountAdjustment != null ->
+ generator.writeObject(value.percentageDiscountAdjustment)
+ value.usageDiscountAdjustment != null ->
+ generator.writeObject(value.usageDiscountAdjustment)
+ value.minimumAdjustment != null ->
+ generator.writeObject(value.minimumAdjustment)
+ value.maximumAdjustment != null ->
+ generator.writeObject(value.maximumAdjustment)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Adjustment")
+ }
+ }
+ }
+
+ @JsonDeserialize(builder = AmountDiscountAdjustment.Builder::class)
+ @NoAutoDetect
+ class AmountDiscountAdjustment
+ private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
+ private val appliesToPriceIds: JsonField>,
+ private val reason: JsonField,
+ private val adjustmentType: JsonField,
+ private val amountDiscount: JsonField,
+ private val additionalProperties: Map,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(): List =
+ appliesToPriceIds.getRequired("applies_to_price_ids")
+
+ /** The reason for the adjustment. */
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+
+ fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type")
+
+ /**
+ * The amount by which to discount the prices this adjustment applies to in a given
+ * billing period.
+ */
+ fun amountDiscount(): String = amountDiscount.getRequired("amount_discount")
+
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun _appliesToPriceIds() = appliesToPriceIds
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+
+ @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType
+
+ /**
+ * The amount by which to discount the prices this adjustment applies to in a given
+ * billing period.
+ */
+ @JsonProperty("amount_discount") @ExcludeMissing fun _amountDiscount() = amountDiscount
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun validate(): AmountDiscountAdjustment = apply {
+ if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
+ appliesToPriceIds()
+ reason()
+ adjustmentType()
+ amountDiscount()
+ validated = true
+ }
+ }
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun builder() = Builder()
+ }
+
+ class Builder {
+
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
+ private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var reason: JsonField = JsonMissing.of()
+ private var adjustmentType: JsonField = JsonMissing.of()
+ private var amountDiscount: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply {
+ this.id = amountDiscountAdjustment.id
+ this.isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = amountDiscountAdjustment.planPhaseOrder
+ this.appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds
+ this.reason = amountDiscountAdjustment.reason
+ this.adjustmentType = amountDiscountAdjustment.adjustmentType
+ this.amountDiscount = amountDiscountAdjustment.amountDiscount
+ additionalProperties(amountDiscountAdjustment.additionalProperties)
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(appliesToPriceIds: List) =
+ appliesToPriceIds(JsonField.of(appliesToPriceIds))
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply {
+ this.appliesToPriceIds = appliesToPriceIds
+ }
+
+ /** The reason for the adjustment. */
+ fun reason(reason: String) = reason(JsonField.of(reason))
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason")
+ @ExcludeMissing
+ fun reason(reason: JsonField) = apply { this.reason = reason }
+
+ fun adjustmentType(adjustmentType: AdjustmentType) =
+ adjustmentType(JsonField.of(adjustmentType))
+
+ @JsonProperty("adjustment_type")
+ @ExcludeMissing
+ fun adjustmentType(adjustmentType: JsonField) = apply {
+ this.adjustmentType = adjustmentType
+ }
+
+ /**
+ * The amount by which to discount the prices this adjustment applies to in a given
+ * billing period.
+ */
+ fun amountDiscount(amountDiscount: String) =
+ amountDiscount(JsonField.of(amountDiscount))
+
+ /**
+ * The amount by which to discount the prices this adjustment applies to in a given
+ * billing period.
+ */
+ @JsonProperty("amount_discount")
+ @ExcludeMissing
+ fun amountDiscount(amountDiscount: JsonField) = apply {
+ this.amountDiscount = amountDiscount
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ @JsonAnySetter
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ this.additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun build(): AmountDiscountAdjustment =
+ AmountDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
+ appliesToPriceIds.map { it.toImmutable() },
+ reason,
+ adjustmentType,
+ amountDiscount,
+ additionalProperties.toImmutable(),
+ )
+ }
+
+ class AdjustmentType
+ @JsonCreator
+ private constructor(
+ private val value: JsonField,
+ ) : Enum {
+
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+
+ companion object {
+
+ @JvmField val AMOUNT_DISCOUNT = AdjustmentType(JsonField.of("amount_discount"))
+
+ @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value))
+ }
+
+ enum class Known {
+ AMOUNT_DISCOUNT,
+ }
+
+ enum class Value {
+ AMOUNT_DISCOUNT,
+ _UNKNOWN,
+ }
+
+ fun value(): Value =
+ when (this) {
+ AMOUNT_DISCOUNT -> Value.AMOUNT_DISCOUNT
+ else -> Value._UNKNOWN
+ }
+
+ fun known(): Known =
+ when (this) {
+ AMOUNT_DISCOUNT -> Known.AMOUNT_DISCOUNT
+ else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value")
+ }
+
+ fun asString(): String = _value().asStringOrThrow()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}"
+ }
+
+ @JsonDeserialize(builder = PercentageDiscountAdjustment.Builder::class)
+ @NoAutoDetect
+ class PercentageDiscountAdjustment
+ private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
+ private val appliesToPriceIds: JsonField>,
+ private val reason: JsonField,
+ private val adjustmentType: JsonField,
+ private val percentageDiscount: JsonField,
+ private val additionalProperties: Map,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(): List =
+ appliesToPriceIds.getRequired("applies_to_price_ids")
+
+ /** The reason for the adjustment. */
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+
+ fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type")
+
+ /**
+ * The percentage (as a value between 0 and 1) by which to discount the price intervals
+ * this adjustment applies to in a given billing period.
+ */
+ fun percentageDiscount(): Double = percentageDiscount.getRequired("percentage_discount")
+
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun _appliesToPriceIds() = appliesToPriceIds
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+
+ @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType
+
+ /**
+ * The percentage (as a value between 0 and 1) by which to discount the price intervals
+ * this adjustment applies to in a given billing period.
+ */
+ @JsonProperty("percentage_discount")
+ @ExcludeMissing
+ fun _percentageDiscount() = percentageDiscount
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun validate(): PercentageDiscountAdjustment = apply {
+ if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
+ appliesToPriceIds()
+ reason()
+ adjustmentType()
+ percentageDiscount()
+ validated = true
+ }
+ }
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun builder() = Builder()
+ }
+
+ class Builder {
+
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
+ private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var reason: JsonField = JsonMissing.of()
+ private var adjustmentType: JsonField = JsonMissing.of()
+ private var percentageDiscount: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) =
+ apply {
+ this.id = percentageDiscountAdjustment.id
+ this.isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder
+ this.appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds
+ this.reason = percentageDiscountAdjustment.reason
+ this.adjustmentType = percentageDiscountAdjustment.adjustmentType
+ this.percentageDiscount = percentageDiscountAdjustment.percentageDiscount
+ additionalProperties(percentageDiscountAdjustment.additionalProperties)
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(appliesToPriceIds: List) =
+ appliesToPriceIds(JsonField.of(appliesToPriceIds))
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply {
+ this.appliesToPriceIds = appliesToPriceIds
+ }
+
+ /** The reason for the adjustment. */
+ fun reason(reason: String) = reason(JsonField.of(reason))
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason")
+ @ExcludeMissing
+ fun reason(reason: JsonField) = apply { this.reason = reason }
+
+ fun adjustmentType(adjustmentType: AdjustmentType) =
+ adjustmentType(JsonField.of(adjustmentType))
+
+ @JsonProperty("adjustment_type")
+ @ExcludeMissing
+ fun adjustmentType(adjustmentType: JsonField) = apply {
+ this.adjustmentType = adjustmentType
+ }
+
+ /**
+ * The percentage (as a value between 0 and 1) by which to discount the price
+ * intervals this adjustment applies to in a given billing period.
+ */
+ fun percentageDiscount(percentageDiscount: Double) =
+ percentageDiscount(JsonField.of(percentageDiscount))
+
+ /**
+ * The percentage (as a value between 0 and 1) by which to discount the price
+ * intervals this adjustment applies to in a given billing period.
+ */
+ @JsonProperty("percentage_discount")
+ @ExcludeMissing
+ fun percentageDiscount(percentageDiscount: JsonField) = apply {
+ this.percentageDiscount = percentageDiscount
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ @JsonAnySetter
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ this.additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun build(): PercentageDiscountAdjustment =
+ PercentageDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
+ appliesToPriceIds.map { it.toImmutable() },
+ reason,
+ adjustmentType,
+ percentageDiscount,
+ additionalProperties.toImmutable(),
+ )
+ }
+
+ class AdjustmentType
+ @JsonCreator
+ private constructor(
+ private val value: JsonField,
+ ) : Enum {
+
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+
+ companion object {
+
+ @JvmField
+ val PERCENTAGE_DISCOUNT = AdjustmentType(JsonField.of("percentage_discount"))
+
+ @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value))
+ }
+
+ enum class Known {
+ PERCENTAGE_DISCOUNT,
+ }
+
+ enum class Value {
+ PERCENTAGE_DISCOUNT,
+ _UNKNOWN,
+ }
+
+ fun value(): Value =
+ when (this) {
+ PERCENTAGE_DISCOUNT -> Value.PERCENTAGE_DISCOUNT
+ else -> Value._UNKNOWN
+ }
+
+ fun known(): Known =
+ when (this) {
+ PERCENTAGE_DISCOUNT -> Known.PERCENTAGE_DISCOUNT
+ else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value")
+ }
+
+ fun asString(): String = _value().asStringOrThrow()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}"
+ }
+
+ @JsonDeserialize(builder = UsageDiscountAdjustment.Builder::class)
+ @NoAutoDetect
+ class UsageDiscountAdjustment
+ private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
+ private val appliesToPriceIds: JsonField>,
+ private val reason: JsonField,
+ private val adjustmentType: JsonField,
+ private val usageDiscount: JsonField,
+ private val additionalProperties: Map,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(): List =
+ appliesToPriceIds.getRequired("applies_to_price_ids")
+
+ /** The reason for the adjustment. */
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+
+ fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type")
+
+ /**
+ * The number of usage units by which to discount the price this adjustment applies to
+ * in a given billing period.
+ */
+ fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount")
+
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun _appliesToPriceIds() = appliesToPriceIds
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+
+ @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType
+
+ /**
+ * The number of usage units by which to discount the price this adjustment applies to
+ * in a given billing period.
+ */
+ @JsonProperty("usage_discount") @ExcludeMissing fun _usageDiscount() = usageDiscount
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun validate(): UsageDiscountAdjustment = apply {
+ if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
+ appliesToPriceIds()
+ reason()
+ adjustmentType()
+ usageDiscount()
+ validated = true
+ }
+ }
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun builder() = Builder()
+ }
+
+ class Builder {
+
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
+ private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var reason: JsonField = JsonMissing.of()
+ private var adjustmentType: JsonField = JsonMissing.of()
+ private var usageDiscount: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply {
+ this.id = usageDiscountAdjustment.id
+ this.isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = usageDiscountAdjustment.planPhaseOrder
+ this.appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds
+ this.reason = usageDiscountAdjustment.reason
+ this.adjustmentType = usageDiscountAdjustment.adjustmentType
+ this.usageDiscount = usageDiscountAdjustment.usageDiscount
+ additionalProperties(usageDiscountAdjustment.additionalProperties)
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(appliesToPriceIds: List) =
+ appliesToPriceIds(JsonField.of(appliesToPriceIds))
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply {
+ this.appliesToPriceIds = appliesToPriceIds
+ }
+
+ /** The reason for the adjustment. */
+ fun reason(reason: String) = reason(JsonField.of(reason))
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason")
+ @ExcludeMissing
+ fun reason(reason: JsonField) = apply { this.reason = reason }
+
+ fun adjustmentType(adjustmentType: AdjustmentType) =
+ adjustmentType(JsonField.of(adjustmentType))
+
+ @JsonProperty("adjustment_type")
+ @ExcludeMissing
+ fun adjustmentType(adjustmentType: JsonField) = apply {
+ this.adjustmentType = adjustmentType
+ }
+
+ /**
+ * The number of usage units by which to discount the price this adjustment applies
+ * to in a given billing period.
+ */
+ fun usageDiscount(usageDiscount: Double) =
+ usageDiscount(JsonField.of(usageDiscount))
+
+ /**
+ * The number of usage units by which to discount the price this adjustment applies
+ * to in a given billing period.
+ */
+ @JsonProperty("usage_discount")
+ @ExcludeMissing
+ fun usageDiscount(usageDiscount: JsonField) = apply {
+ this.usageDiscount = usageDiscount
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ @JsonAnySetter
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ this.additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun build(): UsageDiscountAdjustment =
+ UsageDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
+ appliesToPriceIds.map { it.toImmutable() },
+ reason,
+ adjustmentType,
+ usageDiscount,
+ additionalProperties.toImmutable(),
+ )
+ }
+
+ class AdjustmentType
+ @JsonCreator
+ private constructor(
+ private val value: JsonField,
+ ) : Enum {
+
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+
+ companion object {
+
+ @JvmField val USAGE_DISCOUNT = AdjustmentType(JsonField.of("usage_discount"))
+
+ @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value))
+ }
+
+ enum class Known {
+ USAGE_DISCOUNT,
+ }
+
+ enum class Value {
+ USAGE_DISCOUNT,
+ _UNKNOWN,
+ }
+
+ fun value(): Value =
+ when (this) {
+ USAGE_DISCOUNT -> Value.USAGE_DISCOUNT
+ else -> Value._UNKNOWN
+ }
+
+ fun known(): Known =
+ when (this) {
+ USAGE_DISCOUNT -> Known.USAGE_DISCOUNT
+ else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value")
+ }
+
+ fun asString(): String = _value().asStringOrThrow()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}"
+ }
+
+ @JsonDeserialize(builder = MinimumAdjustment.Builder::class)
+ @NoAutoDetect
+ class MinimumAdjustment
+ private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
+ private val appliesToPriceIds: JsonField>,
+ private val reason: JsonField,
+ private val adjustmentType: JsonField,
+ private val minimumAmount: JsonField,
+ private val itemId: JsonField,
+ private val additionalProperties: Map,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(): List =
+ appliesToPriceIds.getRequired("applies_to_price_ids")
+
+ /** The reason for the adjustment. */
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+
+ fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type")
+
+ /**
+ * The minimum amount to charge in a given billing period for the prices this adjustment
+ * applies to.
+ */
+ fun minimumAmount(): String = minimumAmount.getRequired("minimum_amount")
+
+ /** The item ID that revenue from this minimum will be attributed to. */
+ fun itemId(): String = itemId.getRequired("item_id")
+
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun _appliesToPriceIds() = appliesToPriceIds
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+
+ @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType
+
+ /**
+ * The minimum amount to charge in a given billing period for the prices this adjustment
+ * applies to.
+ */
+ @JsonProperty("minimum_amount") @ExcludeMissing fun _minimumAmount() = minimumAmount
+
+ /** The item ID that revenue from this minimum will be attributed to. */
+ @JsonProperty("item_id") @ExcludeMissing fun _itemId() = itemId
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun validate(): MinimumAdjustment = apply {
+ if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
+ appliesToPriceIds()
+ reason()
+ adjustmentType()
+ minimumAmount()
+ itemId()
+ validated = true
+ }
+ }
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun builder() = Builder()
+ }
+
+ class Builder {
+
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
+ private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var reason: JsonField = JsonMissing.of()
+ private var adjustmentType: JsonField = JsonMissing.of()
+ private var minimumAmount: JsonField = JsonMissing.of()
+ private var itemId: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(minimumAdjustment: MinimumAdjustment) = apply {
+ this.id = minimumAdjustment.id
+ this.isInvoiceLevel = minimumAdjustment.isInvoiceLevel
+ this.planPhaseOrder = minimumAdjustment.planPhaseOrder
+ this.appliesToPriceIds = minimumAdjustment.appliesToPriceIds
+ this.reason = minimumAdjustment.reason
+ this.adjustmentType = minimumAdjustment.adjustmentType
+ this.minimumAmount = minimumAdjustment.minimumAmount
+ this.itemId = minimumAdjustment.itemId
+ additionalProperties(minimumAdjustment.additionalProperties)
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(appliesToPriceIds: List) =
+ appliesToPriceIds(JsonField.of(appliesToPriceIds))
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply {
+ this.appliesToPriceIds = appliesToPriceIds
+ }
+
+ /** The reason for the adjustment. */
+ fun reason(reason: String) = reason(JsonField.of(reason))
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason")
+ @ExcludeMissing
+ fun reason(reason: JsonField) = apply { this.reason = reason }
+
+ fun adjustmentType(adjustmentType: AdjustmentType) =
+ adjustmentType(JsonField.of(adjustmentType))
+
+ @JsonProperty("adjustment_type")
+ @ExcludeMissing
+ fun adjustmentType(adjustmentType: JsonField) = apply {
+ this.adjustmentType = adjustmentType
+ }
+
+ /**
+ * The minimum amount to charge in a given billing period for the prices this
+ * adjustment applies to.
+ */
+ fun minimumAmount(minimumAmount: String) =
+ minimumAmount(JsonField.of(minimumAmount))
+
+ /**
+ * The minimum amount to charge in a given billing period for the prices this
+ * adjustment applies to.
+ */
+ @JsonProperty("minimum_amount")
+ @ExcludeMissing
+ fun minimumAmount(minimumAmount: JsonField) = apply {
+ this.minimumAmount = minimumAmount
+ }
+
+ /** The item ID that revenue from this minimum will be attributed to. */
+ fun itemId(itemId: String) = itemId(JsonField.of(itemId))
+
+ /** The item ID that revenue from this minimum will be attributed to. */
+ @JsonProperty("item_id")
+ @ExcludeMissing
+ fun itemId(itemId: JsonField) = apply { this.itemId = itemId }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ @JsonAnySetter
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ this.additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun build(): MinimumAdjustment =
+ MinimumAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
+ appliesToPriceIds.map { it.toImmutable() },
+ reason,
+ adjustmentType,
+ minimumAmount,
+ itemId,
+ additionalProperties.toImmutable(),
+ )
+ }
+
+ class AdjustmentType
+ @JsonCreator
+ private constructor(
+ private val value: JsonField,
+ ) : Enum {
+
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+
+ companion object {
+
+ @JvmField val MINIMUM = AdjustmentType(JsonField.of("minimum"))
+
+ @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value))
+ }
+
+ enum class Known {
+ MINIMUM,
+ }
+
+ enum class Value {
+ MINIMUM,
+ _UNKNOWN,
+ }
+
+ fun value(): Value =
+ when (this) {
+ MINIMUM -> Value.MINIMUM
+ else -> Value._UNKNOWN
+ }
+
+ fun known(): Known =
+ when (this) {
+ MINIMUM -> Known.MINIMUM
+ else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value")
+ }
+
+ fun asString(): String = _value().asStringOrThrow()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MinimumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && minimumAmount == other.minimumAmount && itemId == other.itemId && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, minimumAmount, itemId, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MinimumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, minimumAmount=$minimumAmount, itemId=$itemId, additionalProperties=$additionalProperties}"
+ }
+
+ @JsonDeserialize(builder = MaximumAdjustment.Builder::class)
+ @NoAutoDetect
+ class MaximumAdjustment
+ private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
+ private val appliesToPriceIds: JsonField>,
+ private val reason: JsonField,
+ private val adjustmentType: JsonField,
+ private val maximumAmount: JsonField,
+ private val additionalProperties: Map,
+ ) {
+
+ private var validated: Boolean = false
+
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(): List =
+ appliesToPriceIds.getRequired("applies_to_price_ids")
+
+ /** The reason for the adjustment. */
+ fun reason(): Optional = Optional.ofNullable(reason.getNullable("reason"))
+
+ fun adjustmentType(): AdjustmentType = adjustmentType.getRequired("adjustment_type")
+
+ /**
+ * The maximum amount to charge in a given billing period for the prices this adjustment
+ * applies to.
+ */
+ fun maximumAmount(): String = maximumAmount.getRequired("maximum_amount")
+
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level") @ExcludeMissing fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order") @ExcludeMissing fun _planPhaseOrder() = planPhaseOrder
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun _appliesToPriceIds() = appliesToPriceIds
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason") @ExcludeMissing fun _reason() = reason
+
+ @JsonProperty("adjustment_type") @ExcludeMissing fun _adjustmentType() = adjustmentType
+
+ /**
+ * The maximum amount to charge in a given billing period for the prices this adjustment
+ * applies to.
+ */
+ @JsonProperty("maximum_amount") @ExcludeMissing fun _maximumAmount() = maximumAmount
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun validate(): MaximumAdjustment = apply {
+ if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
+ appliesToPriceIds()
+ reason()
+ adjustmentType()
+ maximumAmount()
+ validated = true
+ }
+ }
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ @JvmStatic fun builder() = Builder()
+ }
+
+ class Builder {
+
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
+ private var appliesToPriceIds: JsonField> = JsonMissing.of()
+ private var reason: JsonField = JsonMissing.of()
+ private var adjustmentType: JsonField = JsonMissing.of()
+ private var maximumAmount: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(maximumAdjustment: MaximumAdjustment) = apply {
+ this.id = maximumAdjustment.id
+ this.isInvoiceLevel = maximumAdjustment.isInvoiceLevel
+ this.planPhaseOrder = maximumAdjustment.planPhaseOrder
+ this.appliesToPriceIds = maximumAdjustment.appliesToPriceIds
+ this.reason = maximumAdjustment.reason
+ this.adjustmentType = maximumAdjustment.adjustmentType
+ this.maximumAmount = maximumAdjustment.maximumAmount
+ additionalProperties(maximumAdjustment.additionalProperties)
+ }
+
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
+ /** The price IDs that this adjustment applies to. */
+ fun appliesToPriceIds(appliesToPriceIds: List) =
+ appliesToPriceIds(JsonField.of(appliesToPriceIds))
+
+ /** The price IDs that this adjustment applies to. */
+ @JsonProperty("applies_to_price_ids")
+ @ExcludeMissing
+ fun appliesToPriceIds(appliesToPriceIds: JsonField>) = apply {
+ this.appliesToPriceIds = appliesToPriceIds
+ }
+
+ /** The reason for the adjustment. */
+ fun reason(reason: String) = reason(JsonField.of(reason))
+
+ /** The reason for the adjustment. */
+ @JsonProperty("reason")
+ @ExcludeMissing
+ fun reason(reason: JsonField) = apply { this.reason = reason }
+
+ fun adjustmentType(adjustmentType: AdjustmentType) =
+ adjustmentType(JsonField.of(adjustmentType))
+
+ @JsonProperty("adjustment_type")
+ @ExcludeMissing
+ fun adjustmentType(adjustmentType: JsonField) = apply {
+ this.adjustmentType = adjustmentType
+ }
+
+ /**
+ * The maximum amount to charge in a given billing period for the prices this
+ * adjustment applies to.
+ */
+ fun maximumAmount(maximumAmount: String) =
+ maximumAmount(JsonField.of(maximumAmount))
+
+ /**
+ * The maximum amount to charge in a given billing period for the prices this
+ * adjustment applies to.
+ */
+ @JsonProperty("maximum_amount")
+ @ExcludeMissing
+ fun maximumAmount(maximumAmount: JsonField) = apply {
+ this.maximumAmount = maximumAmount
+ }
+
+ fun additionalProperties(additionalProperties: Map) = apply {
+ this.additionalProperties.clear()
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ @JsonAnySetter
+ fun putAdditionalProperty(key: String, value: JsonValue) = apply {
+ this.additionalProperties.put(key, value)
+ }
+
+ fun putAllAdditionalProperties(additionalProperties: Map) =
+ apply {
+ this.additionalProperties.putAll(additionalProperties)
+ }
+
+ fun build(): MaximumAdjustment =
+ MaximumAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
+ appliesToPriceIds.map { it.toImmutable() },
+ reason,
+ adjustmentType,
+ maximumAmount,
+ additionalProperties.toImmutable(),
+ )
+ }
+
+ class AdjustmentType
+ @JsonCreator
+ private constructor(
+ private val value: JsonField,
+ ) : Enum {
+
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is AdjustmentType && value == other.value /* spotless:on */
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+
+ companion object {
+
+ @JvmField val MAXIMUM = AdjustmentType(JsonField.of("maximum"))
+
+ @JvmStatic fun of(value: String) = AdjustmentType(JsonField.of(value))
+ }
+
+ enum class Known {
+ MAXIMUM,
+ }
+
+ enum class Value {
+ MAXIMUM,
+ _UNKNOWN,
+ }
+
+ fun value(): Value =
+ when (this) {
+ MAXIMUM -> Value.MAXIMUM
+ else -> Value._UNKNOWN
+ }
+
+ fun known(): Known =
+ when (this) {
+ MAXIMUM -> Known.MAXIMUM
+ else -> throw OrbInvalidDataException("Unknown AdjustmentType: $value")
+ }
+
+ fun asString(): String = _value().asStringOrThrow()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return /* spotless:off */ other is MaximumAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && maximumAmount == other.maximumAmount && additionalProperties == other.additionalProperties /* spotless:on */
+ }
+
+ /* spotless:off */
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, maximumAmount, additionalProperties) }
+ /* spotless:on */
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "MaximumAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, maximumAmount=$maximumAmount, additionalProperties=$additionalProperties}"
+ }
+ }
+
@JsonDeserialize(builder = BasePlan.Builder::class)
@NoAutoDetect
class BasePlan
@@ -2014,15 +3777,15 @@ private constructor(
return true
}
- return /* spotless:off */ other is Plan && metadata == other.metadata && id == other.id && name == other.name && description == other.description && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && createdAt == other.createdAt && status == other.status && maximum == other.maximum && minimum == other.minimum && discount == other.discount && product == other.product && version == other.version && trialConfig == other.trialConfig && planPhases == other.planPhases && basePlan == other.basePlan && basePlanId == other.basePlanId && externalPlanId == other.externalPlanId && currency == other.currency && invoicingCurrency == other.invoicingCurrency && netTerms == other.netTerms && defaultInvoiceMemo == other.defaultInvoiceMemo && prices == other.prices && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is Plan && metadata == other.metadata && id == other.id && name == other.name && description == other.description && maximumAmount == other.maximumAmount && minimumAmount == other.minimumAmount && createdAt == other.createdAt && status == other.status && maximum == other.maximum && minimum == other.minimum && discount == other.discount && product == other.product && version == other.version && trialConfig == other.trialConfig && planPhases == other.planPhases && basePlan == other.basePlan && basePlanId == other.basePlanId && externalPlanId == other.externalPlanId && currency == other.currency && invoicingCurrency == other.invoicingCurrency && netTerms == other.netTerms && defaultInvoiceMemo == other.defaultInvoiceMemo && prices == other.prices && adjustments == other.adjustments && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(metadata, id, name, description, maximumAmount, minimumAmount, createdAt, status, maximum, minimum, discount, product, version, trialConfig, planPhases, basePlan, basePlanId, externalPlanId, currency, invoicingCurrency, netTerms, defaultInvoiceMemo, prices, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(metadata, id, name, description, maximumAmount, minimumAmount, createdAt, status, maximum, minimum, discount, product, version, trialConfig, planPhases, basePlan, basePlanId, externalPlanId, currency, invoicingCurrency, netTerms, defaultInvoiceMemo, prices, adjustments, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "Plan{metadata=$metadata, id=$id, name=$name, description=$description, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, createdAt=$createdAt, status=$status, maximum=$maximum, minimum=$minimum, discount=$discount, product=$product, version=$version, trialConfig=$trialConfig, planPhases=$planPhases, basePlan=$basePlan, basePlanId=$basePlanId, externalPlanId=$externalPlanId, currency=$currency, invoicingCurrency=$invoicingCurrency, netTerms=$netTerms, defaultInvoiceMemo=$defaultInvoiceMemo, prices=$prices, additionalProperties=$additionalProperties}"
+ "Plan{metadata=$metadata, id=$id, name=$name, description=$description, maximumAmount=$maximumAmount, minimumAmount=$minimumAmount, createdAt=$createdAt, status=$status, maximum=$maximum, minimum=$minimum, discount=$discount, product=$product, version=$version, trialConfig=$trialConfig, planPhases=$planPhases, basePlan=$basePlan, basePlanId=$basePlanId, externalPlanId=$externalPlanId, currency=$currency, invoicingCurrency=$invoicingCurrency, netTerms=$netTerms, defaultInvoiceMemo=$defaultInvoiceMemo, prices=$prices, adjustments=$adjustments, additionalProperties=$additionalProperties}"
}
diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt
index 80e2a6dc..aee059a9 100644
--- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt
+++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Subscription.kt
@@ -1219,6 +1219,9 @@ private constructor(
@NoAutoDetect
class AmountDiscountAdjustment
private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
private val appliesToPriceIds: JsonField>,
private val reason: JsonField,
private val adjustmentType: JsonField,
@@ -1228,6 +1231,18 @@ private constructor(
private var validated: Boolean = false
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(): List =
appliesToPriceIds.getRequired("applies_to_price_ids")
@@ -1243,6 +1258,21 @@ private constructor(
*/
fun amountDiscount(): String = amountDiscount.getRequired("amount_discount")
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun _planPhaseOrder() = planPhaseOrder
+
/** The price IDs that this adjustment applies to. */
@JsonProperty("applies_to_price_ids")
@ExcludeMissing
@@ -1269,6 +1299,9 @@ private constructor(
fun validate(): AmountDiscountAdjustment = apply {
if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
appliesToPriceIds()
reason()
adjustmentType()
@@ -1286,6 +1319,9 @@ private constructor(
class Builder {
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
private var appliesToPriceIds: JsonField> = JsonMissing.of()
private var reason: JsonField = JsonMissing.of()
private var adjustmentType: JsonField = JsonMissing.of()
@@ -1294,6 +1330,9 @@ private constructor(
@JvmSynthetic
internal fun from(amountDiscountAdjustment: AmountDiscountAdjustment) = apply {
+ this.id = amountDiscountAdjustment.id
+ this.isInvoiceLevel = amountDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = amountDiscountAdjustment.planPhaseOrder
this.appliesToPriceIds = amountDiscountAdjustment.appliesToPriceIds
this.reason = amountDiscountAdjustment.reason
this.adjustmentType = amountDiscountAdjustment.adjustmentType
@@ -1301,6 +1340,40 @@ private constructor(
additionalProperties(amountDiscountAdjustment.additionalProperties)
}
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(appliesToPriceIds: List) =
appliesToPriceIds(JsonField.of(appliesToPriceIds))
@@ -1363,6 +1436,9 @@ private constructor(
fun build(): AmountDiscountAdjustment =
AmountDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
appliesToPriceIds.map { it.toImmutable() },
reason,
adjustmentType,
@@ -1429,23 +1505,26 @@ private constructor(
return true
}
- return /* spotless:off */ other is AmountDiscountAdjustment && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is AmountDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && amountDiscount == other.amountDiscount && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, amountDiscount, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "AmountDiscountAdjustment{appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}"
+ "AmountDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, amountDiscount=$amountDiscount, additionalProperties=$additionalProperties}"
}
@JsonDeserialize(builder = PercentageDiscountAdjustment.Builder::class)
@NoAutoDetect
class PercentageDiscountAdjustment
private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
private val appliesToPriceIds: JsonField>,
private val reason: JsonField,
private val adjustmentType: JsonField,
@@ -1455,6 +1534,18 @@ private constructor(
private var validated: Boolean = false
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(): List =
appliesToPriceIds.getRequired("applies_to_price_ids")
@@ -1471,6 +1562,21 @@ private constructor(
fun percentageDiscount(): Double =
percentageDiscount.getRequired("percentage_discount")
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun _planPhaseOrder() = planPhaseOrder
+
/** The price IDs that this adjustment applies to. */
@JsonProperty("applies_to_price_ids")
@ExcludeMissing
@@ -1497,6 +1603,9 @@ private constructor(
fun validate(): PercentageDiscountAdjustment = apply {
if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
appliesToPriceIds()
reason()
adjustmentType()
@@ -1514,6 +1623,9 @@ private constructor(
class Builder {
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
private var appliesToPriceIds: JsonField> = JsonMissing.of()
private var reason: JsonField = JsonMissing.of()
private var adjustmentType: JsonField = JsonMissing.of()
@@ -1523,6 +1635,9 @@ private constructor(
@JvmSynthetic
internal fun from(percentageDiscountAdjustment: PercentageDiscountAdjustment) =
apply {
+ this.id = percentageDiscountAdjustment.id
+ this.isInvoiceLevel = percentageDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = percentageDiscountAdjustment.planPhaseOrder
this.appliesToPriceIds = percentageDiscountAdjustment.appliesToPriceIds
this.reason = percentageDiscountAdjustment.reason
this.adjustmentType = percentageDiscountAdjustment.adjustmentType
@@ -1531,6 +1646,40 @@ private constructor(
additionalProperties(percentageDiscountAdjustment.additionalProperties)
}
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(appliesToPriceIds: List) =
appliesToPriceIds(JsonField.of(appliesToPriceIds))
@@ -1593,6 +1742,9 @@ private constructor(
fun build(): PercentageDiscountAdjustment =
PercentageDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
appliesToPriceIds.map { it.toImmutable() },
reason,
adjustmentType,
@@ -1660,23 +1812,26 @@ private constructor(
return true
}
- return /* spotless:off */ other is PercentageDiscountAdjustment && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is PercentageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && percentageDiscount == other.percentageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, percentageDiscount, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "PercentageDiscountAdjustment{appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}"
+ "PercentageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, percentageDiscount=$percentageDiscount, additionalProperties=$additionalProperties}"
}
@JsonDeserialize(builder = UsageDiscountAdjustment.Builder::class)
@NoAutoDetect
class UsageDiscountAdjustment
private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
private val appliesToPriceIds: JsonField>,
private val reason: JsonField,
private val adjustmentType: JsonField,
@@ -1686,6 +1841,18 @@ private constructor(
private var validated: Boolean = false
+ fun id(): String = id.getRequired("id")
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ fun isInvoiceLevel(): Boolean = isInvoiceLevel.getRequired("is_invoice_level")
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(): Optional =
+ Optional.ofNullable(planPhaseOrder.getNullable("plan_phase_order"))
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(): List =
appliesToPriceIds.getRequired("applies_to_price_ids")
@@ -1701,6 +1868,21 @@ private constructor(
*/
fun usageDiscount(): Double = usageDiscount.getRequired("usage_discount")
+ @JsonProperty("id") @ExcludeMissing fun _id() = id
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments that
+ * apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun _isInvoiceLevel() = isInvoiceLevel
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun _planPhaseOrder() = planPhaseOrder
+
/** The price IDs that this adjustment applies to. */
@JsonProperty("applies_to_price_ids")
@ExcludeMissing
@@ -1725,6 +1907,9 @@ private constructor(
fun validate(): UsageDiscountAdjustment = apply {
if (!validated) {
+ id()
+ isInvoiceLevel()
+ planPhaseOrder()
appliesToPriceIds()
reason()
adjustmentType()
@@ -1742,6 +1927,9 @@ private constructor(
class Builder {
+ private var id: JsonField = JsonMissing.of()
+ private var isInvoiceLevel: JsonField = JsonMissing.of()
+ private var planPhaseOrder: JsonField = JsonMissing.of()
private var appliesToPriceIds: JsonField> = JsonMissing.of()
private var reason: JsonField = JsonMissing.of()
private var adjustmentType: JsonField = JsonMissing.of()
@@ -1750,6 +1938,9 @@ private constructor(
@JvmSynthetic
internal fun from(usageDiscountAdjustment: UsageDiscountAdjustment) = apply {
+ this.id = usageDiscountAdjustment.id
+ this.isInvoiceLevel = usageDiscountAdjustment.isInvoiceLevel
+ this.planPhaseOrder = usageDiscountAdjustment.planPhaseOrder
this.appliesToPriceIds = usageDiscountAdjustment.appliesToPriceIds
this.reason = usageDiscountAdjustment.reason
this.adjustmentType = usageDiscountAdjustment.adjustmentType
@@ -1757,6 +1948,40 @@ private constructor(
additionalProperties(usageDiscountAdjustment.additionalProperties)
}
+ fun id(id: String) = id(JsonField.of(id))
+
+ @JsonProperty("id")
+ @ExcludeMissing
+ fun id(id: JsonField) = apply { this.id = id }
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ fun isInvoiceLevel(isInvoiceLevel: Boolean) =
+ isInvoiceLevel(JsonField.of(isInvoiceLevel))
+
+ /**
+ * True for adjustments that apply to an entire invocice, false for adjustments
+ * that apply to only one price.
+ */
+ @JsonProperty("is_invoice_level")
+ @ExcludeMissing
+ fun isInvoiceLevel(isInvoiceLevel: JsonField) = apply {
+ this.isInvoiceLevel = isInvoiceLevel
+ }
+
+ /** The plan phase in which this adjustment is active. */
+ fun planPhaseOrder(planPhaseOrder: Long) =
+ planPhaseOrder(JsonField.of(planPhaseOrder))
+
+ /** The plan phase in which this adjustment is active. */
+ @JsonProperty("plan_phase_order")
+ @ExcludeMissing
+ fun planPhaseOrder(planPhaseOrder: JsonField) = apply {
+ this.planPhaseOrder = planPhaseOrder
+ }
+
/** The price IDs that this adjustment applies to. */
fun appliesToPriceIds(appliesToPriceIds: List) =
appliesToPriceIds(JsonField.of(appliesToPriceIds))
@@ -1819,6 +2044,9 @@ private constructor(
fun build(): UsageDiscountAdjustment =
UsageDiscountAdjustment(
+ id,
+ isInvoiceLevel,
+ planPhaseOrder,
appliesToPriceIds.map { it.toImmutable() },
reason,
adjustmentType,
@@ -1885,23 +2113,26 @@ private constructor(
return true
}
- return /* spotless:off */ other is UsageDiscountAdjustment && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
+ return /* spotless:off */ other is UsageDiscountAdjustment && id == other.id && isInvoiceLevel == other.isInvoiceLevel && planPhaseOrder == other.planPhaseOrder && appliesToPriceIds == other.appliesToPriceIds && reason == other.reason && adjustmentType == other.adjustmentType && usageDiscount == other.usageDiscount && additionalProperties == other.additionalProperties /* spotless:on */
}
/* spotless:off */
- private val hashCode: Int by lazy { Objects.hash(appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) }
+ private val hashCode: Int by lazy { Objects.hash(id, isInvoiceLevel, planPhaseOrder, appliesToPriceIds, reason, adjustmentType, usageDiscount, additionalProperties) }
/* spotless:on */
override fun hashCode(): Int = hashCode
override fun toString() =
- "UsageDiscountAdjustment{appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}"
+ "UsageDiscountAdjustment{id=$id, isInvoiceLevel=$isInvoiceLevel, planPhaseOrder=$planPhaseOrder, appliesToPriceIds=$appliesToPriceIds, reason=$reason, adjustmentType=$adjustmentType, usageDiscount=$usageDiscount, additionalProperties=$additionalProperties}"
}
@JsonDeserialize(builder = MinimumAdjustment.Builder::class)
@NoAutoDetect
class MinimumAdjustment
private constructor(
+ private val id: JsonField,
+ private val isInvoiceLevel: JsonField,
+ private val planPhaseOrder: JsonField,
private val appliesToPriceIds: JsonField>,
private val reason: JsonField