@@ -29,6 +29,7 @@ class PriceInterval
2929private constructor (
3030 private val id: JsonField <String >,
3131 private val billingCycleDay: JsonField <Long >,
32+ private val canDeferBilling: JsonField <Boolean >,
3233 private val currentBillingPeriodEndDate: JsonField <OffsetDateTime >,
3334 private val currentBillingPeriodStartDate: JsonField <OffsetDateTime >,
3435 private val endDate: JsonField <OffsetDateTime >,
@@ -46,6 +47,9 @@ private constructor(
4647 @JsonProperty(" billing_cycle_day" )
4748 @ExcludeMissing
4849 billingCycleDay: JsonField <Long > = JsonMissing .of(),
50+ @JsonProperty(" can_defer_billing" )
51+ @ExcludeMissing
52+ canDeferBilling: JsonField <Boolean > = JsonMissing .of(),
4953 @JsonProperty(" current_billing_period_end_date" )
5054 @ExcludeMissing
5155 currentBillingPeriodEndDate: JsonField <OffsetDateTime > = JsonMissing .of(),
@@ -69,6 +73,7 @@ private constructor(
6973 ) : this (
7074 id,
7175 billingCycleDay,
76+ canDeferBilling,
7277 currentBillingPeriodEndDate,
7378 currentBillingPeriodStartDate,
7479 endDate,
@@ -94,6 +99,15 @@ private constructor(
9499 */
95100 fun billingCycleDay (): Long = billingCycleDay.getRequired(" billing_cycle_day" )
96101
102+ /* *
103+ * For in-arrears prices. If true, and the price interval ends mid-cycle, the final line item
104+ * will be deferred to the next scheduled invoice instead of being billed mid-cycle.
105+ *
106+ * @throws OrbInvalidDataException if the JSON field has an unexpected type or is unexpectedly
107+ * missing or null (e.g. if the server responded with an unexpected value).
108+ */
109+ fun canDeferBilling (): Boolean = canDeferBilling.getRequired(" can_defer_billing" )
110+
97111 /* *
98112 * The end of the current billing period. This is an exclusive timestamp, such that the instant
99113 * returned is exactly the end of the billing period. Set to null if this price interval is not
@@ -194,6 +208,15 @@ private constructor(
194208 @ExcludeMissing
195209 fun _billingCycleDay (): JsonField <Long > = billingCycleDay
196210
211+ /* *
212+ * Returns the raw JSON value of [canDeferBilling].
213+ *
214+ * Unlike [canDeferBilling], this method doesn't throw if the JSON field has an unexpected type.
215+ */
216+ @JsonProperty(" can_defer_billing" )
217+ @ExcludeMissing
218+ fun _canDeferBilling (): JsonField <Boolean > = canDeferBilling
219+
197220 /* *
198221 * Returns the raw JSON value of [currentBillingPeriodEndDate].
199222 *
@@ -286,6 +309,7 @@ private constructor(
286309 * ```java
287310 * .id()
288311 * .billingCycleDay()
312+ * .canDeferBilling()
289313 * .currentBillingPeriodEndDate()
290314 * .currentBillingPeriodStartDate()
291315 * .endDate()
@@ -304,6 +328,7 @@ private constructor(
304328
305329 private var id: JsonField <String >? = null
306330 private var billingCycleDay: JsonField <Long >? = null
331+ private var canDeferBilling: JsonField <Boolean >? = null
307332 private var currentBillingPeriodEndDate: JsonField <OffsetDateTime >? = null
308333 private var currentBillingPeriodStartDate: JsonField <OffsetDateTime >? = null
309334 private var endDate: JsonField <OffsetDateTime >? = null
@@ -320,6 +345,7 @@ private constructor(
320345 internal fun from (priceInterval : PriceInterval ) = apply {
321346 id = priceInterval.id
322347 billingCycleDay = priceInterval.billingCycleDay
348+ canDeferBilling = priceInterval.canDeferBilling
323349 currentBillingPeriodEndDate = priceInterval.currentBillingPeriodEndDate
324350 currentBillingPeriodStartDate = priceInterval.currentBillingPeriodStartDate
325351 endDate = priceInterval.endDate
@@ -356,6 +382,24 @@ private constructor(
356382 this .billingCycleDay = billingCycleDay
357383 }
358384
385+ /* *
386+ * For in-arrears prices. If true, and the price interval ends mid-cycle, the final line
387+ * item will be deferred to the next scheduled invoice instead of being billed mid-cycle.
388+ */
389+ fun canDeferBilling (canDeferBilling : Boolean ) =
390+ canDeferBilling(JsonField .of(canDeferBilling))
391+
392+ /* *
393+ * Sets [Builder.canDeferBilling] to an arbitrary JSON value.
394+ *
395+ * You should usually call [Builder.canDeferBilling] with a well-typed [Boolean] value
396+ * instead. This method is primarily for setting the field to an undocumented or not yet
397+ * supported value.
398+ */
399+ fun canDeferBilling (canDeferBilling : JsonField <Boolean >) = apply {
400+ this .canDeferBilling = canDeferBilling
401+ }
402+
359403 /* *
360404 * The end of the current billing period. This is an exclusive timestamp, such that the
361405 * instant returned is exactly the end of the billing period. Set to null if this price
@@ -720,6 +764,7 @@ private constructor(
720764 * ```java
721765 * .id()
722766 * .billingCycleDay()
767+ * .canDeferBilling()
723768 * .currentBillingPeriodEndDate()
724769 * .currentBillingPeriodStartDate()
725770 * .endDate()
@@ -736,6 +781,7 @@ private constructor(
736781 PriceInterval (
737782 checkRequired(" id" , id),
738783 checkRequired(" billingCycleDay" , billingCycleDay),
784+ checkRequired(" canDeferBilling" , canDeferBilling),
739785 checkRequired(" currentBillingPeriodEndDate" , currentBillingPeriodEndDate),
740786 checkRequired(" currentBillingPeriodStartDate" , currentBillingPeriodStartDate),
741787 checkRequired(" endDate" , endDate),
@@ -759,6 +805,7 @@ private constructor(
759805
760806 id()
761807 billingCycleDay()
808+ canDeferBilling()
762809 currentBillingPeriodEndDate()
763810 currentBillingPeriodStartDate()
764811 endDate()
@@ -787,6 +834,7 @@ private constructor(
787834 internal fun validity (): Int =
788835 (if (id.asKnown().isPresent) 1 else 0 ) +
789836 (if (billingCycleDay.asKnown().isPresent) 1 else 0 ) +
837+ (if (canDeferBilling.asKnown().isPresent) 1 else 0 ) +
790838 (if (currentBillingPeriodEndDate.asKnown().isPresent) 1 else 0 ) +
791839 (if (currentBillingPeriodStartDate.asKnown().isPresent) 1 else 0 ) +
792840 (if (endDate.asKnown().isPresent) 1 else 0 ) +
@@ -805,6 +853,7 @@ private constructor(
805853 return other is PriceInterval &&
806854 id == other.id &&
807855 billingCycleDay == other.billingCycleDay &&
856+ canDeferBilling == other.canDeferBilling &&
808857 currentBillingPeriodEndDate == other.currentBillingPeriodEndDate &&
809858 currentBillingPeriodStartDate == other.currentBillingPeriodStartDate &&
810859 endDate == other.endDate &&
@@ -820,6 +869,7 @@ private constructor(
820869 Objects .hash(
821870 id,
822871 billingCycleDay,
872+ canDeferBilling,
823873 currentBillingPeriodEndDate,
824874 currentBillingPeriodStartDate,
825875 endDate,
@@ -835,5 +885,5 @@ private constructor(
835885 override fun hashCode (): Int = hashCode
836886
837887 override fun toString () =
838- " PriceInterval{id=$id , billingCycleDay=$billingCycleDay , currentBillingPeriodEndDate=$currentBillingPeriodEndDate , currentBillingPeriodStartDate=$currentBillingPeriodStartDate , endDate=$endDate , filter=$filter , fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions , price=$price , startDate=$startDate , usageCustomerIds=$usageCustomerIds , additionalProperties=$additionalProperties }"
888+ " PriceInterval{id=$id , billingCycleDay=$billingCycleDay , canDeferBilling= $canDeferBilling , currentBillingPeriodEndDate=$currentBillingPeriodEndDate , currentBillingPeriodStartDate=$currentBillingPeriodStartDate , endDate=$endDate , filter=$filter , fixedFeeQuantityTransitions=$fixedFeeQuantityTransitions , price=$price , startDate=$startDate , usageCustomerIds=$usageCustomerIds , additionalProperties=$additionalProperties }"
839889}
0 commit comments