From 00866a557ba12a39d7899bc3bc0a2950094ad355 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 20:09:51 +0000 Subject: [PATCH 1/5] chore(ci): ensure docs generation always succeeds --- .github/workflows/publish-sonatype.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 96822978..5ab47fba 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -33,7 +33,7 @@ jobs: export -- GPG_SIGNING_KEY_ID printenv -- GPG_SIGNING_KEY | gpg --batch --passphrase-fd 3 --import 3<<< "$GPG_SIGNING_PASSWORD" GPG_SIGNING_KEY_ID="$(gpg --with-colons --list-keys | awk -F : -- '/^pub:/ { getline; print "0x" substr($10, length($10) - 7) }')" - ./gradlew publishAndReleaseToMavenCentral --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache + ./gradlew publishAndReleaseToMavenCentral -Dorg.gradle.jvmargs="-Xmx8g" --stacktrace -PmavenCentralUsername="$SONATYPE_USERNAME" -PmavenCentralPassword="$SONATYPE_PASSWORD" --no-configuration-cache env: SONATYPE_USERNAME: ${{ secrets.ORB_SONATYPE_USERNAME || secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.ORB_SONATYPE_PASSWORD || secrets.SONATYPE_PASSWORD }} From ee43b240c6ca6968cca70b7c6db999c7de19b2bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 21:48:42 +0000 Subject: [PATCH 2/5] chore(ci): bump `actions/setup-java` to v4 --- .github/workflows/publish-sonatype.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-sonatype.yml b/.github/workflows/publish-sonatype.yml index 5ab47fba..9875f43e 100644 --- a/.github/workflows/publish-sonatype.yml +++ b/.github/workflows/publish-sonatype.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: | From 52612a73768f17c76ccfff8e5dacf9457dd08c0d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 05:12:38 +0000 Subject: [PATCH 3/5] feat(api): api update --- .stats.yml | 4 +- .../com/withorb/api/models/CreditNote.kt | 109 +++++- .../api/models/CreditNoteCreateParams.kt | 316 +++++++++++++++++- .../CustomerCostListByExternalIdParams.kt | 12 +- .../api/models/CustomerCostListParams.kt | 12 +- ...tomerCreditLedgerListByExternalIdParams.kt | 4 +- .../models/CustomerCreditLedgerListParams.kt | 4 +- .../api/models/EventBackfillCreateParams.kt | 16 +- .../api/models/InvoiceVoidInvoiceParams.kt | 2 +- .../withorb/api/models/MutatedSubscription.kt | 24 +- .../api/models/PriceEvaluateMultipleParams.kt | 56 +++- .../models/PriceEvaluateMultipleResponse.kt | 54 ++- .../PriceEvaluatePreviewEventsParams.kt | 56 +++- .../PriceEvaluatePreviewEventsResponse.kt | 54 ++- .../com/withorb/api/models/Subscription.kt | 24 +- .../api/models/SubscriptionCreateParams.kt | 2 +- .../SubscriptionPriceIntervalsParams.kt | 20 +- .../services/async/CreditNoteServiceAsync.kt | 24 +- .../api/services/async/InvoiceServiceAsync.kt | 4 +- .../async/SubscriptionServiceAsync.kt | 2 +- .../async/customers/CostServiceAsync.kt | 28 +- .../customers/credits/LedgerServiceAsync.kt | 8 +- .../services/blocking/CreditNoteService.kt | 24 +- .../api/services/blocking/InvoiceService.kt | 4 +- .../services/blocking/SubscriptionService.kt | 2 +- .../blocking/customers/CostService.kt | 28 +- .../customers/credits/LedgerService.kt | 8 +- .../ChangedSubscriptionResourcesTest.kt | 20 ++ .../api/models/CreditNoteCreateParamsTest.kt | 13 + .../models/CreditNoteListPageResponseTest.kt | 10 + .../com/withorb/api/models/CreditNoteTest.kt | 6 + .../api/models/MutatedSubscriptionTest.kt | 36 ++ .../models/PriceEvaluateMultipleParamsTest.kt | 3 + .../PriceEvaluateMultipleResponseTest.kt | 3 + .../PriceEvaluatePreviewEventsParamsTest.kt | 3 + .../PriceEvaluatePreviewEventsResponseTest.kt | 3 + .../SubscriptionChangeApplyResponseTest.kt | 36 ++ .../SubscriptionChangeCancelResponseTest.kt | 36 ++ .../SubscriptionChangeRetrieveResponseTest.kt | 36 ++ .../async/CreditNoteServiceAsyncTest.kt | 5 + .../services/async/PriceServiceAsyncTest.kt | 2 + .../blocking/CreditNoteServiceTest.kt | 5 + .../api/services/blocking/PriceServiceTest.kt | 2 + 43 files changed, 993 insertions(+), 127 deletions(-) diff --git a/.stats.yml b/.stats.yml index 31ac085d..d44c6fa9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0db984d367f9ae04249fb6c72789b0a38ef1785d156b438fe03290fa4e262a7d.yml -openapi_spec_hash: c901c8b4fc2b0399a33b1346f8521850 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml +openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e config_hash: 3c3524be9607afb24d2139ce26ce5389 diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt index 2326e64b..1e2e7f60 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNote.kt @@ -824,6 +824,8 @@ private constructor( private val subtotal: JsonField, private val taxAmounts: JsonField>, private val discounts: JsonField>, + private val endTimeExclusive: JsonField, + private val startTimeInclusive: JsonField, private val additionalProperties: MutableMap, ) { @@ -845,6 +847,12 @@ private constructor( @JsonProperty("discounts") @ExcludeMissing discounts: JsonField> = JsonMissing.of(), + @JsonProperty("end_time_exclusive") + @ExcludeMissing + endTimeExclusive: JsonField = JsonMissing.of(), + @JsonProperty("start_time_inclusive") + @ExcludeMissing + startTimeInclusive: JsonField = JsonMissing.of(), ) : this( id, amount, @@ -854,6 +862,8 @@ private constructor( subtotal, taxAmounts, discounts, + endTimeExclusive, + startTimeInclusive, mutableMapOf(), ) @@ -921,6 +931,24 @@ private constructor( */ fun discounts(): Optional> = discounts.getOptional("discounts") + /** + * The end time of the service period for this credit note line item. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endTimeExclusive(): Optional = + endTimeExclusive.getOptional("end_time_exclusive") + + /** + * The start time of the service period for this credit note line item. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun startTimeInclusive(): Optional = + startTimeInclusive.getOptional("start_time_inclusive") + /** * Returns the raw JSON value of [id]. * @@ -981,6 +1009,26 @@ private constructor( @ExcludeMissing fun _discounts(): JsonField> = discounts + /** + * Returns the raw JSON value of [endTimeExclusive]. + * + * Unlike [endTimeExclusive], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("end_time_exclusive") + @ExcludeMissing + fun _endTimeExclusive(): JsonField = endTimeExclusive + + /** + * Returns the raw JSON value of [startTimeInclusive]. + * + * Unlike [startTimeInclusive], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("start_time_inclusive") + @ExcludeMissing + fun _startTimeInclusive(): JsonField = startTimeInclusive + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -1023,6 +1071,8 @@ private constructor( private var subtotal: JsonField? = null private var taxAmounts: JsonField>? = null private var discounts: JsonField>? = null + private var endTimeExclusive: JsonField = JsonMissing.of() + private var startTimeInclusive: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -1035,6 +1085,8 @@ private constructor( subtotal = lineItem.subtotal taxAmounts = lineItem.taxAmounts.map { it.toMutableList() } discounts = lineItem.discounts.map { it.toMutableList() } + endTimeExclusive = lineItem.endTimeExclusive + startTimeInclusive = lineItem.startTimeInclusive additionalProperties = lineItem.additionalProperties.toMutableMap() } @@ -1172,6 +1224,49 @@ private constructor( } } + /** The end time of the service period for this credit note line item. */ + fun endTimeExclusive(endTimeExclusive: OffsetDateTime?) = + endTimeExclusive(JsonField.ofNullable(endTimeExclusive)) + + /** + * Alias for calling [Builder.endTimeExclusive] with `endTimeExclusive.orElse(null)`. + */ + fun endTimeExclusive(endTimeExclusive: Optional) = + endTimeExclusive(endTimeExclusive.getOrNull()) + + /** + * Sets [Builder.endTimeExclusive] to an arbitrary JSON value. + * + * You should usually call [Builder.endTimeExclusive] with a well-typed [OffsetDateTime] + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun endTimeExclusive(endTimeExclusive: JsonField) = apply { + this.endTimeExclusive = endTimeExclusive + } + + /** The start time of the service period for this credit note line item. */ + fun startTimeInclusive(startTimeInclusive: OffsetDateTime?) = + startTimeInclusive(JsonField.ofNullable(startTimeInclusive)) + + /** + * Alias for calling [Builder.startTimeInclusive] with + * `startTimeInclusive.orElse(null)`. + */ + fun startTimeInclusive(startTimeInclusive: Optional) = + startTimeInclusive(startTimeInclusive.getOrNull()) + + /** + * Sets [Builder.startTimeInclusive] to an arbitrary JSON value. + * + * You should usually call [Builder.startTimeInclusive] with a well-typed + * [OffsetDateTime] value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun startTimeInclusive(startTimeInclusive: JsonField) = apply { + this.startTimeInclusive = startTimeInclusive + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -1219,6 +1314,8 @@ private constructor( checkRequired("subtotal", subtotal), checkRequired("taxAmounts", taxAmounts).map { it.toImmutable() }, (discounts ?: JsonMissing.of()).map { it.toImmutable() }, + endTimeExclusive, + startTimeInclusive, additionalProperties.toMutableMap(), ) } @@ -1238,6 +1335,8 @@ private constructor( subtotal() taxAmounts().forEach { it.validate() } discounts().ifPresent { it.forEach { it.validate() } } + endTimeExclusive() + startTimeInclusive() validated = true } @@ -1264,7 +1363,9 @@ private constructor( (if (quantity.asKnown().isPresent) 1 else 0) + (if (subtotal.asKnown().isPresent) 1 else 0) + (taxAmounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (discounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (discounts.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (endTimeExclusive.asKnown().isPresent) 1 else 0) + + (if (startTimeInclusive.asKnown().isPresent) 1 else 0) class Discount private constructor( @@ -1836,17 +1937,17 @@ private constructor( return true } - return /* spotless:off */ other is LineItem && id == other.id && amount == other.amount && itemId == other.itemId && name == other.name && quantity == other.quantity && subtotal == other.subtotal && taxAmounts == other.taxAmounts && discounts == other.discounts && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && id == other.id && amount == other.amount && itemId == other.itemId && name == other.name && quantity == other.quantity && subtotal == other.subtotal && taxAmounts == other.taxAmounts && discounts == other.discounts && endTimeExclusive == other.endTimeExclusive && startTimeInclusive == other.startTimeInclusive && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(id, amount, itemId, name, quantity, subtotal, taxAmounts, discounts, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(id, amount, itemId, name, quantity, subtotal, taxAmounts, discounts, endTimeExclusive, startTimeInclusive, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{id=$id, amount=$amount, itemId=$itemId, name=$name, quantity=$quantity, subtotal=$subtotal, taxAmounts=$taxAmounts, discounts=$discounts, additionalProperties=$additionalProperties}" + "LineItem{id=$id, amount=$amount, itemId=$itemId, name=$name, quantity=$quantity, subtotal=$subtotal, taxAmounts=$taxAmounts, discounts=$discounts, endTimeExclusive=$endTimeExclusive, startTimeInclusive=$startTimeInclusive, additionalProperties=$additionalProperties}" } /** The maximum amount applied on the original invoice */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index b03b0df4..aff78d0d 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -18,12 +18,35 @@ import com.withorb.api.core.http.Headers import com.withorb.api.core.http.QueryParams import com.withorb.api.core.toImmutable import com.withorb.api.errors.OrbInvalidDataException +import java.time.LocalDate import java.util.Collections import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ +/** + * This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). + * + * The credit note service period configuration supports two explicit modes: + * 1. Global service periods: Specify start_date and end_date at the credit note level. These dates + * will be applied to all line items uniformly. + * 2. Individual service periods: Specify start_date and end_date for each line item. When using + * this mode, ALL line items must have individual periods specified. + * 3. Default behavior: If no service periods are specified (neither global nor individual), the + * original invoice line item service periods will be used. + * + * Note: Mixing global and individual service periods in the same request is not allowed to prevent + * confusion. + * + * Service period dates are normalized to the start of the day in the customer's timezone to ensure + * consistent handling across different timezones. + * + * Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g., "2023-09-22") to match + * other Orb APIs like /v1/invoice_line_items. + * + * Note: Both start_date and end_date are inclusive - the service period will cover both the start + * date and end date completely (from start of start_date to end of end_date). + */ class CreditNoteCreateParams private constructor( private val body: Body, @@ -45,6 +68,17 @@ private constructor( */ fun reason(): Reason = body.reason() + /** + * A date string to specify the global credit note service period end date in the customer's + * timezone. This will be applied to all line items that don't have their own individual service + * periods specified. If not provided, line items will use their original invoice line item + * service periods. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun endDate(): Optional = body.endDate() + /** * An optional memo to attach to the credit note. * @@ -53,6 +87,17 @@ private constructor( */ fun memo(): Optional = body.memo() + /** + * A date string to specify the global credit note service period start date in the customer's + * timezone. This will be applied to all line items that don't have their own individual service + * periods specified. If not provided, line items will use their original invoice line item + * service periods. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server + * responded with an unexpected value). + */ + fun startDate(): Optional = body.startDate() + /** * Returns the raw JSON value of [lineItems]. * @@ -67,6 +112,13 @@ private constructor( */ fun _reason(): JsonField = body._reason() + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _endDate(): JsonField = body._endDate() + /** * Returns the raw JSON value of [memo]. * @@ -74,6 +126,13 @@ private constructor( */ fun _memo(): JsonField = body._memo() + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ + fun _startDate(): JsonField = body._startDate() + fun _additionalBodyProperties(): Map = body._additionalProperties() fun _additionalHeaders(): Headers = additionalHeaders @@ -117,7 +176,10 @@ private constructor( * Otherwise, it's more convenient to use the top-level setters instead: * - [lineItems] * - [reason] + * - [endDate] * - [memo] + * - [startDate] + * - etc. */ fun body(body: Body) = apply { this.body = body.toBuilder() } @@ -150,6 +212,26 @@ private constructor( */ fun reason(reason: JsonField) = apply { body.reason(reason) } + /** + * A date string to specify the global credit note service period end date in the customer's + * timezone. This will be applied to all line items that don't have their own individual + * service periods specified. If not provided, line items will use their original invoice + * line item service periods. This date is inclusive. + */ + fun endDate(endDate: LocalDate?) = apply { body.endDate(endDate) } + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [LocalDate] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun endDate(endDate: JsonField) = apply { body.endDate(endDate) } + /** An optional memo to attach to the credit note. */ fun memo(memo: String?) = apply { body.memo(memo) } @@ -164,6 +246,26 @@ private constructor( */ fun memo(memo: JsonField) = apply { body.memo(memo) } + /** + * A date string to specify the global credit note service period start date in the + * customer's timezone. This will be applied to all line items that don't have their own + * individual service periods specified. If not provided, line items will use their original + * invoice line item service periods. This date is inclusive. + */ + fun startDate(startDate: LocalDate?) = apply { body.startDate(startDate) } + + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [LocalDate] value instead. + * This method is primarily for setting the field to an undocumented or not yet supported + * value. + */ + fun startDate(startDate: JsonField) = apply { body.startDate(startDate) } + fun additionalBodyProperties(additionalBodyProperties: Map) = apply { body.additionalProperties(additionalBodyProperties) } @@ -312,7 +414,9 @@ private constructor( private constructor( private val lineItems: JsonField>, private val reason: JsonField, + private val endDate: JsonField, private val memo: JsonField, + private val startDate: JsonField, private val additionalProperties: MutableMap, ) { @@ -322,8 +426,14 @@ private constructor( @ExcludeMissing lineItems: JsonField> = JsonMissing.of(), @JsonProperty("reason") @ExcludeMissing reason: JsonField = JsonMissing.of(), + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), @JsonProperty("memo") @ExcludeMissing memo: JsonField = JsonMissing.of(), - ) : this(lineItems, reason, memo, mutableMapOf()) + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(lineItems, reason, endDate, memo, startDate, mutableMapOf()) /** * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -339,6 +449,17 @@ private constructor( */ fun reason(): Reason = reason.getRequired("reason") + /** + * A date string to specify the global credit note service period end date in the customer's + * timezone. This will be applied to all line items that don't have their own individual + * service periods specified. If not provided, line items will use their original invoice + * line item service periods. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endDate(): Optional = endDate.getOptional("end_date") + /** * An optional memo to attach to the credit note. * @@ -347,6 +468,17 @@ private constructor( */ fun memo(): Optional = memo.getOptional("memo") + /** + * A date string to specify the global credit note service period start date in the + * customer's timezone. This will be applied to all line items that don't have their own + * individual service periods specified. If not provided, line items will use their original + * invoice line item service periods. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun startDate(): Optional = startDate.getOptional("start_date") + /** * Returns the raw JSON value of [lineItems]. * @@ -363,6 +495,13 @@ private constructor( */ @JsonProperty("reason") @ExcludeMissing fun _reason(): JsonField = reason + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + /** * Returns the raw JSON value of [memo]. * @@ -370,6 +509,15 @@ private constructor( */ @JsonProperty("memo") @ExcludeMissing fun _memo(): JsonField = memo + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("start_date") + @ExcludeMissing + fun _startDate(): JsonField = startDate + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -401,14 +549,18 @@ private constructor( private var lineItems: JsonField>? = null private var reason: JsonField? = null + private var endDate: JsonField = JsonMissing.of() private var memo: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(body: Body) = apply { lineItems = body.lineItems.map { it.toMutableList() } reason = body.reason + endDate = body.endDate memo = body.memo + startDate = body.startDate additionalProperties = body.additionalProperties.toMutableMap() } @@ -449,6 +601,26 @@ private constructor( */ fun reason(reason: JsonField) = apply { this.reason = reason } + /** + * A date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items that don't have their own + * individual service periods specified. If not provided, line items will use their + * original invoice line item service periods. This date is inclusive. + */ + fun endDate(endDate: LocalDate?) = endDate(JsonField.ofNullable(endDate)) + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + /** An optional memo to attach to the credit note. */ fun memo(memo: String?) = memo(JsonField.ofNullable(memo)) @@ -464,6 +636,26 @@ private constructor( */ fun memo(memo: JsonField) = apply { this.memo = memo } + /** + * A date string to specify the global credit note service period start date in the + * customer's timezone. This will be applied to all line items that don't have their own + * individual service periods specified. If not provided, line items will use their + * original invoice line item service periods. This date is inclusive. + */ + fun startDate(startDate: LocalDate?) = startDate(JsonField.ofNullable(startDate)) + + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -500,7 +692,9 @@ private constructor( Body( checkRequired("lineItems", lineItems).map { it.toImmutable() }, checkRequired("reason", reason), + endDate, memo, + startDate, additionalProperties.toMutableMap(), ) } @@ -514,7 +708,9 @@ private constructor( lineItems().forEach { it.validate() } reason().validate() + endDate() memo() + startDate() validated = true } @@ -536,30 +732,34 @@ private constructor( internal fun validity(): Int = (lineItems.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (reason.asKnown().getOrNull()?.validity() ?: 0) + - (if (memo.asKnown().isPresent) 1 else 0) + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (memo.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is Body && lineItems == other.lineItems && reason == other.reason && memo == other.memo && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Body && lineItems == other.lineItems && reason == other.reason && endDate == other.endDate && memo == other.memo && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(lineItems, reason, memo, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(lineItems, reason, endDate, memo, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Body{lineItems=$lineItems, reason=$reason, memo=$memo, additionalProperties=$additionalProperties}" + "Body{lineItems=$lineItems, reason=$reason, endDate=$endDate, memo=$memo, startDate=$startDate, additionalProperties=$additionalProperties}" } class LineItem private constructor( private val amount: JsonField, private val invoiceLineItemId: JsonField, + private val endDate: JsonField, + private val startDate: JsonField, private val additionalProperties: MutableMap, ) { @@ -569,7 +769,13 @@ private constructor( @JsonProperty("invoice_line_item_id") @ExcludeMissing invoiceLineItemId: JsonField = JsonMissing.of(), - ) : this(amount, invoiceLineItemId, mutableMapOf()) + @JsonProperty("end_date") + @ExcludeMissing + endDate: JsonField = JsonMissing.of(), + @JsonProperty("start_date") + @ExcludeMissing + startDate: JsonField = JsonMissing.of(), + ) : this(amount, invoiceLineItemId, endDate, startDate, mutableMapOf()) /** * The total amount in the invoice's currency to credit this line item. @@ -587,6 +793,28 @@ private constructor( */ fun invoiceLineItemId(): String = invoiceLineItemId.getRequired("invoice_line_item_id") + /** + * A date string to specify this line item's credit note service period end date in the + * customer's timezone. If provided, this will be used for this specific line item. If not + * provided, will use the global end_date if available, otherwise defaults to the original + * invoice line item's end date. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun endDate(): Optional = endDate.getOptional("end_date") + + /** + * A date string to specify this line item's credit note service period start date in the + * customer's timezone. If provided, this will be used for this specific line item. If not + * provided, will use the global start_date if available, otherwise defaults to the original + * invoice line item's start date. This date is inclusive. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun startDate(): Optional = startDate.getOptional("start_date") + /** * Returns the raw JSON value of [amount]. * @@ -604,6 +832,22 @@ private constructor( @ExcludeMissing fun _invoiceLineItemId(): JsonField = invoiceLineItemId + /** + * Returns the raw JSON value of [endDate]. + * + * Unlike [endDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("end_date") @ExcludeMissing fun _endDate(): JsonField = endDate + + /** + * Returns the raw JSON value of [startDate]. + * + * Unlike [startDate], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("start_date") + @ExcludeMissing + fun _startDate(): JsonField = startDate + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -635,12 +879,16 @@ private constructor( private var amount: JsonField? = null private var invoiceLineItemId: JsonField? = null + private var endDate: JsonField = JsonMissing.of() + private var startDate: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(lineItem: LineItem) = apply { amount = lineItem.amount invoiceLineItemId = lineItem.invoiceLineItemId + endDate = lineItem.endDate + startDate = lineItem.startDate additionalProperties = lineItem.additionalProperties.toMutableMap() } @@ -671,6 +919,46 @@ private constructor( this.invoiceLineItemId = invoiceLineItemId } + /** + * A date string to specify this line item's credit note service period end date in the + * customer's timezone. If provided, this will be used for this specific line item. If + * not provided, will use the global end_date if available, otherwise defaults to the + * original invoice line item's end date. This date is inclusive. + */ + fun endDate(endDate: LocalDate?) = endDate(JsonField.ofNullable(endDate)) + + /** Alias for calling [Builder.endDate] with `endDate.orElse(null)`. */ + fun endDate(endDate: Optional) = endDate(endDate.getOrNull()) + + /** + * Sets [Builder.endDate] to an arbitrary JSON value. + * + * You should usually call [Builder.endDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun endDate(endDate: JsonField) = apply { this.endDate = endDate } + + /** + * A date string to specify this line item's credit note service period start date in + * the customer's timezone. If provided, this will be used for this specific line item. + * If not provided, will use the global start_date if available, otherwise defaults to + * the original invoice line item's start date. This date is inclusive. + */ + fun startDate(startDate: LocalDate?) = startDate(JsonField.ofNullable(startDate)) + + /** Alias for calling [Builder.startDate] with `startDate.orElse(null)`. */ + fun startDate(startDate: Optional) = startDate(startDate.getOrNull()) + + /** + * Sets [Builder.startDate] to an arbitrary JSON value. + * + * You should usually call [Builder.startDate] with a well-typed [LocalDate] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun startDate(startDate: JsonField) = apply { this.startDate = startDate } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -707,6 +995,8 @@ private constructor( LineItem( checkRequired("amount", amount), checkRequired("invoiceLineItemId", invoiceLineItemId), + endDate, + startDate, additionalProperties.toMutableMap(), ) } @@ -720,6 +1010,8 @@ private constructor( amount() invoiceLineItemId() + endDate() + startDate() validated = true } @@ -740,24 +1032,26 @@ private constructor( @JvmSynthetic internal fun validity(): Int = (if (amount.asKnown().isPresent) 1 else 0) + - (if (invoiceLineItemId.asKnown().isPresent) 1 else 0) + (if (invoiceLineItemId.asKnown().isPresent) 1 else 0) + + (if (endDate.asKnown().isPresent) 1 else 0) + + (if (startDate.asKnown().isPresent) 1 else 0) override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is LineItem && amount == other.amount && invoiceLineItemId == other.invoiceLineItemId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is LineItem && amount == other.amount && invoiceLineItemId == other.invoiceLineItemId && endDate == other.endDate && startDate == other.startDate && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(amount, invoiceLineItemId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(amount, invoiceLineItemId, endDate, startDate, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "LineItem{amount=$amount, invoiceLineItemId=$invoiceLineItemId, additionalProperties=$additionalProperties}" + "LineItem{amount=$amount, invoiceLineItemId=$invoiceLineItemId, endDate=$endDate, startDate=$startDate, additionalProperties=$additionalProperties}" } /** An optional reason for the credit note. */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt index 174a94c4..35670f0c 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListByExternalIdParams.kt @@ -64,16 +64,16 @@ import kotlin.jvm.optionals.getOrNull * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for this * price, and that the subscription's billing period bounds are aligned to the first of the month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt index 2fbc742a..2e0fd0d7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCostListParams.kt @@ -64,16 +64,16 @@ import kotlin.jvm.optionals.getOrNull * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for this * price, and that the subscription's billing period bounds are aligned to the first of the month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt index 8dd1b841..3b1fce37 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListByExternalIdParams.kt @@ -51,8 +51,8 @@ import kotlin.jvm.optionals.getOrNull * be used before any deductions take place from a non-expiring credit block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block with - * the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a - * $5.00 cost basis). + * the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid credits with a + * \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, * Orb will deduct from the next block, ending at the credit block which consists of unexpiring diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt index 61a6b3d1..86f767f3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CustomerCreditLedgerListParams.kt @@ -51,8 +51,8 @@ import kotlin.jvm.optionals.getOrNull * be used before any deductions take place from a non-expiring credit block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block with - * the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid credits with a - * $5.00 cost basis). + * the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid credits with a + * \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this case, * Orb will deduct from the next block, ending at the credit block which consists of unexpiring diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt index a9b5ac8a..277df7ed 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/EventBackfillCreateParams.kt @@ -60,7 +60,7 @@ private constructor( /** * The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb allows - * backfills up to 10 days in duration at a time. Reach out to discuss extending this limit and + * backfills up to 31 days in duration at a time. Reach out to discuss extending this limit and * your use case. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly @@ -70,7 +70,7 @@ private constructor( /** * The (inclusive) start of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending this * limit and your use case. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly @@ -228,7 +228,7 @@ private constructor( /** * The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending this * limit and your use case. */ fun timeframeEnd(timeframeEnd: OffsetDateTime) = apply { body.timeframeEnd(timeframeEnd) } @@ -246,7 +246,7 @@ private constructor( /** * The (inclusive) start of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending this * limit and your use case. */ fun timeframeStart(timeframeStart: OffsetDateTime) = apply { @@ -560,7 +560,7 @@ private constructor( /** * The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending this * limit and your use case. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -570,7 +570,7 @@ private constructor( /** * The (inclusive) start of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending this + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending this * limit and your use case. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is @@ -747,7 +747,7 @@ private constructor( /** * The (exclusive) end of the usage timeframe affected by this backfill. By default, Orb - * allows backfills up to 10 days in duration at a time. Reach out to discuss extending + * allows backfills up to 31 days in duration at a time. Reach out to discuss extending * this limit and your use case. */ fun timeframeEnd(timeframeEnd: OffsetDateTime) = @@ -766,7 +766,7 @@ private constructor( /** * The (inclusive) start of the usage timeframe affected by this backfill. By default, - * Orb allows backfills up to 10 days in duration at a time. Reach out to discuss + * Orb allows backfills up to 31 days in duration at a time. Reach out to discuss * extending this limit and your use case. */ fun timeframeStart(timeframeStart: OffsetDateTime) = diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt index 6824d660..3ce745b2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/InvoiceVoidInvoiceParams.kt @@ -16,7 +16,7 @@ import kotlin.jvm.optionals.getOrNull * invoices that are in the `issued` status. * * If the associated invoice has used the customer balance to change the amount due, the customer - * balance operation will be reverted. For example, if the invoice used $10 of customer balance, + * balance operation will be reverted. For example, if the invoice used \$10 of customer balance, * that amount will be added back to the customer balance upon voiding. * * If the invoice was used to purchase a credit block, but the invoice is not yet paid, the credit diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/MutatedSubscription.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/MutatedSubscription.kt index 59aa52d8..6da0977e 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/MutatedSubscription.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/MutatedSubscription.kt @@ -283,7 +283,8 @@ private constructor( defaultInvoiceMemo.getOptional("default_invoice_memo") /** - * The discount intervals for this subscription sorted by the start_date. + * The discount intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -315,7 +316,8 @@ private constructor( invoicingThreshold.getOptional("invoicing_threshold") /** - * The maximum intervals for this subscription sorted by the start_date. + * The maximum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -335,7 +337,8 @@ private constructor( fun metadata(): Metadata = metadata.getRequired("metadata") /** - * The minimum intervals for this subscription sorted by the start_date. + * The minimum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -1053,7 +1056,10 @@ private constructor( this.defaultInvoiceMemo = defaultInvoiceMemo } - /** The discount intervals for this subscription sorted by the start_date. */ + /** + * The discount intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun discountIntervals(discountIntervals: List) = discountIntervals(JsonField.of(discountIntervals)) @@ -1165,7 +1171,10 @@ private constructor( this.invoicingThreshold = invoicingThreshold } - /** The maximum intervals for this subscription sorted by the start_date. */ + /** + * The maximum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun maximumIntervals(maximumIntervals: List) = maximumIntervals(JsonField.of(maximumIntervals)) @@ -1211,7 +1220,10 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** The minimum intervals for this subscription sorted by the start_date. */ + /** + * The minimum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun minimumIntervals(minimumIntervals: List) = minimumIntervals(JsonField.of(minimumIntervals)) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleParams.kt index 73510ef4..b23e41fd 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleParams.kt @@ -796,6 +796,7 @@ private constructor( class PriceEvaluation private constructor( + private val externalPriceId: JsonField, private val filter: JsonField, private val groupingKeys: JsonField>, private val price: JsonField, @@ -805,13 +806,24 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("external_price_id") + @ExcludeMissing + externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("filter") @ExcludeMissing filter: JsonField = JsonMissing.of(), @JsonProperty("grouping_keys") @ExcludeMissing groupingKeys: JsonField> = JsonMissing.of(), @JsonProperty("price") @ExcludeMissing price: JsonField = JsonMissing.of(), @JsonProperty("price_id") @ExcludeMissing priceId: JsonField = JsonMissing.of(), - ) : this(filter, groupingKeys, price, priceId, mutableMapOf()) + ) : this(externalPriceId, filter, groupingKeys, price, priceId, mutableMapOf()) + + /** + * The external ID of a price to evaluate that exists in your Orb account. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun externalPriceId(): Optional = externalPriceId.getOptional("external_price_id") /** * A boolean [computed property](/extensibility/advanced-metrics#computed-properties) used @@ -849,6 +861,16 @@ private constructor( */ fun priceId(): Optional = priceId.getOptional("price_id") + /** + * Returns the raw JSON value of [externalPriceId]. + * + * Unlike [externalPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + /** * Returns the raw JSON value of [filter]. * @@ -901,6 +923,7 @@ private constructor( /** A builder for [PriceEvaluation]. */ class Builder internal constructor() { + private var externalPriceId: JsonField = JsonMissing.of() private var filter: JsonField = JsonMissing.of() private var groupingKeys: JsonField>? = null private var price: JsonField = JsonMissing.of() @@ -909,6 +932,7 @@ private constructor( @JvmSynthetic internal fun from(priceEvaluation: PriceEvaluation) = apply { + externalPriceId = priceEvaluation.externalPriceId filter = priceEvaluation.filter groupingKeys = priceEvaluation.groupingKeys.map { it.toMutableList() } price = priceEvaluation.price @@ -916,6 +940,25 @@ private constructor( additionalProperties = priceEvaluation.additionalProperties.toMutableMap() } + /** The external ID of a price to evaluate that exists in your Orb account. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + + /** + * Sets [Builder.externalPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + /** * A boolean [computed property](/extensibility/advanced-metrics#computed-properties) * used to filter the underlying billable metric @@ -1164,6 +1207,7 @@ private constructor( */ fun build(): PriceEvaluation = PriceEvaluation( + externalPriceId, filter, (groupingKeys ?: JsonMissing.of()).map { it.toImmutable() }, price, @@ -1179,6 +1223,7 @@ private constructor( return@apply } + externalPriceId() filter() groupingKeys() price().ifPresent { it.validate() } @@ -1202,7 +1247,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (filter.asKnown().isPresent) 1 else 0) + + (if (externalPriceId.asKnown().isPresent) 1 else 0) + + (if (filter.asKnown().isPresent) 1 else 0) + (groupingKeys.asKnown().getOrNull()?.size ?: 0) + (price.asKnown().getOrNull()?.validity() ?: 0) + (if (priceId.asKnown().isPresent) 1 else 0) @@ -2351,17 +2397,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceEvaluation && filter == other.filter && groupingKeys == other.groupingKeys && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceEvaluation && externalPriceId == other.externalPriceId && filter == other.filter && groupingKeys == other.groupingKeys && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(filter, groupingKeys, price, priceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalPriceId, filter, groupingKeys, price, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceEvaluation{filter=$filter, groupingKeys=$groupingKeys, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" + "PriceEvaluation{externalPriceId=$externalPriceId, filter=$filter, groupingKeys=$groupingKeys, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponse.kt index 3d81dab4..8df83229 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponse.kt @@ -175,6 +175,7 @@ private constructor( private constructor( private val currency: JsonField, private val priceGroups: JsonField>, + private val externalPriceId: JsonField, private val inlinePriceIndex: JsonField, private val priceId: JsonField, private val additionalProperties: MutableMap, @@ -188,11 +189,14 @@ private constructor( @JsonProperty("price_groups") @ExcludeMissing priceGroups: JsonField> = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("inline_price_index") @ExcludeMissing inlinePriceIndex: JsonField = JsonMissing.of(), @JsonProperty("price_id") @ExcludeMissing priceId: JsonField = JsonMissing.of(), - ) : this(currency, priceGroups, inlinePriceIndex, priceId, mutableMapOf()) + ) : this(currency, priceGroups, externalPriceId, inlinePriceIndex, priceId, mutableMapOf()) /** * The currency of the price @@ -210,6 +214,14 @@ private constructor( */ fun priceGroups(): List = priceGroups.getRequired("price_groups") + /** + * The external ID of the price + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun externalPriceId(): Optional = externalPriceId.getOptional("external_price_id") + /** * The index of the inline price * @@ -242,6 +254,16 @@ private constructor( @ExcludeMissing fun _priceGroups(): JsonField> = priceGroups + /** + * Returns the raw JSON value of [externalPriceId]. + * + * Unlike [externalPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + /** * Returns the raw JSON value of [inlinePriceIndex]. * @@ -290,6 +312,7 @@ private constructor( private var currency: JsonField? = null private var priceGroups: JsonField>? = null + private var externalPriceId: JsonField = JsonMissing.of() private var inlinePriceIndex: JsonField = JsonMissing.of() private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -298,6 +321,7 @@ private constructor( internal fun from(data: Data) = apply { currency = data.currency priceGroups = data.priceGroups.map { it.toMutableList() } + externalPriceId = data.externalPriceId inlinePriceIndex = data.inlinePriceIndex priceId = data.priceId additionalProperties = data.additionalProperties.toMutableMap() @@ -342,6 +366,25 @@ private constructor( } } + /** The external ID of the price */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + + /** + * Sets [Builder.externalPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + /** The index of the inline price */ fun inlinePriceIndex(inlinePriceIndex: Long?) = inlinePriceIndex(JsonField.ofNullable(inlinePriceIndex)) @@ -422,6 +465,7 @@ private constructor( Data( checkRequired("currency", currency), checkRequired("priceGroups", priceGroups).map { it.toImmutable() }, + externalPriceId, inlinePriceIndex, priceId, additionalProperties.toMutableMap(), @@ -437,6 +481,7 @@ private constructor( currency() priceGroups().forEach { it.validate() } + externalPriceId() inlinePriceIndex() priceId() validated = true @@ -460,6 +505,7 @@ private constructor( internal fun validity(): Int = (if (currency.asKnown().isPresent) 1 else 0) + (priceGroups.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (externalPriceId.asKnown().isPresent) 1 else 0) + (if (inlinePriceIndex.asKnown().isPresent) 1 else 0) + (if (priceId.asKnown().isPresent) 1 else 0) @@ -468,17 +514,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && currency == other.currency && priceGroups == other.priceGroups && inlinePriceIndex == other.inlinePriceIndex && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && currency == other.currency && priceGroups == other.priceGroups && externalPriceId == other.externalPriceId && inlinePriceIndex == other.inlinePriceIndex && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, priceGroups, inlinePriceIndex, priceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(currency, priceGroups, externalPriceId, inlinePriceIndex, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{currency=$currency, priceGroups=$priceGroups, inlinePriceIndex=$inlinePriceIndex, priceId=$priceId, additionalProperties=$additionalProperties}" + "Data{currency=$currency, priceGroups=$priceGroups, externalPriceId=$externalPriceId, inlinePriceIndex=$inlinePriceIndex, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParams.kt index 9dfd0b54..8dc49855 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParams.kt @@ -1332,6 +1332,7 @@ private constructor( class PriceEvaluation private constructor( + private val externalPriceId: JsonField, private val filter: JsonField, private val groupingKeys: JsonField>, private val price: JsonField, @@ -1341,13 +1342,24 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("external_price_id") + @ExcludeMissing + externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("filter") @ExcludeMissing filter: JsonField = JsonMissing.of(), @JsonProperty("grouping_keys") @ExcludeMissing groupingKeys: JsonField> = JsonMissing.of(), @JsonProperty("price") @ExcludeMissing price: JsonField = JsonMissing.of(), @JsonProperty("price_id") @ExcludeMissing priceId: JsonField = JsonMissing.of(), - ) : this(filter, groupingKeys, price, priceId, mutableMapOf()) + ) : this(externalPriceId, filter, groupingKeys, price, priceId, mutableMapOf()) + + /** + * The external ID of a price to evaluate that exists in your Orb account. + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun externalPriceId(): Optional = externalPriceId.getOptional("external_price_id") /** * A boolean [computed property](/extensibility/advanced-metrics#computed-properties) used @@ -1385,6 +1397,16 @@ private constructor( */ fun priceId(): Optional = priceId.getOptional("price_id") + /** + * Returns the raw JSON value of [externalPriceId]. + * + * Unlike [externalPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + /** * Returns the raw JSON value of [filter]. * @@ -1437,6 +1459,7 @@ private constructor( /** A builder for [PriceEvaluation]. */ class Builder internal constructor() { + private var externalPriceId: JsonField = JsonMissing.of() private var filter: JsonField = JsonMissing.of() private var groupingKeys: JsonField>? = null private var price: JsonField = JsonMissing.of() @@ -1445,6 +1468,7 @@ private constructor( @JvmSynthetic internal fun from(priceEvaluation: PriceEvaluation) = apply { + externalPriceId = priceEvaluation.externalPriceId filter = priceEvaluation.filter groupingKeys = priceEvaluation.groupingKeys.map { it.toMutableList() } price = priceEvaluation.price @@ -1452,6 +1476,25 @@ private constructor( additionalProperties = priceEvaluation.additionalProperties.toMutableMap() } + /** The external ID of a price to evaluate that exists in your Orb account. */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + + /** + * Sets [Builder.externalPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + /** * A boolean [computed property](/extensibility/advanced-metrics#computed-properties) * used to filter the underlying billable metric @@ -1700,6 +1743,7 @@ private constructor( */ fun build(): PriceEvaluation = PriceEvaluation( + externalPriceId, filter, (groupingKeys ?: JsonMissing.of()).map { it.toImmutable() }, price, @@ -1715,6 +1759,7 @@ private constructor( return@apply } + externalPriceId() filter() groupingKeys() price().ifPresent { it.validate() } @@ -1738,7 +1783,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (filter.asKnown().isPresent) 1 else 0) + + (if (externalPriceId.asKnown().isPresent) 1 else 0) + + (if (filter.asKnown().isPresent) 1 else 0) + (groupingKeys.asKnown().getOrNull()?.size ?: 0) + (price.asKnown().getOrNull()?.validity() ?: 0) + (if (priceId.asKnown().isPresent) 1 else 0) @@ -2887,17 +2933,17 @@ private constructor( return true } - return /* spotless:off */ other is PriceEvaluation && filter == other.filter && groupingKeys == other.groupingKeys && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is PriceEvaluation && externalPriceId == other.externalPriceId && filter == other.filter && groupingKeys == other.groupingKeys && price == other.price && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(filter, groupingKeys, price, priceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(externalPriceId, filter, groupingKeys, price, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "PriceEvaluation{filter=$filter, groupingKeys=$groupingKeys, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" + "PriceEvaluation{externalPriceId=$externalPriceId, filter=$filter, groupingKeys=$groupingKeys, price=$price, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponse.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponse.kt index 0a33238c..aa97e71a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponse.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponse.kt @@ -177,6 +177,7 @@ private constructor( private constructor( private val currency: JsonField, private val priceGroups: JsonField>, + private val externalPriceId: JsonField, private val inlinePriceIndex: JsonField, private val priceId: JsonField, private val additionalProperties: MutableMap, @@ -190,11 +191,14 @@ private constructor( @JsonProperty("price_groups") @ExcludeMissing priceGroups: JsonField> = JsonMissing.of(), + @JsonProperty("external_price_id") + @ExcludeMissing + externalPriceId: JsonField = JsonMissing.of(), @JsonProperty("inline_price_index") @ExcludeMissing inlinePriceIndex: JsonField = JsonMissing.of(), @JsonProperty("price_id") @ExcludeMissing priceId: JsonField = JsonMissing.of(), - ) : this(currency, priceGroups, inlinePriceIndex, priceId, mutableMapOf()) + ) : this(currency, priceGroups, externalPriceId, inlinePriceIndex, priceId, mutableMapOf()) /** * The currency of the price @@ -212,6 +216,14 @@ private constructor( */ fun priceGroups(): List = priceGroups.getRequired("price_groups") + /** + * The external ID of the price + * + * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun externalPriceId(): Optional = externalPriceId.getOptional("external_price_id") + /** * The index of the inline price * @@ -244,6 +256,16 @@ private constructor( @ExcludeMissing fun _priceGroups(): JsonField> = priceGroups + /** + * Returns the raw JSON value of [externalPriceId]. + * + * Unlike [externalPriceId], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("external_price_id") + @ExcludeMissing + fun _externalPriceId(): JsonField = externalPriceId + /** * Returns the raw JSON value of [inlinePriceIndex]. * @@ -292,6 +314,7 @@ private constructor( private var currency: JsonField? = null private var priceGroups: JsonField>? = null + private var externalPriceId: JsonField = JsonMissing.of() private var inlinePriceIndex: JsonField = JsonMissing.of() private var priceId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @@ -300,6 +323,7 @@ private constructor( internal fun from(data: Data) = apply { currency = data.currency priceGroups = data.priceGroups.map { it.toMutableList() } + externalPriceId = data.externalPriceId inlinePriceIndex = data.inlinePriceIndex priceId = data.priceId additionalProperties = data.additionalProperties.toMutableMap() @@ -344,6 +368,25 @@ private constructor( } } + /** The external ID of the price */ + fun externalPriceId(externalPriceId: String?) = + externalPriceId(JsonField.ofNullable(externalPriceId)) + + /** Alias for calling [Builder.externalPriceId] with `externalPriceId.orElse(null)`. */ + fun externalPriceId(externalPriceId: Optional) = + externalPriceId(externalPriceId.getOrNull()) + + /** + * Sets [Builder.externalPriceId] to an arbitrary JSON value. + * + * You should usually call [Builder.externalPriceId] with a well-typed [String] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun externalPriceId(externalPriceId: JsonField) = apply { + this.externalPriceId = externalPriceId + } + /** The index of the inline price */ fun inlinePriceIndex(inlinePriceIndex: Long?) = inlinePriceIndex(JsonField.ofNullable(inlinePriceIndex)) @@ -424,6 +467,7 @@ private constructor( Data( checkRequired("currency", currency), checkRequired("priceGroups", priceGroups).map { it.toImmutable() }, + externalPriceId, inlinePriceIndex, priceId, additionalProperties.toMutableMap(), @@ -439,6 +483,7 @@ private constructor( currency() priceGroups().forEach { it.validate() } + externalPriceId() inlinePriceIndex() priceId() validated = true @@ -462,6 +507,7 @@ private constructor( internal fun validity(): Int = (if (currency.asKnown().isPresent) 1 else 0) + (priceGroups.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (if (externalPriceId.asKnown().isPresent) 1 else 0) + (if (inlinePriceIndex.asKnown().isPresent) 1 else 0) + (if (priceId.asKnown().isPresent) 1 else 0) @@ -470,17 +516,17 @@ private constructor( return true } - return /* spotless:off */ other is Data && currency == other.currency && priceGroups == other.priceGroups && inlinePriceIndex == other.inlinePriceIndex && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is Data && currency == other.currency && priceGroups == other.priceGroups && externalPriceId == other.externalPriceId && inlinePriceIndex == other.inlinePriceIndex && priceId == other.priceId && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(currency, priceGroups, inlinePriceIndex, priceId, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(currency, priceGroups, externalPriceId, inlinePriceIndex, priceId, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "Data{currency=$currency, priceGroups=$priceGroups, inlinePriceIndex=$inlinePriceIndex, priceId=$priceId, additionalProperties=$additionalProperties}" + "Data{currency=$currency, priceGroups=$priceGroups, externalPriceId=$externalPriceId, inlinePriceIndex=$inlinePriceIndex, priceId=$priceId, additionalProperties=$additionalProperties}" } override fun equals(other: Any?): Boolean { 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 8fc75a3d..dd1abad3 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 @@ -295,7 +295,8 @@ private constructor( defaultInvoiceMemo.getOptional("default_invoice_memo") /** - * The discount intervals for this subscription sorted by the start_date. + * The discount intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -327,7 +328,8 @@ private constructor( invoicingThreshold.getOptional("invoicing_threshold") /** - * The maximum intervals for this subscription sorted by the start_date. + * The maximum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -347,7 +349,8 @@ private constructor( fun metadata(): Metadata = metadata.getRequired("metadata") /** - * The minimum intervals for this subscription sorted by the start_date. + * The minimum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. * * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly * missing or null (e.g. if the server responded with an unexpected value). @@ -1042,7 +1045,10 @@ private constructor( this.defaultInvoiceMemo = defaultInvoiceMemo } - /** The discount intervals for this subscription sorted by the start_date. */ + /** + * The discount intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun discountIntervals(discountIntervals: List) = discountIntervals(JsonField.of(discountIntervals)) @@ -1154,7 +1160,10 @@ private constructor( this.invoicingThreshold = invoicingThreshold } - /** The maximum intervals for this subscription sorted by the start_date. */ + /** + * The maximum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun maximumIntervals(maximumIntervals: List) = maximumIntervals(JsonField.of(maximumIntervals)) @@ -1200,7 +1209,10 @@ private constructor( */ fun metadata(metadata: JsonField) = apply { this.metadata = metadata } - /** The minimum intervals for this subscription sorted by the start_date. */ + /** + * The minimum intervals for this subscription sorted by the start_date. This field is + * deprecated in favor of `adjustment_intervals`. + */ @Deprecated("deprecated") fun minimumIntervals(minimumIntervals: List) = minimumIntervals(JsonField.of(minimumIntervals)) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt index 3b41b53d..80b61e11 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionCreateParams.kt @@ -264,7 +264,7 @@ import kotlin.jvm.optionals.getOrNull * Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To enable * threshold billing, pass in an `invoicing_threshold`, which is specified in the subscription's * invoicing currency, when creating a subscription. E.g. pass in `10.00` to issue an invoice when - * usage amounts hit $10.00 for a subscription that invoices in USD. + * usage amounts hit \$10.00 for a subscription that invoices in USD. */ class SubscriptionCreateParams private constructor( diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt index 130fa5ac..5620881b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/SubscriptionPriceIntervalsParams.kt @@ -5491,7 +5491,7 @@ private constructor( fun billingCycleDay(): Optional = billingCycleDay.getOptional("billing_cycle_day") /** - * The updated end date of this price interval. If not specified, the start date will not be + * The updated end date of this price interval. If not specified, the end date will not be * updated. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the @@ -5703,8 +5703,8 @@ private constructor( } /** - * The updated end date of this price interval. If not specified, the start date will - * not be updated. + * The updated end date of this price interval. If not specified, the end date will not + * be updated. */ fun endDate(endDate: EndDate?) = endDate(JsonField.ofNullable(endDate)) @@ -5947,7 +5947,7 @@ private constructor( (usageCustomerIds.asKnown().getOrNull()?.size ?: 0) /** - * The updated end date of this price interval. If not specified, the start date will not be + * The updated end date of this price interval. If not specified, the end date will not be * updated. */ @JsonDeserialize(using = EndDate.Deserializer::class) @@ -6581,8 +6581,8 @@ private constructor( adjustmentIntervalId.getRequired("adjustment_interval_id") /** - * The updated end date of this adjustment interval. If not specified, the start date will - * not be updated. + * The updated end date of this adjustment interval. If not specified, the end date will not + * be updated. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -6681,8 +6681,8 @@ private constructor( } /** - * The updated end date of this adjustment interval. If not specified, the start date - * will not be updated. + * The updated end date of this adjustment interval. If not specified, the end date will + * not be updated. */ fun endDate(endDate: EndDate?) = endDate(JsonField.ofNullable(endDate)) @@ -6807,8 +6807,8 @@ private constructor( (startDate.asKnown().getOrNull()?.validity() ?: 0) /** - * The updated end date of this adjustment interval. If not specified, the start date will - * not be updated. + * The updated end date of this adjustment interval. If not specified, the end date will not + * be updated. */ @JsonDeserialize(using = EndDate.Deserializer::class) @JsonSerialize(using = EndDate.Serializer::class) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt index e8cf1191..99c197e7 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/CreditNoteServiceAsync.kt @@ -27,7 +27,29 @@ interface CreditNoteServiceAsync { */ fun withOptions(modifier: Consumer): CreditNoteServiceAsync - /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ + /** + * This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). + * + * The credit note service period configuration supports two explicit modes: + * 1. Global service periods: Specify start_date and end_date at the credit note level. These + * dates will be applied to all line items uniformly. + * 2. Individual service periods: Specify start_date and end_date for each line item. When using + * this mode, ALL line items must have individual periods specified. + * 3. Default behavior: If no service periods are specified (neither global nor individual), the + * original invoice line item service periods will be used. + * + * Note: Mixing global and individual service periods in the same request is not allowed to + * prevent confusion. + * + * Service period dates are normalized to the start of the day in the customer's timezone to + * ensure consistent handling across different timezones. + * + * Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g., "2023-09-22") to + * match other Orb APIs like /v1/invoice_line_items. + * + * Note: Both start_date and end_date are inclusive - the service period will cover both the + * start date and end date completely (from start of start_date to end of end_date). + */ fun create(params: CreditNoteCreateParams): CompletableFuture = create(params, RequestOptions.none()) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt index 73c3b588..72b05d83 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/InvoiceServiceAsync.kt @@ -263,8 +263,8 @@ interface InvoiceServiceAsync { * to invoices that are in the `issued` status. * * If the associated invoice has used the customer balance to change the amount due, the - * customer balance operation will be reverted. For example, if the invoice used $10 of customer - * balance, that amount will be added back to the customer balance upon voiding. + * customer balance operation will be reverted. For example, if the invoice used \$10 of + * customer balance, that amount will be added back to the customer balance upon voiding. * * If the invoice was used to purchase a credit block, but the invoice is not yet paid, the * credit block will be voided. If the invoice was created due to a top-up, the top-up will be diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt index ef60a903..62f384c2 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/SubscriptionServiceAsync.kt @@ -281,7 +281,7 @@ interface SubscriptionServiceAsync { * Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To * enable threshold billing, pass in an `invoicing_threshold`, which is specified in the * subscription's invoicing currency, when creating a subscription. E.g. pass in `10.00` to - * issue an invoice when usage amounts hit $10.00 for a subscription that invoices in USD. + * issue an invoice when usage amounts hit \$10.00 for a subscription that invoices in USD. */ fun create(): CompletableFuture = create(SubscriptionCreateParams.none()) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt index f3033f77..1c075e4a 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/CostServiceAsync.kt @@ -75,17 +75,17 @@ interface CostServiceAsync { * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this - * price, and that the subscription's billing period bounds are aligned to the first of the + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for + * this price, and that the subscription's billing period bounds are aligned to the first of the * month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * @@ -219,17 +219,17 @@ interface CostServiceAsync { * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this - * price, and that the subscription's billing period bounds are aligned to the first of the + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for + * this price, and that the subscription's billing period bounds are aligned to the first of the * month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt index 9ab63fa3..746db07b 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/async/customers/credits/LedgerServiceAsync.kt @@ -68,8 +68,8 @@ interface LedgerServiceAsync { * block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block - * with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid - * credits with a $5.00 cost basis). + * with the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid + * credits with a \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this * case, Orb will deduct from the next block, ending at the credit block which consists of @@ -444,8 +444,8 @@ interface LedgerServiceAsync { * block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block - * with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid - * credits with a $5.00 cost basis). + * with the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid + * credits with a \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this * case, Orb will deduct from the next block, ending at the credit block which consists of diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt index 79147cec..c6db53bc 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/CreditNoteService.kt @@ -27,7 +27,29 @@ interface CreditNoteService { */ fun withOptions(modifier: Consumer): CreditNoteService - /** This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). */ + /** + * This endpoint is used to create a single [`Credit Note`](/invoicing/credit-notes). + * + * The credit note service period configuration supports two explicit modes: + * 1. Global service periods: Specify start_date and end_date at the credit note level. These + * dates will be applied to all line items uniformly. + * 2. Individual service periods: Specify start_date and end_date for each line item. When using + * this mode, ALL line items must have individual periods specified. + * 3. Default behavior: If no service periods are specified (neither global nor individual), the + * original invoice line item service periods will be used. + * + * Note: Mixing global and individual service periods in the same request is not allowed to + * prevent confusion. + * + * Service period dates are normalized to the start of the day in the customer's timezone to + * ensure consistent handling across different timezones. + * + * Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g., "2023-09-22") to + * match other Orb APIs like /v1/invoice_line_items. + * + * Note: Both start_date and end_date are inclusive - the service period will cover both the + * start date and end date completely (from start of start_date to end of end_date). + */ fun create(params: CreditNoteCreateParams): CreditNote = create(params, RequestOptions.none()) /** @see [create] */ diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt index b160cdb3..4f372335 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/InvoiceService.kt @@ -240,8 +240,8 @@ interface InvoiceService { * to invoices that are in the `issued` status. * * If the associated invoice has used the customer balance to change the amount due, the - * customer balance operation will be reverted. For example, if the invoice used $10 of customer - * balance, that amount will be added back to the customer balance upon voiding. + * customer balance operation will be reverted. For example, if the invoice used \$10 of + * customer balance, that amount will be added back to the customer balance upon voiding. * * If the invoice was used to purchase a credit block, but the invoice is not yet paid, the * credit block will be voided. If the invoice was created due to a top-up, the top-up will be diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt index 9afef8c4..d8a373e3 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/SubscriptionService.kt @@ -281,7 +281,7 @@ interface SubscriptionService { * Orb supports invoicing for a subscription when a preconfigured usage threshold is hit. To * enable threshold billing, pass in an `invoicing_threshold`, which is specified in the * subscription's invoicing currency, when creating a subscription. E.g. pass in `10.00` to - * issue an invoice when usage amounts hit $10.00 for a subscription that invoices in USD. + * issue an invoice when usage amounts hit \$10.00 for a subscription that invoices in USD. */ fun create(): MutatedSubscription = create(SubscriptionCreateParams.none()) diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt index 33b4b1de..29ea8044 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/CostService.kt @@ -75,17 +75,17 @@ interface CostService { * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this - * price, and that the subscription's billing period bounds are aligned to the first of the + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for + * this price, and that the subscription's billing period bounds are aligned to the first of the * month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * @@ -216,17 +216,17 @@ interface CostService { * * A customer that uses a few API calls a day but has a minimum commitment might exhibit the * following pattern for their subtotal and total in the first few days of the month. Here, we - * assume that each API call is $2.50, the customer's plan has a monthly minimum of $50 for this - * price, and that the subscription's billing period bounds are aligned to the first of the + * assume that each API call is \$2.50, the customer's plan has a monthly minimum of \$50 for + * this price, and that the subscription's billing period bounds are aligned to the first of the * month: * * | timeframe_start | timeframe_end | Cumulative usage | Subtotal | Total (incl. commitment) | * |-----------------|---------------|------------------|----------|--------------------------| - * | 2023-02-01 | 2023-02-02 | 9 | $22.50 | $50.00 | - * | 2023-02-01 | 2023-02-03 | 19 | $47.50 | $50.00 | - * | 2023-02-01 | 2023-02-04 | 20 | $50.00 | $50.00 | - * | 2023-02-01 | 2023-02-05 | 28 | $70.00 | $70.00 | - * | 2023-02-01 | 2023-02-06 | 36 | $90.00 | $90.00 | + * | 2023-02-01 | 2023-02-02 | 9 | \$22.50 | \$50.00 | + * | 2023-02-01 | 2023-02-03 | 19 | \$47.50 | \$50.00 | + * | 2023-02-01 | 2023-02-04 | 20 | \$50.00 | \$50.00 | + * | 2023-02-01 | 2023-02-05 | 28 | \$70.00 | \$70.00 | + * | 2023-02-01 | 2023-02-06 | 36 | \$90.00 | \$90.00 | * * ### Periodic values * diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt index 943e063a..39051901 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/services/blocking/customers/credits/LedgerService.kt @@ -68,8 +68,8 @@ interface LedgerService { * block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block - * with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid - * credits with a $5.00 cost basis). + * with the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid + * credits with a \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this * case, Orb will deduct from the next block, ending at the credit block which consists of @@ -438,8 +438,8 @@ interface LedgerService { * block. * * If there are multiple blocks with the same expiration date, Orb will deduct from the block - * with the _lower cost basis_ first (e.g. trial credits with a $0 cost basis before paid - * credits with a $5.00 cost basis). + * with the _lower cost basis_ first (e.g. trial credits with a \$0 cost basis before paid + * credits with a \$5.00 cost basis). * * It's also possible for a single usage event's deduction to _span_ credit blocks. In this * case, Orb will deduct from the next block, ending at the credit block which consists of diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt index 402b82b7..05ee64f7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/ChangedSubscriptionResourcesTest.kt @@ -56,6 +56,10 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -533,6 +537,10 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -1013,6 +1021,8 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .maximumAmountAdjustment( @@ -1479,6 +1489,8 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .maximumAmountAdjustment( @@ -1951,6 +1963,10 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2428,6 +2444,10 @@ internal class ChangedSubscriptionResourcesTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt index 1eac522c..9ac12b2b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt @@ -2,6 +2,7 @@ package com.withorb.api.models +import java.time.LocalDate import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -14,10 +15,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") + .endDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-09-22")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) + .endDate(LocalDate.parse("2023-09-22")) .memo("An optional memo for my credit note.") + .startDate(LocalDate.parse("2023-09-22")) .build() } @@ -29,10 +34,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") + .endDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-09-22")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) + .endDate(LocalDate.parse("2023-09-22")) .memo("An optional memo for my credit note.") + .startDate(LocalDate.parse("2023-09-22")) .build() val body = params._body() @@ -42,10 +51,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") + .endDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-09-22")) .build() ) assertThat(body.reason()).isEqualTo(CreditNoteCreateParams.Reason.DUPLICATE) + assertThat(body.endDate()).contains(LocalDate.parse("2023-09-22")) assertThat(body.memo()).contains("An optional memo for my credit note.") + assertThat(body.startDate()).contains(LocalDate.parse("2023-09-22")) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListPageResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListPageResponseTest.kt index 8b80119f..f9050c10 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListPageResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteListPageResponseTest.kt @@ -55,6 +55,10 @@ internal class CreditNoteListPageResponseTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -143,6 +147,8 @@ internal class CreditNoteListPageResponseTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .maximumAmountAdjustment( @@ -234,6 +240,10 @@ internal class CreditNoteListPageResponseTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteTest.kt index 140367f9..650052c2 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteTest.kt @@ -52,6 +52,8 @@ internal class CreditNoteTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .maximumAmountAdjustment( @@ -131,6 +133,8 @@ internal class CreditNoteTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) assertThat(creditNote.maximumAmountAdjustment()) @@ -211,6 +215,8 @@ internal class CreditNoteTest { .reason("reason") .build() ) + .endTimeExclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .startTimeInclusive(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt index 2980d769..0954a8dc 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/MutatedSubscriptionTest.kt @@ -650,6 +650,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -1175,6 +1181,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2306,6 +2318,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2808,6 +2826,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -3913,6 +3937,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -4438,6 +4468,12 @@ internal class MutatedSubscriptionTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleParamsTest.kt index e8eb10c4..29090f70 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleParamsTest.kt @@ -19,6 +19,7 @@ internal class PriceEvaluateMultipleParamsTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluateMultipleParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( @@ -82,6 +83,7 @@ internal class PriceEvaluateMultipleParamsTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluateMultipleParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( @@ -146,6 +148,7 @@ internal class PriceEvaluateMultipleParamsTest { assertThat(body.priceEvaluations().getOrNull()) .containsExactly( PriceEvaluateMultipleParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponseTest.kt index 7d188f91..67a2c3e6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluateMultipleResponseTest.kt @@ -23,6 +23,7 @@ internal class PriceEvaluateMultipleResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() @@ -40,6 +41,7 @@ internal class PriceEvaluateMultipleResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() @@ -61,6 +63,7 @@ internal class PriceEvaluateMultipleResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParamsTest.kt index 52beed75..664021e7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsParamsTest.kt @@ -32,6 +32,7 @@ internal class PriceEvaluatePreviewEventsParamsTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluatePreviewEventsParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( @@ -108,6 +109,7 @@ internal class PriceEvaluatePreviewEventsParamsTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluatePreviewEventsParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( @@ -186,6 +188,7 @@ internal class PriceEvaluatePreviewEventsParamsTest { assertThat(body.priceEvaluations().getOrNull()) .containsExactly( PriceEvaluatePreviewEventsParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey("case when my_event_type = 'foo' then true else false end") .price( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponseTest.kt index d27cba94..bbce4257 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/PriceEvaluatePreviewEventsResponseTest.kt @@ -23,6 +23,7 @@ internal class PriceEvaluatePreviewEventsResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() @@ -40,6 +41,7 @@ internal class PriceEvaluatePreviewEventsResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() @@ -61,6 +63,7 @@ internal class PriceEvaluatePreviewEventsResponseTest { .quantity(0.0) .build() ) + .externalPriceId("external_price_id") .inlinePriceIndex(0L) .priceId("price_id") .build() diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt index 85791e17..b360b6c1 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeApplyResponseTest.kt @@ -725,6 +725,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -1344,6 +1350,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2612,6 +2624,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -3189,6 +3207,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -4449,6 +4473,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -5068,6 +5098,12 @@ internal class SubscriptionChangeApplyResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt index 93f7574a..80b3221b 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeCancelResponseTest.kt @@ -725,6 +725,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -1344,6 +1350,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2612,6 +2624,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -3189,6 +3207,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -4449,6 +4473,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -5068,6 +5098,12 @@ internal class SubscriptionChangeCancelResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt index 6b0bd030..f4f60324 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/SubscriptionChangeRetrieveResponseTest.kt @@ -725,6 +725,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -1344,6 +1350,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -2612,6 +2624,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -3189,6 +3207,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -4449,6 +4473,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( @@ -5068,6 +5098,12 @@ internal class SubscriptionChangeRetrieveResponseTest { .reason("reason") .build() ) + .endTimeExclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) + .startTimeInclusive( + OffsetDateTime.parse("2019-12-27T18:11:19.117Z") + ) .build() ) .maximumAmountAdjustment( diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt index 9ebc1dc7..45c8dad6 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.async import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClientAsync import com.withorb.api.models.CreditNoteCreateParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -27,10 +28,14 @@ internal class CreditNoteServiceAsyncTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") + .endDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-09-22")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) + .endDate(LocalDate.parse("2023-09-22")) .memo("An optional memo for my credit note.") + .startDate(LocalDate.parse("2023-09-22")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt index 1e1fe0d2..3d1b41f7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/PriceServiceAsyncTest.kt @@ -170,6 +170,7 @@ internal class PriceServiceAsyncTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluateMultipleParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey( "case when my_event_type = 'foo' then true else false end" @@ -268,6 +269,7 @@ internal class PriceServiceAsyncTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluatePreviewEventsParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey( "case when my_event_type = 'foo' then true else false end" diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt index 73083a0e..5fdd282c 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt @@ -5,6 +5,7 @@ package com.withorb.api.services.blocking import com.withorb.api.TestServerExtension import com.withorb.api.client.okhttp.OrbOkHttpClient import com.withorb.api.models.CreditNoteCreateParams +import java.time.LocalDate import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -27,10 +28,14 @@ internal class CreditNoteServiceTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") + .endDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-09-22")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) + .endDate(LocalDate.parse("2023-09-22")) .memo("An optional memo for my credit note.") + .startDate(LocalDate.parse("2023-09-22")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt index 864fc1dd..e11ed122 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/PriceServiceTest.kt @@ -166,6 +166,7 @@ internal class PriceServiceTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluateMultipleParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey( "case when my_event_type = 'foo' then true else false end" @@ -263,6 +264,7 @@ internal class PriceServiceTest { .externalCustomerId("external_customer_id") .addPriceEvaluation( PriceEvaluatePreviewEventsParams.PriceEvaluation.builder() + .externalPriceId("external_price_id") .filter("my_numeric_property > 100 AND my_other_property = 'bar'") .addGroupingKey( "case when my_event_type = 'foo' then true else false end" From b80c170203b1bbe44da7121d69d245ca6b5db2b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:07:05 +0000 Subject: [PATCH 4/5] feat(api): api update --- .stats.yml | 4 +- .../api/models/CreditNoteCreateParams.kt | 90 +++++++++---------- .../api/models/CreditNoteCreateParamsTest.kt | 24 ++--- .../async/CreditNoteServiceAsyncTest.kt | 8 +- .../blocking/CreditNoteServiceTest.kt | 8 +- 5 files changed, 64 insertions(+), 70 deletions(-) diff --git a/.stats.yml b/.stats.yml index d44c6fa9..3888ba9f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 116 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-612316c13276a207f56e2e2c7bbc68f4bb73de85e3661595a23f23d9ccc80276.yml -openapi_spec_hash: 6e125f05e40521ec485edf6e15beec2e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-e79a36262fa3c577305a43717398fb70482bb2dca47cdb3e201cbb2a590c359c.yml +openapi_spec_hash: 1e04880dccbcc082ba451083e421a471 config_hash: 3c3524be9607afb24d2139ce26ce5389 diff --git a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt index aff78d0d..a360c8a5 100644 --- a/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt +++ b/orb-java-core/src/main/kotlin/com/withorb/api/models/CreditNoteCreateParams.kt @@ -69,10 +69,9 @@ private constructor( fun reason(): Reason = body.reason() /** - * A date string to specify the global credit note service period end date in the customer's - * timezone. This will be applied to all line items that don't have their own individual service - * periods specified. If not provided, line items will use their original invoice line item - * service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items will + * use their original invoice line item service periods. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server * responded with an unexpected value). @@ -88,10 +87,9 @@ private constructor( fun memo(): Optional = body.memo() /** - * A date string to specify the global credit note service period start date in the customer's - * timezone. This will be applied to all line items that don't have their own individual service - * periods specified. If not provided, line items will use their original invoice line item - * service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items will + * use their original invoice line item service periods. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the server * responded with an unexpected value). @@ -213,10 +211,9 @@ private constructor( fun reason(reason: JsonField) = apply { body.reason(reason) } /** - * A date string to specify the global credit note service period end date in the customer's - * timezone. This will be applied to all line items that don't have their own individual - * service periods specified. If not provided, line items will use their original invoice - * line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items + * will use their original invoice line item service periods. This date is inclusive. */ fun endDate(endDate: LocalDate?) = apply { body.endDate(endDate) } @@ -247,10 +244,9 @@ private constructor( fun memo(memo: JsonField) = apply { body.memo(memo) } /** - * A date string to specify the global credit note service period start date in the - * customer's timezone. This will be applied to all line items that don't have their own - * individual service periods specified. If not provided, line items will use their original - * invoice line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items + * will use their original invoice line item service periods. This date is inclusive. */ fun startDate(startDate: LocalDate?) = apply { body.startDate(startDate) } @@ -450,10 +446,9 @@ private constructor( fun reason(): Reason = reason.getRequired("reason") /** - * A date string to specify the global credit note service period end date in the customer's - * timezone. This will be applied to all line items that don't have their own individual - * service periods specified. If not provided, line items will use their original invoice - * line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items + * will use their original invoice line item service periods. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -469,10 +464,9 @@ private constructor( fun memo(): Optional = memo.getOptional("memo") /** - * A date string to specify the global credit note service period start date in the - * customer's timezone. This will be applied to all line items that don't have their own - * individual service periods specified. If not provided, line items will use their original - * invoice line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in the + * customer's timezone. This will be applied to all line items. If not provided, line items + * will use their original invoice line item service periods. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -602,10 +596,10 @@ private constructor( fun reason(reason: JsonField) = apply { this.reason = reason } /** - * A date string to specify the global credit note service period end date in the - * customer's timezone. This will be applied to all line items that don't have their own - * individual service periods specified. If not provided, line items will use their - * original invoice line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in + * the customer's timezone. This will be applied to all line items. If not provided, + * line items will use their original invoice line item service periods. This date is + * inclusive. */ fun endDate(endDate: LocalDate?) = endDate(JsonField.ofNullable(endDate)) @@ -637,10 +631,10 @@ private constructor( fun memo(memo: JsonField) = apply { this.memo = memo } /** - * A date string to specify the global credit note service period start date in the - * customer's timezone. This will be applied to all line items that don't have their own - * individual service periods specified. If not provided, line items will use their - * original invoice line item service periods. This date is inclusive. + * An optional date string to specify the global credit note service period end date in + * the customer's timezone. This will be applied to all line items. If not provided, + * line items will use their original invoice line item service periods. This date is + * inclusive. */ fun startDate(startDate: LocalDate?) = startDate(JsonField.ofNullable(startDate)) @@ -794,10 +788,10 @@ private constructor( fun invoiceLineItemId(): String = invoiceLineItemId.getRequired("invoice_line_item_id") /** - * A date string to specify this line item's credit note service period end date in the - * customer's timezone. If provided, this will be used for this specific line item. If not - * provided, will use the global end_date if available, otherwise defaults to the original - * invoice line item's end date. This date is inclusive. + * An optional date string to specify this line item's credit note service period end date + * in the customer's timezone. If provided, this will be used for this specific line item. + * If not provided, will use the global end_date if available, otherwise defaults to the + * original invoice line item's end date. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -805,10 +799,10 @@ private constructor( fun endDate(): Optional = endDate.getOptional("end_date") /** - * A date string to specify this line item's credit note service period start date in the - * customer's timezone. If provided, this will be used for this specific line item. If not - * provided, will use the global start_date if available, otherwise defaults to the original - * invoice line item's start date. This date is inclusive. + * An optional date string to specify this line item's credit note service period start date + * in the customer's timezone. If provided, this will be used for this specific line item. + * If not provided, will use the global start_date if available, otherwise defaults to the + * original invoice line item's start date. This date is inclusive. * * @throws OrbInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -920,10 +914,10 @@ private constructor( } /** - * A date string to specify this line item's credit note service period end date in the - * customer's timezone. If provided, this will be used for this specific line item. If - * not provided, will use the global end_date if available, otherwise defaults to the - * original invoice line item's end date. This date is inclusive. + * An optional date string to specify this line item's credit note service period end + * date in the customer's timezone. If provided, this will be used for this specific + * line item. If not provided, will use the global end_date if available, otherwise + * defaults to the original invoice line item's end date. This date is inclusive. */ fun endDate(endDate: LocalDate?) = endDate(JsonField.ofNullable(endDate)) @@ -940,10 +934,10 @@ private constructor( fun endDate(endDate: JsonField) = apply { this.endDate = endDate } /** - * A date string to specify this line item's credit note service period start date in - * the customer's timezone. If provided, this will be used for this specific line item. - * If not provided, will use the global start_date if available, otherwise defaults to - * the original invoice line item's start date. This date is inclusive. + * An optional date string to specify this line item's credit note service period start + * date in the customer's timezone. If provided, this will be used for this specific + * line item. If not provided, will use the global start_date if available, otherwise + * defaults to the original invoice line item's start date. This date is inclusive. */ fun startDate(startDate: LocalDate?) = startDate(JsonField.ofNullable(startDate)) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt index 9ac12b2b..b1dbbc62 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/models/CreditNoteCreateParamsTest.kt @@ -15,14 +15,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") - .endDate(LocalDate.parse("2023-09-22")) - .startDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) - .endDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) .memo("An optional memo for my credit note.") - .startDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-01-01")) .build() } @@ -34,14 +34,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") - .endDate(LocalDate.parse("2023-09-22")) - .startDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) - .endDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) .memo("An optional memo for my credit note.") - .startDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-01-01")) .build() val body = params._body() @@ -51,14 +51,14 @@ internal class CreditNoteCreateParamsTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") - .endDate(LocalDate.parse("2023-09-22")) - .startDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) assertThat(body.reason()).isEqualTo(CreditNoteCreateParams.Reason.DUPLICATE) - assertThat(body.endDate()).contains(LocalDate.parse("2023-09-22")) + assertThat(body.endDate()).contains(LocalDate.parse("2023-01-31")) assertThat(body.memo()).contains("An optional memo for my credit note.") - assertThat(body.startDate()).contains(LocalDate.parse("2023-09-22")) + assertThat(body.startDate()).contains(LocalDate.parse("2023-01-01")) } @Test diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt index 45c8dad6..197e00d7 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/async/CreditNoteServiceAsyncTest.kt @@ -28,14 +28,14 @@ internal class CreditNoteServiceAsyncTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") - .endDate(LocalDate.parse("2023-09-22")) - .startDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) - .endDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) .memo("An optional memo for my credit note.") - .startDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) diff --git a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt index 5fdd282c..c87148ac 100644 --- a/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt +++ b/orb-java-core/src/test/kotlin/com/withorb/api/services/blocking/CreditNoteServiceTest.kt @@ -28,14 +28,14 @@ internal class CreditNoteServiceTest { CreditNoteCreateParams.LineItem.builder() .amount("amount") .invoiceLineItemId("4khy3nwzktxv7") - .endDate(LocalDate.parse("2023-09-22")) - .startDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) .reason(CreditNoteCreateParams.Reason.DUPLICATE) - .endDate(LocalDate.parse("2023-09-22")) + .endDate(LocalDate.parse("2023-01-31")) .memo("An optional memo for my credit note.") - .startDate(LocalDate.parse("2023-09-22")) + .startDate(LocalDate.parse("2023-01-01")) .build() ) From bfd6209d74166d5e4865c2b24d8b2897f0c10f9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 20:07:33 +0000 Subject: [PATCH 5/5] release: 1.4.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ README.md | 6 +++--- build.gradle.kts | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ffd..3e9af1b3 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "1.4.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 040abd39..40626eab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 1.4.0 (2025-07-16) + +Full Changelog: [v1.3.0...v1.4.0](https://github.com/orbcorp/orb-java/compare/v1.3.0...v1.4.0) + +### Features + +* **api:** api update ([b80c170](https://github.com/orbcorp/orb-java/commit/b80c170203b1bbe44da7121d69d245ca6b5db2b8)) +* **api:** api update ([52612a7](https://github.com/orbcorp/orb-java/commit/52612a73768f17c76ccfff8e5dacf9457dd08c0d)) + + +### Chores + +* **ci:** bump `actions/setup-java` to v4 ([ee43b24](https://github.com/orbcorp/orb-java/commit/ee43b240c6ca6968cca70b7c6db999c7de19b2bd)) +* **ci:** ensure docs generation always succeeds ([00866a5](https://github.com/orbcorp/orb-java/commit/00866a557ba12a39d7899bc3bc0a2950094ad355)) + ## 1.3.0 (2025-07-08) Full Changelog: [v1.2.0...v1.3.0](https://github.com/orbcorp/orb-java/compare/v1.2.0...v1.3.0) diff --git a/README.md b/README.md index 09e41e3b..0dfea076 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/1.3.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/1.4.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:1.3.0") +implementation("com.withorb.api:orb-java:1.4.0") ``` ### Maven @@ -28,7 +28,7 @@ implementation("com.withorb.api:orb-java:1.3.0") com.withorb.api orb-java - 1.3.0 + 1.4.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index 347ed743..beb75bdb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,4 @@ allprojects { group = "com.withorb.api" - version = "1.3.0" // x-release-please-version + version = "1.4.0" // x-release-please-version }