@@ -27,6 +27,7 @@ constructor(
2727 private val lineItems: List <LineItem >,
2828 private val netTerms: Long ,
2929 private val customerId: String? ,
30+ private val discount: Discount ? ,
3031 private val externalCustomerId: String? ,
3132 private val memo: String? ,
3233 private val metadata: Metadata ? ,
@@ -46,6 +47,8 @@ constructor(
4647
4748 fun customerId (): Optional <String > = Optional .ofNullable(customerId)
4849
50+ fun discount (): Optional <Discount > = Optional .ofNullable(discount)
51+
4952 fun externalCustomerId (): Optional <String > = Optional .ofNullable(externalCustomerId)
5053
5154 fun memo (): Optional <String > = Optional .ofNullable(memo)
@@ -62,6 +65,7 @@ constructor(
6265 lineItems,
6366 netTerms,
6467 customerId,
68+ discount,
6569 externalCustomerId,
6670 memo,
6771 metadata,
@@ -83,6 +87,7 @@ constructor(
8387 private val lineItems: List <LineItem >? ,
8488 private val netTerms: Long? ,
8589 private val customerId: String? ,
90+ private val discount: Discount ? ,
8691 private val externalCustomerId: String? ,
8792 private val memo: String? ,
8893 private val metadata: Metadata ? ,
@@ -118,6 +123,9 @@ constructor(
118123 */
119124 @JsonProperty(" customer_id" ) fun customerId (): String? = customerId
120125
126+ /* * An optional discount to attach to the invoice. */
127+ @JsonProperty(" discount" ) fun discount (): Discount ? = discount
128+
121129 /* *
122130 * The `external_customer_id` of the `Customer` to create this invoice for. One of
123131 * `customer_id` and `external_customer_id` are required.
@@ -157,6 +165,7 @@ constructor(
157165 this .lineItems == other.lineItems &&
158166 this .netTerms == other.netTerms &&
159167 this .customerId == other.customerId &&
168+ this .discount == other.discount &&
160169 this .externalCustomerId == other.externalCustomerId &&
161170 this .memo == other.memo &&
162171 this .metadata == other.metadata &&
@@ -173,6 +182,7 @@ constructor(
173182 lineItems,
174183 netTerms,
175184 customerId,
185+ discount,
176186 externalCustomerId,
177187 memo,
178188 metadata,
@@ -184,7 +194,7 @@ constructor(
184194 }
185195
186196 override fun toString () =
187- " InvoiceCreateBody{currency=$currency , invoiceDate=$invoiceDate , lineItems=$lineItems , netTerms=$netTerms , customerId=$customerId , externalCustomerId=$externalCustomerId , memo=$memo , metadata=$metadata , willAutoIssue=$willAutoIssue , additionalProperties=$additionalProperties }"
197+ " InvoiceCreateBody{currency=$currency , invoiceDate=$invoiceDate , lineItems=$lineItems , netTerms=$netTerms , customerId=$customerId , discount= $discount , externalCustomerId=$externalCustomerId , memo=$memo , metadata=$metadata , willAutoIssue=$willAutoIssue , additionalProperties=$additionalProperties }"
188198
189199 companion object {
190200
@@ -198,6 +208,7 @@ constructor(
198208 private var lineItems: List <LineItem >? = null
199209 private var netTerms: Long? = null
200210 private var customerId: String? = null
211+ private var discount: Discount ? = null
201212 private var externalCustomerId: String? = null
202213 private var memo: String? = null
203214 private var metadata: Metadata ? = null
@@ -211,6 +222,7 @@ constructor(
211222 this .lineItems = invoiceCreateBody.lineItems
212223 this .netTerms = invoiceCreateBody.netTerms
213224 this .customerId = invoiceCreateBody.customerId
225+ this .discount = invoiceCreateBody.discount
214226 this .externalCustomerId = invoiceCreateBody.externalCustomerId
215227 this .memo = invoiceCreateBody.memo
216228 this .metadata = invoiceCreateBody.metadata
@@ -251,6 +263,10 @@ constructor(
251263 @JsonProperty(" customer_id" )
252264 fun customerId (customerId : String ) = apply { this .customerId = customerId }
253265
266+ /* * An optional discount to attach to the invoice. */
267+ @JsonProperty(" discount" )
268+ fun discount (discount : Discount ) = apply { this .discount = discount }
269+
254270 /* *
255271 * The `external_customer_id` of the `Customer` to create this invoice for. One of
256272 * `customer_id` and `external_customer_id` are required.
@@ -300,6 +316,7 @@ constructor(
300316 .toUnmodifiable(),
301317 checkNotNull(netTerms) { " `netTerms` is required but was not set" },
302318 customerId,
319+ discount,
303320 externalCustomerId,
304321 memo,
305322 metadata,
@@ -326,6 +343,7 @@ constructor(
326343 this .lineItems == other.lineItems &&
327344 this .netTerms == other.netTerms &&
328345 this .customerId == other.customerId &&
346+ this .discount == other.discount &&
329347 this .externalCustomerId == other.externalCustomerId &&
330348 this .memo == other.memo &&
331349 this .metadata == other.metadata &&
@@ -342,6 +360,7 @@ constructor(
342360 lineItems,
343361 netTerms,
344362 customerId,
363+ discount,
345364 externalCustomerId,
346365 memo,
347366 metadata,
@@ -353,7 +372,7 @@ constructor(
353372 }
354373
355374 override fun toString () =
356- " InvoiceCreateParams{currency=$currency , invoiceDate=$invoiceDate , lineItems=$lineItems , netTerms=$netTerms , customerId=$customerId , externalCustomerId=$externalCustomerId , memo=$memo , metadata=$metadata , willAutoIssue=$willAutoIssue , additionalQueryParams=$additionalQueryParams , additionalHeaders=$additionalHeaders , additionalBodyProperties=$additionalBodyProperties }"
375+ " InvoiceCreateParams{currency=$currency , invoiceDate=$invoiceDate , lineItems=$lineItems , netTerms=$netTerms , customerId=$customerId , discount= $discount , externalCustomerId=$externalCustomerId , memo=$memo , metadata=$metadata , willAutoIssue=$willAutoIssue , additionalQueryParams=$additionalQueryParams , additionalHeaders=$additionalHeaders , additionalBodyProperties=$additionalBodyProperties }"
357376
358377 fun toBuilder () = Builder ().from(this )
359378
@@ -370,6 +389,7 @@ constructor(
370389 private var lineItems: MutableList <LineItem > = mutableListOf ()
371390 private var netTerms: Long? = null
372391 private var customerId: String? = null
392+ private var discount: Discount ? = null
373393 private var externalCustomerId: String? = null
374394 private var memo: String? = null
375395 private var metadata: Metadata ? = null
@@ -385,6 +405,7 @@ constructor(
385405 this .lineItems(invoiceCreateParams.lineItems)
386406 this .netTerms = invoiceCreateParams.netTerms
387407 this .customerId = invoiceCreateParams.customerId
408+ this .discount = invoiceCreateParams.discount
388409 this .externalCustomerId = invoiceCreateParams.externalCustomerId
389410 this .memo = invoiceCreateParams.memo
390411 this .metadata = invoiceCreateParams.metadata
@@ -425,6 +446,29 @@ constructor(
425446 */
426447 fun customerId (customerId : String ) = apply { this .customerId = customerId }
427448
449+ /* * An optional discount to attach to the invoice. */
450+ fun discount (discount : Discount ) = apply { this .discount = discount }
451+
452+ /* * An optional discount to attach to the invoice. */
453+ fun discount (percentageDiscount : Discount .PercentageDiscount ) = apply {
454+ this .discount = Discount .ofPercentageDiscount(percentageDiscount)
455+ }
456+
457+ /* * An optional discount to attach to the invoice. */
458+ fun discount (trialDiscount : Discount .TrialDiscount ) = apply {
459+ this .discount = Discount .ofTrialDiscount(trialDiscount)
460+ }
461+
462+ /* * An optional discount to attach to the invoice. */
463+ fun discount (usageDiscount : Discount .UsageDiscount ) = apply {
464+ this .discount = Discount .ofUsageDiscount(usageDiscount)
465+ }
466+
467+ /* * An optional discount to attach to the invoice. */
468+ fun discount (amountDiscount : Discount .AmountDiscount ) = apply {
469+ this .discount = Discount .ofAmountDiscount(amountDiscount)
470+ }
471+
428472 /* *
429473 * The `external_customer_id` of the `Customer` to create this invoice for. One of
430474 * `customer_id` and `external_customer_id` are required.
@@ -511,6 +555,7 @@ constructor(
511555 .toUnmodifiable(),
512556 checkNotNull(netTerms) { " `netTerms` is required but was not set" },
513557 customerId,
558+ discount,
514559 externalCustomerId,
515560 memo,
516561 metadata,
0 commit comments