diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cc51f6f8..fc0d7ff8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.44.0" + ".": "0.45.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index b21f5baa..58bce287 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 103 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-a2c1aa029d1e72a5fc7d3c6cd431479888ebd9a379683a2c8630da48437baa4f.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-6797b438a8e6a6856e28f4304a5a3c81bb67e74fa2d6fcc20e734880c725295a.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 4242f0f7..a76c58d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.45.0 (2025-03-07) + +Full Changelog: [v0.44.0...v0.45.0](https://github.com/orbcorp/orb-java/compare/v0.44.0...v0.45.0) + +### Features + +* **api:** api update ([#317](https://github.com/orbcorp/orb-java/issues/317)) ([540fe9c](https://github.com/orbcorp/orb-java/commit/540fe9cfb9c92531ee1c517d06c3401f3b4511a1)) +* **client:** detect binary incompatible jackson versions ([#315](https://github.com/orbcorp/orb-java/issues/315)) ([50dd8a9](https://github.com/orbcorp/orb-java/commit/50dd8a98c468428cc2598ba4ce5d561a615b736e)) + ## 0.44.0 (2025-03-06) Full Changelog: [v0.43.0...v0.44.0](https://github.com/orbcorp/orb-java/compare/v0.43.0...v0.44.0) diff --git a/README.md b/README.md index 54ca1a67..625b2010 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.44.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.withorb.api/orb-java)](https://central.sonatype.com/artifact/com.withorb.api/orb-java/0.45.0) @@ -19,7 +19,7 @@ The REST API documentation can be found on [docs.withorb.com](https://docs.witho ### Gradle ```kotlin -implementation("com.withorb.api:orb-java:0.44.0") +implementation("com.withorb.api:orb-java:0.45.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:0.44.0") com.withorb.api orb-java - 0.44.0 + 0.45.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index f6397730..1629af51 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "0.44.0" // x-release-please-version + version = "0.45.0" // x-release-please-version } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt index 814b479f..45bc6ad7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/ObjectMappers.kt @@ -9,11 +9,15 @@ import com.fasterxml.jackson.databind.SerializationFeature import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.cfg.CoercionAction.Fail import com.fasterxml.jackson.databind.cfg.CoercionInputShape.Integer +import com.fasterxml.jackson.databind.exc.InvalidDefinitionException +import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.datatype.jdk8.Jdk8Module import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule import com.fasterxml.jackson.module.kotlin.jacksonMapperBuilder +import com.withorb.api.errors.OrbException +import com.withorb.api.errors.OrbInvalidDataException import java.io.InputStream fun jsonMapper(): JsonMapper = @@ -43,3 +47,38 @@ private object InputStreamJsonSerializer : BaseSerializer(InputStre } } } + +@JvmSynthetic +internal fun enhanceJacksonException(fallbackMessage: String, e: Exception): Exception { + // These exceptions should only happen if our code is wrong OR if the user is using a binary + // incompatible version of `com.fasterxml.jackson.core:jackson-databind`: + // https://javadoc.io/static/com.fasterxml.jackson.core/jackson-databind/2.18.1/index.html + val isUnexpectedException = + e is UnrecognizedPropertyException || e is InvalidDefinitionException + if (!isUnexpectedException) { + return OrbInvalidDataException(fallbackMessage, e) + } + + val jacksonVersion = JsonMapper::class.java.`package`.implementationVersion + if (jacksonVersion.isNullOrEmpty() || jacksonVersion == COMPILED_JACKSON_VERSION) { + return OrbInvalidDataException(fallbackMessage, e) + } + + return OrbException( + """ + Jackson threw an unexpected exception and its runtime version ($jacksonVersion) mismatches the version the SDK was compiled with ($COMPILED_JACKSON_VERSION). + + You may be using a version of `com.fasterxml.jackson.core:jackson-databind` that's not binary compatible with the SDK. + + This can happen if you are either: + 1. Directly depending on a different Jackson version + 2. Depending on some library that depends on a different Jackson version, potentially transitively + + Double-check that you are depending on a compatible Jackson version. + """ + .trimIndent(), + e, + ) +} + +const val COMPILED_JACKSON_VERSION = "2.18.1" diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/JsonHandler.kt b/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/JsonHandler.kt index a254740d..b96bd9d7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/JsonHandler.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/core/handlers/JsonHandler.kt @@ -4,18 +4,17 @@ package com.withorb.api.core.handlers import com.fasterxml.jackson.databind.json.JsonMapper import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.withorb.api.core.enhanceJacksonException import com.withorb.api.core.http.HttpResponse import com.withorb.api.core.http.HttpResponse.Handler -import com.withorb.api.errors.OrbException @JvmSynthetic internal inline fun jsonHandler(jsonMapper: JsonMapper): Handler = object : Handler { - override fun handle(response: HttpResponse): T { + override fun handle(response: HttpResponse): T = try { - return jsonMapper.readValue(response.body(), jacksonTypeRef()) + jsonMapper.readValue(response.body(), jacksonTypeRef()) } catch (e: Exception) { - throw OrbException("Error reading response", e) + throw enhanceJacksonException("Error reading response", e) } - } } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt index 7a7bb803..9390ddc8 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/Alert.kt @@ -992,26 +992,26 @@ private constructor( companion object { - @JvmField val USAGE_EXCEEDED = of("usage_exceeded") - - @JvmField val COST_EXCEEDED = of("cost_exceeded") - @JvmField val CREDIT_BALANCE_DEPLETED = of("credit_balance_depleted") @JvmField val CREDIT_BALANCE_DROPPED = of("credit_balance_dropped") @JvmField val CREDIT_BALANCE_RECOVERED = of("credit_balance_recovered") + @JvmField val USAGE_EXCEEDED = of("usage_exceeded") + + @JvmField val COST_EXCEEDED = of("cost_exceeded") + @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } /** An enum containing [Type]'s known values. */ enum class Known { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, + USAGE_EXCEEDED, + COST_EXCEEDED, } /** @@ -1024,11 +1024,11 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, + USAGE_EXCEEDED, + COST_EXCEEDED, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1042,11 +1042,11 @@ private constructor( */ fun value(): Value = when (this) { - USAGE_EXCEEDED -> Value.USAGE_EXCEEDED - COST_EXCEEDED -> Value.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Value.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Value.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED + USAGE_EXCEEDED -> Value.USAGE_EXCEEDED + COST_EXCEEDED -> Value.COST_EXCEEDED else -> Value._UNKNOWN } @@ -1060,11 +1060,11 @@ private constructor( */ fun known(): Known = when (this) { - USAGE_EXCEEDED -> Known.USAGE_EXCEEDED - COST_EXCEEDED -> Known.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Known.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Known.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED + USAGE_EXCEEDED -> Known.USAGE_EXCEEDED + COST_EXCEEDED -> Known.COST_EXCEEDED else -> throw OrbInvalidDataException("Unknown Type: $value") } diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt index 8f8ec64d..7889c0bf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForCustomerParams.kt @@ -445,10 +445,6 @@ private constructor( companion object { - @JvmField val USAGE_EXCEEDED = of("usage_exceeded") - - @JvmField val COST_EXCEEDED = of("cost_exceeded") - @JvmField val CREDIT_BALANCE_DEPLETED = of("credit_balance_depleted") @JvmField val CREDIT_BALANCE_DROPPED = of("credit_balance_dropped") @@ -460,8 +456,6 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, @@ -477,8 +471,6 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, @@ -495,8 +487,6 @@ private constructor( */ fun value(): Value = when (this) { - USAGE_EXCEEDED -> Value.USAGE_EXCEEDED - COST_EXCEEDED -> Value.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Value.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Value.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED @@ -513,8 +503,6 @@ private constructor( */ fun known(): Known = when (this) { - USAGE_EXCEEDED -> Known.USAGE_EXCEEDED - COST_EXCEEDED -> Known.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Known.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Known.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt index 2deb5b5c..365b7cdf 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParams.kt @@ -451,10 +451,6 @@ private constructor( companion object { - @JvmField val USAGE_EXCEEDED = of("usage_exceeded") - - @JvmField val COST_EXCEEDED = of("cost_exceeded") - @JvmField val CREDIT_BALANCE_DEPLETED = of("credit_balance_depleted") @JvmField val CREDIT_BALANCE_DROPPED = of("credit_balance_dropped") @@ -466,8 +462,6 @@ private constructor( /** An enum containing [Type]'s known values. */ enum class Known { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, @@ -483,8 +477,6 @@ private constructor( * - It was constructed with an arbitrary value using the [of] method. */ enum class Value { - USAGE_EXCEEDED, - COST_EXCEEDED, CREDIT_BALANCE_DEPLETED, CREDIT_BALANCE_DROPPED, CREDIT_BALANCE_RECOVERED, @@ -501,8 +493,6 @@ private constructor( */ fun value(): Value = when (this) { - USAGE_EXCEEDED -> Value.USAGE_EXCEEDED - COST_EXCEEDED -> Value.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Value.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Value.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED @@ -519,8 +509,6 @@ private constructor( */ fun known(): Known = when (this) { - USAGE_EXCEEDED -> Known.USAGE_EXCEEDED - COST_EXCEEDED -> Known.COST_EXCEEDED CREDIT_BALANCE_DEPLETED -> Known.CREDIT_BALANCE_DEPLETED CREDIT_BALANCE_DROPPED -> Known.CREDIT_BALANCE_DROPPED CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt index 7107f735..48e4caf2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/AlertCreateForSubscriptionParams.kt @@ -576,12 +576,6 @@ private constructor( @JvmField val COST_EXCEEDED = of("cost_exceeded") - @JvmField val CREDIT_BALANCE_DEPLETED = of("credit_balance_depleted") - - @JvmField val CREDIT_BALANCE_DROPPED = of("credit_balance_dropped") - - @JvmField val CREDIT_BALANCE_RECOVERED = of("credit_balance_recovered") - @JvmStatic fun of(value: String) = Type(JsonField.of(value)) } @@ -589,9 +583,6 @@ private constructor( enum class Known { USAGE_EXCEEDED, COST_EXCEEDED, - CREDIT_BALANCE_DEPLETED, - CREDIT_BALANCE_DROPPED, - CREDIT_BALANCE_RECOVERED, } /** @@ -606,9 +597,6 @@ private constructor( enum class Value { USAGE_EXCEEDED, COST_EXCEEDED, - CREDIT_BALANCE_DEPLETED, - CREDIT_BALANCE_DROPPED, - CREDIT_BALANCE_RECOVERED, /** An enum member indicating that [Type] was instantiated with an unknown value. */ _UNKNOWN, } @@ -624,9 +612,6 @@ private constructor( when (this) { USAGE_EXCEEDED -> Value.USAGE_EXCEEDED COST_EXCEEDED -> Value.COST_EXCEEDED - CREDIT_BALANCE_DEPLETED -> Value.CREDIT_BALANCE_DEPLETED - CREDIT_BALANCE_DROPPED -> Value.CREDIT_BALANCE_DROPPED - CREDIT_BALANCE_RECOVERED -> Value.CREDIT_BALANCE_RECOVERED else -> Value._UNKNOWN } @@ -642,9 +627,6 @@ private constructor( when (this) { USAGE_EXCEEDED -> Known.USAGE_EXCEEDED COST_EXCEEDED -> Known.COST_EXCEEDED - CREDIT_BALANCE_DEPLETED -> Known.CREDIT_BALANCE_DEPLETED - CREDIT_BALANCE_DROPPED -> Known.CREDIT_BALANCE_DROPPED - CREDIT_BALANCE_RECOVERED -> Known.CREDIT_BALANCE_RECOVERED else -> throw OrbInvalidDataException("Unknown Type: $value") } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt index 7276a96b..66d04cb3 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForCustomerParamsTest.kt @@ -13,7 +13,7 @@ class AlertCreateForCustomerParamsTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold(AlertCreateForCustomerParams.Threshold.builder().value(0.0).build()) .build() } @@ -24,7 +24,7 @@ class AlertCreateForCustomerParamsTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold(AlertCreateForCustomerParams.Threshold.builder().value(0.0).build()) .build() @@ -32,7 +32,7 @@ class AlertCreateForCustomerParamsTest { assertNotNull(body) assertThat(body.currency()).isEqualTo("currency") - assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) assertThat(body.thresholds()) .contains(listOf(AlertCreateForCustomerParams.Threshold.builder().value(0.0).build())) } @@ -43,14 +43,14 @@ class AlertCreateForCustomerParamsTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .build() val body = params._body() assertNotNull(body) assertThat(body.currency()).isEqualTo("currency") - assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + assertThat(body.type()).isEqualTo(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) } @Test @@ -59,7 +59,7 @@ class AlertCreateForCustomerParamsTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .build() assertThat(params).isNotNull // path param "customerId" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt index 9fc3acdb..540ad93a 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertCreateForExternalCustomerParamsTest.kt @@ -13,7 +13,7 @@ class AlertCreateForExternalCustomerParamsTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() ) @@ -26,7 +26,7 @@ class AlertCreateForExternalCustomerParamsTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() ) @@ -36,7 +36,8 @@ class AlertCreateForExternalCustomerParamsTest { assertNotNull(body) assertThat(body.currency()).isEqualTo("currency") - assertThat(body.type()).isEqualTo(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + assertThat(body.type()) + .isEqualTo(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) assertThat(body.thresholds()) .contains( listOf(AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build()) @@ -49,14 +50,15 @@ class AlertCreateForExternalCustomerParamsTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .build() val body = params._body() assertNotNull(body) assertThat(body.currency()).isEqualTo("currency") - assertThat(body.type()).isEqualTo(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + assertThat(body.type()) + .isEqualTo(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) } @Test @@ -65,7 +67,7 @@ class AlertCreateForExternalCustomerParamsTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .build() assertThat(params).isNotNull // path param "externalCustomerId" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt index 02b182bc..71540ee4 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/AlertTest.kt @@ -33,7 +33,7 @@ class AlertTest { ) .subscription(Alert.Subscription.builder().id("VDGsT23osdLb84KD").build()) .addThreshold(Alert.Threshold.builder().value(0.0).build()) - .type(Alert.Type.USAGE_EXCEEDED) + .type(Alert.Type.CREDIT_BALANCE_DEPLETED) .build() assertThat(alert).isNotNull assertThat(alert.id()).isEqualTo("XuxCbt7x9L82yyeF") @@ -58,6 +58,6 @@ class AlertTest { .contains(Alert.Subscription.builder().id("VDGsT23osdLb84KD").build()) assertThat(alert.thresholds().get()) .containsExactly(Alert.Threshold.builder().value(0.0).build()) - assertThat(alert.type()).isEqualTo(Alert.Type.USAGE_EXCEEDED) + assertThat(alert.type()).isEqualTo(Alert.Type.CREDIT_BALANCE_DEPLETED) } } diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt index 744e38e4..6d919afb 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/AlertServiceAsyncTest.kt @@ -85,7 +85,7 @@ class AlertServiceAsyncTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForCustomerParams.Threshold.builder().value(0.0).build() ) @@ -110,7 +110,7 @@ class AlertServiceAsyncTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt index f3188cb5..9a67cad1 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/AlertServiceTest.kt @@ -81,7 +81,7 @@ class AlertServiceTest { AlertCreateForCustomerParams.builder() .customerId("customer_id") .currency("currency") - .type(AlertCreateForCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForCustomerParams.Threshold.builder().value(0.0).build() ) @@ -105,7 +105,7 @@ class AlertServiceTest { AlertCreateForExternalCustomerParams.builder() .externalCustomerId("external_customer_id") .currency("currency") - .type(AlertCreateForExternalCustomerParams.Type.USAGE_EXCEEDED) + .type(AlertCreateForExternalCustomerParams.Type.CREDIT_BALANCE_DEPLETED) .addThreshold( AlertCreateForExternalCustomerParams.Threshold.builder().value(0.0).build() )