• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16707

14 Dec 2024 12:12AM UTC coverage: 15.91% (-0.08%) from 15.988%
#16707

Pull #1931

github

web-flow
Merge 90c2dfd77 into cf528f2c8
Pull Request #1931: Update generated code

43 of 1442 new or added lines in 28 files covered. (2.98%)

137 existing lines in 17 files now uncovered.

18625 of 117068 relevant lines covered (15.91%)

0.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/stripe/param/InvoiceCreatePreviewParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.net.ApiRequestParams;
6
import com.stripe.param.common.EmptyParam;
7
import java.math.BigDecimal;
8
import java.util.ArrayList;
9
import java.util.HashMap;
10
import java.util.List;
11
import java.util.Map;
12
import lombok.Getter;
13

14
@Getter
15
public class InvoiceCreatePreviewParams extends ApiRequestParams {
16
  /** Settings for automatic tax lookup for this invoice preview. */
17
  @SerializedName("automatic_tax")
18
  AutomaticTax automaticTax;
19

20
  /**
21
   * The ID of the coupon to apply to this phase of the subscription schedule. This field has been
22
   * deprecated and will be removed in a future API version. Use {@code discounts} instead.
23
   */
24
  @SerializedName("coupon")
25
  String coupon;
26

27
  /**
28
   * The currency to preview this invoice in. Defaults to that of {@code customer} if not specified.
29
   */
30
  @SerializedName("currency")
31
  String currency;
32

33
  /**
34
   * The identifier of the customer whose upcoming invoice you'd like to retrieve. If {@code
35
   * automatic_tax} is enabled then one of {@code customer}, {@code customer_details}, {@code
36
   * subscription}, or {@code schedule} must be set.
37
   */
38
  @SerializedName("customer")
39
  String customer;
40

41
  /**
42
   * Details about the customer you want to invoice or overrides for an existing customer. If {@code
43
   * automatic_tax} is enabled then one of {@code customer}, {@code customer_details}, {@code
44
   * subscription}, or {@code schedule} must be set.
45
   */
46
  @SerializedName("customer_details")
47
  CustomerDetails customerDetails;
48

49
  /**
50
   * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the
51
   * discount from the subscription or customer. This works for both coupons directly applied to an
52
   * invoice and coupons applied to a subscription. Pass an empty string to avoid inheriting any
53
   * discounts.
54
   */
55
  @SerializedName("discounts")
56
  Object discounts;
57

58
  /** Specifies which fields in the response should be expanded. */
59
  @SerializedName("expand")
60
  List<String> expand;
61

62
  /**
63
   * Map of extra parameters for custom features not available in this client library. The content
64
   * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
65
   * key/value pair is serialized as if the key is a root-level field (serialized) name in this
66
   * param object. Effectively, this map is flattened to its parent instance.
67
   */
68
  @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
69
  Map<String, Object> extraParams;
70

71
  /** List of invoice items to add or update in the upcoming invoice preview (up to 250). */
72
  @SerializedName("invoice_items")
73
  List<InvoiceCreatePreviewParams.InvoiceItem> invoiceItems;
74

75
  /**
76
   * The connected account that issues the invoice. The invoice is presented with the branding and
77
   * support information of the specified account.
78
   */
79
  @SerializedName("issuer")
80
  Issuer issuer;
81

82
  /**
83
   * The account (if any) for which the funds of the invoice payment are intended. If set, the
84
   * invoice will be presented with the branding and support information of the specified account.
85
   * See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a>
86
   * documentation for details.
87
   */
88
  @SerializedName("on_behalf_of")
89
  Object onBehalfOf;
90

91
  /**
92
   * Customizes the types of values to include when calculating the invoice. Defaults to {@code
93
   * next} if unspecified.
94
   */
95
  @SerializedName("preview_mode")
96
  PreviewMode previewMode;
97

98
  /**
99
   * The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used
100
   * with subscription or subscription fields.
101
   */
102
  @SerializedName("schedule")
103
  String schedule;
104

105
  /**
106
   * The schedule creation or modification params to apply as a preview. Cannot be used with {@code
107
   * subscription} or {@code subscription_} prefixed fields.
108
   */
109
  @SerializedName("schedule_details")
110
  ScheduleDetails scheduleDetails;
111

112
  /**
113
   * The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If
114
   * not provided, but a {@code subscription_details.items} is provided, you will preview creating a
115
   * subscription with those items. If neither {@code subscription} nor {@code
116
   * subscription_details.items} is provided, you will retrieve the next upcoming invoice from among
117
   * the customer's subscriptions.
118
   */
119
  @SerializedName("subscription")
120
  String subscription;
121

122
  /**
123
   * The subscription creation or modification params to apply as a preview. Cannot be used with
124
   * {@code schedule} or {@code schedule_details} fields.
125
   */
126
  @SerializedName("subscription_details")
127
  SubscriptionDetails subscriptionDetails;
128

129
  private InvoiceCreatePreviewParams(
130
      AutomaticTax automaticTax,
131
      String coupon,
132
      String currency,
133
      String customer,
134
      CustomerDetails customerDetails,
135
      Object discounts,
136
      List<String> expand,
137
      Map<String, Object> extraParams,
138
      List<InvoiceCreatePreviewParams.InvoiceItem> invoiceItems,
139
      Issuer issuer,
140
      Object onBehalfOf,
141
      PreviewMode previewMode,
142
      String schedule,
143
      ScheduleDetails scheduleDetails,
144
      String subscription,
145
      SubscriptionDetails subscriptionDetails) {
×
146
    this.automaticTax = automaticTax;
×
147
    this.coupon = coupon;
×
148
    this.currency = currency;
×
149
    this.customer = customer;
×
150
    this.customerDetails = customerDetails;
×
151
    this.discounts = discounts;
×
152
    this.expand = expand;
×
153
    this.extraParams = extraParams;
×
154
    this.invoiceItems = invoiceItems;
×
155
    this.issuer = issuer;
×
156
    this.onBehalfOf = onBehalfOf;
×
157
    this.previewMode = previewMode;
×
158
    this.schedule = schedule;
×
159
    this.scheduleDetails = scheduleDetails;
×
160
    this.subscription = subscription;
×
161
    this.subscriptionDetails = subscriptionDetails;
×
162
  }
×
163

164
  public static Builder builder() {
165
    return new Builder();
×
166
  }
167

168
  public static class Builder {
×
169
    private AutomaticTax automaticTax;
170

171
    private String coupon;
172

173
    private String currency;
174

175
    private String customer;
176

177
    private CustomerDetails customerDetails;
178

179
    private Object discounts;
180

181
    private List<String> expand;
182

183
    private Map<String, Object> extraParams;
184

185
    private List<InvoiceCreatePreviewParams.InvoiceItem> invoiceItems;
186

187
    private Issuer issuer;
188

189
    private Object onBehalfOf;
190

191
    private PreviewMode previewMode;
192

193
    private String schedule;
194

195
    private ScheduleDetails scheduleDetails;
196

197
    private String subscription;
198

199
    private SubscriptionDetails subscriptionDetails;
200

201
    /** Finalize and obtain parameter instance from this builder. */
202
    public InvoiceCreatePreviewParams build() {
203
      return new InvoiceCreatePreviewParams(
×
204
          this.automaticTax,
205
          this.coupon,
206
          this.currency,
207
          this.customer,
208
          this.customerDetails,
209
          this.discounts,
210
          this.expand,
211
          this.extraParams,
212
          this.invoiceItems,
213
          this.issuer,
214
          this.onBehalfOf,
215
          this.previewMode,
216
          this.schedule,
217
          this.scheduleDetails,
218
          this.subscription,
219
          this.subscriptionDetails);
220
    }
221

222
    /** Settings for automatic tax lookup for this invoice preview. */
223
    public Builder setAutomaticTax(InvoiceCreatePreviewParams.AutomaticTax automaticTax) {
224
      this.automaticTax = automaticTax;
×
225
      return this;
×
226
    }
227

228
    /**
229
     * The ID of the coupon to apply to this phase of the subscription schedule. This field has been
230
     * deprecated and will be removed in a future API version. Use {@code discounts} instead.
231
     */
232
    public Builder setCoupon(String coupon) {
233
      this.coupon = coupon;
×
234
      return this;
×
235
    }
236

237
    /**
238
     * The currency to preview this invoice in. Defaults to that of {@code customer} if not
239
     * specified.
240
     */
241
    public Builder setCurrency(String currency) {
242
      this.currency = currency;
×
243
      return this;
×
244
    }
245

246
    /**
247
     * The identifier of the customer whose upcoming invoice you'd like to retrieve. If {@code
248
     * automatic_tax} is enabled then one of {@code customer}, {@code customer_details}, {@code
249
     * subscription}, or {@code schedule} must be set.
250
     */
251
    public Builder setCustomer(String customer) {
252
      this.customer = customer;
×
253
      return this;
×
254
    }
255

256
    /**
257
     * Details about the customer you want to invoice or overrides for an existing customer. If
258
     * {@code automatic_tax} is enabled then one of {@code customer}, {@code customer_details},
259
     * {@code subscription}, or {@code schedule} must be set.
260
     */
261
    public Builder setCustomerDetails(InvoiceCreatePreviewParams.CustomerDetails customerDetails) {
262
      this.customerDetails = customerDetails;
×
263
      return this;
×
264
    }
265

266
    /**
267
     * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call,
268
     * and subsequent calls adds additional elements to the original list. See {@link
269
     * InvoiceCreatePreviewParams#discounts} for the field documentation.
270
     */
271
    @SuppressWarnings("unchecked")
272
    public Builder addDiscount(InvoiceCreatePreviewParams.Discount element) {
273
      if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
274
        this.discounts = new ArrayList<InvoiceCreatePreviewParams.Discount>();
×
275
      }
276
      ((List<InvoiceCreatePreviewParams.Discount>) this.discounts).add(element);
×
277
      return this;
×
278
    }
279

280
    /**
281
     * Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call,
282
     * and subsequent calls adds additional elements to the original list. See {@link
283
     * InvoiceCreatePreviewParams#discounts} for the field documentation.
284
     */
285
    @SuppressWarnings("unchecked")
286
    public Builder addAllDiscount(List<InvoiceCreatePreviewParams.Discount> elements) {
287
      if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
288
        this.discounts = new ArrayList<InvoiceCreatePreviewParams.Discount>();
×
289
      }
290
      ((List<InvoiceCreatePreviewParams.Discount>) this.discounts).addAll(elements);
×
291
      return this;
×
292
    }
293

294
    /**
295
     * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the
296
     * discount from the subscription or customer. This works for both coupons directly applied to
297
     * an invoice and coupons applied to a subscription. Pass an empty string to avoid inheriting
298
     * any discounts.
299
     */
300
    public Builder setDiscounts(EmptyParam discounts) {
301
      this.discounts = discounts;
×
302
      return this;
×
303
    }
304

305
    /**
306
     * The coupons to redeem into discounts for the invoice preview. If not specified, inherits the
307
     * discount from the subscription or customer. This works for both coupons directly applied to
308
     * an invoice and coupons applied to a subscription. Pass an empty string to avoid inheriting
309
     * any discounts.
310
     */
311
    public Builder setDiscounts(List<InvoiceCreatePreviewParams.Discount> discounts) {
312
      this.discounts = discounts;
×
313
      return this;
×
314
    }
315

316
    /**
317
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
318
     * subsequent calls adds additional elements to the original list. See {@link
319
     * InvoiceCreatePreviewParams#expand} for the field documentation.
320
     */
321
    public Builder addExpand(String element) {
322
      if (this.expand == null) {
×
323
        this.expand = new ArrayList<>();
×
324
      }
325
      this.expand.add(element);
×
326
      return this;
×
327
    }
328

329
    /**
330
     * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
331
     * subsequent calls adds additional elements to the original list. See {@link
332
     * InvoiceCreatePreviewParams#expand} for the field documentation.
333
     */
334
    public Builder addAllExpand(List<String> elements) {
335
      if (this.expand == null) {
×
336
        this.expand = new ArrayList<>();
×
337
      }
338
      this.expand.addAll(elements);
×
339
      return this;
×
340
    }
341

342
    /**
343
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
344
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
345
     * InvoiceCreatePreviewParams#extraParams} for the field documentation.
346
     */
347
    public Builder putExtraParam(String key, Object value) {
348
      if (this.extraParams == null) {
×
349
        this.extraParams = new HashMap<>();
×
350
      }
351
      this.extraParams.put(key, value);
×
352
      return this;
×
353
    }
354

355
    /**
356
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
357
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
358
     * See {@link InvoiceCreatePreviewParams#extraParams} for the field documentation.
359
     */
360
    public Builder putAllExtraParam(Map<String, Object> map) {
361
      if (this.extraParams == null) {
×
362
        this.extraParams = new HashMap<>();
×
363
      }
364
      this.extraParams.putAll(map);
×
365
      return this;
×
366
    }
367

368
    /**
369
     * Add an element to `invoiceItems` list. A list is initialized for the first `add/addAll` call,
370
     * and subsequent calls adds additional elements to the original list. See {@link
371
     * InvoiceCreatePreviewParams#invoiceItems} for the field documentation.
372
     */
373
    public Builder addInvoiceItem(InvoiceCreatePreviewParams.InvoiceItem element) {
374
      if (this.invoiceItems == null) {
×
375
        this.invoiceItems = new ArrayList<>();
×
376
      }
377
      this.invoiceItems.add(element);
×
378
      return this;
×
379
    }
380

381
    /**
382
     * Add all elements to `invoiceItems` list. A list is initialized for the first `add/addAll`
383
     * call, and subsequent calls adds additional elements to the original list. See {@link
384
     * InvoiceCreatePreviewParams#invoiceItems} for the field documentation.
385
     */
386
    public Builder addAllInvoiceItem(List<InvoiceCreatePreviewParams.InvoiceItem> elements) {
387
      if (this.invoiceItems == null) {
×
388
        this.invoiceItems = new ArrayList<>();
×
389
      }
390
      this.invoiceItems.addAll(elements);
×
391
      return this;
×
392
    }
393

394
    /**
395
     * The connected account that issues the invoice. The invoice is presented with the branding and
396
     * support information of the specified account.
397
     */
398
    public Builder setIssuer(InvoiceCreatePreviewParams.Issuer issuer) {
399
      this.issuer = issuer;
×
400
      return this;
×
401
    }
402

403
    /**
404
     * The account (if any) for which the funds of the invoice payment are intended. If set, the
405
     * invoice will be presented with the branding and support information of the specified account.
406
     * See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a>
407
     * documentation for details.
408
     */
409
    public Builder setOnBehalfOf(String onBehalfOf) {
410
      this.onBehalfOf = onBehalfOf;
×
411
      return this;
×
412
    }
413

414
    /**
415
     * The account (if any) for which the funds of the invoice payment are intended. If set, the
416
     * invoice will be presented with the branding and support information of the specified account.
417
     * See the <a href="https://stripe.com/docs/billing/invoices/connect">Invoices with Connect</a>
418
     * documentation for details.
419
     */
420
    public Builder setOnBehalfOf(EmptyParam onBehalfOf) {
421
      this.onBehalfOf = onBehalfOf;
×
422
      return this;
×
423
    }
424

425
    /**
426
     * Customizes the types of values to include when calculating the invoice. Defaults to {@code
427
     * next} if unspecified.
428
     */
429
    public Builder setPreviewMode(InvoiceCreatePreviewParams.PreviewMode previewMode) {
430
      this.previewMode = previewMode;
×
431
      return this;
×
432
    }
433

434
    /**
435
     * The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used
436
     * with subscription or subscription fields.
437
     */
438
    public Builder setSchedule(String schedule) {
439
      this.schedule = schedule;
×
440
      return this;
×
441
    }
442

443
    /**
444
     * The schedule creation or modification params to apply as a preview. Cannot be used with
445
     * {@code subscription} or {@code subscription_} prefixed fields.
446
     */
447
    public Builder setScheduleDetails(InvoiceCreatePreviewParams.ScheduleDetails scheduleDetails) {
448
      this.scheduleDetails = scheduleDetails;
×
449
      return this;
×
450
    }
451

452
    /**
453
     * The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If
454
     * not provided, but a {@code subscription_details.items} is provided, you will preview creating
455
     * a subscription with those items. If neither {@code subscription} nor {@code
456
     * subscription_details.items} is provided, you will retrieve the next upcoming invoice from
457
     * among the customer's subscriptions.
458
     */
459
    public Builder setSubscription(String subscription) {
460
      this.subscription = subscription;
×
461
      return this;
×
462
    }
463

464
    /**
465
     * The subscription creation or modification params to apply as a preview. Cannot be used with
466
     * {@code schedule} or {@code schedule_details} fields.
467
     */
468
    public Builder setSubscriptionDetails(
469
        InvoiceCreatePreviewParams.SubscriptionDetails subscriptionDetails) {
470
      this.subscriptionDetails = subscriptionDetails;
×
471
      return this;
×
472
    }
473
  }
474

475
  @Getter
476
  public static class AutomaticTax {
477
    /**
478
     * <strong>Required.</strong> Whether Stripe automatically computes tax on this invoice. Note
479
     * that incompatible invoice items (invoice items with manually specified <a
480
     * href="https://stripe.com/docs/api/tax_rates">tax rates</a>, negative amounts, or {@code
481
     * tax_behavior=unspecified}) cannot be added to automatic tax invoices.
482
     */
483
    @SerializedName("enabled")
484
    Boolean enabled;
485

486
    /**
487
     * Map of extra parameters for custom features not available in this client library. The content
488
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
489
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
490
     * param object. Effectively, this map is flattened to its parent instance.
491
     */
492
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
493
    Map<String, Object> extraParams;
494

495
    /**
496
     * The account that's liable for tax. If set, the business address and tax registrations
497
     * required to perform the tax calculation are loaded from this account. The tax transaction is
498
     * returned in the report of the connected account.
499
     */
500
    @SerializedName("liability")
501
    Liability liability;
502

503
    private AutomaticTax(Boolean enabled, Map<String, Object> extraParams, Liability liability) {
×
504
      this.enabled = enabled;
×
505
      this.extraParams = extraParams;
×
506
      this.liability = liability;
×
507
    }
×
508

509
    public static Builder builder() {
510
      return new Builder();
×
511
    }
512

513
    public static class Builder {
×
514
      private Boolean enabled;
515

516
      private Map<String, Object> extraParams;
517

518
      private Liability liability;
519

520
      /** Finalize and obtain parameter instance from this builder. */
521
      public InvoiceCreatePreviewParams.AutomaticTax build() {
522
        return new InvoiceCreatePreviewParams.AutomaticTax(
×
523
            this.enabled, this.extraParams, this.liability);
524
      }
525

526
      /**
527
       * <strong>Required.</strong> Whether Stripe automatically computes tax on this invoice. Note
528
       * that incompatible invoice items (invoice items with manually specified <a
529
       * href="https://stripe.com/docs/api/tax_rates">tax rates</a>, negative amounts, or {@code
530
       * tax_behavior=unspecified}) cannot be added to automatic tax invoices.
531
       */
532
      public Builder setEnabled(Boolean enabled) {
533
        this.enabled = enabled;
×
534
        return this;
×
535
      }
536

537
      /**
538
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
539
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
540
       * InvoiceCreatePreviewParams.AutomaticTax#extraParams} for the field documentation.
541
       */
542
      public Builder putExtraParam(String key, Object value) {
543
        if (this.extraParams == null) {
×
544
          this.extraParams = new HashMap<>();
×
545
        }
546
        this.extraParams.put(key, value);
×
547
        return this;
×
548
      }
549

550
      /**
551
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
552
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
553
       * See {@link InvoiceCreatePreviewParams.AutomaticTax#extraParams} for the field
554
       * documentation.
555
       */
556
      public Builder putAllExtraParam(Map<String, Object> map) {
557
        if (this.extraParams == null) {
×
558
          this.extraParams = new HashMap<>();
×
559
        }
560
        this.extraParams.putAll(map);
×
561
        return this;
×
562
      }
563

564
      /**
565
       * The account that's liable for tax. If set, the business address and tax registrations
566
       * required to perform the tax calculation are loaded from this account. The tax transaction
567
       * is returned in the report of the connected account.
568
       */
569
      public Builder setLiability(InvoiceCreatePreviewParams.AutomaticTax.Liability liability) {
570
        this.liability = liability;
×
571
        return this;
×
572
      }
573
    }
574

575
    @Getter
576
    public static class Liability {
577
      /** The connected account being referenced when {@code type} is {@code account}. */
578
      @SerializedName("account")
579
      String account;
580

581
      /**
582
       * Map of extra parameters for custom features not available in this client library. The
583
       * content in this map is not serialized under this field's {@code @SerializedName} value.
584
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
585
       * name in this param object. Effectively, this map is flattened to its parent instance.
586
       */
587
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
588
      Map<String, Object> extraParams;
589

590
      /** <strong>Required.</strong> Type of the account referenced in the request. */
591
      @SerializedName("type")
592
      Type type;
593

594
      private Liability(String account, Map<String, Object> extraParams, Type type) {
×
595
        this.account = account;
×
596
        this.extraParams = extraParams;
×
597
        this.type = type;
×
598
      }
×
599

600
      public static Builder builder() {
601
        return new Builder();
×
602
      }
603

604
      public static class Builder {
×
605
        private String account;
606

607
        private Map<String, Object> extraParams;
608

609
        private Type type;
610

611
        /** Finalize and obtain parameter instance from this builder. */
612
        public InvoiceCreatePreviewParams.AutomaticTax.Liability build() {
613
          return new InvoiceCreatePreviewParams.AutomaticTax.Liability(
×
614
              this.account, this.extraParams, this.type);
615
        }
616

617
        /** The connected account being referenced when {@code type} is {@code account}. */
618
        public Builder setAccount(String account) {
619
          this.account = account;
×
620
          return this;
×
621
        }
622

623
        /**
624
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
625
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
626
         * map. See {@link InvoiceCreatePreviewParams.AutomaticTax.Liability#extraParams} for the
627
         * field documentation.
628
         */
629
        public Builder putExtraParam(String key, Object value) {
630
          if (this.extraParams == null) {
×
631
            this.extraParams = new HashMap<>();
×
632
          }
633
          this.extraParams.put(key, value);
×
634
          return this;
×
635
        }
636

637
        /**
638
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
639
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
640
         * map. See {@link InvoiceCreatePreviewParams.AutomaticTax.Liability#extraParams} for the
641
         * field documentation.
642
         */
643
        public Builder putAllExtraParam(Map<String, Object> map) {
644
          if (this.extraParams == null) {
×
645
            this.extraParams = new HashMap<>();
×
646
          }
647
          this.extraParams.putAll(map);
×
648
          return this;
×
649
        }
650

651
        /** <strong>Required.</strong> Type of the account referenced in the request. */
652
        public Builder setType(InvoiceCreatePreviewParams.AutomaticTax.Liability.Type type) {
653
          this.type = type;
×
654
          return this;
×
655
        }
656
      }
657

658
      public enum Type implements ApiRequestParams.EnumParam {
×
659
        @SerializedName("account")
×
660
        ACCOUNT("account"),
661

662
        @SerializedName("self")
×
663
        SELF("self");
664

665
        @Getter(onMethod_ = {@Override})
666
        private final String value;
667

668
        Type(String value) {
×
669
          this.value = value;
×
670
        }
×
671
      }
672
    }
673
  }
674

675
  @Getter
676
  public static class CustomerDetails {
677
    /** The customer's address. */
678
    @SerializedName("address")
679
    Object address;
680

681
    /**
682
     * Map of extra parameters for custom features not available in this client library. The content
683
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
684
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
685
     * param object. Effectively, this map is flattened to its parent instance.
686
     */
687
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
688
    Map<String, Object> extraParams;
689

690
    /** The customer's shipping information. Appears on invoices emailed to this customer. */
691
    @SerializedName("shipping")
692
    Object shipping;
693

694
    /** Tax details about the customer. */
695
    @SerializedName("tax")
696
    Tax tax;
697

698
    /** The customer's tax exemption. One of {@code none}, {@code exempt}, or {@code reverse}. */
699
    @SerializedName("tax_exempt")
700
    ApiRequestParams.EnumParam taxExempt;
701

702
    /** The customer's tax IDs. */
703
    @SerializedName("tax_ids")
704
    List<InvoiceCreatePreviewParams.CustomerDetails.TaxId> taxIds;
705

706
    private CustomerDetails(
707
        Object address,
708
        Map<String, Object> extraParams,
709
        Object shipping,
710
        Tax tax,
711
        ApiRequestParams.EnumParam taxExempt,
712
        List<InvoiceCreatePreviewParams.CustomerDetails.TaxId> taxIds) {
×
713
      this.address = address;
×
714
      this.extraParams = extraParams;
×
715
      this.shipping = shipping;
×
716
      this.tax = tax;
×
717
      this.taxExempt = taxExempt;
×
718
      this.taxIds = taxIds;
×
719
    }
×
720

721
    public static Builder builder() {
722
      return new Builder();
×
723
    }
724

725
    public static class Builder {
×
726
      private Object address;
727

728
      private Map<String, Object> extraParams;
729

730
      private Object shipping;
731

732
      private Tax tax;
733

734
      private ApiRequestParams.EnumParam taxExempt;
735

736
      private List<InvoiceCreatePreviewParams.CustomerDetails.TaxId> taxIds;
737

738
      /** Finalize and obtain parameter instance from this builder. */
739
      public InvoiceCreatePreviewParams.CustomerDetails build() {
740
        return new InvoiceCreatePreviewParams.CustomerDetails(
×
741
            this.address, this.extraParams, this.shipping, this.tax, this.taxExempt, this.taxIds);
742
      }
743

744
      /** The customer's address. */
745
      public Builder setAddress(InvoiceCreatePreviewParams.CustomerDetails.Address address) {
746
        this.address = address;
×
747
        return this;
×
748
      }
749

750
      /** The customer's address. */
751
      public Builder setAddress(EmptyParam address) {
752
        this.address = address;
×
753
        return this;
×
754
      }
755

756
      /**
757
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
758
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
759
       * InvoiceCreatePreviewParams.CustomerDetails#extraParams} for the field documentation.
760
       */
761
      public Builder putExtraParam(String key, Object value) {
762
        if (this.extraParams == null) {
×
763
          this.extraParams = new HashMap<>();
×
764
        }
765
        this.extraParams.put(key, value);
×
766
        return this;
×
767
      }
768

769
      /**
770
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
771
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
772
       * See {@link InvoiceCreatePreviewParams.CustomerDetails#extraParams} for the field
773
       * documentation.
774
       */
775
      public Builder putAllExtraParam(Map<String, Object> map) {
776
        if (this.extraParams == null) {
×
777
          this.extraParams = new HashMap<>();
×
778
        }
779
        this.extraParams.putAll(map);
×
780
        return this;
×
781
      }
782

783
      /** The customer's shipping information. Appears on invoices emailed to this customer. */
784
      public Builder setShipping(InvoiceCreatePreviewParams.CustomerDetails.Shipping shipping) {
785
        this.shipping = shipping;
×
786
        return this;
×
787
      }
788

789
      /** The customer's shipping information. Appears on invoices emailed to this customer. */
790
      public Builder setShipping(EmptyParam shipping) {
791
        this.shipping = shipping;
×
792
        return this;
×
793
      }
794

795
      /** Tax details about the customer. */
796
      public Builder setTax(InvoiceCreatePreviewParams.CustomerDetails.Tax tax) {
797
        this.tax = tax;
×
798
        return this;
×
799
      }
800

801
      /** The customer's tax exemption. One of {@code none}, {@code exempt}, or {@code reverse}. */
802
      public Builder setTaxExempt(InvoiceCreatePreviewParams.CustomerDetails.TaxExempt taxExempt) {
803
        this.taxExempt = taxExempt;
×
804
        return this;
×
805
      }
806

807
      /** The customer's tax exemption. One of {@code none}, {@code exempt}, or {@code reverse}. */
808
      public Builder setTaxExempt(EmptyParam taxExempt) {
809
        this.taxExempt = taxExempt;
×
810
        return this;
×
811
      }
812

813
      /**
814
       * Add an element to `taxIds` list. A list is initialized for the first `add/addAll` call, and
815
       * subsequent calls adds additional elements to the original list. See {@link
816
       * InvoiceCreatePreviewParams.CustomerDetails#taxIds} for the field documentation.
817
       */
818
      public Builder addTaxId(InvoiceCreatePreviewParams.CustomerDetails.TaxId element) {
819
        if (this.taxIds == null) {
×
820
          this.taxIds = new ArrayList<>();
×
821
        }
822
        this.taxIds.add(element);
×
823
        return this;
×
824
      }
825

826
      /**
827
       * Add all elements to `taxIds` list. A list is initialized for the first `add/addAll` call,
828
       * and subsequent calls adds additional elements to the original list. See {@link
829
       * InvoiceCreatePreviewParams.CustomerDetails#taxIds} for the field documentation.
830
       */
831
      public Builder addAllTaxId(List<InvoiceCreatePreviewParams.CustomerDetails.TaxId> elements) {
832
        if (this.taxIds == null) {
×
833
          this.taxIds = new ArrayList<>();
×
834
        }
835
        this.taxIds.addAll(elements);
×
836
        return this;
×
837
      }
838
    }
839

840
    @Getter
841
    public static class Address {
842
      /** City, district, suburb, town, or village. */
843
      @SerializedName("city")
844
      String city;
845

846
      /**
847
       * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO
848
       * 3166-1 alpha-2</a>).
849
       */
850
      @SerializedName("country")
851
      String country;
852

853
      /**
854
       * Map of extra parameters for custom features not available in this client library. The
855
       * content in this map is not serialized under this field's {@code @SerializedName} value.
856
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
857
       * name in this param object. Effectively, this map is flattened to its parent instance.
858
       */
859
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
860
      Map<String, Object> extraParams;
861

862
      /** Address line 1 (e.g., street, PO Box, or company name). */
863
      @SerializedName("line1")
864
      String line1;
865

866
      /** Address line 2 (e.g., apartment, suite, unit, or building). */
867
      @SerializedName("line2")
868
      String line2;
869

870
      /** ZIP or postal code. */
871
      @SerializedName("postal_code")
872
      String postalCode;
873

874
      /** State, county, province, or region. */
875
      @SerializedName("state")
876
      String state;
877

878
      private Address(
879
          String city,
880
          String country,
881
          Map<String, Object> extraParams,
882
          String line1,
883
          String line2,
884
          String postalCode,
885
          String state) {
×
886
        this.city = city;
×
887
        this.country = country;
×
888
        this.extraParams = extraParams;
×
889
        this.line1 = line1;
×
890
        this.line2 = line2;
×
891
        this.postalCode = postalCode;
×
892
        this.state = state;
×
893
      }
×
894

895
      public static Builder builder() {
896
        return new Builder();
×
897
      }
898

899
      public static class Builder {
×
900
        private String city;
901

902
        private String country;
903

904
        private Map<String, Object> extraParams;
905

906
        private String line1;
907

908
        private String line2;
909

910
        private String postalCode;
911

912
        private String state;
913

914
        /** Finalize and obtain parameter instance from this builder. */
915
        public InvoiceCreatePreviewParams.CustomerDetails.Address build() {
916
          return new InvoiceCreatePreviewParams.CustomerDetails.Address(
×
917
              this.city,
918
              this.country,
919
              this.extraParams,
920
              this.line1,
921
              this.line2,
922
              this.postalCode,
923
              this.state);
924
        }
925

926
        /** City, district, suburb, town, or village. */
927
        public Builder setCity(String city) {
928
          this.city = city;
×
929
          return this;
×
930
        }
931

932
        /**
933
         * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO
934
         * 3166-1 alpha-2</a>).
935
         */
936
        public Builder setCountry(String country) {
937
          this.country = country;
×
938
          return this;
×
939
        }
940

941
        /**
942
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
943
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
944
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Address#extraParams} for the
945
         * field documentation.
946
         */
947
        public Builder putExtraParam(String key, Object value) {
948
          if (this.extraParams == null) {
×
949
            this.extraParams = new HashMap<>();
×
950
          }
951
          this.extraParams.put(key, value);
×
952
          return this;
×
953
        }
954

955
        /**
956
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
957
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
958
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Address#extraParams} for the
959
         * field documentation.
960
         */
961
        public Builder putAllExtraParam(Map<String, Object> map) {
962
          if (this.extraParams == null) {
×
963
            this.extraParams = new HashMap<>();
×
964
          }
965
          this.extraParams.putAll(map);
×
966
          return this;
×
967
        }
968

969
        /** Address line 1 (e.g., street, PO Box, or company name). */
970
        public Builder setLine1(String line1) {
971
          this.line1 = line1;
×
972
          return this;
×
973
        }
974

975
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
976
        public Builder setLine2(String line2) {
977
          this.line2 = line2;
×
978
          return this;
×
979
        }
980

981
        /** ZIP or postal code. */
982
        public Builder setPostalCode(String postalCode) {
983
          this.postalCode = postalCode;
×
984
          return this;
×
985
        }
986

987
        /** State, county, province, or region. */
988
        public Builder setState(String state) {
989
          this.state = state;
×
990
          return this;
×
991
        }
992
      }
993
    }
994

995
    @Getter
996
    public static class Shipping {
997
      /** <strong>Required.</strong> Customer shipping address. */
998
      @SerializedName("address")
999
      Address address;
1000

1001
      /**
1002
       * Map of extra parameters for custom features not available in this client library. The
1003
       * content in this map is not serialized under this field's {@code @SerializedName} value.
1004
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
1005
       * name in this param object. Effectively, this map is flattened to its parent instance.
1006
       */
1007
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1008
      Map<String, Object> extraParams;
1009

1010
      /** <strong>Required.</strong> Customer name. */
1011
      @SerializedName("name")
1012
      String name;
1013

1014
      /** Customer phone (including extension). */
1015
      @SerializedName("phone")
1016
      String phone;
1017

1018
      private Shipping(
1019
          Address address, Map<String, Object> extraParams, String name, String phone) {
×
1020
        this.address = address;
×
1021
        this.extraParams = extraParams;
×
1022
        this.name = name;
×
1023
        this.phone = phone;
×
1024
      }
×
1025

1026
      public static Builder builder() {
1027
        return new Builder();
×
1028
      }
1029

1030
      public static class Builder {
×
1031
        private Address address;
1032

1033
        private Map<String, Object> extraParams;
1034

1035
        private String name;
1036

1037
        private String phone;
1038

1039
        /** Finalize and obtain parameter instance from this builder. */
1040
        public InvoiceCreatePreviewParams.CustomerDetails.Shipping build() {
1041
          return new InvoiceCreatePreviewParams.CustomerDetails.Shipping(
×
1042
              this.address, this.extraParams, this.name, this.phone);
1043
        }
1044

1045
        /** <strong>Required.</strong> Customer shipping address. */
1046
        public Builder setAddress(
1047
            InvoiceCreatePreviewParams.CustomerDetails.Shipping.Address address) {
1048
          this.address = address;
×
1049
          return this;
×
1050
        }
1051

1052
        /**
1053
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
1054
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1055
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Shipping#extraParams} for the
1056
         * field documentation.
1057
         */
1058
        public Builder putExtraParam(String key, Object value) {
1059
          if (this.extraParams == null) {
×
1060
            this.extraParams = new HashMap<>();
×
1061
          }
1062
          this.extraParams.put(key, value);
×
1063
          return this;
×
1064
        }
1065

1066
        /**
1067
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1068
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1069
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Shipping#extraParams} for the
1070
         * field documentation.
1071
         */
1072
        public Builder putAllExtraParam(Map<String, Object> map) {
1073
          if (this.extraParams == null) {
×
1074
            this.extraParams = new HashMap<>();
×
1075
          }
1076
          this.extraParams.putAll(map);
×
1077
          return this;
×
1078
        }
1079

1080
        /** <strong>Required.</strong> Customer name. */
1081
        public Builder setName(String name) {
1082
          this.name = name;
×
1083
          return this;
×
1084
        }
1085

1086
        /** Customer phone (including extension). */
1087
        public Builder setPhone(String phone) {
1088
          this.phone = phone;
×
1089
          return this;
×
1090
        }
1091
      }
1092

1093
      @Getter
1094
      public static class Address {
1095
        /** City, district, suburb, town, or village. */
1096
        @SerializedName("city")
1097
        String city;
1098

1099
        /**
1100
         * A freeform text field for the country. However, in order to activate some tax features,
1101
         * the format should be a two-letter country code (<a
1102
         * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1103
         */
1104
        @SerializedName("country")
1105
        String country;
1106

1107
        /**
1108
         * Map of extra parameters for custom features not available in this client library. The
1109
         * content in this map is not serialized under this field's {@code @SerializedName} value.
1110
         * Instead, each key/value pair is serialized as if the key is a root-level field
1111
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
1112
         * instance.
1113
         */
1114
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1115
        Map<String, Object> extraParams;
1116

1117
        /** Address line 1 (e.g., street, PO Box, or company name). */
1118
        @SerializedName("line1")
1119
        String line1;
1120

1121
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1122
        @SerializedName("line2")
1123
        String line2;
1124

1125
        /** ZIP or postal code. */
1126
        @SerializedName("postal_code")
1127
        String postalCode;
1128

1129
        /** State, county, province, or region. */
1130
        @SerializedName("state")
1131
        String state;
1132

1133
        private Address(
1134
            String city,
1135
            String country,
1136
            Map<String, Object> extraParams,
1137
            String line1,
1138
            String line2,
1139
            String postalCode,
1140
            String state) {
×
1141
          this.city = city;
×
1142
          this.country = country;
×
1143
          this.extraParams = extraParams;
×
1144
          this.line1 = line1;
×
1145
          this.line2 = line2;
×
1146
          this.postalCode = postalCode;
×
1147
          this.state = state;
×
1148
        }
×
1149

1150
        public static Builder builder() {
1151
          return new Builder();
×
1152
        }
1153

1154
        public static class Builder {
×
1155
          private String city;
1156

1157
          private String country;
1158

1159
          private Map<String, Object> extraParams;
1160

1161
          private String line1;
1162

1163
          private String line2;
1164

1165
          private String postalCode;
1166

1167
          private String state;
1168

1169
          /** Finalize and obtain parameter instance from this builder. */
1170
          public InvoiceCreatePreviewParams.CustomerDetails.Shipping.Address build() {
1171
            return new InvoiceCreatePreviewParams.CustomerDetails.Shipping.Address(
×
1172
                this.city,
1173
                this.country,
1174
                this.extraParams,
1175
                this.line1,
1176
                this.line2,
1177
                this.postalCode,
1178
                this.state);
1179
          }
1180

1181
          /** City, district, suburb, town, or village. */
1182
          public Builder setCity(String city) {
1183
            this.city = city;
×
1184
            return this;
×
1185
          }
1186

1187
          /**
1188
           * A freeform text field for the country. However, in order to activate some tax features,
1189
           * the format should be a two-letter country code (<a
1190
           * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1191
           */
1192
          public Builder setCountry(String country) {
1193
            this.country = country;
×
1194
            return this;
×
1195
          }
1196

1197
          /**
1198
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
1199
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1200
           * map. See {@link
1201
           * InvoiceCreatePreviewParams.CustomerDetails.Shipping.Address#extraParams} for the field
1202
           * documentation.
1203
           */
1204
          public Builder putExtraParam(String key, Object value) {
1205
            if (this.extraParams == null) {
×
1206
              this.extraParams = new HashMap<>();
×
1207
            }
1208
            this.extraParams.put(key, value);
×
1209
            return this;
×
1210
          }
1211

1212
          /**
1213
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1214
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1215
           * map. See {@link
1216
           * InvoiceCreatePreviewParams.CustomerDetails.Shipping.Address#extraParams} for the field
1217
           * documentation.
1218
           */
1219
          public Builder putAllExtraParam(Map<String, Object> map) {
1220
            if (this.extraParams == null) {
×
1221
              this.extraParams = new HashMap<>();
×
1222
            }
1223
            this.extraParams.putAll(map);
×
1224
            return this;
×
1225
          }
1226

1227
          /** Address line 1 (e.g., street, PO Box, or company name). */
1228
          public Builder setLine1(String line1) {
1229
            this.line1 = line1;
×
1230
            return this;
×
1231
          }
1232

1233
          /** Address line 2 (e.g., apartment, suite, unit, or building). */
1234
          public Builder setLine2(String line2) {
1235
            this.line2 = line2;
×
1236
            return this;
×
1237
          }
1238

1239
          /** ZIP or postal code. */
1240
          public Builder setPostalCode(String postalCode) {
1241
            this.postalCode = postalCode;
×
1242
            return this;
×
1243
          }
1244

1245
          /** State, county, province, or region. */
1246
          public Builder setState(String state) {
1247
            this.state = state;
×
1248
            return this;
×
1249
          }
1250
        }
1251
      }
1252
    }
1253

1254
    @Getter
1255
    public static class Tax {
1256
      /**
1257
       * Map of extra parameters for custom features not available in this client library. The
1258
       * content in this map is not serialized under this field's {@code @SerializedName} value.
1259
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
1260
       * name in this param object. Effectively, this map is flattened to its parent instance.
1261
       */
1262
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1263
      Map<String, Object> extraParams;
1264

1265
      /**
1266
       * A recent IP address of the customer used for tax reporting and tax location inference.
1267
       * Stripe recommends updating the IP address when a new PaymentMethod is attached or the
1268
       * address field on the customer is updated. We recommend against updating this field more
1269
       * frequently since it could result in unexpected tax location/reporting outcomes.
1270
       */
1271
      @SerializedName("ip_address")
1272
      Object ipAddress;
1273

1274
      private Tax(Map<String, Object> extraParams, Object ipAddress) {
×
1275
        this.extraParams = extraParams;
×
1276
        this.ipAddress = ipAddress;
×
1277
      }
×
1278

1279
      public static Builder builder() {
1280
        return new Builder();
×
1281
      }
1282

1283
      public static class Builder {
×
1284
        private Map<String, Object> extraParams;
1285

1286
        private Object ipAddress;
1287

1288
        /** Finalize and obtain parameter instance from this builder. */
1289
        public InvoiceCreatePreviewParams.CustomerDetails.Tax build() {
1290
          return new InvoiceCreatePreviewParams.CustomerDetails.Tax(
×
1291
              this.extraParams, this.ipAddress);
1292
        }
1293

1294
        /**
1295
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
1296
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1297
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Tax#extraParams} for the field
1298
         * documentation.
1299
         */
1300
        public Builder putExtraParam(String key, Object value) {
1301
          if (this.extraParams == null) {
×
1302
            this.extraParams = new HashMap<>();
×
1303
          }
1304
          this.extraParams.put(key, value);
×
1305
          return this;
×
1306
        }
1307

1308
        /**
1309
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1310
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1311
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.Tax#extraParams} for the field
1312
         * documentation.
1313
         */
1314
        public Builder putAllExtraParam(Map<String, Object> map) {
1315
          if (this.extraParams == null) {
×
1316
            this.extraParams = new HashMap<>();
×
1317
          }
1318
          this.extraParams.putAll(map);
×
1319
          return this;
×
1320
        }
1321

1322
        /**
1323
         * A recent IP address of the customer used for tax reporting and tax location inference.
1324
         * Stripe recommends updating the IP address when a new PaymentMethod is attached or the
1325
         * address field on the customer is updated. We recommend against updating this field more
1326
         * frequently since it could result in unexpected tax location/reporting outcomes.
1327
         */
1328
        public Builder setIpAddress(String ipAddress) {
1329
          this.ipAddress = ipAddress;
×
1330
          return this;
×
1331
        }
1332

1333
        /**
1334
         * A recent IP address of the customer used for tax reporting and tax location inference.
1335
         * Stripe recommends updating the IP address when a new PaymentMethod is attached or the
1336
         * address field on the customer is updated. We recommend against updating this field more
1337
         * frequently since it could result in unexpected tax location/reporting outcomes.
1338
         */
1339
        public Builder setIpAddress(EmptyParam ipAddress) {
1340
          this.ipAddress = ipAddress;
×
1341
          return this;
×
1342
        }
1343
      }
1344
    }
1345

1346
    @Getter
1347
    public static class TaxId {
1348
      /**
1349
       * Map of extra parameters for custom features not available in this client library. The
1350
       * content in this map is not serialized under this field's {@code @SerializedName} value.
1351
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
1352
       * name in this param object. Effectively, this map is flattened to its parent instance.
1353
       */
1354
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1355
      Map<String, Object> extraParams;
1356

1357
      /**
1358
       * <strong>Required.</strong> Type of the tax ID, one of {@code ad_nrt}, {@code ae_trn},
1359
       * {@code al_tin}, {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code
1360
       * au_arn}, {@code ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin},
1361
       * {@code br_cnpj}, {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code
1362
       * ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst},
1363
       * {@code cd_nif}, {@code ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code
1364
       * co_nit}, {@code cr_tin}, {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin},
1365
       * {@code es_cif}, {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code
1366
       * gn_nif}, {@code hk_br}, {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code il_vat},
1367
       * {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code
1368
       * ke_pin}, {@code kh_tin}, {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code li_vat},
1369
       * {@code ma_vat}, {@code md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif}, {@code
1370
       * mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code no_vat},
1371
       * {@code no_voec}, {@code np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc}, {@code
1372
       * ph_tin}, {@code ro_tin}, {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat},
1373
       * {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code sr_fin}, {@code
1374
       * sv_nit}, {@code th_vat}, {@code tj_tin}, {@code tr_tin}, {@code tw_vat}, {@code tz_vat},
1375
       * {@code ua_vat}, {@code ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code uz_tin}, {@code
1376
       * uz_vat}, {@code ve_rif}, {@code vn_tin}, {@code za_vat}, {@code zm_tin}, or {@code zw_tin}
1377
       */
1378
      @SerializedName("type")
1379
      Type type;
1380

1381
      /** <strong>Required.</strong> Value of the tax ID. */
1382
      @SerializedName("value")
1383
      String value;
1384

1385
      private TaxId(Map<String, Object> extraParams, Type type, String value) {
×
1386
        this.extraParams = extraParams;
×
1387
        this.type = type;
×
1388
        this.value = value;
×
1389
      }
×
1390

1391
      public static Builder builder() {
1392
        return new Builder();
×
1393
      }
1394

1395
      public static class Builder {
×
1396
        private Map<String, Object> extraParams;
1397

1398
        private Type type;
1399

1400
        private String value;
1401

1402
        /** Finalize and obtain parameter instance from this builder. */
1403
        public InvoiceCreatePreviewParams.CustomerDetails.TaxId build() {
1404
          return new InvoiceCreatePreviewParams.CustomerDetails.TaxId(
×
1405
              this.extraParams, this.type, this.value);
1406
        }
1407

1408
        /**
1409
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
1410
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1411
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.TaxId#extraParams} for the
1412
         * field documentation.
1413
         */
1414
        public Builder putExtraParam(String key, Object value) {
1415
          if (this.extraParams == null) {
×
1416
            this.extraParams = new HashMap<>();
×
1417
          }
1418
          this.extraParams.put(key, value);
×
1419
          return this;
×
1420
        }
1421

1422
        /**
1423
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1424
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1425
         * map. See {@link InvoiceCreatePreviewParams.CustomerDetails.TaxId#extraParams} for the
1426
         * field documentation.
1427
         */
1428
        public Builder putAllExtraParam(Map<String, Object> map) {
1429
          if (this.extraParams == null) {
×
1430
            this.extraParams = new HashMap<>();
×
1431
          }
1432
          this.extraParams.putAll(map);
×
1433
          return this;
×
1434
        }
1435

1436
        /**
1437
         * <strong>Required.</strong> Type of the tax ID, one of {@code ad_nrt}, {@code ae_trn},
1438
         * {@code al_tin}, {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code
1439
         * au_arn}, {@code ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin},
1440
         * {@code br_cnpj}, {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code
1441
         * ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst},
1442
         * {@code cd_nif}, {@code ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code
1443
         * co_nit}, {@code cr_tin}, {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin},
1444
         * {@code es_cif}, {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat},
1445
         * {@code gn_nif}, {@code hk_br}, {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code
1446
         * il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn},
1447
         * {@code ke_pin}, {@code kh_tin}, {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code
1448
         * li_vat}, {@code ma_vat}, {@code md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif},
1449
         * {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code
1450
         * no_vat}, {@code no_voec}, {@code np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc},
1451
         * {@code ph_tin}, {@code ro_tin}, {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code
1452
         * sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code
1453
         * sr_fin}, {@code sv_nit}, {@code th_vat}, {@code tj_tin}, {@code tr_tin}, {@code tw_vat},
1454
         * {@code tz_vat}, {@code ua_vat}, {@code ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code
1455
         * uz_tin}, {@code uz_vat}, {@code ve_rif}, {@code vn_tin}, {@code za_vat}, {@code zm_tin},
1456
         * or {@code zw_tin}
1457
         */
1458
        public Builder setType(InvoiceCreatePreviewParams.CustomerDetails.TaxId.Type type) {
1459
          this.type = type;
×
1460
          return this;
×
1461
        }
1462

1463
        /** <strong>Required.</strong> Value of the tax ID. */
1464
        public Builder setValue(String value) {
1465
          this.value = value;
×
1466
          return this;
×
1467
        }
1468
      }
1469

1470
      public enum Type implements ApiRequestParams.EnumParam {
×
1471
        @SerializedName("ad_nrt")
×
1472
        AD_NRT("ad_nrt"),
1473

1474
        @SerializedName("ae_trn")
×
1475
        AE_TRN("ae_trn"),
1476

NEW
1477
        @SerializedName("al_tin")
×
1478
        AL_TIN("al_tin"),
1479

NEW
1480
        @SerializedName("am_tin")
×
1481
        AM_TIN("am_tin"),
1482

NEW
1483
        @SerializedName("ao_tin")
×
1484
        AO_TIN("ao_tin"),
1485

UNCOV
1486
        @SerializedName("ar_cuit")
×
1487
        AR_CUIT("ar_cuit"),
1488

1489
        @SerializedName("au_abn")
×
1490
        AU_ABN("au_abn"),
1491

1492
        @SerializedName("au_arn")
×
1493
        AU_ARN("au_arn"),
1494

NEW
1495
        @SerializedName("ba_tin")
×
1496
        BA_TIN("ba_tin"),
1497

NEW
1498
        @SerializedName("bb_tin")
×
1499
        BB_TIN("bb_tin"),
1500

UNCOV
1501
        @SerializedName("bg_uic")
×
1502
        BG_UIC("bg_uic"),
1503

1504
        @SerializedName("bh_vat")
×
1505
        BH_VAT("bh_vat"),
1506

1507
        @SerializedName("bo_tin")
×
1508
        BO_TIN("bo_tin"),
1509

1510
        @SerializedName("br_cnpj")
×
1511
        BR_CNPJ("br_cnpj"),
1512

1513
        @SerializedName("br_cpf")
×
1514
        BR_CPF("br_cpf"),
1515

NEW
1516
        @SerializedName("bs_tin")
×
1517
        BS_TIN("bs_tin"),
1518

UNCOV
1519
        @SerializedName("by_tin")
×
1520
        BY_TIN("by_tin"),
1521

1522
        @SerializedName("ca_bn")
×
1523
        CA_BN("ca_bn"),
1524

1525
        @SerializedName("ca_gst_hst")
×
1526
        CA_GST_HST("ca_gst_hst"),
1527

1528
        @SerializedName("ca_pst_bc")
×
1529
        CA_PST_BC("ca_pst_bc"),
1530

1531
        @SerializedName("ca_pst_mb")
×
1532
        CA_PST_MB("ca_pst_mb"),
1533

1534
        @SerializedName("ca_pst_sk")
×
1535
        CA_PST_SK("ca_pst_sk"),
1536

1537
        @SerializedName("ca_qst")
×
1538
        CA_QST("ca_qst"),
1539

NEW
1540
        @SerializedName("cd_nif")
×
1541
        CD_NIF("cd_nif"),
1542

UNCOV
1543
        @SerializedName("ch_uid")
×
1544
        CH_UID("ch_uid"),
1545

1546
        @SerializedName("ch_vat")
×
1547
        CH_VAT("ch_vat"),
1548

1549
        @SerializedName("cl_tin")
×
1550
        CL_TIN("cl_tin"),
1551

1552
        @SerializedName("cn_tin")
×
1553
        CN_TIN("cn_tin"),
1554

1555
        @SerializedName("co_nit")
×
1556
        CO_NIT("co_nit"),
1557

1558
        @SerializedName("cr_tin")
×
1559
        CR_TIN("cr_tin"),
1560

1561
        @SerializedName("de_stn")
×
1562
        DE_STN("de_stn"),
1563

1564
        @SerializedName("do_rcn")
×
1565
        DO_RCN("do_rcn"),
1566

1567
        @SerializedName("ec_ruc")
×
1568
        EC_RUC("ec_ruc"),
1569

1570
        @SerializedName("eg_tin")
×
1571
        EG_TIN("eg_tin"),
1572

1573
        @SerializedName("es_cif")
×
1574
        ES_CIF("es_cif"),
1575

1576
        @SerializedName("eu_oss_vat")
×
1577
        EU_OSS_VAT("eu_oss_vat"),
1578

1579
        @SerializedName("eu_vat")
×
1580
        EU_VAT("eu_vat"),
1581

1582
        @SerializedName("gb_vat")
×
1583
        GB_VAT("gb_vat"),
1584

1585
        @SerializedName("ge_vat")
×
1586
        GE_VAT("ge_vat"),
1587

NEW
1588
        @SerializedName("gn_nif")
×
1589
        GN_NIF("gn_nif"),
1590

UNCOV
1591
        @SerializedName("hk_br")
×
1592
        HK_BR("hk_br"),
1593

1594
        @SerializedName("hr_oib")
×
1595
        HR_OIB("hr_oib"),
1596

1597
        @SerializedName("hu_tin")
×
1598
        HU_TIN("hu_tin"),
1599

1600
        @SerializedName("id_npwp")
×
1601
        ID_NPWP("id_npwp"),
1602

1603
        @SerializedName("il_vat")
×
1604
        IL_VAT("il_vat"),
1605

1606
        @SerializedName("in_gst")
×
1607
        IN_GST("in_gst"),
1608

1609
        @SerializedName("is_vat")
×
1610
        IS_VAT("is_vat"),
1611

1612
        @SerializedName("jp_cn")
×
1613
        JP_CN("jp_cn"),
1614

1615
        @SerializedName("jp_rn")
×
1616
        JP_RN("jp_rn"),
1617

1618
        @SerializedName("jp_trn")
×
1619
        JP_TRN("jp_trn"),
1620

1621
        @SerializedName("ke_pin")
×
1622
        KE_PIN("ke_pin"),
1623

NEW
1624
        @SerializedName("kh_tin")
×
1625
        KH_TIN("kh_tin"),
1626

UNCOV
1627
        @SerializedName("kr_brn")
×
1628
        KR_BRN("kr_brn"),
1629

1630
        @SerializedName("kz_bin")
×
1631
        KZ_BIN("kz_bin"),
1632

1633
        @SerializedName("li_uid")
×
1634
        LI_UID("li_uid"),
1635

1636
        @SerializedName("li_vat")
×
1637
        LI_VAT("li_vat"),
1638

1639
        @SerializedName("ma_vat")
×
1640
        MA_VAT("ma_vat"),
1641

1642
        @SerializedName("md_vat")
×
1643
        MD_VAT("md_vat"),
1644

NEW
1645
        @SerializedName("me_pib")
×
1646
        ME_PIB("me_pib"),
1647

NEW
1648
        @SerializedName("mk_vat")
×
1649
        MK_VAT("mk_vat"),
1650

NEW
1651
        @SerializedName("mr_nif")
×
1652
        MR_NIF("mr_nif"),
1653

UNCOV
1654
        @SerializedName("mx_rfc")
×
1655
        MX_RFC("mx_rfc"),
1656

1657
        @SerializedName("my_frp")
×
1658
        MY_FRP("my_frp"),
1659

1660
        @SerializedName("my_itn")
×
1661
        MY_ITN("my_itn"),
1662

1663
        @SerializedName("my_sst")
×
1664
        MY_SST("my_sst"),
1665

1666
        @SerializedName("ng_tin")
×
1667
        NG_TIN("ng_tin"),
1668

1669
        @SerializedName("no_vat")
×
1670
        NO_VAT("no_vat"),
1671

1672
        @SerializedName("no_voec")
×
1673
        NO_VOEC("no_voec"),
1674

NEW
1675
        @SerializedName("np_pan")
×
1676
        NP_PAN("np_pan"),
1677

UNCOV
1678
        @SerializedName("nz_gst")
×
1679
        NZ_GST("nz_gst"),
1680

1681
        @SerializedName("om_vat")
×
1682
        OM_VAT("om_vat"),
1683

1684
        @SerializedName("pe_ruc")
×
1685
        PE_RUC("pe_ruc"),
1686

1687
        @SerializedName("ph_tin")
×
1688
        PH_TIN("ph_tin"),
1689

1690
        @SerializedName("ro_tin")
×
1691
        RO_TIN("ro_tin"),
1692

1693
        @SerializedName("rs_pib")
×
1694
        RS_PIB("rs_pib"),
1695

1696
        @SerializedName("ru_inn")
×
1697
        RU_INN("ru_inn"),
1698

1699
        @SerializedName("ru_kpp")
×
1700
        RU_KPP("ru_kpp"),
1701

1702
        @SerializedName("sa_vat")
×
1703
        SA_VAT("sa_vat"),
1704

1705
        @SerializedName("sg_gst")
×
1706
        SG_GST("sg_gst"),
1707

1708
        @SerializedName("sg_uen")
×
1709
        SG_UEN("sg_uen"),
1710

1711
        @SerializedName("si_tin")
×
1712
        SI_TIN("si_tin"),
1713

NEW
1714
        @SerializedName("sn_ninea")
×
1715
        SN_NINEA("sn_ninea"),
1716

NEW
1717
        @SerializedName("sr_fin")
×
1718
        SR_FIN("sr_fin"),
1719

UNCOV
1720
        @SerializedName("sv_nit")
×
1721
        SV_NIT("sv_nit"),
1722

1723
        @SerializedName("th_vat")
×
1724
        TH_VAT("th_vat"),
1725

NEW
1726
        @SerializedName("tj_tin")
×
1727
        TJ_TIN("tj_tin"),
1728

UNCOV
1729
        @SerializedName("tr_tin")
×
1730
        TR_TIN("tr_tin"),
1731

1732
        @SerializedName("tw_vat")
×
1733
        TW_VAT("tw_vat"),
1734

1735
        @SerializedName("tz_vat")
×
1736
        TZ_VAT("tz_vat"),
1737

1738
        @SerializedName("ua_vat")
×
1739
        UA_VAT("ua_vat"),
1740

NEW
1741
        @SerializedName("ug_tin")
×
1742
        UG_TIN("ug_tin"),
1743

UNCOV
1744
        @SerializedName("us_ein")
×
1745
        US_EIN("us_ein"),
1746

1747
        @SerializedName("uy_ruc")
×
1748
        UY_RUC("uy_ruc"),
1749

1750
        @SerializedName("uz_tin")
×
1751
        UZ_TIN("uz_tin"),
1752

1753
        @SerializedName("uz_vat")
×
1754
        UZ_VAT("uz_vat"),
1755

1756
        @SerializedName("ve_rif")
×
1757
        VE_RIF("ve_rif"),
1758

1759
        @SerializedName("vn_tin")
×
1760
        VN_TIN("vn_tin"),
1761

1762
        @SerializedName("za_vat")
×
1763
        ZA_VAT("za_vat"),
1764

NEW
1765
        @SerializedName("zm_tin")
×
1766
        ZM_TIN("zm_tin"),
1767

NEW
1768
        @SerializedName("zw_tin")
×
1769
        ZW_TIN("zw_tin");
1770

1771
        @Getter(onMethod_ = {@Override})
1772
        private final String value;
1773

1774
        Type(String value) {
×
1775
          this.value = value;
×
1776
        }
×
1777
      }
1778
    }
1779

1780
    public enum TaxExempt implements ApiRequestParams.EnumParam {
×
1781
      @SerializedName("exempt")
×
1782
      EXEMPT("exempt"),
1783

1784
      @SerializedName("none")
×
1785
      NONE("none"),
1786

1787
      @SerializedName("reverse")
×
1788
      REVERSE("reverse");
1789

1790
      @Getter(onMethod_ = {@Override})
1791
      private final String value;
1792

1793
      TaxExempt(String value) {
×
1794
        this.value = value;
×
1795
      }
×
1796
    }
1797
  }
1798

1799
  @Getter
1800
  public static class Discount {
1801
    /** ID of the coupon to create a new discount for. */
1802
    @SerializedName("coupon")
1803
    String coupon;
1804

1805
    /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
1806
    @SerializedName("discount")
1807
    String discount;
1808

1809
    /**
1810
     * Map of extra parameters for custom features not available in this client library. The content
1811
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1812
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1813
     * param object. Effectively, this map is flattened to its parent instance.
1814
     */
1815
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1816
    Map<String, Object> extraParams;
1817

1818
    /** ID of the promotion code to create a new discount for. */
1819
    @SerializedName("promotion_code")
1820
    String promotionCode;
1821

1822
    private Discount(
1823
        String coupon, String discount, Map<String, Object> extraParams, String promotionCode) {
×
1824
      this.coupon = coupon;
×
1825
      this.discount = discount;
×
1826
      this.extraParams = extraParams;
×
1827
      this.promotionCode = promotionCode;
×
1828
    }
×
1829

1830
    public static Builder builder() {
1831
      return new Builder();
×
1832
    }
1833

1834
    public static class Builder {
×
1835
      private String coupon;
1836

1837
      private String discount;
1838

1839
      private Map<String, Object> extraParams;
1840

1841
      private String promotionCode;
1842

1843
      /** Finalize and obtain parameter instance from this builder. */
1844
      public InvoiceCreatePreviewParams.Discount build() {
1845
        return new InvoiceCreatePreviewParams.Discount(
×
1846
            this.coupon, this.discount, this.extraParams, this.promotionCode);
1847
      }
1848

1849
      /** ID of the coupon to create a new discount for. */
1850
      public Builder setCoupon(String coupon) {
1851
        this.coupon = coupon;
×
1852
        return this;
×
1853
      }
1854

1855
      /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
1856
      public Builder setDiscount(String discount) {
1857
        this.discount = discount;
×
1858
        return this;
×
1859
      }
1860

1861
      /**
1862
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1863
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1864
       * InvoiceCreatePreviewParams.Discount#extraParams} for the field documentation.
1865
       */
1866
      public Builder putExtraParam(String key, Object value) {
1867
        if (this.extraParams == null) {
×
1868
          this.extraParams = new HashMap<>();
×
1869
        }
1870
        this.extraParams.put(key, value);
×
1871
        return this;
×
1872
      }
1873

1874
      /**
1875
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1876
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1877
       * See {@link InvoiceCreatePreviewParams.Discount#extraParams} for the field documentation.
1878
       */
1879
      public Builder putAllExtraParam(Map<String, Object> map) {
1880
        if (this.extraParams == null) {
×
1881
          this.extraParams = new HashMap<>();
×
1882
        }
1883
        this.extraParams.putAll(map);
×
1884
        return this;
×
1885
      }
1886

1887
      /** ID of the promotion code to create a new discount for. */
1888
      public Builder setPromotionCode(String promotionCode) {
1889
        this.promotionCode = promotionCode;
×
1890
        return this;
×
1891
      }
1892
    }
1893
  }
1894

1895
  @Getter
1896
  public static class InvoiceItem {
1897
    /** The integer amount in cents (or local equivalent) of previewed invoice item. */
1898
    @SerializedName("amount")
1899
    Long amount;
1900

1901
    /**
1902
     * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
1903
     * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
1904
     * currency</a>. Only applicable to new invoice items.
1905
     */
1906
    @SerializedName("currency")
1907
    String currency;
1908

1909
    /**
1910
     * An arbitrary string which you can attach to the invoice item. The description is displayed in
1911
     * the invoice for easy tracking.
1912
     */
1913
    @SerializedName("description")
1914
    String description;
1915

1916
    /**
1917
     * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except
1918
     * for negative invoice items.
1919
     */
1920
    @SerializedName("discountable")
1921
    Boolean discountable;
1922

1923
    /** The coupons to redeem into discounts for the invoice item in the preview. */
1924
    @SerializedName("discounts")
1925
    Object discounts;
1926

1927
    /**
1928
     * Map of extra parameters for custom features not available in this client library. The content
1929
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1930
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1931
     * param object. Effectively, this map is flattened to its parent instance.
1932
     */
1933
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1934
    Map<String, Object> extraParams;
1935

1936
    /**
1937
     * The ID of the invoice item to update in preview. If not specified, a new invoice item will be
1938
     * added to the preview of the upcoming invoice.
1939
     */
1940
    @SerializedName("invoiceitem")
1941
    String invoiceitem;
1942

1943
    /**
1944
     * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
1945
     * to an object. This can be useful for storing additional information about the object in a
1946
     * structured format. Individual keys can be unset by posting an empty value to them. All keys
1947
     * can be unset by posting an empty value to {@code metadata}.
1948
     */
1949
    @SerializedName("metadata")
1950
    Object metadata;
1951

1952
    /**
1953
     * The period associated with this invoice item. When set to different values, the period will
1954
     * be rendered on the invoice. If you have <a
1955
     * href="https://stripe.com/docs/revenue-recognition">Stripe Revenue Recognition</a> enabled,
1956
     * the period will be used to recognize and defer revenue. See the <a
1957
     * href="https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing">Revenue
1958
     * Recognition documentation</a> for details.
1959
     */
1960
    @SerializedName("period")
1961
    Period period;
1962

1963
    /** The ID of the price object. One of {@code price} or {@code price_data} is required. */
1964
    @SerializedName("price")
1965
    String price;
1966

1967
    /**
1968
     * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
1969
     * inline. One of {@code price} or {@code price_data} is required.
1970
     */
1971
    @SerializedName("price_data")
1972
    PriceData priceData;
1973

1974
    /** Non-negative integer. The quantity of units for the invoice item. */
1975
    @SerializedName("quantity")
1976
    Long quantity;
1977

1978
    /**
1979
     * Only required if a <a
1980
     * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
1981
     * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the price is
1982
     * considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
1983
     * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
1984
     * exclusive}, it cannot be changed.
1985
     */
1986
    @SerializedName("tax_behavior")
1987
    TaxBehavior taxBehavior;
1988

1989
    /** A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. */
1990
    @SerializedName("tax_code")
1991
    Object taxCode;
1992

1993
    /**
1994
     * The tax rates that apply to the item. When set, any {@code default_tax_rates} do not apply to
1995
     * this item.
1996
     */
1997
    @SerializedName("tax_rates")
1998
    Object taxRates;
1999

2000
    /**
2001
     * The integer unit amount in cents (or local equivalent) of the charge to be applied to the
2002
     * upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount.
2003
     * If you want to apply a credit to the customer's account, pass a negative unit_amount.
2004
     */
2005
    @SerializedName("unit_amount")
2006
    Long unitAmount;
2007

2008
    /**
2009
     * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent) with
2010
     * at most 12 decimal places. Only one of {@code unit_amount} and {@code unit_amount_decimal}
2011
     * can be set.
2012
     */
2013
    @SerializedName("unit_amount_decimal")
2014
    BigDecimal unitAmountDecimal;
2015

2016
    private InvoiceItem(
2017
        Long amount,
2018
        String currency,
2019
        String description,
2020
        Boolean discountable,
2021
        Object discounts,
2022
        Map<String, Object> extraParams,
2023
        String invoiceitem,
2024
        Object metadata,
2025
        Period period,
2026
        String price,
2027
        PriceData priceData,
2028
        Long quantity,
2029
        TaxBehavior taxBehavior,
2030
        Object taxCode,
2031
        Object taxRates,
2032
        Long unitAmount,
2033
        BigDecimal unitAmountDecimal) {
×
2034
      this.amount = amount;
×
2035
      this.currency = currency;
×
2036
      this.description = description;
×
2037
      this.discountable = discountable;
×
2038
      this.discounts = discounts;
×
2039
      this.extraParams = extraParams;
×
2040
      this.invoiceitem = invoiceitem;
×
2041
      this.metadata = metadata;
×
2042
      this.period = period;
×
2043
      this.price = price;
×
2044
      this.priceData = priceData;
×
2045
      this.quantity = quantity;
×
2046
      this.taxBehavior = taxBehavior;
×
2047
      this.taxCode = taxCode;
×
2048
      this.taxRates = taxRates;
×
2049
      this.unitAmount = unitAmount;
×
2050
      this.unitAmountDecimal = unitAmountDecimal;
×
2051
    }
×
2052

2053
    public static Builder builder() {
2054
      return new Builder();
×
2055
    }
2056

2057
    public static class Builder {
×
2058
      private Long amount;
2059

2060
      private String currency;
2061

2062
      private String description;
2063

2064
      private Boolean discountable;
2065

2066
      private Object discounts;
2067

2068
      private Map<String, Object> extraParams;
2069

2070
      private String invoiceitem;
2071

2072
      private Object metadata;
2073

2074
      private Period period;
2075

2076
      private String price;
2077

2078
      private PriceData priceData;
2079

2080
      private Long quantity;
2081

2082
      private TaxBehavior taxBehavior;
2083

2084
      private Object taxCode;
2085

2086
      private Object taxRates;
2087

2088
      private Long unitAmount;
2089

2090
      private BigDecimal unitAmountDecimal;
2091

2092
      /** Finalize and obtain parameter instance from this builder. */
2093
      public InvoiceCreatePreviewParams.InvoiceItem build() {
2094
        return new InvoiceCreatePreviewParams.InvoiceItem(
×
2095
            this.amount,
2096
            this.currency,
2097
            this.description,
2098
            this.discountable,
2099
            this.discounts,
2100
            this.extraParams,
2101
            this.invoiceitem,
2102
            this.metadata,
2103
            this.period,
2104
            this.price,
2105
            this.priceData,
2106
            this.quantity,
2107
            this.taxBehavior,
2108
            this.taxCode,
2109
            this.taxRates,
2110
            this.unitAmount,
2111
            this.unitAmountDecimal);
2112
      }
2113

2114
      /** The integer amount in cents (or local equivalent) of previewed invoice item. */
2115
      public Builder setAmount(Long amount) {
2116
        this.amount = amount;
×
2117
        return this;
×
2118
      }
2119

2120
      /**
2121
       * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
2122
       * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
2123
       * currency</a>. Only applicable to new invoice items.
2124
       */
2125
      public Builder setCurrency(String currency) {
2126
        this.currency = currency;
×
2127
        return this;
×
2128
      }
2129

2130
      /**
2131
       * An arbitrary string which you can attach to the invoice item. The description is displayed
2132
       * in the invoice for easy tracking.
2133
       */
2134
      public Builder setDescription(String description) {
2135
        this.description = description;
×
2136
        return this;
×
2137
      }
2138

2139
      /**
2140
       * Explicitly controls whether discounts apply to this invoice item. Defaults to true, except
2141
       * for negative invoice items.
2142
       */
2143
      public Builder setDiscountable(Boolean discountable) {
2144
        this.discountable = discountable;
×
2145
        return this;
×
2146
      }
2147

2148
      /**
2149
       * Add an element to `discounts` list. A list is initialized for the first `add/addAll` call,
2150
       * and subsequent calls adds additional elements to the original list. See {@link
2151
       * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation.
2152
       */
2153
      @SuppressWarnings("unchecked")
2154
      public Builder addDiscount(InvoiceCreatePreviewParams.InvoiceItem.Discount element) {
2155
        if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
2156
          this.discounts = new ArrayList<InvoiceCreatePreviewParams.InvoiceItem.Discount>();
×
2157
        }
2158
        ((List<InvoiceCreatePreviewParams.InvoiceItem.Discount>) this.discounts).add(element);
×
2159
        return this;
×
2160
      }
2161

2162
      /**
2163
       * Add all elements to `discounts` list. A list is initialized for the first `add/addAll`
2164
       * call, and subsequent calls adds additional elements to the original list. See {@link
2165
       * InvoiceCreatePreviewParams.InvoiceItem#discounts} for the field documentation.
2166
       */
2167
      @SuppressWarnings("unchecked")
2168
      public Builder addAllDiscount(
2169
          List<InvoiceCreatePreviewParams.InvoiceItem.Discount> elements) {
2170
        if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
2171
          this.discounts = new ArrayList<InvoiceCreatePreviewParams.InvoiceItem.Discount>();
×
2172
        }
2173
        ((List<InvoiceCreatePreviewParams.InvoiceItem.Discount>) this.discounts).addAll(elements);
×
2174
        return this;
×
2175
      }
2176

2177
      /** The coupons to redeem into discounts for the invoice item in the preview. */
2178
      public Builder setDiscounts(EmptyParam discounts) {
2179
        this.discounts = discounts;
×
2180
        return this;
×
2181
      }
2182

2183
      /** The coupons to redeem into discounts for the invoice item in the preview. */
2184
      public Builder setDiscounts(List<InvoiceCreatePreviewParams.InvoiceItem.Discount> discounts) {
2185
        this.discounts = discounts;
×
2186
        return this;
×
2187
      }
2188

2189
      /**
2190
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
2191
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
2192
       * InvoiceCreatePreviewParams.InvoiceItem#extraParams} for the field documentation.
2193
       */
2194
      public Builder putExtraParam(String key, Object value) {
2195
        if (this.extraParams == null) {
×
2196
          this.extraParams = new HashMap<>();
×
2197
        }
2198
        this.extraParams.put(key, value);
×
2199
        return this;
×
2200
      }
2201

2202
      /**
2203
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2204
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
2205
       * See {@link InvoiceCreatePreviewParams.InvoiceItem#extraParams} for the field documentation.
2206
       */
2207
      public Builder putAllExtraParam(Map<String, Object> map) {
2208
        if (this.extraParams == null) {
×
2209
          this.extraParams = new HashMap<>();
×
2210
        }
2211
        this.extraParams.putAll(map);
×
2212
        return this;
×
2213
      }
2214

2215
      /**
2216
       * The ID of the invoice item to update in preview. If not specified, a new invoice item will
2217
       * be added to the preview of the upcoming invoice.
2218
       */
2219
      public Builder setInvoiceitem(String invoiceitem) {
2220
        this.invoiceitem = invoiceitem;
×
2221
        return this;
×
2222
      }
2223

2224
      /**
2225
       * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll`
2226
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
2227
       * InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation.
2228
       */
2229
      @SuppressWarnings("unchecked")
2230
      public Builder putMetadata(String key, String value) {
2231
        if (this.metadata == null || this.metadata instanceof EmptyParam) {
×
2232
          this.metadata = new HashMap<String, String>();
×
2233
        }
2234
        ((Map<String, String>) this.metadata).put(key, value);
×
2235
        return this;
×
2236
      }
2237

2238
      /**
2239
       * Add all map key/value pairs to `metadata` map. A map is initialized for the first
2240
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
2241
       * See {@link InvoiceCreatePreviewParams.InvoiceItem#metadata} for the field documentation.
2242
       */
2243
      @SuppressWarnings("unchecked")
2244
      public Builder putAllMetadata(Map<String, String> map) {
2245
        if (this.metadata == null || this.metadata instanceof EmptyParam) {
×
2246
          this.metadata = new HashMap<String, String>();
×
2247
        }
2248
        ((Map<String, String>) this.metadata).putAll(map);
×
2249
        return this;
×
2250
      }
2251

2252
      /**
2253
       * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
2254
       * attach to an object. This can be useful for storing additional information about the object
2255
       * in a structured format. Individual keys can be unset by posting an empty value to them. All
2256
       * keys can be unset by posting an empty value to {@code metadata}.
2257
       */
2258
      public Builder setMetadata(EmptyParam metadata) {
2259
        this.metadata = metadata;
×
2260
        return this;
×
2261
      }
2262

2263
      /**
2264
       * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
2265
       * attach to an object. This can be useful for storing additional information about the object
2266
       * in a structured format. Individual keys can be unset by posting an empty value to them. All
2267
       * keys can be unset by posting an empty value to {@code metadata}.
2268
       */
2269
      public Builder setMetadata(Map<String, String> metadata) {
2270
        this.metadata = metadata;
×
2271
        return this;
×
2272
      }
2273

2274
      /**
2275
       * The period associated with this invoice item. When set to different values, the period will
2276
       * be rendered on the invoice. If you have <a
2277
       * href="https://stripe.com/docs/revenue-recognition">Stripe Revenue Recognition</a> enabled,
2278
       * the period will be used to recognize and defer revenue. See the <a
2279
       * href="https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing">Revenue
2280
       * Recognition documentation</a> for details.
2281
       */
2282
      public Builder setPeriod(InvoiceCreatePreviewParams.InvoiceItem.Period period) {
2283
        this.period = period;
×
2284
        return this;
×
2285
      }
2286

2287
      /** The ID of the price object. One of {@code price} or {@code price_data} is required. */
2288
      public Builder setPrice(String price) {
2289
        this.price = price;
×
2290
        return this;
×
2291
      }
2292

2293
      /**
2294
       * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
2295
       * inline. One of {@code price} or {@code price_data} is required.
2296
       */
2297
      public Builder setPriceData(InvoiceCreatePreviewParams.InvoiceItem.PriceData priceData) {
2298
        this.priceData = priceData;
×
2299
        return this;
×
2300
      }
2301

2302
      /** Non-negative integer. The quantity of units for the invoice item. */
2303
      public Builder setQuantity(Long quantity) {
2304
        this.quantity = quantity;
×
2305
        return this;
×
2306
      }
2307

2308
      /**
2309
       * Only required if a <a
2310
       * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
2311
       * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the price
2312
       * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
2313
       * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
2314
       * exclusive}, it cannot be changed.
2315
       */
2316
      public Builder setTaxBehavior(
2317
          InvoiceCreatePreviewParams.InvoiceItem.TaxBehavior taxBehavior) {
2318
        this.taxBehavior = taxBehavior;
×
2319
        return this;
×
2320
      }
2321

2322
      /** A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. */
2323
      public Builder setTaxCode(String taxCode) {
2324
        this.taxCode = taxCode;
×
2325
        return this;
×
2326
      }
2327

2328
      /** A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID. */
2329
      public Builder setTaxCode(EmptyParam taxCode) {
2330
        this.taxCode = taxCode;
×
2331
        return this;
×
2332
      }
2333

2334
      /**
2335
       * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call,
2336
       * and subsequent calls adds additional elements to the original list. See {@link
2337
       * InvoiceCreatePreviewParams.InvoiceItem#taxRates} for the field documentation.
2338
       */
2339
      @SuppressWarnings("unchecked")
2340
      public Builder addTaxRate(String element) {
2341
        if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
2342
          this.taxRates = new ArrayList<String>();
×
2343
        }
2344
        ((List<String>) this.taxRates).add(element);
×
2345
        return this;
×
2346
      }
2347

2348
      /**
2349
       * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll` call,
2350
       * and subsequent calls adds additional elements to the original list. See {@link
2351
       * InvoiceCreatePreviewParams.InvoiceItem#taxRates} for the field documentation.
2352
       */
2353
      @SuppressWarnings("unchecked")
2354
      public Builder addAllTaxRate(List<String> elements) {
2355
        if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
2356
          this.taxRates = new ArrayList<String>();
×
2357
        }
2358
        ((List<String>) this.taxRates).addAll(elements);
×
2359
        return this;
×
2360
      }
2361

2362
      /**
2363
       * The tax rates that apply to the item. When set, any {@code default_tax_rates} do not apply
2364
       * to this item.
2365
       */
2366
      public Builder setTaxRates(EmptyParam taxRates) {
2367
        this.taxRates = taxRates;
×
2368
        return this;
×
2369
      }
2370

2371
      /**
2372
       * The tax rates that apply to the item. When set, any {@code default_tax_rates} do not apply
2373
       * to this item.
2374
       */
2375
      public Builder setTaxRates(List<String> taxRates) {
2376
        this.taxRates = taxRates;
×
2377
        return this;
×
2378
      }
2379

2380
      /**
2381
       * The integer unit amount in cents (or local equivalent) of the charge to be applied to the
2382
       * upcoming invoice. This unit_amount will be multiplied by the quantity to get the full
2383
       * amount. If you want to apply a credit to the customer's account, pass a negative
2384
       * unit_amount.
2385
       */
2386
      public Builder setUnitAmount(Long unitAmount) {
2387
        this.unitAmount = unitAmount;
×
2388
        return this;
×
2389
      }
2390

2391
      /**
2392
       * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
2393
       * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
2394
       * unit_amount_decimal} can be set.
2395
       */
2396
      public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
2397
        this.unitAmountDecimal = unitAmountDecimal;
×
2398
        return this;
×
2399
      }
2400
    }
2401

2402
    @Getter
2403
    public static class Discount {
2404
      /** ID of the coupon to create a new discount for. */
2405
      @SerializedName("coupon")
2406
      String coupon;
2407

2408
      /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
2409
      @SerializedName("discount")
2410
      String discount;
2411

2412
      /**
2413
       * Map of extra parameters for custom features not available in this client library. The
2414
       * content in this map is not serialized under this field's {@code @SerializedName} value.
2415
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
2416
       * name in this param object. Effectively, this map is flattened to its parent instance.
2417
       */
2418
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
2419
      Map<String, Object> extraParams;
2420

2421
      /** ID of the promotion code to create a new discount for. */
2422
      @SerializedName("promotion_code")
2423
      String promotionCode;
2424

2425
      private Discount(
2426
          String coupon, String discount, Map<String, Object> extraParams, String promotionCode) {
×
2427
        this.coupon = coupon;
×
2428
        this.discount = discount;
×
2429
        this.extraParams = extraParams;
×
2430
        this.promotionCode = promotionCode;
×
2431
      }
×
2432

2433
      public static Builder builder() {
2434
        return new Builder();
×
2435
      }
2436

2437
      public static class Builder {
×
2438
        private String coupon;
2439

2440
        private String discount;
2441

2442
        private Map<String, Object> extraParams;
2443

2444
        private String promotionCode;
2445

2446
        /** Finalize and obtain parameter instance from this builder. */
2447
        public InvoiceCreatePreviewParams.InvoiceItem.Discount build() {
2448
          return new InvoiceCreatePreviewParams.InvoiceItem.Discount(
×
2449
              this.coupon, this.discount, this.extraParams, this.promotionCode);
2450
        }
2451

2452
        /** ID of the coupon to create a new discount for. */
2453
        public Builder setCoupon(String coupon) {
2454
          this.coupon = coupon;
×
2455
          return this;
×
2456
        }
2457

2458
        /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
2459
        public Builder setDiscount(String discount) {
2460
          this.discount = discount;
×
2461
          return this;
×
2462
        }
2463

2464
        /**
2465
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
2466
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2467
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.Discount#extraParams} for the
2468
         * field documentation.
2469
         */
2470
        public Builder putExtraParam(String key, Object value) {
2471
          if (this.extraParams == null) {
×
2472
            this.extraParams = new HashMap<>();
×
2473
          }
2474
          this.extraParams.put(key, value);
×
2475
          return this;
×
2476
        }
2477

2478
        /**
2479
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2480
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2481
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.Discount#extraParams} for the
2482
         * field documentation.
2483
         */
2484
        public Builder putAllExtraParam(Map<String, Object> map) {
2485
          if (this.extraParams == null) {
×
2486
            this.extraParams = new HashMap<>();
×
2487
          }
2488
          this.extraParams.putAll(map);
×
2489
          return this;
×
2490
        }
2491

2492
        /** ID of the promotion code to create a new discount for. */
2493
        public Builder setPromotionCode(String promotionCode) {
2494
          this.promotionCode = promotionCode;
×
2495
          return this;
×
2496
        }
2497
      }
2498
    }
2499

2500
    @Getter
2501
    public static class Period {
2502
      /**
2503
       * <strong>Required.</strong> The end of the period, which must be greater than or equal to
2504
       * the start. This value is inclusive.
2505
       */
2506
      @SerializedName("end")
2507
      Long end;
2508

2509
      /**
2510
       * Map of extra parameters for custom features not available in this client library. The
2511
       * content in this map is not serialized under this field's {@code @SerializedName} value.
2512
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
2513
       * name in this param object. Effectively, this map is flattened to its parent instance.
2514
       */
2515
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
2516
      Map<String, Object> extraParams;
2517

2518
      /** <strong>Required.</strong> The start of the period. This value is inclusive. */
2519
      @SerializedName("start")
2520
      Long start;
2521

2522
      private Period(Long end, Map<String, Object> extraParams, Long start) {
×
2523
        this.end = end;
×
2524
        this.extraParams = extraParams;
×
2525
        this.start = start;
×
2526
      }
×
2527

2528
      public static Builder builder() {
2529
        return new Builder();
×
2530
      }
2531

2532
      public static class Builder {
×
2533
        private Long end;
2534

2535
        private Map<String, Object> extraParams;
2536

2537
        private Long start;
2538

2539
        /** Finalize and obtain parameter instance from this builder. */
2540
        public InvoiceCreatePreviewParams.InvoiceItem.Period build() {
2541
          return new InvoiceCreatePreviewParams.InvoiceItem.Period(
×
2542
              this.end, this.extraParams, this.start);
2543
        }
2544

2545
        /**
2546
         * <strong>Required.</strong> The end of the period, which must be greater than or equal to
2547
         * the start. This value is inclusive.
2548
         */
2549
        public Builder setEnd(Long end) {
2550
          this.end = end;
×
2551
          return this;
×
2552
        }
2553

2554
        /**
2555
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
2556
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2557
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.Period#extraParams} for the field
2558
         * documentation.
2559
         */
2560
        public Builder putExtraParam(String key, Object value) {
2561
          if (this.extraParams == null) {
×
2562
            this.extraParams = new HashMap<>();
×
2563
          }
2564
          this.extraParams.put(key, value);
×
2565
          return this;
×
2566
        }
2567

2568
        /**
2569
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2570
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2571
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.Period#extraParams} for the field
2572
         * documentation.
2573
         */
2574
        public Builder putAllExtraParam(Map<String, Object> map) {
2575
          if (this.extraParams == null) {
×
2576
            this.extraParams = new HashMap<>();
×
2577
          }
2578
          this.extraParams.putAll(map);
×
2579
          return this;
×
2580
        }
2581

2582
        /** <strong>Required.</strong> The start of the period. This value is inclusive. */
2583
        public Builder setStart(Long start) {
2584
          this.start = start;
×
2585
          return this;
×
2586
        }
2587
      }
2588
    }
2589

2590
    @Getter
2591
    public static class PriceData {
2592
      /**
2593
       * <strong>Required.</strong> Three-letter <a
2594
       * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
2595
       * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
2596
       */
2597
      @SerializedName("currency")
2598
      String currency;
2599

2600
      /**
2601
       * Map of extra parameters for custom features not available in this client library. The
2602
       * content in this map is not serialized under this field's {@code @SerializedName} value.
2603
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
2604
       * name in this param object. Effectively, this map is flattened to its parent instance.
2605
       */
2606
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
2607
      Map<String, Object> extraParams;
2608

2609
      /** <strong>Required.</strong> The ID of the product that this price will belong to. */
2610
      @SerializedName("product")
2611
      String product;
2612

2613
      /**
2614
       * Only required if a <a
2615
       * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
2616
       * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the price
2617
       * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
2618
       * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
2619
       * exclusive}, it cannot be changed.
2620
       */
2621
      @SerializedName("tax_behavior")
2622
      TaxBehavior taxBehavior;
2623

2624
      /**
2625
       * A positive integer in cents (or local equivalent) (or 0 for a free price) representing how
2626
       * much to charge.
2627
       */
2628
      @SerializedName("unit_amount")
2629
      Long unitAmount;
2630

2631
      /**
2632
       * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
2633
       * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
2634
       * unit_amount_decimal} can be set.
2635
       */
2636
      @SerializedName("unit_amount_decimal")
2637
      BigDecimal unitAmountDecimal;
2638

2639
      private PriceData(
2640
          String currency,
2641
          Map<String, Object> extraParams,
2642
          String product,
2643
          TaxBehavior taxBehavior,
2644
          Long unitAmount,
2645
          BigDecimal unitAmountDecimal) {
×
2646
        this.currency = currency;
×
2647
        this.extraParams = extraParams;
×
2648
        this.product = product;
×
2649
        this.taxBehavior = taxBehavior;
×
2650
        this.unitAmount = unitAmount;
×
2651
        this.unitAmountDecimal = unitAmountDecimal;
×
2652
      }
×
2653

2654
      public static Builder builder() {
2655
        return new Builder();
×
2656
      }
2657

2658
      public static class Builder {
×
2659
        private String currency;
2660

2661
        private Map<String, Object> extraParams;
2662

2663
        private String product;
2664

2665
        private TaxBehavior taxBehavior;
2666

2667
        private Long unitAmount;
2668

2669
        private BigDecimal unitAmountDecimal;
2670

2671
        /** Finalize and obtain parameter instance from this builder. */
2672
        public InvoiceCreatePreviewParams.InvoiceItem.PriceData build() {
2673
          return new InvoiceCreatePreviewParams.InvoiceItem.PriceData(
×
2674
              this.currency,
2675
              this.extraParams,
2676
              this.product,
2677
              this.taxBehavior,
2678
              this.unitAmount,
2679
              this.unitAmountDecimal);
2680
        }
2681

2682
        /**
2683
         * <strong>Required.</strong> Three-letter <a
2684
         * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
2685
         * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
2686
         */
2687
        public Builder setCurrency(String currency) {
2688
          this.currency = currency;
×
2689
          return this;
×
2690
        }
2691

2692
        /**
2693
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
2694
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2695
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.PriceData#extraParams} for the
2696
         * field documentation.
2697
         */
2698
        public Builder putExtraParam(String key, Object value) {
2699
          if (this.extraParams == null) {
×
2700
            this.extraParams = new HashMap<>();
×
2701
          }
2702
          this.extraParams.put(key, value);
×
2703
          return this;
×
2704
        }
2705

2706
        /**
2707
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2708
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
2709
         * map. See {@link InvoiceCreatePreviewParams.InvoiceItem.PriceData#extraParams} for the
2710
         * field documentation.
2711
         */
2712
        public Builder putAllExtraParam(Map<String, Object> map) {
2713
          if (this.extraParams == null) {
×
2714
            this.extraParams = new HashMap<>();
×
2715
          }
2716
          this.extraParams.putAll(map);
×
2717
          return this;
×
2718
        }
2719

2720
        /** <strong>Required.</strong> The ID of the product that this price will belong to. */
2721
        public Builder setProduct(String product) {
2722
          this.product = product;
×
2723
          return this;
×
2724
        }
2725

2726
        /**
2727
         * Only required if a <a
2728
         * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
2729
         * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the price
2730
         * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
2731
         * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
2732
         * exclusive}, it cannot be changed.
2733
         */
2734
        public Builder setTaxBehavior(
2735
            InvoiceCreatePreviewParams.InvoiceItem.PriceData.TaxBehavior taxBehavior) {
2736
          this.taxBehavior = taxBehavior;
×
2737
          return this;
×
2738
        }
2739

2740
        /**
2741
         * A positive integer in cents (or local equivalent) (or 0 for a free price) representing
2742
         * how much to charge.
2743
         */
2744
        public Builder setUnitAmount(Long unitAmount) {
2745
          this.unitAmount = unitAmount;
×
2746
          return this;
×
2747
        }
2748

2749
        /**
2750
         * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
2751
         * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
2752
         * unit_amount_decimal} can be set.
2753
         */
2754
        public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
2755
          this.unitAmountDecimal = unitAmountDecimal;
×
2756
          return this;
×
2757
        }
2758
      }
2759

2760
      public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
2761
        @SerializedName("exclusive")
×
2762
        EXCLUSIVE("exclusive"),
2763

2764
        @SerializedName("inclusive")
×
2765
        INCLUSIVE("inclusive"),
2766

2767
        @SerializedName("unspecified")
×
2768
        UNSPECIFIED("unspecified");
2769

2770
        @Getter(onMethod_ = {@Override})
2771
        private final String value;
2772

2773
        TaxBehavior(String value) {
×
2774
          this.value = value;
×
2775
        }
×
2776
      }
2777
    }
2778

2779
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
2780
      @SerializedName("exclusive")
×
2781
      EXCLUSIVE("exclusive"),
2782

2783
      @SerializedName("inclusive")
×
2784
      INCLUSIVE("inclusive"),
2785

2786
      @SerializedName("unspecified")
×
2787
      UNSPECIFIED("unspecified");
2788

2789
      @Getter(onMethod_ = {@Override})
2790
      private final String value;
2791

2792
      TaxBehavior(String value) {
×
2793
        this.value = value;
×
2794
      }
×
2795
    }
2796
  }
2797

2798
  @Getter
2799
  public static class Issuer {
2800
    /** The connected account being referenced when {@code type} is {@code account}. */
2801
    @SerializedName("account")
2802
    String account;
2803

2804
    /**
2805
     * Map of extra parameters for custom features not available in this client library. The content
2806
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
2807
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
2808
     * param object. Effectively, this map is flattened to its parent instance.
2809
     */
2810
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
2811
    Map<String, Object> extraParams;
2812

2813
    /** <strong>Required.</strong> Type of the account referenced in the request. */
2814
    @SerializedName("type")
2815
    Type type;
2816

2817
    private Issuer(String account, Map<String, Object> extraParams, Type type) {
×
2818
      this.account = account;
×
2819
      this.extraParams = extraParams;
×
2820
      this.type = type;
×
2821
    }
×
2822

2823
    public static Builder builder() {
2824
      return new Builder();
×
2825
    }
2826

2827
    public static class Builder {
×
2828
      private String account;
2829

2830
      private Map<String, Object> extraParams;
2831

2832
      private Type type;
2833

2834
      /** Finalize and obtain parameter instance from this builder. */
2835
      public InvoiceCreatePreviewParams.Issuer build() {
2836
        return new InvoiceCreatePreviewParams.Issuer(this.account, this.extraParams, this.type);
×
2837
      }
2838

2839
      /** The connected account being referenced when {@code type} is {@code account}. */
2840
      public Builder setAccount(String account) {
2841
        this.account = account;
×
2842
        return this;
×
2843
      }
2844

2845
      /**
2846
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
2847
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
2848
       * InvoiceCreatePreviewParams.Issuer#extraParams} for the field documentation.
2849
       */
2850
      public Builder putExtraParam(String key, Object value) {
2851
        if (this.extraParams == null) {
×
2852
          this.extraParams = new HashMap<>();
×
2853
        }
2854
        this.extraParams.put(key, value);
×
2855
        return this;
×
2856
      }
2857

2858
      /**
2859
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2860
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
2861
       * See {@link InvoiceCreatePreviewParams.Issuer#extraParams} for the field documentation.
2862
       */
2863
      public Builder putAllExtraParam(Map<String, Object> map) {
2864
        if (this.extraParams == null) {
×
2865
          this.extraParams = new HashMap<>();
×
2866
        }
2867
        this.extraParams.putAll(map);
×
2868
        return this;
×
2869
      }
2870

2871
      /** <strong>Required.</strong> Type of the account referenced in the request. */
2872
      public Builder setType(InvoiceCreatePreviewParams.Issuer.Type type) {
2873
        this.type = type;
×
2874
        return this;
×
2875
      }
2876
    }
2877

2878
    public enum Type implements ApiRequestParams.EnumParam {
×
2879
      @SerializedName("account")
×
2880
      ACCOUNT("account"),
2881

2882
      @SerializedName("self")
×
2883
      SELF("self");
2884

2885
      @Getter(onMethod_ = {@Override})
2886
      private final String value;
2887

2888
      Type(String value) {
×
2889
        this.value = value;
×
2890
      }
×
2891
    }
2892
  }
2893

2894
  @Getter
2895
  public static class ScheduleDetails {
2896
    /**
2897
     * Behavior of the subscription schedule and underlying subscription when it ends. Possible
2898
     * values are {@code release} or {@code cancel} with the default being {@code release}. {@code
2899
     * release} will end the subscription schedule and keep the underlying subscription running.
2900
     * {@code cancel} will end the subscription schedule and cancel the underlying subscription.
2901
     */
2902
    @SerializedName("end_behavior")
2903
    EndBehavior endBehavior;
2904

2905
    /**
2906
     * Map of extra parameters for custom features not available in this client library. The content
2907
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
2908
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
2909
     * param object. Effectively, this map is flattened to its parent instance.
2910
     */
2911
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
2912
    Map<String, Object> extraParams;
2913

2914
    /**
2915
     * List representing phases of the subscription schedule. Each phase can be customized to have
2916
     * different durations, plans, and coupons. If there are multiple phases, the {@code end_date}
2917
     * of one phase will always equal the {@code start_date} of the next phase.
2918
     */
2919
    @SerializedName("phases")
2920
    List<InvoiceCreatePreviewParams.ScheduleDetails.Phase> phases;
2921

2922
    /**
2923
     * In cases where the {@code schedule_details} params update the currently active phase,
2924
     * specifies if and how to prorate at the time of the request.
2925
     */
2926
    @SerializedName("proration_behavior")
2927
    ProrationBehavior prorationBehavior;
2928

2929
    private ScheduleDetails(
2930
        EndBehavior endBehavior,
2931
        Map<String, Object> extraParams,
2932
        List<InvoiceCreatePreviewParams.ScheduleDetails.Phase> phases,
2933
        ProrationBehavior prorationBehavior) {
×
2934
      this.endBehavior = endBehavior;
×
2935
      this.extraParams = extraParams;
×
2936
      this.phases = phases;
×
2937
      this.prorationBehavior = prorationBehavior;
×
2938
    }
×
2939

2940
    public static Builder builder() {
2941
      return new Builder();
×
2942
    }
2943

2944
    public static class Builder {
×
2945
      private EndBehavior endBehavior;
2946

2947
      private Map<String, Object> extraParams;
2948

2949
      private List<InvoiceCreatePreviewParams.ScheduleDetails.Phase> phases;
2950

2951
      private ProrationBehavior prorationBehavior;
2952

2953
      /** Finalize and obtain parameter instance from this builder. */
2954
      public InvoiceCreatePreviewParams.ScheduleDetails build() {
2955
        return new InvoiceCreatePreviewParams.ScheduleDetails(
×
2956
            this.endBehavior, this.extraParams, this.phases, this.prorationBehavior);
2957
      }
2958

2959
      /**
2960
       * Behavior of the subscription schedule and underlying subscription when it ends. Possible
2961
       * values are {@code release} or {@code cancel} with the default being {@code release}. {@code
2962
       * release} will end the subscription schedule and keep the underlying subscription running.
2963
       * {@code cancel} will end the subscription schedule and cancel the underlying subscription.
2964
       */
2965
      public Builder setEndBehavior(
2966
          InvoiceCreatePreviewParams.ScheduleDetails.EndBehavior endBehavior) {
2967
        this.endBehavior = endBehavior;
×
2968
        return this;
×
2969
      }
2970

2971
      /**
2972
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
2973
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
2974
       * InvoiceCreatePreviewParams.ScheduleDetails#extraParams} for the field documentation.
2975
       */
2976
      public Builder putExtraParam(String key, Object value) {
2977
        if (this.extraParams == null) {
×
2978
          this.extraParams = new HashMap<>();
×
2979
        }
2980
        this.extraParams.put(key, value);
×
2981
        return this;
×
2982
      }
2983

2984
      /**
2985
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
2986
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
2987
       * See {@link InvoiceCreatePreviewParams.ScheduleDetails#extraParams} for the field
2988
       * documentation.
2989
       */
2990
      public Builder putAllExtraParam(Map<String, Object> map) {
2991
        if (this.extraParams == null) {
×
2992
          this.extraParams = new HashMap<>();
×
2993
        }
2994
        this.extraParams.putAll(map);
×
2995
        return this;
×
2996
      }
2997

2998
      /**
2999
       * Add an element to `phases` list. A list is initialized for the first `add/addAll` call, and
3000
       * subsequent calls adds additional elements to the original list. See {@link
3001
       * InvoiceCreatePreviewParams.ScheduleDetails#phases} for the field documentation.
3002
       */
3003
      public Builder addPhase(InvoiceCreatePreviewParams.ScheduleDetails.Phase element) {
3004
        if (this.phases == null) {
×
3005
          this.phases = new ArrayList<>();
×
3006
        }
3007
        this.phases.add(element);
×
3008
        return this;
×
3009
      }
3010

3011
      /**
3012
       * Add all elements to `phases` list. A list is initialized for the first `add/addAll` call,
3013
       * and subsequent calls adds additional elements to the original list. See {@link
3014
       * InvoiceCreatePreviewParams.ScheduleDetails#phases} for the field documentation.
3015
       */
3016
      public Builder addAllPhase(List<InvoiceCreatePreviewParams.ScheduleDetails.Phase> elements) {
3017
        if (this.phases == null) {
×
3018
          this.phases = new ArrayList<>();
×
3019
        }
3020
        this.phases.addAll(elements);
×
3021
        return this;
×
3022
      }
3023

3024
      /**
3025
       * In cases where the {@code schedule_details} params update the currently active phase,
3026
       * specifies if and how to prorate at the time of the request.
3027
       */
3028
      public Builder setProrationBehavior(
3029
          InvoiceCreatePreviewParams.ScheduleDetails.ProrationBehavior prorationBehavior) {
3030
        this.prorationBehavior = prorationBehavior;
×
3031
        return this;
×
3032
      }
3033
    }
3034

3035
    @Getter
3036
    public static class Phase {
3037
      /**
3038
       * A list of prices and quantities that will generate invoice items appended to the next
3039
       * invoice for this phase. You may pass up to 20 items.
3040
       */
3041
      @SerializedName("add_invoice_items")
3042
      List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem> addInvoiceItems;
3043

3044
      /**
3045
       * A non-negative decimal between 0 and 100, with at most two decimal places. This represents
3046
       * the percentage of the subscription invoice total that will be transferred to the
3047
       * application owner's Stripe account. The request must be made by a platform account on a
3048
       * connected account in order to set an application fee percentage. For more information, see
3049
       * the application fees <a
3050
       * href="https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions">documentation</a>.
3051
       */
3052
      @SerializedName("application_fee_percent")
3053
      BigDecimal applicationFeePercent;
3054

3055
      /** Automatic tax settings for this phase. */
3056
      @SerializedName("automatic_tax")
3057
      AutomaticTax automaticTax;
3058

3059
      /**
3060
       * Can be set to {@code phase_start} to set the anchor to the start of the phase or {@code
3061
       * automatic} to automatically change it if needed. Cannot be set to {@code phase_start} if
3062
       * this phase specifies a trial. For more information, see the billing cycle <a
3063
       * href="https://stripe.com/docs/billing/subscriptions/billing-cycle">documentation</a>.
3064
       */
3065
      @SerializedName("billing_cycle_anchor")
3066
      BillingCycleAnchor billingCycleAnchor;
3067

3068
      /**
3069
       * Define thresholds at which an invoice will be sent, and the subscription advanced to a new
3070
       * billing period. Pass an empty string to remove previously-defined thresholds.
3071
       */
3072
      @SerializedName("billing_thresholds")
3073
      Object billingThresholds;
3074

3075
      /**
3076
       * Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
3077
       * Stripe will attempt to pay the underlying subscription at the end of each billing cycle
3078
       * using the default source attached to the customer. When sending an invoice, Stripe will
3079
       * email your customer an invoice with payment instructions and mark the subscription as
3080
       * {@code active}. Defaults to {@code charge_automatically} on creation.
3081
       */
3082
      @SerializedName("collection_method")
3083
      CollectionMethod collectionMethod;
3084

3085
      /**
3086
       * The ID of the coupon to apply to this phase of the subscription schedule. This field has
3087
       * been deprecated and will be removed in a future API version. Use {@code discounts} instead.
3088
       */
3089
      @SerializedName("coupon")
3090
      String coupon;
3091

3092
      /**
3093
       * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
3094
       * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
3095
       * currency</a>.
3096
       */
3097
      @SerializedName("currency")
3098
      String currency;
3099

3100
      /**
3101
       * ID of the default payment method for the subscription schedule. It must belong to the
3102
       * customer associated with the subscription schedule. If not set, invoices will use the
3103
       * default payment method in the customer's invoice settings.
3104
       */
3105
      @SerializedName("default_payment_method")
3106
      String defaultPaymentMethod;
3107

3108
      /**
3109
       * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax Rates
3110
       * will set the Subscription's <a
3111
       * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
3112
       * default_tax_rates}</a>, which means they will be the Invoice's <a
3113
       * href="https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates">{@code
3114
       * default_tax_rates}</a> for any Invoices issued by the Subscription during this Phase.
3115
       */
3116
      @SerializedName("default_tax_rates")
3117
      Object defaultTaxRates;
3118

3119
      /**
3120
       * Subscription description, meant to be displayable to the customer. Use this field to
3121
       * optionally store an explanation of the subscription for rendering in Stripe surfaces and
3122
       * certain local payment methods UIs.
3123
       */
3124
      @SerializedName("description")
3125
      Object description;
3126

3127
      /**
3128
       * The coupons to redeem into discounts for the schedule phase. If not specified, inherits the
3129
       * discount from the subscription's customer. Pass an empty string to avoid inheriting any
3130
       * discounts.
3131
       */
3132
      @SerializedName("discounts")
3133
      Object discounts;
3134

3135
      /**
3136
       * The date at which this phase of the subscription schedule ends. If set, {@code iterations}
3137
       * must not be set.
3138
       */
3139
      @SerializedName("end_date")
3140
      Object endDate;
3141

3142
      /**
3143
       * Map of extra parameters for custom features not available in this client library. The
3144
       * content in this map is not serialized under this field's {@code @SerializedName} value.
3145
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
3146
       * name in this param object. Effectively, this map is flattened to its parent instance.
3147
       */
3148
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
3149
      Map<String, Object> extraParams;
3150

3151
      /** All invoices will be billed using the specified settings. */
3152
      @SerializedName("invoice_settings")
3153
      InvoiceSettings invoiceSettings;
3154

3155
      /**
3156
       * <strong>Required.</strong> List of configuration items, each with an attached price, to
3157
       * apply during this phase of the subscription schedule.
3158
       */
3159
      @SerializedName("items")
3160
      List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item> items;
3161

3162
      /**
3163
       * Integer representing the multiplier applied to the price interval. For example, {@code
3164
       * iterations=2} applied to a price with {@code interval=month} and {@code interval_count=3}
3165
       * results in a phase of duration {@code 2 * 3 months = 6 months}. If set, {@code end_date}
3166
       * must not be set.
3167
       */
3168
      @SerializedName("iterations")
3169
      Long iterations;
3170

3171
      /**
3172
       * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
3173
       * attach to a phase. Metadata on a schedule's phase will update the underlying subscription's
3174
       * {@code metadata} when the phase is entered, adding new keys and replacing existing keys in
3175
       * the subscription's {@code metadata}. Individual keys in the subscription's {@code metadata}
3176
       * can be unset by posting an empty value to them in the phase's {@code metadata}. To unset
3177
       * all keys in the subscription's {@code metadata}, update the subscription directly or unset
3178
       * every key individually from the phase's {@code metadata}.
3179
       */
3180
      @SerializedName("metadata")
3181
      Map<String, String> metadata;
3182

3183
      /**
3184
       * The account on behalf of which to charge, for each of the associated subscription's
3185
       * invoices.
3186
       */
3187
      @SerializedName("on_behalf_of")
3188
      String onBehalfOf;
3189

3190
      /**
3191
       * Whether the subscription schedule will create <a
3192
       * href="https://stripe.com/docs/billing/subscriptions/prorations">prorations</a> when
3193
       * transitioning to this phase. The default value is {@code create_prorations}. This setting
3194
       * controls prorations when a phase is started asynchronously and it is persisted as a field
3195
       * on the phase. It's different from the request-level <a
3196
       * href="https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior">proration_behavior</a>
3197
       * parameter which controls what happens if the update request affects the billing
3198
       * configuration of the current phase.
3199
       */
3200
      @SerializedName("proration_behavior")
3201
      ProrationBehavior prorationBehavior;
3202

3203
      /**
3204
       * The date at which this phase of the subscription schedule starts or {@code now}. Must be
3205
       * set on the first phase.
3206
       */
3207
      @SerializedName("start_date")
3208
      Object startDate;
3209

3210
      /**
3211
       * The data with which to automatically create a Transfer for each of the associated
3212
       * subscription's invoices.
3213
       */
3214
      @SerializedName("transfer_data")
3215
      TransferData transferData;
3216

3217
      /**
3218
       * If set to true the entire phase is counted as a trial and the customer will not be charged
3219
       * for any fees.
3220
       */
3221
      @SerializedName("trial")
3222
      Boolean trial;
3223

3224
      /**
3225
       * Sets the phase to trialing from the start date to this date. Must be before the phase end
3226
       * date, can not be combined with {@code trial}
3227
       */
3228
      @SerializedName("trial_end")
3229
      Object trialEnd;
3230

3231
      private Phase(
3232
          List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem> addInvoiceItems,
3233
          BigDecimal applicationFeePercent,
3234
          AutomaticTax automaticTax,
3235
          BillingCycleAnchor billingCycleAnchor,
3236
          Object billingThresholds,
3237
          CollectionMethod collectionMethod,
3238
          String coupon,
3239
          String currency,
3240
          String defaultPaymentMethod,
3241
          Object defaultTaxRates,
3242
          Object description,
3243
          Object discounts,
3244
          Object endDate,
3245
          Map<String, Object> extraParams,
3246
          InvoiceSettings invoiceSettings,
3247
          List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item> items,
3248
          Long iterations,
3249
          Map<String, String> metadata,
3250
          String onBehalfOf,
3251
          ProrationBehavior prorationBehavior,
3252
          Object startDate,
3253
          TransferData transferData,
3254
          Boolean trial,
3255
          Object trialEnd) {
×
3256
        this.addInvoiceItems = addInvoiceItems;
×
3257
        this.applicationFeePercent = applicationFeePercent;
×
3258
        this.automaticTax = automaticTax;
×
3259
        this.billingCycleAnchor = billingCycleAnchor;
×
3260
        this.billingThresholds = billingThresholds;
×
3261
        this.collectionMethod = collectionMethod;
×
3262
        this.coupon = coupon;
×
3263
        this.currency = currency;
×
3264
        this.defaultPaymentMethod = defaultPaymentMethod;
×
3265
        this.defaultTaxRates = defaultTaxRates;
×
3266
        this.description = description;
×
3267
        this.discounts = discounts;
×
3268
        this.endDate = endDate;
×
3269
        this.extraParams = extraParams;
×
3270
        this.invoiceSettings = invoiceSettings;
×
3271
        this.items = items;
×
3272
        this.iterations = iterations;
×
3273
        this.metadata = metadata;
×
3274
        this.onBehalfOf = onBehalfOf;
×
3275
        this.prorationBehavior = prorationBehavior;
×
3276
        this.startDate = startDate;
×
3277
        this.transferData = transferData;
×
3278
        this.trial = trial;
×
3279
        this.trialEnd = trialEnd;
×
3280
      }
×
3281

3282
      public static Builder builder() {
3283
        return new Builder();
×
3284
      }
3285

3286
      public static class Builder {
×
3287
        private List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem>
3288
            addInvoiceItems;
3289

3290
        private BigDecimal applicationFeePercent;
3291

3292
        private AutomaticTax automaticTax;
3293

3294
        private BillingCycleAnchor billingCycleAnchor;
3295

3296
        private Object billingThresholds;
3297

3298
        private CollectionMethod collectionMethod;
3299

3300
        private String coupon;
3301

3302
        private String currency;
3303

3304
        private String defaultPaymentMethod;
3305

3306
        private Object defaultTaxRates;
3307

3308
        private Object description;
3309

3310
        private Object discounts;
3311

3312
        private Object endDate;
3313

3314
        private Map<String, Object> extraParams;
3315

3316
        private InvoiceSettings invoiceSettings;
3317

3318
        private List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item> items;
3319

3320
        private Long iterations;
3321

3322
        private Map<String, String> metadata;
3323

3324
        private String onBehalfOf;
3325

3326
        private ProrationBehavior prorationBehavior;
3327

3328
        private Object startDate;
3329

3330
        private TransferData transferData;
3331

3332
        private Boolean trial;
3333

3334
        private Object trialEnd;
3335

3336
        /** Finalize and obtain parameter instance from this builder. */
3337
        public InvoiceCreatePreviewParams.ScheduleDetails.Phase build() {
3338
          return new InvoiceCreatePreviewParams.ScheduleDetails.Phase(
×
3339
              this.addInvoiceItems,
3340
              this.applicationFeePercent,
3341
              this.automaticTax,
3342
              this.billingCycleAnchor,
3343
              this.billingThresholds,
3344
              this.collectionMethod,
3345
              this.coupon,
3346
              this.currency,
3347
              this.defaultPaymentMethod,
3348
              this.defaultTaxRates,
3349
              this.description,
3350
              this.discounts,
3351
              this.endDate,
3352
              this.extraParams,
3353
              this.invoiceSettings,
3354
              this.items,
3355
              this.iterations,
3356
              this.metadata,
3357
              this.onBehalfOf,
3358
              this.prorationBehavior,
3359
              this.startDate,
3360
              this.transferData,
3361
              this.trial,
3362
              this.trialEnd);
3363
        }
3364

3365
        /**
3366
         * Add an element to `addInvoiceItems` list. A list is initialized for the first
3367
         * `add/addAll` call, and subsequent calls adds additional elements to the original list.
3368
         * See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#addInvoiceItems} for the
3369
         * field documentation.
3370
         */
3371
        public Builder addAddInvoiceItem(
3372
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem element) {
3373
          if (this.addInvoiceItems == null) {
×
3374
            this.addInvoiceItems = new ArrayList<>();
×
3375
          }
3376
          this.addInvoiceItems.add(element);
×
3377
          return this;
×
3378
        }
3379

3380
        /**
3381
         * Add all elements to `addInvoiceItems` list. A list is initialized for the first
3382
         * `add/addAll` call, and subsequent calls adds additional elements to the original list.
3383
         * See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#addInvoiceItems} for the
3384
         * field documentation.
3385
         */
3386
        public Builder addAllAddInvoiceItem(
3387
            List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem> elements) {
3388
          if (this.addInvoiceItems == null) {
×
3389
            this.addInvoiceItems = new ArrayList<>();
×
3390
          }
3391
          this.addInvoiceItems.addAll(elements);
×
3392
          return this;
×
3393
        }
3394

3395
        /**
3396
         * A non-negative decimal between 0 and 100, with at most two decimal places. This
3397
         * represents the percentage of the subscription invoice total that will be transferred to
3398
         * the application owner's Stripe account. The request must be made by a platform account on
3399
         * a connected account in order to set an application fee percentage. For more information,
3400
         * see the application fees <a
3401
         * href="https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions">documentation</a>.
3402
         */
3403
        public Builder setApplicationFeePercent(BigDecimal applicationFeePercent) {
3404
          this.applicationFeePercent = applicationFeePercent;
×
3405
          return this;
×
3406
        }
3407

3408
        /** Automatic tax settings for this phase. */
3409
        public Builder setAutomaticTax(
3410
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax automaticTax) {
3411
          this.automaticTax = automaticTax;
×
3412
          return this;
×
3413
        }
3414

3415
        /**
3416
         * Can be set to {@code phase_start} to set the anchor to the start of the phase or {@code
3417
         * automatic} to automatically change it if needed. Cannot be set to {@code phase_start} if
3418
         * this phase specifies a trial. For more information, see the billing cycle <a
3419
         * href="https://stripe.com/docs/billing/subscriptions/billing-cycle">documentation</a>.
3420
         */
3421
        public Builder setBillingCycleAnchor(
3422
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingCycleAnchor
3423
                billingCycleAnchor) {
3424
          this.billingCycleAnchor = billingCycleAnchor;
×
3425
          return this;
×
3426
        }
3427

3428
        /**
3429
         * Define thresholds at which an invoice will be sent, and the subscription advanced to a
3430
         * new billing period. Pass an empty string to remove previously-defined thresholds.
3431
         */
3432
        public Builder setBillingThresholds(
3433
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds billingThresholds) {
3434
          this.billingThresholds = billingThresholds;
×
3435
          return this;
×
3436
        }
3437

3438
        /**
3439
         * Define thresholds at which an invoice will be sent, and the subscription advanced to a
3440
         * new billing period. Pass an empty string to remove previously-defined thresholds.
3441
         */
3442
        public Builder setBillingThresholds(EmptyParam billingThresholds) {
3443
          this.billingThresholds = billingThresholds;
×
3444
          return this;
×
3445
        }
3446

3447
        /**
3448
         * Either {@code charge_automatically}, or {@code send_invoice}. When charging
3449
         * automatically, Stripe will attempt to pay the underlying subscription at the end of each
3450
         * billing cycle using the default source attached to the customer. When sending an invoice,
3451
         * Stripe will email your customer an invoice with payment instructions and mark the
3452
         * subscription as {@code active}. Defaults to {@code charge_automatically} on creation.
3453
         */
3454
        public Builder setCollectionMethod(
3455
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.CollectionMethod collectionMethod) {
3456
          this.collectionMethod = collectionMethod;
×
3457
          return this;
×
3458
        }
3459

3460
        /**
3461
         * The ID of the coupon to apply to this phase of the subscription schedule. This field has
3462
         * been deprecated and will be removed in a future API version. Use {@code discounts}
3463
         * instead.
3464
         */
3465
        public Builder setCoupon(String coupon) {
3466
          this.coupon = coupon;
×
3467
          return this;
×
3468
        }
3469

3470
        /**
3471
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
3472
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
3473
         * currency</a>.
3474
         */
3475
        public Builder setCurrency(String currency) {
3476
          this.currency = currency;
×
3477
          return this;
×
3478
        }
3479

3480
        /**
3481
         * ID of the default payment method for the subscription schedule. It must belong to the
3482
         * customer associated with the subscription schedule. If not set, invoices will use the
3483
         * default payment method in the customer's invoice settings.
3484
         */
3485
        public Builder setDefaultPaymentMethod(String defaultPaymentMethod) {
3486
          this.defaultPaymentMethod = defaultPaymentMethod;
×
3487
          return this;
×
3488
        }
3489

3490
        /**
3491
         * Add an element to `defaultTaxRates` list. A list is initialized for the first
3492
         * `add/addAll` call, and subsequent calls adds additional elements to the original list.
3493
         * See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#defaultTaxRates} for the
3494
         * field documentation.
3495
         */
3496
        @SuppressWarnings("unchecked")
3497
        public Builder addDefaultTaxRate(String element) {
3498
          if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
×
3499
            this.defaultTaxRates = new ArrayList<String>();
×
3500
          }
3501
          ((List<String>) this.defaultTaxRates).add(element);
×
3502
          return this;
×
3503
        }
3504

3505
        /**
3506
         * Add all elements to `defaultTaxRates` list. A list is initialized for the first
3507
         * `add/addAll` call, and subsequent calls adds additional elements to the original list.
3508
         * See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#defaultTaxRates} for the
3509
         * field documentation.
3510
         */
3511
        @SuppressWarnings("unchecked")
3512
        public Builder addAllDefaultTaxRate(List<String> elements) {
3513
          if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
×
3514
            this.defaultTaxRates = new ArrayList<String>();
×
3515
          }
3516
          ((List<String>) this.defaultTaxRates).addAll(elements);
×
3517
          return this;
×
3518
        }
3519

3520
        /**
3521
         * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
3522
         * Rates will set the Subscription's <a
3523
         * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
3524
         * default_tax_rates}</a>, which means they will be the Invoice's <a
3525
         * href="https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates">{@code
3526
         * default_tax_rates}</a> for any Invoices issued by the Subscription during this Phase.
3527
         */
3528
        public Builder setDefaultTaxRates(EmptyParam defaultTaxRates) {
3529
          this.defaultTaxRates = defaultTaxRates;
×
3530
          return this;
×
3531
        }
3532

3533
        /**
3534
         * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
3535
         * Rates will set the Subscription's <a
3536
         * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
3537
         * default_tax_rates}</a>, which means they will be the Invoice's <a
3538
         * href="https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates">{@code
3539
         * default_tax_rates}</a> for any Invoices issued by the Subscription during this Phase.
3540
         */
3541
        public Builder setDefaultTaxRates(List<String> defaultTaxRates) {
3542
          this.defaultTaxRates = defaultTaxRates;
×
3543
          return this;
×
3544
        }
3545

3546
        /**
3547
         * Subscription description, meant to be displayable to the customer. Use this field to
3548
         * optionally store an explanation of the subscription for rendering in Stripe surfaces and
3549
         * certain local payment methods UIs.
3550
         */
3551
        public Builder setDescription(String description) {
3552
          this.description = description;
×
3553
          return this;
×
3554
        }
3555

3556
        /**
3557
         * Subscription description, meant to be displayable to the customer. Use this field to
3558
         * optionally store an explanation of the subscription for rendering in Stripe surfaces and
3559
         * certain local payment methods UIs.
3560
         */
3561
        public Builder setDescription(EmptyParam description) {
3562
          this.description = description;
×
3563
          return this;
×
3564
        }
3565

3566
        /**
3567
         * Add an element to `discounts` list. A list is initialized for the first `add/addAll`
3568
         * call, and subsequent calls adds additional elements to the original list. See {@link
3569
         * InvoiceCreatePreviewParams.ScheduleDetails.Phase#discounts} for the field documentation.
3570
         */
3571
        @SuppressWarnings("unchecked")
3572
        public Builder addDiscount(
3573
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount element) {
3574
          if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
3575
            this.discounts =
×
3576
                new ArrayList<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount>();
3577
          }
3578
          ((List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount>) this.discounts)
×
3579
              .add(element);
×
3580
          return this;
×
3581
        }
3582

3583
        /**
3584
         * Add all elements to `discounts` list. A list is initialized for the first `add/addAll`
3585
         * call, and subsequent calls adds additional elements to the original list. See {@link
3586
         * InvoiceCreatePreviewParams.ScheduleDetails.Phase#discounts} for the field documentation.
3587
         */
3588
        @SuppressWarnings("unchecked")
3589
        public Builder addAllDiscount(
3590
            List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount> elements) {
3591
          if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
3592
            this.discounts =
×
3593
                new ArrayList<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount>();
3594
          }
3595
          ((List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount>) this.discounts)
×
3596
              .addAll(elements);
×
3597
          return this;
×
3598
        }
3599

3600
        /**
3601
         * The coupons to redeem into discounts for the schedule phase. If not specified, inherits
3602
         * the discount from the subscription's customer. Pass an empty string to avoid inheriting
3603
         * any discounts.
3604
         */
3605
        public Builder setDiscounts(EmptyParam discounts) {
3606
          this.discounts = discounts;
×
3607
          return this;
×
3608
        }
3609

3610
        /**
3611
         * The coupons to redeem into discounts for the schedule phase. If not specified, inherits
3612
         * the discount from the subscription's customer. Pass an empty string to avoid inheriting
3613
         * any discounts.
3614
         */
3615
        public Builder setDiscounts(
3616
            List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount> discounts) {
3617
          this.discounts = discounts;
×
3618
          return this;
×
3619
        }
3620

3621
        /**
3622
         * The date at which this phase of the subscription schedule ends. If set, {@code
3623
         * iterations} must not be set.
3624
         */
3625
        public Builder setEndDate(Long endDate) {
3626
          this.endDate = endDate;
×
3627
          return this;
×
3628
        }
3629

3630
        /**
3631
         * The date at which this phase of the subscription schedule ends. If set, {@code
3632
         * iterations} must not be set.
3633
         */
3634
        public Builder setEndDate(
3635
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.EndDate endDate) {
3636
          this.endDate = endDate;
×
3637
          return this;
×
3638
        }
3639

3640
        /**
3641
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
3642
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
3643
         * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#extraParams} for the
3644
         * field documentation.
3645
         */
3646
        public Builder putExtraParam(String key, Object value) {
3647
          if (this.extraParams == null) {
×
3648
            this.extraParams = new HashMap<>();
×
3649
          }
3650
          this.extraParams.put(key, value);
×
3651
          return this;
×
3652
        }
3653

3654
        /**
3655
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
3656
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
3657
         * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#extraParams} for the
3658
         * field documentation.
3659
         */
3660
        public Builder putAllExtraParam(Map<String, Object> map) {
3661
          if (this.extraParams == null) {
×
3662
            this.extraParams = new HashMap<>();
×
3663
          }
3664
          this.extraParams.putAll(map);
×
3665
          return this;
×
3666
        }
3667

3668
        /** All invoices will be billed using the specified settings. */
3669
        public Builder setInvoiceSettings(
3670
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings invoiceSettings) {
3671
          this.invoiceSettings = invoiceSettings;
×
3672
          return this;
×
3673
        }
3674

3675
        /**
3676
         * Add an element to `items` list. A list is initialized for the first `add/addAll` call,
3677
         * and subsequent calls adds additional elements to the original list. See {@link
3678
         * InvoiceCreatePreviewParams.ScheduleDetails.Phase#items} for the field documentation.
3679
         */
3680
        public Builder addItem(InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item element) {
3681
          if (this.items == null) {
×
3682
            this.items = new ArrayList<>();
×
3683
          }
3684
          this.items.add(element);
×
3685
          return this;
×
3686
        }
3687

3688
        /**
3689
         * Add all elements to `items` list. A list is initialized for the first `add/addAll` call,
3690
         * and subsequent calls adds additional elements to the original list. See {@link
3691
         * InvoiceCreatePreviewParams.ScheduleDetails.Phase#items} for the field documentation.
3692
         */
3693
        public Builder addAllItem(
3694
            List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item> elements) {
3695
          if (this.items == null) {
×
3696
            this.items = new ArrayList<>();
×
3697
          }
3698
          this.items.addAll(elements);
×
3699
          return this;
×
3700
        }
3701

3702
        /**
3703
         * Integer representing the multiplier applied to the price interval. For example, {@code
3704
         * iterations=2} applied to a price with {@code interval=month} and {@code interval_count=3}
3705
         * results in a phase of duration {@code 2 * 3 months = 6 months}. If set, {@code end_date}
3706
         * must not be set.
3707
         */
3708
        public Builder setIterations(Long iterations) {
3709
          this.iterations = iterations;
×
3710
          return this;
×
3711
        }
3712

3713
        /**
3714
         * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll`
3715
         * call, and subsequent calls add additional key/value pairs to the original map. See {@link
3716
         * InvoiceCreatePreviewParams.ScheduleDetails.Phase#metadata} for the field documentation.
3717
         */
3718
        public Builder putMetadata(String key, String value) {
3719
          if (this.metadata == null) {
×
3720
            this.metadata = new HashMap<>();
×
3721
          }
3722
          this.metadata.put(key, value);
×
3723
          return this;
×
3724
        }
3725

3726
        /**
3727
         * Add all map key/value pairs to `metadata` map. A map is initialized for the first
3728
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
3729
         * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase#metadata} for the field
3730
         * documentation.
3731
         */
3732
        public Builder putAllMetadata(Map<String, String> map) {
3733
          if (this.metadata == null) {
×
3734
            this.metadata = new HashMap<>();
×
3735
          }
3736
          this.metadata.putAll(map);
×
3737
          return this;
×
3738
        }
3739

3740
        /**
3741
         * The account on behalf of which to charge, for each of the associated subscription's
3742
         * invoices.
3743
         */
3744
        public Builder setOnBehalfOf(String onBehalfOf) {
3745
          this.onBehalfOf = onBehalfOf;
×
3746
          return this;
×
3747
        }
3748

3749
        /**
3750
         * Whether the subscription schedule will create <a
3751
         * href="https://stripe.com/docs/billing/subscriptions/prorations">prorations</a> when
3752
         * transitioning to this phase. The default value is {@code create_prorations}. This setting
3753
         * controls prorations when a phase is started asynchronously and it is persisted as a field
3754
         * on the phase. It's different from the request-level <a
3755
         * href="https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior">proration_behavior</a>
3756
         * parameter which controls what happens if the update request affects the billing
3757
         * configuration of the current phase.
3758
         */
3759
        public Builder setProrationBehavior(
3760
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.ProrationBehavior prorationBehavior) {
3761
          this.prorationBehavior = prorationBehavior;
×
3762
          return this;
×
3763
        }
3764

3765
        /**
3766
         * The date at which this phase of the subscription schedule starts or {@code now}. Must be
3767
         * set on the first phase.
3768
         */
3769
        public Builder setStartDate(Long startDate) {
3770
          this.startDate = startDate;
×
3771
          return this;
×
3772
        }
3773

3774
        /**
3775
         * The date at which this phase of the subscription schedule starts or {@code now}. Must be
3776
         * set on the first phase.
3777
         */
3778
        public Builder setStartDate(
3779
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.StartDate startDate) {
3780
          this.startDate = startDate;
×
3781
          return this;
×
3782
        }
3783

3784
        /**
3785
         * The data with which to automatically create a Transfer for each of the associated
3786
         * subscription's invoices.
3787
         */
3788
        public Builder setTransferData(
3789
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.TransferData transferData) {
3790
          this.transferData = transferData;
×
3791
          return this;
×
3792
        }
3793

3794
        /**
3795
         * If set to true the entire phase is counted as a trial and the customer will not be
3796
         * charged for any fees.
3797
         */
3798
        public Builder setTrial(Boolean trial) {
3799
          this.trial = trial;
×
3800
          return this;
×
3801
        }
3802

3803
        /**
3804
         * Sets the phase to trialing from the start date to this date. Must be before the phase end
3805
         * date, can not be combined with {@code trial}
3806
         */
3807
        public Builder setTrialEnd(Long trialEnd) {
3808
          this.trialEnd = trialEnd;
×
3809
          return this;
×
3810
        }
3811

3812
        /**
3813
         * Sets the phase to trialing from the start date to this date. Must be before the phase end
3814
         * date, can not be combined with {@code trial}
3815
         */
3816
        public Builder setTrialEnd(
3817
            InvoiceCreatePreviewParams.ScheduleDetails.Phase.TrialEnd trialEnd) {
3818
          this.trialEnd = trialEnd;
×
3819
          return this;
×
3820
        }
3821
      }
3822

3823
      @Getter
3824
      public static class AddInvoiceItem {
3825
        /** The coupons to redeem into discounts for the item. */
3826
        @SerializedName("discounts")
3827
        List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount> discounts;
3828

3829
        /**
3830
         * Map of extra parameters for custom features not available in this client library. The
3831
         * content in this map is not serialized under this field's {@code @SerializedName} value.
3832
         * Instead, each key/value pair is serialized as if the key is a root-level field
3833
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
3834
         * instance.
3835
         */
3836
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
3837
        Map<String, Object> extraParams;
3838

3839
        /** The ID of the price object. One of {@code price} or {@code price_data} is required. */
3840
        @SerializedName("price")
3841
        String price;
3842

3843
        /**
3844
         * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
3845
         * inline. One of {@code price} or {@code price_data} is required.
3846
         */
3847
        @SerializedName("price_data")
3848
        PriceData priceData;
3849

3850
        /** Quantity for this item. Defaults to 1. */
3851
        @SerializedName("quantity")
3852
        Long quantity;
3853

3854
        /**
3855
         * The tax rates which apply to the item. When set, the {@code default_tax_rates} do not
3856
         * apply to this item.
3857
         */
3858
        @SerializedName("tax_rates")
3859
        Object taxRates;
3860

3861
        private AddInvoiceItem(
3862
            List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount>
3863
                discounts,
3864
            Map<String, Object> extraParams,
3865
            String price,
3866
            PriceData priceData,
3867
            Long quantity,
3868
            Object taxRates) {
×
3869
          this.discounts = discounts;
×
3870
          this.extraParams = extraParams;
×
3871
          this.price = price;
×
3872
          this.priceData = priceData;
×
3873
          this.quantity = quantity;
×
3874
          this.taxRates = taxRates;
×
3875
        }
×
3876

3877
        public static Builder builder() {
3878
          return new Builder();
×
3879
        }
3880

3881
        public static class Builder {
×
3882
          private List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount>
3883
              discounts;
3884

3885
          private Map<String, Object> extraParams;
3886

3887
          private String price;
3888

3889
          private PriceData priceData;
3890

3891
          private Long quantity;
3892

3893
          private Object taxRates;
3894

3895
          /** Finalize and obtain parameter instance from this builder. */
3896
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem build() {
3897
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem(
×
3898
                this.discounts,
3899
                this.extraParams,
3900
                this.price,
3901
                this.priceData,
3902
                this.quantity,
3903
                this.taxRates);
3904
          }
3905

3906
          /**
3907
           * Add an element to `discounts` list. A list is initialized for the first `add/addAll`
3908
           * call, and subsequent calls adds additional elements to the original list. See {@link
3909
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#discounts} for the
3910
           * field documentation.
3911
           */
3912
          public Builder addDiscount(
3913
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount element) {
3914
            if (this.discounts == null) {
×
3915
              this.discounts = new ArrayList<>();
×
3916
            }
3917
            this.discounts.add(element);
×
3918
            return this;
×
3919
          }
3920

3921
          /**
3922
           * Add all elements to `discounts` list. A list is initialized for the first `add/addAll`
3923
           * call, and subsequent calls adds additional elements to the original list. See {@link
3924
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#discounts} for the
3925
           * field documentation.
3926
           */
3927
          public Builder addAllDiscount(
3928
              List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount>
3929
                  elements) {
3930
            if (this.discounts == null) {
×
3931
              this.discounts = new ArrayList<>();
×
3932
            }
3933
            this.discounts.addAll(elements);
×
3934
            return this;
×
3935
          }
3936

3937
          /**
3938
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
3939
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
3940
           * map. See {@link
3941
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#extraParams} for the
3942
           * field documentation.
3943
           */
3944
          public Builder putExtraParam(String key, Object value) {
3945
            if (this.extraParams == null) {
×
3946
              this.extraParams = new HashMap<>();
×
3947
            }
3948
            this.extraParams.put(key, value);
×
3949
            return this;
×
3950
          }
3951

3952
          /**
3953
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
3954
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
3955
           * map. See {@link
3956
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#extraParams} for the
3957
           * field documentation.
3958
           */
3959
          public Builder putAllExtraParam(Map<String, Object> map) {
3960
            if (this.extraParams == null) {
×
3961
              this.extraParams = new HashMap<>();
×
3962
            }
3963
            this.extraParams.putAll(map);
×
3964
            return this;
×
3965
          }
3966

3967
          /** The ID of the price object. One of {@code price} or {@code price_data} is required. */
3968
          public Builder setPrice(String price) {
3969
            this.price = price;
×
3970
            return this;
×
3971
          }
3972

3973
          /**
3974
           * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a>
3975
           * object inline. One of {@code price} or {@code price_data} is required.
3976
           */
3977
          public Builder setPriceData(
3978
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData priceData) {
3979
            this.priceData = priceData;
×
3980
            return this;
×
3981
          }
3982

3983
          /** Quantity for this item. Defaults to 1. */
3984
          public Builder setQuantity(Long quantity) {
3985
            this.quantity = quantity;
×
3986
            return this;
×
3987
          }
3988

3989
          /**
3990
           * Add an element to `taxRates` list. A list is initialized for the first `add/addAll`
3991
           * call, and subsequent calls adds additional elements to the original list. See {@link
3992
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#taxRates} for the field
3993
           * documentation.
3994
           */
3995
          @SuppressWarnings("unchecked")
3996
          public Builder addTaxRate(String element) {
3997
            if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
3998
              this.taxRates = new ArrayList<String>();
×
3999
            }
4000
            ((List<String>) this.taxRates).add(element);
×
4001
            return this;
×
4002
          }
4003

4004
          /**
4005
           * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll`
4006
           * call, and subsequent calls adds additional elements to the original list. See {@link
4007
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem#taxRates} for the field
4008
           * documentation.
4009
           */
4010
          @SuppressWarnings("unchecked")
4011
          public Builder addAllTaxRate(List<String> elements) {
4012
            if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
4013
              this.taxRates = new ArrayList<String>();
×
4014
            }
4015
            ((List<String>) this.taxRates).addAll(elements);
×
4016
            return this;
×
4017
          }
4018

4019
          /**
4020
           * The tax rates which apply to the item. When set, the {@code default_tax_rates} do not
4021
           * apply to this item.
4022
           */
4023
          public Builder setTaxRates(EmptyParam taxRates) {
4024
            this.taxRates = taxRates;
×
4025
            return this;
×
4026
          }
4027

4028
          /**
4029
           * The tax rates which apply to the item. When set, the {@code default_tax_rates} do not
4030
           * apply to this item.
4031
           */
4032
          public Builder setTaxRates(List<String> taxRates) {
4033
            this.taxRates = taxRates;
×
4034
            return this;
×
4035
          }
4036
        }
4037

4038
        @Getter
4039
        public static class Discount {
4040
          /** ID of the coupon to create a new discount for. */
4041
          @SerializedName("coupon")
4042
          String coupon;
4043

4044
          /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
4045
          @SerializedName("discount")
4046
          String discount;
4047

4048
          /**
4049
           * Map of extra parameters for custom features not available in this client library. The
4050
           * content in this map is not serialized under this field's {@code @SerializedName} value.
4051
           * Instead, each key/value pair is serialized as if the key is a root-level field
4052
           * (serialized) name in this param object. Effectively, this map is flattened to its
4053
           * parent instance.
4054
           */
4055
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4056
          Map<String, Object> extraParams;
4057

4058
          /** ID of the promotion code to create a new discount for. */
4059
          @SerializedName("promotion_code")
4060
          String promotionCode;
4061

4062
          private Discount(
4063
              String coupon,
4064
              String discount,
4065
              Map<String, Object> extraParams,
4066
              String promotionCode) {
×
4067
            this.coupon = coupon;
×
4068
            this.discount = discount;
×
4069
            this.extraParams = extraParams;
×
4070
            this.promotionCode = promotionCode;
×
4071
          }
×
4072

4073
          public static Builder builder() {
4074
            return new Builder();
×
4075
          }
4076

4077
          public static class Builder {
×
4078
            private String coupon;
4079

4080
            private String discount;
4081

4082
            private Map<String, Object> extraParams;
4083

4084
            private String promotionCode;
4085

4086
            /** Finalize and obtain parameter instance from this builder. */
4087
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount
4088
                build() {
4089
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount(
×
4090
                  this.coupon, this.discount, this.extraParams, this.promotionCode);
4091
            }
4092

4093
            /** ID of the coupon to create a new discount for. */
4094
            public Builder setCoupon(String coupon) {
4095
              this.coupon = coupon;
×
4096
              return this;
×
4097
            }
4098

4099
            /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
4100
            public Builder setDiscount(String discount) {
4101
              this.discount = discount;
×
4102
              return this;
×
4103
            }
4104

4105
            /**
4106
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
4107
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4108
             * original map. See {@link
4109
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount#extraParams}
4110
             * for the field documentation.
4111
             */
4112
            public Builder putExtraParam(String key, Object value) {
4113
              if (this.extraParams == null) {
×
4114
                this.extraParams = new HashMap<>();
×
4115
              }
4116
              this.extraParams.put(key, value);
×
4117
              return this;
×
4118
            }
4119

4120
            /**
4121
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4122
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4123
             * original map. See {@link
4124
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.Discount#extraParams}
4125
             * for the field documentation.
4126
             */
4127
            public Builder putAllExtraParam(Map<String, Object> map) {
4128
              if (this.extraParams == null) {
×
4129
                this.extraParams = new HashMap<>();
×
4130
              }
4131
              this.extraParams.putAll(map);
×
4132
              return this;
×
4133
            }
4134

4135
            /** ID of the promotion code to create a new discount for. */
4136
            public Builder setPromotionCode(String promotionCode) {
4137
              this.promotionCode = promotionCode;
×
4138
              return this;
×
4139
            }
4140
          }
4141
        }
4142

4143
        @Getter
4144
        public static class PriceData {
4145
          /**
4146
           * <strong>Required.</strong> Three-letter <a
4147
           * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
4148
           * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
4149
           * currency</a>.
4150
           */
4151
          @SerializedName("currency")
4152
          String currency;
4153

4154
          /**
4155
           * Map of extra parameters for custom features not available in this client library. The
4156
           * content in this map is not serialized under this field's {@code @SerializedName} value.
4157
           * Instead, each key/value pair is serialized as if the key is a root-level field
4158
           * (serialized) name in this param object. Effectively, this map is flattened to its
4159
           * parent instance.
4160
           */
4161
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4162
          Map<String, Object> extraParams;
4163

4164
          /** <strong>Required.</strong> The ID of the product that this price will belong to. */
4165
          @SerializedName("product")
4166
          String product;
4167

4168
          /**
4169
           * Only required if a <a
4170
           * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
4171
           * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
4172
           * price is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive},
4173
           * {@code exclusive}, or {@code unspecified}. Once specified as either {@code inclusive}
4174
           * or {@code exclusive}, it cannot be changed.
4175
           */
4176
          @SerializedName("tax_behavior")
4177
          TaxBehavior taxBehavior;
4178

4179
          /**
4180
           * A positive integer in cents (or local equivalent) (or 0 for a free price) representing
4181
           * how much to charge or a negative integer representing the amount to credit to the
4182
           * customer.
4183
           */
4184
          @SerializedName("unit_amount")
4185
          Long unitAmount;
4186

4187
          /**
4188
           * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
4189
           * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
4190
           * unit_amount_decimal} can be set.
4191
           */
4192
          @SerializedName("unit_amount_decimal")
4193
          BigDecimal unitAmountDecimal;
4194

4195
          private PriceData(
4196
              String currency,
4197
              Map<String, Object> extraParams,
4198
              String product,
4199
              TaxBehavior taxBehavior,
4200
              Long unitAmount,
4201
              BigDecimal unitAmountDecimal) {
×
4202
            this.currency = currency;
×
4203
            this.extraParams = extraParams;
×
4204
            this.product = product;
×
4205
            this.taxBehavior = taxBehavior;
×
4206
            this.unitAmount = unitAmount;
×
4207
            this.unitAmountDecimal = unitAmountDecimal;
×
4208
          }
×
4209

4210
          public static Builder builder() {
4211
            return new Builder();
×
4212
          }
4213

4214
          public static class Builder {
×
4215
            private String currency;
4216

4217
            private Map<String, Object> extraParams;
4218

4219
            private String product;
4220

4221
            private TaxBehavior taxBehavior;
4222

4223
            private Long unitAmount;
4224

4225
            private BigDecimal unitAmountDecimal;
4226

4227
            /** Finalize and obtain parameter instance from this builder. */
4228
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData
4229
                build() {
4230
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData(
×
4231
                  this.currency,
4232
                  this.extraParams,
4233
                  this.product,
4234
                  this.taxBehavior,
4235
                  this.unitAmount,
4236
                  this.unitAmountDecimal);
4237
            }
4238

4239
            /**
4240
             * <strong>Required.</strong> Three-letter <a
4241
             * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
4242
             * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
4243
             * currency</a>.
4244
             */
4245
            public Builder setCurrency(String currency) {
4246
              this.currency = currency;
×
4247
              return this;
×
4248
            }
4249

4250
            /**
4251
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
4252
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4253
             * original map. See {@link
4254
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData#extraParams}
4255
             * for the field documentation.
4256
             */
4257
            public Builder putExtraParam(String key, Object value) {
4258
              if (this.extraParams == null) {
×
4259
                this.extraParams = new HashMap<>();
×
4260
              }
4261
              this.extraParams.put(key, value);
×
4262
              return this;
×
4263
            }
4264

4265
            /**
4266
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4267
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4268
             * original map. See {@link
4269
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData#extraParams}
4270
             * for the field documentation.
4271
             */
4272
            public Builder putAllExtraParam(Map<String, Object> map) {
4273
              if (this.extraParams == null) {
×
4274
                this.extraParams = new HashMap<>();
×
4275
              }
4276
              this.extraParams.putAll(map);
×
4277
              return this;
×
4278
            }
4279

4280
            /** <strong>Required.</strong> The ID of the product that this price will belong to. */
4281
            public Builder setProduct(String product) {
4282
              this.product = product;
×
4283
              return this;
×
4284
            }
4285

4286
            /**
4287
             * Only required if a <a
4288
             * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
4289
             * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
4290
             * price is considered inclusive of taxes or exclusive of taxes. One of {@code
4291
             * inclusive}, {@code exclusive}, or {@code unspecified}. Once specified as either
4292
             * {@code inclusive} or {@code exclusive}, it cannot be changed.
4293
             */
4294
            public Builder setTaxBehavior(
4295
                InvoiceCreatePreviewParams.ScheduleDetails.Phase.AddInvoiceItem.PriceData
4296
                        .TaxBehavior
4297
                    taxBehavior) {
4298
              this.taxBehavior = taxBehavior;
×
4299
              return this;
×
4300
            }
4301

4302
            /**
4303
             * A positive integer in cents (or local equivalent) (or 0 for a free price)
4304
             * representing how much to charge or a negative integer representing the amount to
4305
             * credit to the customer.
4306
             */
4307
            public Builder setUnitAmount(Long unitAmount) {
4308
              this.unitAmount = unitAmount;
×
4309
              return this;
×
4310
            }
4311

4312
            /**
4313
             * Same as {@code unit_amount}, but accepts a decimal value in cents (or local
4314
             * equivalent) with at most 12 decimal places. Only one of {@code unit_amount} and
4315
             * {@code unit_amount_decimal} can be set.
4316
             */
4317
            public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
4318
              this.unitAmountDecimal = unitAmountDecimal;
×
4319
              return this;
×
4320
            }
4321
          }
4322

4323
          public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
4324
            @SerializedName("exclusive")
×
4325
            EXCLUSIVE("exclusive"),
4326

4327
            @SerializedName("inclusive")
×
4328
            INCLUSIVE("inclusive"),
4329

4330
            @SerializedName("unspecified")
×
4331
            UNSPECIFIED("unspecified");
4332

4333
            @Getter(onMethod_ = {@Override})
4334
            private final String value;
4335

4336
            TaxBehavior(String value) {
×
4337
              this.value = value;
×
4338
            }
×
4339
          }
4340
        }
4341
      }
4342

4343
      @Getter
4344
      public static class AutomaticTax {
4345
        /**
4346
         * <strong>Required.</strong> Enabled automatic tax calculation which will automatically
4347
         * compute tax rates on all invoices generated by the subscription.
4348
         */
4349
        @SerializedName("enabled")
4350
        Boolean enabled;
4351

4352
        /**
4353
         * Map of extra parameters for custom features not available in this client library. The
4354
         * content in this map is not serialized under this field's {@code @SerializedName} value.
4355
         * Instead, each key/value pair is serialized as if the key is a root-level field
4356
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
4357
         * instance.
4358
         */
4359
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4360
        Map<String, Object> extraParams;
4361

4362
        /**
4363
         * The account that's liable for tax. If set, the business address and tax registrations
4364
         * required to perform the tax calculation are loaded from this account. The tax transaction
4365
         * is returned in the report of the connected account.
4366
         */
4367
        @SerializedName("liability")
4368
        Liability liability;
4369

4370
        private AutomaticTax(
4371
            Boolean enabled, Map<String, Object> extraParams, Liability liability) {
×
4372
          this.enabled = enabled;
×
4373
          this.extraParams = extraParams;
×
4374
          this.liability = liability;
×
4375
        }
×
4376

4377
        public static Builder builder() {
4378
          return new Builder();
×
4379
        }
4380

4381
        public static class Builder {
×
4382
          private Boolean enabled;
4383

4384
          private Map<String, Object> extraParams;
4385

4386
          private Liability liability;
4387

4388
          /** Finalize and obtain parameter instance from this builder. */
4389
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax build() {
4390
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax(
×
4391
                this.enabled, this.extraParams, this.liability);
4392
          }
4393

4394
          /**
4395
           * <strong>Required.</strong> Enabled automatic tax calculation which will automatically
4396
           * compute tax rates on all invoices generated by the subscription.
4397
           */
4398
          public Builder setEnabled(Boolean enabled) {
4399
            this.enabled = enabled;
×
4400
            return this;
×
4401
          }
4402

4403
          /**
4404
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
4405
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4406
           * map. See {@link
4407
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax#extraParams} for the
4408
           * field documentation.
4409
           */
4410
          public Builder putExtraParam(String key, Object value) {
4411
            if (this.extraParams == null) {
×
4412
              this.extraParams = new HashMap<>();
×
4413
            }
4414
            this.extraParams.put(key, value);
×
4415
            return this;
×
4416
          }
4417

4418
          /**
4419
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4420
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4421
           * map. See {@link
4422
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax#extraParams} for the
4423
           * field documentation.
4424
           */
4425
          public Builder putAllExtraParam(Map<String, Object> map) {
4426
            if (this.extraParams == null) {
×
4427
              this.extraParams = new HashMap<>();
×
4428
            }
4429
            this.extraParams.putAll(map);
×
4430
            return this;
×
4431
          }
4432

4433
          /**
4434
           * The account that's liable for tax. If set, the business address and tax registrations
4435
           * required to perform the tax calculation are loaded from this account. The tax
4436
           * transaction is returned in the report of the connected account.
4437
           */
4438
          public Builder setLiability(
4439
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability liability) {
4440
            this.liability = liability;
×
4441
            return this;
×
4442
          }
4443
        }
4444

4445
        @Getter
4446
        public static class Liability {
4447
          /** The connected account being referenced when {@code type} is {@code account}. */
4448
          @SerializedName("account")
4449
          String account;
4450

4451
          /**
4452
           * Map of extra parameters for custom features not available in this client library. The
4453
           * content in this map is not serialized under this field's {@code @SerializedName} value.
4454
           * Instead, each key/value pair is serialized as if the key is a root-level field
4455
           * (serialized) name in this param object. Effectively, this map is flattened to its
4456
           * parent instance.
4457
           */
4458
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4459
          Map<String, Object> extraParams;
4460

4461
          /** <strong>Required.</strong> Type of the account referenced in the request. */
4462
          @SerializedName("type")
4463
          Type type;
4464

4465
          private Liability(String account, Map<String, Object> extraParams, Type type) {
×
4466
            this.account = account;
×
4467
            this.extraParams = extraParams;
×
4468
            this.type = type;
×
4469
          }
×
4470

4471
          public static Builder builder() {
4472
            return new Builder();
×
4473
          }
4474

4475
          public static class Builder {
×
4476
            private String account;
4477

4478
            private Map<String, Object> extraParams;
4479

4480
            private Type type;
4481

4482
            /** Finalize and obtain parameter instance from this builder. */
4483
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability build() {
4484
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability(
×
4485
                  this.account, this.extraParams, this.type);
4486
            }
4487

4488
            /** The connected account being referenced when {@code type} is {@code account}. */
4489
            public Builder setAccount(String account) {
4490
              this.account = account;
×
4491
              return this;
×
4492
            }
4493

4494
            /**
4495
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
4496
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4497
             * original map. See {@link
4498
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability#extraParams}
4499
             * for the field documentation.
4500
             */
4501
            public Builder putExtraParam(String key, Object value) {
4502
              if (this.extraParams == null) {
×
4503
                this.extraParams = new HashMap<>();
×
4504
              }
4505
              this.extraParams.put(key, value);
×
4506
              return this;
×
4507
            }
4508

4509
            /**
4510
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4511
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4512
             * original map. See {@link
4513
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability#extraParams}
4514
             * for the field documentation.
4515
             */
4516
            public Builder putAllExtraParam(Map<String, Object> map) {
4517
              if (this.extraParams == null) {
×
4518
                this.extraParams = new HashMap<>();
×
4519
              }
4520
              this.extraParams.putAll(map);
×
4521
              return this;
×
4522
            }
4523

4524
            /** <strong>Required.</strong> Type of the account referenced in the request. */
4525
            public Builder setType(
4526
                InvoiceCreatePreviewParams.ScheduleDetails.Phase.AutomaticTax.Liability.Type type) {
4527
              this.type = type;
×
4528
              return this;
×
4529
            }
4530
          }
4531

4532
          public enum Type implements ApiRequestParams.EnumParam {
×
4533
            @SerializedName("account")
×
4534
            ACCOUNT("account"),
4535

4536
            @SerializedName("self")
×
4537
            SELF("self");
4538

4539
            @Getter(onMethod_ = {@Override})
4540
            private final String value;
4541

4542
            Type(String value) {
×
4543
              this.value = value;
×
4544
            }
×
4545
          }
4546
        }
4547
      }
4548

4549
      @Getter
4550
      public static class BillingThresholds {
4551
        /** Monetary threshold that triggers the subscription to advance to a new billing period. */
4552
        @SerializedName("amount_gte")
4553
        Long amountGte;
4554

4555
        /**
4556
         * Map of extra parameters for custom features not available in this client library. The
4557
         * content in this map is not serialized under this field's {@code @SerializedName} value.
4558
         * Instead, each key/value pair is serialized as if the key is a root-level field
4559
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
4560
         * instance.
4561
         */
4562
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4563
        Map<String, Object> extraParams;
4564

4565
        /**
4566
         * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is
4567
         * reached. If true, {@code billing_cycle_anchor} will be updated to the date/time the
4568
         * threshold was last reached; otherwise, the value will remain unchanged.
4569
         */
4570
        @SerializedName("reset_billing_cycle_anchor")
4571
        Boolean resetBillingCycleAnchor;
4572

4573
        private BillingThresholds(
4574
            Long amountGte, Map<String, Object> extraParams, Boolean resetBillingCycleAnchor) {
×
4575
          this.amountGte = amountGte;
×
4576
          this.extraParams = extraParams;
×
4577
          this.resetBillingCycleAnchor = resetBillingCycleAnchor;
×
4578
        }
×
4579

4580
        public static Builder builder() {
4581
          return new Builder();
×
4582
        }
4583

4584
        public static class Builder {
×
4585
          private Long amountGte;
4586

4587
          private Map<String, Object> extraParams;
4588

4589
          private Boolean resetBillingCycleAnchor;
4590

4591
          /** Finalize and obtain parameter instance from this builder. */
4592
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds build() {
4593
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds(
×
4594
                this.amountGte, this.extraParams, this.resetBillingCycleAnchor);
4595
          }
4596

4597
          /**
4598
           * Monetary threshold that triggers the subscription to advance to a new billing period.
4599
           */
4600
          public Builder setAmountGte(Long amountGte) {
4601
            this.amountGte = amountGte;
×
4602
            return this;
×
4603
          }
4604

4605
          /**
4606
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
4607
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4608
           * map. See {@link
4609
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#extraParams} for the
4610
           * field documentation.
4611
           */
4612
          public Builder putExtraParam(String key, Object value) {
4613
            if (this.extraParams == null) {
×
4614
              this.extraParams = new HashMap<>();
×
4615
            }
4616
            this.extraParams.put(key, value);
×
4617
            return this;
×
4618
          }
4619

4620
          /**
4621
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4622
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4623
           * map. See {@link
4624
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.BillingThresholds#extraParams} for the
4625
           * field documentation.
4626
           */
4627
          public Builder putAllExtraParam(Map<String, Object> map) {
4628
            if (this.extraParams == null) {
×
4629
              this.extraParams = new HashMap<>();
×
4630
            }
4631
            this.extraParams.putAll(map);
×
4632
            return this;
×
4633
          }
4634

4635
          /**
4636
           * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is
4637
           * reached. If true, {@code billing_cycle_anchor} will be updated to the date/time the
4638
           * threshold was last reached; otherwise, the value will remain unchanged.
4639
           */
4640
          public Builder setResetBillingCycleAnchor(Boolean resetBillingCycleAnchor) {
4641
            this.resetBillingCycleAnchor = resetBillingCycleAnchor;
×
4642
            return this;
×
4643
          }
4644
        }
4645
      }
4646

4647
      @Getter
4648
      public static class Discount {
4649
        /** ID of the coupon to create a new discount for. */
4650
        @SerializedName("coupon")
4651
        String coupon;
4652

4653
        /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
4654
        @SerializedName("discount")
4655
        String discount;
4656

4657
        /**
4658
         * Map of extra parameters for custom features not available in this client library. The
4659
         * content in this map is not serialized under this field's {@code @SerializedName} value.
4660
         * Instead, each key/value pair is serialized as if the key is a root-level field
4661
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
4662
         * instance.
4663
         */
4664
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4665
        Map<String, Object> extraParams;
4666

4667
        /** ID of the promotion code to create a new discount for. */
4668
        @SerializedName("promotion_code")
4669
        String promotionCode;
4670

4671
        private Discount(
4672
            String coupon, String discount, Map<String, Object> extraParams, String promotionCode) {
×
4673
          this.coupon = coupon;
×
4674
          this.discount = discount;
×
4675
          this.extraParams = extraParams;
×
4676
          this.promotionCode = promotionCode;
×
4677
        }
×
4678

4679
        public static Builder builder() {
4680
          return new Builder();
×
4681
        }
4682

4683
        public static class Builder {
×
4684
          private String coupon;
4685

4686
          private String discount;
4687

4688
          private Map<String, Object> extraParams;
4689

4690
          private String promotionCode;
4691

4692
          /** Finalize and obtain parameter instance from this builder. */
4693
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount build() {
4694
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount(
×
4695
                this.coupon, this.discount, this.extraParams, this.promotionCode);
4696
          }
4697

4698
          /** ID of the coupon to create a new discount for. */
4699
          public Builder setCoupon(String coupon) {
4700
            this.coupon = coupon;
×
4701
            return this;
×
4702
          }
4703

4704
          /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
4705
          public Builder setDiscount(String discount) {
4706
            this.discount = discount;
×
4707
            return this;
×
4708
          }
4709

4710
          /**
4711
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
4712
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4713
           * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#extraParams}
4714
           * for the field documentation.
4715
           */
4716
          public Builder putExtraParam(String key, Object value) {
4717
            if (this.extraParams == null) {
×
4718
              this.extraParams = new HashMap<>();
×
4719
            }
4720
            this.extraParams.put(key, value);
×
4721
            return this;
×
4722
          }
4723

4724
          /**
4725
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4726
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4727
           * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Discount#extraParams}
4728
           * for the field documentation.
4729
           */
4730
          public Builder putAllExtraParam(Map<String, Object> map) {
4731
            if (this.extraParams == null) {
×
4732
              this.extraParams = new HashMap<>();
×
4733
            }
4734
            this.extraParams.putAll(map);
×
4735
            return this;
×
4736
          }
4737

4738
          /** ID of the promotion code to create a new discount for. */
4739
          public Builder setPromotionCode(String promotionCode) {
4740
            this.promotionCode = promotionCode;
×
4741
            return this;
×
4742
          }
4743
        }
4744
      }
4745

4746
      @Getter
4747
      public static class InvoiceSettings {
4748
        /**
4749
         * The account tax IDs associated with this phase of the subscription schedule. Will be set
4750
         * on invoices generated by this phase of the subscription schedule.
4751
         */
4752
        @SerializedName("account_tax_ids")
4753
        Object accountTaxIds;
4754

4755
        /**
4756
         * Number of days within which a customer must pay invoices generated by this subscription
4757
         * schedule. This value will be {@code null} for subscription schedules where {@code
4758
         * billing=charge_automatically}.
4759
         */
4760
        @SerializedName("days_until_due")
4761
        Long daysUntilDue;
4762

4763
        /**
4764
         * Map of extra parameters for custom features not available in this client library. The
4765
         * content in this map is not serialized under this field's {@code @SerializedName} value.
4766
         * Instead, each key/value pair is serialized as if the key is a root-level field
4767
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
4768
         * instance.
4769
         */
4770
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4771
        Map<String, Object> extraParams;
4772

4773
        /**
4774
         * The connected account that issues the invoice. The invoice is presented with the branding
4775
         * and support information of the specified account.
4776
         */
4777
        @SerializedName("issuer")
4778
        Issuer issuer;
4779

4780
        private InvoiceSettings(
4781
            Object accountTaxIds,
4782
            Long daysUntilDue,
4783
            Map<String, Object> extraParams,
4784
            Issuer issuer) {
×
4785
          this.accountTaxIds = accountTaxIds;
×
4786
          this.daysUntilDue = daysUntilDue;
×
4787
          this.extraParams = extraParams;
×
4788
          this.issuer = issuer;
×
4789
        }
×
4790

4791
        public static Builder builder() {
4792
          return new Builder();
×
4793
        }
4794

4795
        public static class Builder {
×
4796
          private Object accountTaxIds;
4797

4798
          private Long daysUntilDue;
4799

4800
          private Map<String, Object> extraParams;
4801

4802
          private Issuer issuer;
4803

4804
          /** Finalize and obtain parameter instance from this builder. */
4805
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings build() {
4806
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings(
×
4807
                this.accountTaxIds, this.daysUntilDue, this.extraParams, this.issuer);
4808
          }
4809

4810
          /**
4811
           * Add an element to `accountTaxIds` list. A list is initialized for the first
4812
           * `add/addAll` call, and subsequent calls adds additional elements to the original list.
4813
           * See {@link
4814
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings#accountTaxIds} for the
4815
           * field documentation.
4816
           */
4817
          @SuppressWarnings("unchecked")
4818
          public Builder addAccountTaxId(String element) {
4819
            if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) {
×
4820
              this.accountTaxIds = new ArrayList<String>();
×
4821
            }
4822
            ((List<String>) this.accountTaxIds).add(element);
×
4823
            return this;
×
4824
          }
4825

4826
          /**
4827
           * Add all elements to `accountTaxIds` list. A list is initialized for the first
4828
           * `add/addAll` call, and subsequent calls adds additional elements to the original list.
4829
           * See {@link
4830
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings#accountTaxIds} for the
4831
           * field documentation.
4832
           */
4833
          @SuppressWarnings("unchecked")
4834
          public Builder addAllAccountTaxId(List<String> elements) {
4835
            if (this.accountTaxIds == null || this.accountTaxIds instanceof EmptyParam) {
×
4836
              this.accountTaxIds = new ArrayList<String>();
×
4837
            }
4838
            ((List<String>) this.accountTaxIds).addAll(elements);
×
4839
            return this;
×
4840
          }
4841

4842
          /**
4843
           * The account tax IDs associated with this phase of the subscription schedule. Will be
4844
           * set on invoices generated by this phase of the subscription schedule.
4845
           */
4846
          public Builder setAccountTaxIds(EmptyParam accountTaxIds) {
4847
            this.accountTaxIds = accountTaxIds;
×
4848
            return this;
×
4849
          }
4850

4851
          /**
4852
           * The account tax IDs associated with this phase of the subscription schedule. Will be
4853
           * set on invoices generated by this phase of the subscription schedule.
4854
           */
4855
          public Builder setAccountTaxIds(List<String> accountTaxIds) {
4856
            this.accountTaxIds = accountTaxIds;
×
4857
            return this;
×
4858
          }
4859

4860
          /**
4861
           * Number of days within which a customer must pay invoices generated by this subscription
4862
           * schedule. This value will be {@code null} for subscription schedules where {@code
4863
           * billing=charge_automatically}.
4864
           */
4865
          public Builder setDaysUntilDue(Long daysUntilDue) {
4866
            this.daysUntilDue = daysUntilDue;
×
4867
            return this;
×
4868
          }
4869

4870
          /**
4871
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
4872
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4873
           * map. See {@link
4874
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings#extraParams} for the
4875
           * field documentation.
4876
           */
4877
          public Builder putExtraParam(String key, Object value) {
4878
            if (this.extraParams == null) {
×
4879
              this.extraParams = new HashMap<>();
×
4880
            }
4881
            this.extraParams.put(key, value);
×
4882
            return this;
×
4883
          }
4884

4885
          /**
4886
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4887
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
4888
           * map. See {@link
4889
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings#extraParams} for the
4890
           * field documentation.
4891
           */
4892
          public Builder putAllExtraParam(Map<String, Object> map) {
4893
            if (this.extraParams == null) {
×
4894
              this.extraParams = new HashMap<>();
×
4895
            }
4896
            this.extraParams.putAll(map);
×
4897
            return this;
×
4898
          }
4899

4900
          /**
4901
           * The connected account that issues the invoice. The invoice is presented with the
4902
           * branding and support information of the specified account.
4903
           */
4904
          public Builder setIssuer(
4905
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer issuer) {
4906
            this.issuer = issuer;
×
4907
            return this;
×
4908
          }
4909
        }
4910

4911
        @Getter
4912
        public static class Issuer {
4913
          /** The connected account being referenced when {@code type} is {@code account}. */
4914
          @SerializedName("account")
4915
          String account;
4916

4917
          /**
4918
           * Map of extra parameters for custom features not available in this client library. The
4919
           * content in this map is not serialized under this field's {@code @SerializedName} value.
4920
           * Instead, each key/value pair is serialized as if the key is a root-level field
4921
           * (serialized) name in this param object. Effectively, this map is flattened to its
4922
           * parent instance.
4923
           */
4924
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
4925
          Map<String, Object> extraParams;
4926

4927
          /** <strong>Required.</strong> Type of the account referenced in the request. */
4928
          @SerializedName("type")
4929
          Type type;
4930

4931
          private Issuer(String account, Map<String, Object> extraParams, Type type) {
×
4932
            this.account = account;
×
4933
            this.extraParams = extraParams;
×
4934
            this.type = type;
×
4935
          }
×
4936

4937
          public static Builder builder() {
4938
            return new Builder();
×
4939
          }
4940

4941
          public static class Builder {
×
4942
            private String account;
4943

4944
            private Map<String, Object> extraParams;
4945

4946
            private Type type;
4947

4948
            /** Finalize and obtain parameter instance from this builder. */
4949
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer build() {
4950
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer(
×
4951
                  this.account, this.extraParams, this.type);
4952
            }
4953

4954
            /** The connected account being referenced when {@code type} is {@code account}. */
4955
            public Builder setAccount(String account) {
4956
              this.account = account;
×
4957
              return this;
×
4958
            }
4959

4960
            /**
4961
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
4962
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4963
             * original map. See {@link
4964
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer#extraParams}
4965
             * for the field documentation.
4966
             */
4967
            public Builder putExtraParam(String key, Object value) {
4968
              if (this.extraParams == null) {
×
4969
                this.extraParams = new HashMap<>();
×
4970
              }
4971
              this.extraParams.put(key, value);
×
4972
              return this;
×
4973
            }
4974

4975
            /**
4976
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
4977
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
4978
             * original map. See {@link
4979
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer#extraParams}
4980
             * for the field documentation.
4981
             */
4982
            public Builder putAllExtraParam(Map<String, Object> map) {
4983
              if (this.extraParams == null) {
×
4984
                this.extraParams = new HashMap<>();
×
4985
              }
4986
              this.extraParams.putAll(map);
×
4987
              return this;
×
4988
            }
4989

4990
            /** <strong>Required.</strong> Type of the account referenced in the request. */
4991
            public Builder setType(
4992
                InvoiceCreatePreviewParams.ScheduleDetails.Phase.InvoiceSettings.Issuer.Type type) {
4993
              this.type = type;
×
4994
              return this;
×
4995
            }
4996
          }
4997

4998
          public enum Type implements ApiRequestParams.EnumParam {
×
4999
            @SerializedName("account")
×
5000
            ACCOUNT("account"),
5001

5002
            @SerializedName("self")
×
5003
            SELF("self");
5004

5005
            @Getter(onMethod_ = {@Override})
5006
            private final String value;
5007

5008
            Type(String value) {
×
5009
              this.value = value;
×
5010
            }
×
5011
          }
5012
        }
5013
      }
5014

5015
      @Getter
5016
      public static class Item {
5017
        /**
5018
         * Define thresholds at which an invoice will be sent, and the subscription advanced to a
5019
         * new billing period. When updating, pass an empty string to remove previously-defined
5020
         * thresholds.
5021
         */
5022
        @SerializedName("billing_thresholds")
5023
        Object billingThresholds;
5024

5025
        /** The coupons to redeem into discounts for the subscription item. */
5026
        @SerializedName("discounts")
5027
        Object discounts;
5028

5029
        /**
5030
         * Map of extra parameters for custom features not available in this client library. The
5031
         * content in this map is not serialized under this field's {@code @SerializedName} value.
5032
         * Instead, each key/value pair is serialized as if the key is a root-level field
5033
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
5034
         * instance.
5035
         */
5036
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5037
        Map<String, Object> extraParams;
5038

5039
        /**
5040
         * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
5041
         * attach to a configuration item. Metadata on a configuration item will update the
5042
         * underlying subscription item's {@code metadata} when the phase is entered, adding new
5043
         * keys and replacing existing keys. Individual keys in the subscription item's {@code
5044
         * metadata} can be unset by posting an empty value to them in the configuration item's
5045
         * {@code metadata}. To unset all keys in the subscription item's {@code metadata}, update
5046
         * the subscription item directly or unset every key individually from the configuration
5047
         * item's {@code metadata}.
5048
         */
5049
        @SerializedName("metadata")
5050
        Map<String, String> metadata;
5051

5052
        /**
5053
         * The plan ID to subscribe to. You may specify the same ID in {@code plan} and {@code
5054
         * price}.
5055
         */
5056
        @SerializedName("plan")
5057
        String plan;
5058

5059
        /** The ID of the price object. */
5060
        @SerializedName("price")
5061
        String price;
5062

5063
        /**
5064
         * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
5065
         * inline.
5066
         */
5067
        @SerializedName("price_data")
5068
        PriceData priceData;
5069

5070
        /**
5071
         * Quantity for the given price. Can be set only if the price's {@code usage_type} is {@code
5072
         * licensed} and not {@code metered}.
5073
         */
5074
        @SerializedName("quantity")
5075
        Long quantity;
5076

5077
        /**
5078
         * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
5079
         * Rates will override the <a
5080
         * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
5081
         * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to remove
5082
         * previously-defined tax rates.
5083
         */
5084
        @SerializedName("tax_rates")
5085
        Object taxRates;
5086

5087
        private Item(
5088
            Object billingThresholds,
5089
            Object discounts,
5090
            Map<String, Object> extraParams,
5091
            Map<String, String> metadata,
5092
            String plan,
5093
            String price,
5094
            PriceData priceData,
5095
            Long quantity,
5096
            Object taxRates) {
×
5097
          this.billingThresholds = billingThresholds;
×
5098
          this.discounts = discounts;
×
5099
          this.extraParams = extraParams;
×
5100
          this.metadata = metadata;
×
5101
          this.plan = plan;
×
5102
          this.price = price;
×
5103
          this.priceData = priceData;
×
5104
          this.quantity = quantity;
×
5105
          this.taxRates = taxRates;
×
5106
        }
×
5107

5108
        public static Builder builder() {
5109
          return new Builder();
×
5110
        }
5111

5112
        public static class Builder {
×
5113
          private Object billingThresholds;
5114

5115
          private Object discounts;
5116

5117
          private Map<String, Object> extraParams;
5118

5119
          private Map<String, String> metadata;
5120

5121
          private String plan;
5122

5123
          private String price;
5124

5125
          private PriceData priceData;
5126

5127
          private Long quantity;
5128

5129
          private Object taxRates;
5130

5131
          /** Finalize and obtain parameter instance from this builder. */
5132
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item build() {
5133
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item(
×
5134
                this.billingThresholds,
5135
                this.discounts,
5136
                this.extraParams,
5137
                this.metadata,
5138
                this.plan,
5139
                this.price,
5140
                this.priceData,
5141
                this.quantity,
5142
                this.taxRates);
5143
          }
5144

5145
          /**
5146
           * Define thresholds at which an invoice will be sent, and the subscription advanced to a
5147
           * new billing period. When updating, pass an empty string to remove previously-defined
5148
           * thresholds.
5149
           */
5150
          public Builder setBillingThresholds(
5151
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.BillingThresholds
5152
                  billingThresholds) {
5153
            this.billingThresholds = billingThresholds;
×
5154
            return this;
×
5155
          }
5156

5157
          /**
5158
           * Define thresholds at which an invoice will be sent, and the subscription advanced to a
5159
           * new billing period. When updating, pass an empty string to remove previously-defined
5160
           * thresholds.
5161
           */
5162
          public Builder setBillingThresholds(EmptyParam billingThresholds) {
5163
            this.billingThresholds = billingThresholds;
×
5164
            return this;
×
5165
          }
5166

5167
          /**
5168
           * Add an element to `discounts` list. A list is initialized for the first `add/addAll`
5169
           * call, and subsequent calls adds additional elements to the original list. See {@link
5170
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#discounts} for the field
5171
           * documentation.
5172
           */
5173
          @SuppressWarnings("unchecked")
5174
          public Builder addDiscount(
5175
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount element) {
5176
            if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
5177
              this.discounts =
×
5178
                  new ArrayList<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount>();
5179
            }
5180
            ((List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount>) this.discounts)
×
5181
                .add(element);
×
5182
            return this;
×
5183
          }
5184

5185
          /**
5186
           * Add all elements to `discounts` list. A list is initialized for the first `add/addAll`
5187
           * call, and subsequent calls adds additional elements to the original list. See {@link
5188
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#discounts} for the field
5189
           * documentation.
5190
           */
5191
          @SuppressWarnings("unchecked")
5192
          public Builder addAllDiscount(
5193
              List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount> elements) {
5194
            if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
5195
              this.discounts =
×
5196
                  new ArrayList<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount>();
5197
            }
5198
            ((List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount>) this.discounts)
×
5199
                .addAll(elements);
×
5200
            return this;
×
5201
          }
5202

5203
          /** The coupons to redeem into discounts for the subscription item. */
5204
          public Builder setDiscounts(EmptyParam discounts) {
5205
            this.discounts = discounts;
×
5206
            return this;
×
5207
          }
5208

5209
          /** The coupons to redeem into discounts for the subscription item. */
5210
          public Builder setDiscounts(
5211
              List<InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount> discounts) {
5212
            this.discounts = discounts;
×
5213
            return this;
×
5214
          }
5215

5216
          /**
5217
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
5218
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
5219
           * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#extraParams} for
5220
           * the field documentation.
5221
           */
5222
          public Builder putExtraParam(String key, Object value) {
5223
            if (this.extraParams == null) {
×
5224
              this.extraParams = new HashMap<>();
×
5225
            }
5226
            this.extraParams.put(key, value);
×
5227
            return this;
×
5228
          }
5229

5230
          /**
5231
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
5232
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
5233
           * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#extraParams} for
5234
           * the field documentation.
5235
           */
5236
          public Builder putAllExtraParam(Map<String, Object> map) {
5237
            if (this.extraParams == null) {
×
5238
              this.extraParams = new HashMap<>();
×
5239
            }
5240
            this.extraParams.putAll(map);
×
5241
            return this;
×
5242
          }
5243

5244
          /**
5245
           * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll`
5246
           * call, and subsequent calls add additional key/value pairs to the original map. See
5247
           * {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#metadata} for the field
5248
           * documentation.
5249
           */
5250
          public Builder putMetadata(String key, String value) {
5251
            if (this.metadata == null) {
×
5252
              this.metadata = new HashMap<>();
×
5253
            }
5254
            this.metadata.put(key, value);
×
5255
            return this;
×
5256
          }
5257

5258
          /**
5259
           * Add all map key/value pairs to `metadata` map. A map is initialized for the first
5260
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
5261
           * map. See {@link InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#metadata} for the
5262
           * field documentation.
5263
           */
5264
          public Builder putAllMetadata(Map<String, String> map) {
5265
            if (this.metadata == null) {
×
5266
              this.metadata = new HashMap<>();
×
5267
            }
5268
            this.metadata.putAll(map);
×
5269
            return this;
×
5270
          }
5271

5272
          /**
5273
           * The plan ID to subscribe to. You may specify the same ID in {@code plan} and {@code
5274
           * price}.
5275
           */
5276
          public Builder setPlan(String plan) {
5277
            this.plan = plan;
×
5278
            return this;
×
5279
          }
5280

5281
          /** The ID of the price object. */
5282
          public Builder setPrice(String price) {
5283
            this.price = price;
×
5284
            return this;
×
5285
          }
5286

5287
          /**
5288
           * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a>
5289
           * object inline.
5290
           */
5291
          public Builder setPriceData(
5292
              InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData priceData) {
5293
            this.priceData = priceData;
×
5294
            return this;
×
5295
          }
5296

5297
          /**
5298
           * Quantity for the given price. Can be set only if the price's {@code usage_type} is
5299
           * {@code licensed} and not {@code metered}.
5300
           */
5301
          public Builder setQuantity(Long quantity) {
5302
            this.quantity = quantity;
×
5303
            return this;
×
5304
          }
5305

5306
          /**
5307
           * Add an element to `taxRates` list. A list is initialized for the first `add/addAll`
5308
           * call, and subsequent calls adds additional elements to the original list. See {@link
5309
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#taxRates} for the field
5310
           * documentation.
5311
           */
5312
          @SuppressWarnings("unchecked")
5313
          public Builder addTaxRate(String element) {
5314
            if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
5315
              this.taxRates = new ArrayList<String>();
×
5316
            }
5317
            ((List<String>) this.taxRates).add(element);
×
5318
            return this;
×
5319
          }
5320

5321
          /**
5322
           * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll`
5323
           * call, and subsequent calls adds additional elements to the original list. See {@link
5324
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item#taxRates} for the field
5325
           * documentation.
5326
           */
5327
          @SuppressWarnings("unchecked")
5328
          public Builder addAllTaxRate(List<String> elements) {
5329
            if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
5330
              this.taxRates = new ArrayList<String>();
×
5331
            }
5332
            ((List<String>) this.taxRates).addAll(elements);
×
5333
            return this;
×
5334
          }
5335

5336
          /**
5337
           * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
5338
           * Rates will override the <a
5339
           * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
5340
           * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to
5341
           * remove previously-defined tax rates.
5342
           */
5343
          public Builder setTaxRates(EmptyParam taxRates) {
5344
            this.taxRates = taxRates;
×
5345
            return this;
×
5346
          }
5347

5348
          /**
5349
           * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
5350
           * Rates will override the <a
5351
           * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
5352
           * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to
5353
           * remove previously-defined tax rates.
5354
           */
5355
          public Builder setTaxRates(List<String> taxRates) {
5356
            this.taxRates = taxRates;
×
5357
            return this;
×
5358
          }
5359
        }
5360

5361
        @Getter
5362
        public static class BillingThresholds {
5363
          /**
5364
           * Map of extra parameters for custom features not available in this client library. The
5365
           * content in this map is not serialized under this field's {@code @SerializedName} value.
5366
           * Instead, each key/value pair is serialized as if the key is a root-level field
5367
           * (serialized) name in this param object. Effectively, this map is flattened to its
5368
           * parent instance.
5369
           */
5370
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5371
          Map<String, Object> extraParams;
5372

5373
          /**
5374
           * <strong>Required.</strong> Number of units that meets the billing threshold to advance
5375
           * the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 <a
5376
           * href="https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte">monetary
5377
           * threshold</a>)
5378
           */
5379
          @SerializedName("usage_gte")
5380
          Long usageGte;
5381

5382
          private BillingThresholds(Map<String, Object> extraParams, Long usageGte) {
×
5383
            this.extraParams = extraParams;
×
5384
            this.usageGte = usageGte;
×
5385
          }
×
5386

5387
          public static Builder builder() {
5388
            return new Builder();
×
5389
          }
5390

5391
          public static class Builder {
×
5392
            private Map<String, Object> extraParams;
5393

5394
            private Long usageGte;
5395

5396
            /** Finalize and obtain parameter instance from this builder. */
5397
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.BillingThresholds build() {
5398
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.BillingThresholds(
×
5399
                  this.extraParams, this.usageGte);
5400
            }
5401

5402
            /**
5403
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
5404
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5405
             * original map. See {@link
5406
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.BillingThresholds#extraParams}
5407
             * for the field documentation.
5408
             */
5409
            public Builder putExtraParam(String key, Object value) {
5410
              if (this.extraParams == null) {
×
5411
                this.extraParams = new HashMap<>();
×
5412
              }
5413
              this.extraParams.put(key, value);
×
5414
              return this;
×
5415
            }
5416

5417
            /**
5418
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
5419
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5420
             * original map. See {@link
5421
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.BillingThresholds#extraParams}
5422
             * for the field documentation.
5423
             */
5424
            public Builder putAllExtraParam(Map<String, Object> map) {
5425
              if (this.extraParams == null) {
×
5426
                this.extraParams = new HashMap<>();
×
5427
              }
5428
              this.extraParams.putAll(map);
×
5429
              return this;
×
5430
            }
5431

5432
            /**
5433
             * <strong>Required.</strong> Number of units that meets the billing threshold to
5434
             * advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet
5435
             * a $50 <a
5436
             * href="https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte">monetary
5437
             * threshold</a>)
5438
             */
5439
            public Builder setUsageGte(Long usageGte) {
5440
              this.usageGte = usageGte;
×
5441
              return this;
×
5442
            }
5443
          }
5444
        }
5445

5446
        @Getter
5447
        public static class Discount {
5448
          /** ID of the coupon to create a new discount for. */
5449
          @SerializedName("coupon")
5450
          String coupon;
5451

5452
          /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
5453
          @SerializedName("discount")
5454
          String discount;
5455

5456
          /**
5457
           * Map of extra parameters for custom features not available in this client library. The
5458
           * content in this map is not serialized under this field's {@code @SerializedName} value.
5459
           * Instead, each key/value pair is serialized as if the key is a root-level field
5460
           * (serialized) name in this param object. Effectively, this map is flattened to its
5461
           * parent instance.
5462
           */
5463
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5464
          Map<String, Object> extraParams;
5465

5466
          /** ID of the promotion code to create a new discount for. */
5467
          @SerializedName("promotion_code")
5468
          String promotionCode;
5469

5470
          private Discount(
5471
              String coupon,
5472
              String discount,
5473
              Map<String, Object> extraParams,
5474
              String promotionCode) {
×
5475
            this.coupon = coupon;
×
5476
            this.discount = discount;
×
5477
            this.extraParams = extraParams;
×
5478
            this.promotionCode = promotionCode;
×
5479
          }
×
5480

5481
          public static Builder builder() {
5482
            return new Builder();
×
5483
          }
5484

5485
          public static class Builder {
×
5486
            private String coupon;
5487

5488
            private String discount;
5489

5490
            private Map<String, Object> extraParams;
5491

5492
            private String promotionCode;
5493

5494
            /** Finalize and obtain parameter instance from this builder. */
5495
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount build() {
5496
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount(
×
5497
                  this.coupon, this.discount, this.extraParams, this.promotionCode);
5498
            }
5499

5500
            /** ID of the coupon to create a new discount for. */
5501
            public Builder setCoupon(String coupon) {
5502
              this.coupon = coupon;
×
5503
              return this;
×
5504
            }
5505

5506
            /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
5507
            public Builder setDiscount(String discount) {
5508
              this.discount = discount;
×
5509
              return this;
×
5510
            }
5511

5512
            /**
5513
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
5514
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5515
             * original map. See {@link
5516
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount#extraParams} for the
5517
             * field documentation.
5518
             */
5519
            public Builder putExtraParam(String key, Object value) {
5520
              if (this.extraParams == null) {
×
5521
                this.extraParams = new HashMap<>();
×
5522
              }
5523
              this.extraParams.put(key, value);
×
5524
              return this;
×
5525
            }
5526

5527
            /**
5528
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
5529
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5530
             * original map. See {@link
5531
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.Discount#extraParams} for the
5532
             * field documentation.
5533
             */
5534
            public Builder putAllExtraParam(Map<String, Object> map) {
5535
              if (this.extraParams == null) {
×
5536
                this.extraParams = new HashMap<>();
×
5537
              }
5538
              this.extraParams.putAll(map);
×
5539
              return this;
×
5540
            }
5541

5542
            /** ID of the promotion code to create a new discount for. */
5543
            public Builder setPromotionCode(String promotionCode) {
5544
              this.promotionCode = promotionCode;
×
5545
              return this;
×
5546
            }
5547
          }
5548
        }
5549

5550
        @Getter
5551
        public static class PriceData {
5552
          /**
5553
           * <strong>Required.</strong> Three-letter <a
5554
           * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
5555
           * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
5556
           * currency</a>.
5557
           */
5558
          @SerializedName("currency")
5559
          String currency;
5560

5561
          /**
5562
           * Map of extra parameters for custom features not available in this client library. The
5563
           * content in this map is not serialized under this field's {@code @SerializedName} value.
5564
           * Instead, each key/value pair is serialized as if the key is a root-level field
5565
           * (serialized) name in this param object. Effectively, this map is flattened to its
5566
           * parent instance.
5567
           */
5568
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5569
          Map<String, Object> extraParams;
5570

5571
          /** <strong>Required.</strong> The ID of the product that this price will belong to. */
5572
          @SerializedName("product")
5573
          String product;
5574

5575
          /**
5576
           * <strong>Required.</strong> The recurring components of a price such as {@code interval}
5577
           * and {@code interval_count}.
5578
           */
5579
          @SerializedName("recurring")
5580
          Recurring recurring;
5581

5582
          /**
5583
           * Only required if a <a
5584
           * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
5585
           * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
5586
           * price is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive},
5587
           * {@code exclusive}, or {@code unspecified}. Once specified as either {@code inclusive}
5588
           * or {@code exclusive}, it cannot be changed.
5589
           */
5590
          @SerializedName("tax_behavior")
5591
          TaxBehavior taxBehavior;
5592

5593
          /**
5594
           * A positive integer in cents (or local equivalent) (or 0 for a free price) representing
5595
           * how much to charge.
5596
           */
5597
          @SerializedName("unit_amount")
5598
          Long unitAmount;
5599

5600
          /**
5601
           * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
5602
           * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
5603
           * unit_amount_decimal} can be set.
5604
           */
5605
          @SerializedName("unit_amount_decimal")
5606
          BigDecimal unitAmountDecimal;
5607

5608
          private PriceData(
5609
              String currency,
5610
              Map<String, Object> extraParams,
5611
              String product,
5612
              Recurring recurring,
5613
              TaxBehavior taxBehavior,
5614
              Long unitAmount,
5615
              BigDecimal unitAmountDecimal) {
×
5616
            this.currency = currency;
×
5617
            this.extraParams = extraParams;
×
5618
            this.product = product;
×
5619
            this.recurring = recurring;
×
5620
            this.taxBehavior = taxBehavior;
×
5621
            this.unitAmount = unitAmount;
×
5622
            this.unitAmountDecimal = unitAmountDecimal;
×
5623
          }
×
5624

5625
          public static Builder builder() {
5626
            return new Builder();
×
5627
          }
5628

5629
          public static class Builder {
×
5630
            private String currency;
5631

5632
            private Map<String, Object> extraParams;
5633

5634
            private String product;
5635

5636
            private Recurring recurring;
5637

5638
            private TaxBehavior taxBehavior;
5639

5640
            private Long unitAmount;
5641

5642
            private BigDecimal unitAmountDecimal;
5643

5644
            /** Finalize and obtain parameter instance from this builder. */
5645
            public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData build() {
5646
              return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData(
×
5647
                  this.currency,
5648
                  this.extraParams,
5649
                  this.product,
5650
                  this.recurring,
5651
                  this.taxBehavior,
5652
                  this.unitAmount,
5653
                  this.unitAmountDecimal);
5654
            }
5655

5656
            /**
5657
             * <strong>Required.</strong> Three-letter <a
5658
             * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
5659
             * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
5660
             * currency</a>.
5661
             */
5662
            public Builder setCurrency(String currency) {
5663
              this.currency = currency;
×
5664
              return this;
×
5665
            }
5666

5667
            /**
5668
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
5669
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5670
             * original map. See {@link
5671
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData#extraParams} for the
5672
             * field documentation.
5673
             */
5674
            public Builder putExtraParam(String key, Object value) {
5675
              if (this.extraParams == null) {
×
5676
                this.extraParams = new HashMap<>();
×
5677
              }
5678
              this.extraParams.put(key, value);
×
5679
              return this;
×
5680
            }
5681

5682
            /**
5683
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
5684
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5685
             * original map. See {@link
5686
             * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData#extraParams} for the
5687
             * field documentation.
5688
             */
5689
            public Builder putAllExtraParam(Map<String, Object> map) {
5690
              if (this.extraParams == null) {
×
5691
                this.extraParams = new HashMap<>();
×
5692
              }
5693
              this.extraParams.putAll(map);
×
5694
              return this;
×
5695
            }
5696

5697
            /** <strong>Required.</strong> The ID of the product that this price will belong to. */
5698
            public Builder setProduct(String product) {
5699
              this.product = product;
×
5700
              return this;
×
5701
            }
5702

5703
            /**
5704
             * <strong>Required.</strong> The recurring components of a price such as {@code
5705
             * interval} and {@code interval_count}.
5706
             */
5707
            public Builder setRecurring(
5708
                InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.Recurring
5709
                    recurring) {
5710
              this.recurring = recurring;
×
5711
              return this;
×
5712
            }
5713

5714
            /**
5715
             * Only required if a <a
5716
             * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
5717
             * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
5718
             * price is considered inclusive of taxes or exclusive of taxes. One of {@code
5719
             * inclusive}, {@code exclusive}, or {@code unspecified}. Once specified as either
5720
             * {@code inclusive} or {@code exclusive}, it cannot be changed.
5721
             */
5722
            public Builder setTaxBehavior(
5723
                InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.TaxBehavior
5724
                    taxBehavior) {
5725
              this.taxBehavior = taxBehavior;
×
5726
              return this;
×
5727
            }
5728

5729
            /**
5730
             * A positive integer in cents (or local equivalent) (or 0 for a free price)
5731
             * representing how much to charge.
5732
             */
5733
            public Builder setUnitAmount(Long unitAmount) {
5734
              this.unitAmount = unitAmount;
×
5735
              return this;
×
5736
            }
5737

5738
            /**
5739
             * Same as {@code unit_amount}, but accepts a decimal value in cents (or local
5740
             * equivalent) with at most 12 decimal places. Only one of {@code unit_amount} and
5741
             * {@code unit_amount_decimal} can be set.
5742
             */
5743
            public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
5744
              this.unitAmountDecimal = unitAmountDecimal;
×
5745
              return this;
×
5746
            }
5747
          }
5748

5749
          @Getter
5750
          public static class Recurring {
5751
            /**
5752
             * Map of extra parameters for custom features not available in this client library. The
5753
             * content in this map is not serialized under this field's {@code @SerializedName}
5754
             * value. Instead, each key/value pair is serialized as if the key is a root-level field
5755
             * (serialized) name in this param object. Effectively, this map is flattened to its
5756
             * parent instance.
5757
             */
5758
            @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5759
            Map<String, Object> extraParams;
5760

5761
            /**
5762
             * <strong>Required.</strong> Specifies billing frequency. Either {@code day}, {@code
5763
             * week}, {@code month} or {@code year}.
5764
             */
5765
            @SerializedName("interval")
5766
            Interval interval;
5767

5768
            /**
5769
             * The number of intervals between subscription billings. For example, {@code
5770
             * interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three
5771
             * years interval allowed (3 years, 36 months, or 156 weeks).
5772
             */
5773
            @SerializedName("interval_count")
5774
            Long intervalCount;
5775

5776
            private Recurring(
5777
                Map<String, Object> extraParams, Interval interval, Long intervalCount) {
×
5778
              this.extraParams = extraParams;
×
5779
              this.interval = interval;
×
5780
              this.intervalCount = intervalCount;
×
5781
            }
×
5782

5783
            public static Builder builder() {
5784
              return new Builder();
×
5785
            }
5786

5787
            public static class Builder {
×
5788
              private Map<String, Object> extraParams;
5789

5790
              private Interval interval;
5791

5792
              private Long intervalCount;
5793

5794
              /** Finalize and obtain parameter instance from this builder. */
5795
              public InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.Recurring
5796
                  build() {
5797
                return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData
×
5798
                    .Recurring(this.extraParams, this.interval, this.intervalCount);
5799
              }
5800

5801
              /**
5802
               * Add a key/value pair to `extraParams` map. A map is initialized for the first
5803
               * `put/putAll` call, and subsequent calls add additional key/value pairs to the
5804
               * original map. See {@link
5805
               * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.Recurring#extraParams}
5806
               * for the field documentation.
5807
               */
5808
              public Builder putExtraParam(String key, Object value) {
5809
                if (this.extraParams == null) {
×
5810
                  this.extraParams = new HashMap<>();
×
5811
                }
5812
                this.extraParams.put(key, value);
×
5813
                return this;
×
5814
              }
5815

5816
              /**
5817
               * Add all map key/value pairs to `extraParams` map. A map is initialized for the
5818
               * first `put/putAll` call, and subsequent calls add additional key/value pairs to the
5819
               * original map. See {@link
5820
               * InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.Recurring#extraParams}
5821
               * for the field documentation.
5822
               */
5823
              public Builder putAllExtraParam(Map<String, Object> map) {
5824
                if (this.extraParams == null) {
×
5825
                  this.extraParams = new HashMap<>();
×
5826
                }
5827
                this.extraParams.putAll(map);
×
5828
                return this;
×
5829
              }
5830

5831
              /**
5832
               * <strong>Required.</strong> Specifies billing frequency. Either {@code day}, {@code
5833
               * week}, {@code month} or {@code year}.
5834
               */
5835
              public Builder setInterval(
5836
                  InvoiceCreatePreviewParams.ScheduleDetails.Phase.Item.PriceData.Recurring.Interval
5837
                      interval) {
5838
                this.interval = interval;
×
5839
                return this;
×
5840
              }
5841

5842
              /**
5843
               * The number of intervals between subscription billings. For example, {@code
5844
               * interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three
5845
               * years interval allowed (3 years, 36 months, or 156 weeks).
5846
               */
5847
              public Builder setIntervalCount(Long intervalCount) {
5848
                this.intervalCount = intervalCount;
×
5849
                return this;
×
5850
              }
5851
            }
5852

5853
            public enum Interval implements ApiRequestParams.EnumParam {
×
5854
              @SerializedName("day")
×
5855
              DAY("day"),
5856

5857
              @SerializedName("month")
×
5858
              MONTH("month"),
5859

5860
              @SerializedName("week")
×
5861
              WEEK("week"),
5862

5863
              @SerializedName("year")
×
5864
              YEAR("year");
5865

5866
              @Getter(onMethod_ = {@Override})
5867
              private final String value;
5868

5869
              Interval(String value) {
×
5870
                this.value = value;
×
5871
              }
×
5872
            }
5873
          }
5874

5875
          public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
5876
            @SerializedName("exclusive")
×
5877
            EXCLUSIVE("exclusive"),
5878

5879
            @SerializedName("inclusive")
×
5880
            INCLUSIVE("inclusive"),
5881

5882
            @SerializedName("unspecified")
×
5883
            UNSPECIFIED("unspecified");
5884

5885
            @Getter(onMethod_ = {@Override})
5886
            private final String value;
5887

5888
            TaxBehavior(String value) {
×
5889
              this.value = value;
×
5890
            }
×
5891
          }
5892
        }
5893
      }
5894

5895
      @Getter
5896
      public static class TransferData {
5897
        /**
5898
         * A non-negative decimal between 0 and 100, with at most two decimal places. This
5899
         * represents the percentage of the subscription invoice total that will be transferred to
5900
         * the destination account. By default, the entire amount is transferred to the destination.
5901
         */
5902
        @SerializedName("amount_percent")
5903
        BigDecimal amountPercent;
5904

5905
        /** <strong>Required.</strong> ID of an existing, connected Stripe account. */
5906
        @SerializedName("destination")
5907
        String destination;
5908

5909
        /**
5910
         * Map of extra parameters for custom features not available in this client library. The
5911
         * content in this map is not serialized under this field's {@code @SerializedName} value.
5912
         * Instead, each key/value pair is serialized as if the key is a root-level field
5913
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
5914
         * instance.
5915
         */
5916
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
5917
        Map<String, Object> extraParams;
5918

5919
        private TransferData(
5920
            BigDecimal amountPercent, String destination, Map<String, Object> extraParams) {
×
5921
          this.amountPercent = amountPercent;
×
5922
          this.destination = destination;
×
5923
          this.extraParams = extraParams;
×
5924
        }
×
5925

5926
        public static Builder builder() {
5927
          return new Builder();
×
5928
        }
5929

5930
        public static class Builder {
×
5931
          private BigDecimal amountPercent;
5932

5933
          private String destination;
5934

5935
          private Map<String, Object> extraParams;
5936

5937
          /** Finalize and obtain parameter instance from this builder. */
5938
          public InvoiceCreatePreviewParams.ScheduleDetails.Phase.TransferData build() {
5939
            return new InvoiceCreatePreviewParams.ScheduleDetails.Phase.TransferData(
×
5940
                this.amountPercent, this.destination, this.extraParams);
5941
          }
5942

5943
          /**
5944
           * A non-negative decimal between 0 and 100, with at most two decimal places. This
5945
           * represents the percentage of the subscription invoice total that will be transferred to
5946
           * the destination account. By default, the entire amount is transferred to the
5947
           * destination.
5948
           */
5949
          public Builder setAmountPercent(BigDecimal amountPercent) {
5950
            this.amountPercent = amountPercent;
×
5951
            return this;
×
5952
          }
5953

5954
          /** <strong>Required.</strong> ID of an existing, connected Stripe account. */
5955
          public Builder setDestination(String destination) {
5956
            this.destination = destination;
×
5957
            return this;
×
5958
          }
5959

5960
          /**
5961
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
5962
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
5963
           * map. See {@link
5964
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.TransferData#extraParams} for the
5965
           * field documentation.
5966
           */
5967
          public Builder putExtraParam(String key, Object value) {
5968
            if (this.extraParams == null) {
×
5969
              this.extraParams = new HashMap<>();
×
5970
            }
5971
            this.extraParams.put(key, value);
×
5972
            return this;
×
5973
          }
5974

5975
          /**
5976
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
5977
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
5978
           * map. See {@link
5979
           * InvoiceCreatePreviewParams.ScheduleDetails.Phase.TransferData#extraParams} for the
5980
           * field documentation.
5981
           */
5982
          public Builder putAllExtraParam(Map<String, Object> map) {
5983
            if (this.extraParams == null) {
×
5984
              this.extraParams = new HashMap<>();
×
5985
            }
5986
            this.extraParams.putAll(map);
×
5987
            return this;
×
5988
          }
5989
        }
5990
      }
5991

5992
      public enum BillingCycleAnchor implements ApiRequestParams.EnumParam {
×
5993
        @SerializedName("automatic")
×
5994
        AUTOMATIC("automatic"),
5995

5996
        @SerializedName("phase_start")
×
5997
        PHASE_START("phase_start");
5998

5999
        @Getter(onMethod_ = {@Override})
6000
        private final String value;
6001

6002
        BillingCycleAnchor(String value) {
×
6003
          this.value = value;
×
6004
        }
×
6005
      }
6006

6007
      public enum CollectionMethod implements ApiRequestParams.EnumParam {
×
6008
        @SerializedName("charge_automatically")
×
6009
        CHARGE_AUTOMATICALLY("charge_automatically"),
6010

6011
        @SerializedName("send_invoice")
×
6012
        SEND_INVOICE("send_invoice");
6013

6014
        @Getter(onMethod_ = {@Override})
6015
        private final String value;
6016

6017
        CollectionMethod(String value) {
×
6018
          this.value = value;
×
6019
        }
×
6020
      }
6021

6022
      public enum EndDate implements ApiRequestParams.EnumParam {
×
6023
        @SerializedName("now")
×
6024
        NOW("now");
6025

6026
        @Getter(onMethod_ = {@Override})
6027
        private final String value;
6028

6029
        EndDate(String value) {
×
6030
          this.value = value;
×
6031
        }
×
6032
      }
6033

6034
      public enum ProrationBehavior implements ApiRequestParams.EnumParam {
×
6035
        @SerializedName("always_invoice")
×
6036
        ALWAYS_INVOICE("always_invoice"),
6037

6038
        @SerializedName("create_prorations")
×
6039
        CREATE_PRORATIONS("create_prorations"),
6040

6041
        @SerializedName("none")
×
6042
        NONE("none");
6043

6044
        @Getter(onMethod_ = {@Override})
6045
        private final String value;
6046

6047
        ProrationBehavior(String value) {
×
6048
          this.value = value;
×
6049
        }
×
6050
      }
6051

6052
      public enum StartDate implements ApiRequestParams.EnumParam {
×
6053
        @SerializedName("now")
×
6054
        NOW("now");
6055

6056
        @Getter(onMethod_ = {@Override})
6057
        private final String value;
6058

6059
        StartDate(String value) {
×
6060
          this.value = value;
×
6061
        }
×
6062
      }
6063

6064
      public enum TrialEnd implements ApiRequestParams.EnumParam {
×
6065
        @SerializedName("now")
×
6066
        NOW("now");
6067

6068
        @Getter(onMethod_ = {@Override})
6069
        private final String value;
6070

6071
        TrialEnd(String value) {
×
6072
          this.value = value;
×
6073
        }
×
6074
      }
6075
    }
6076

6077
    public enum EndBehavior implements ApiRequestParams.EnumParam {
×
6078
      @SerializedName("cancel")
×
6079
      CANCEL("cancel"),
6080

6081
      @SerializedName("release")
×
6082
      RELEASE("release");
6083

6084
      @Getter(onMethod_ = {@Override})
6085
      private final String value;
6086

6087
      EndBehavior(String value) {
×
6088
        this.value = value;
×
6089
      }
×
6090
    }
6091

6092
    public enum ProrationBehavior implements ApiRequestParams.EnumParam {
×
6093
      @SerializedName("always_invoice")
×
6094
      ALWAYS_INVOICE("always_invoice"),
6095

6096
      @SerializedName("create_prorations")
×
6097
      CREATE_PRORATIONS("create_prorations"),
6098

6099
      @SerializedName("none")
×
6100
      NONE("none");
6101

6102
      @Getter(onMethod_ = {@Override})
6103
      private final String value;
6104

6105
      ProrationBehavior(String value) {
×
6106
        this.value = value;
×
6107
      }
×
6108
    }
6109
  }
6110

6111
  @Getter
6112
  public static class SubscriptionDetails {
6113
    /**
6114
     * For new subscriptions, a future timestamp to anchor the subscription's <a
6115
     * href="https://stripe.com/docs/subscriptions/billing-cycle">billing cycle</a>. This is used to
6116
     * determine the date of the first full invoice, and, for plans with {@code month} or {@code
6117
     * year} intervals, the day of the month for subsequent invoices. For existing subscriptions,
6118
     * the value can only be set to {@code now} or {@code unchanged}.
6119
     */
6120
    @SerializedName("billing_cycle_anchor")
6121
    Object billingCycleAnchor;
6122

6123
    /**
6124
     * A timestamp at which the subscription should cancel. If set to a date before the current
6125
     * period ends, this will cause a proration if prorations have been enabled using {@code
6126
     * proration_behavior}. If set during a future period, this will always cause a proration for
6127
     * that period.
6128
     */
6129
    @SerializedName("cancel_at")
6130
    Object cancelAt;
6131

6132
    /**
6133
     * Indicate whether this subscription should cancel at the end of the current period ({@code
6134
     * current_period_end}). Defaults to {@code false}.
6135
     */
6136
    @SerializedName("cancel_at_period_end")
6137
    Boolean cancelAtPeriodEnd;
6138

6139
    /** This simulates the subscription being canceled or expired immediately. */
6140
    @SerializedName("cancel_now")
6141
    Boolean cancelNow;
6142

6143
    /**
6144
     * If provided, the invoice returned will preview updating or creating a subscription with these
6145
     * default tax rates. The default tax rates will apply to any line item that does not have
6146
     * {@code tax_rates} set.
6147
     */
6148
    @SerializedName("default_tax_rates")
6149
    Object defaultTaxRates;
6150

6151
    /**
6152
     * Map of extra parameters for custom features not available in this client library. The content
6153
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
6154
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
6155
     * param object. Effectively, this map is flattened to its parent instance.
6156
     */
6157
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
6158
    Map<String, Object> extraParams;
6159

6160
    /** A list of up to 20 subscription items, each with an attached price. */
6161
    @SerializedName("items")
6162
    List<InvoiceCreatePreviewParams.SubscriptionDetails.Item> items;
6163

6164
    /**
6165
     * Determines how to handle <a
6166
     * href="https://stripe.com/docs/billing/subscriptions/prorations">prorations</a> when the
6167
     * billing cycle changes (e.g., when switching plans, resetting {@code
6168
     * billing_cycle_anchor=now}, or starting a trial), or if an item's {@code quantity} changes.
6169
     * The default value is {@code create_prorations}.
6170
     */
6171
    @SerializedName("proration_behavior")
6172
    ProrationBehavior prorationBehavior;
6173

6174
    /**
6175
     * If previewing an update to a subscription, and doing proration, {@code
6176
     * subscription_details.proration_date} forces the proration to be calculated as though the
6177
     * update was done at the specified time. The time given must be within the current subscription
6178
     * period and within the current phase of the schedule backing this subscription, if the
6179
     * schedule exists. If set, {@code subscription}, and one of {@code subscription_details.items},
6180
     * or {@code subscription_details.trial_end} are required. Also, {@code
6181
     * subscription_details.proration_behavior} cannot be set to 'none'.
6182
     */
6183
    @SerializedName("proration_date")
6184
    Long prorationDate;
6185

6186
    /**
6187
     * For paused subscriptions, setting {@code subscription_details.resume_at} to {@code now} will
6188
     * preview the invoice that will be generated if the subscription is resumed.
6189
     */
6190
    @SerializedName("resume_at")
6191
    ResumeAt resumeAt;
6192

6193
    /** Date a subscription is intended to start (can be future or past). */
6194
    @SerializedName("start_date")
6195
    Long startDate;
6196

6197
    /**
6198
     * If provided, the invoice returned will preview updating or creating a subscription with that
6199
     * trial end. If set, one of {@code subscription_details.items} or {@code subscription} is
6200
     * required.
6201
     */
6202
    @SerializedName("trial_end")
6203
    Object trialEnd;
6204

6205
    private SubscriptionDetails(
6206
        Object billingCycleAnchor,
6207
        Object cancelAt,
6208
        Boolean cancelAtPeriodEnd,
6209
        Boolean cancelNow,
6210
        Object defaultTaxRates,
6211
        Map<String, Object> extraParams,
6212
        List<InvoiceCreatePreviewParams.SubscriptionDetails.Item> items,
6213
        ProrationBehavior prorationBehavior,
6214
        Long prorationDate,
6215
        ResumeAt resumeAt,
6216
        Long startDate,
6217
        Object trialEnd) {
×
6218
      this.billingCycleAnchor = billingCycleAnchor;
×
6219
      this.cancelAt = cancelAt;
×
6220
      this.cancelAtPeriodEnd = cancelAtPeriodEnd;
×
6221
      this.cancelNow = cancelNow;
×
6222
      this.defaultTaxRates = defaultTaxRates;
×
6223
      this.extraParams = extraParams;
×
6224
      this.items = items;
×
6225
      this.prorationBehavior = prorationBehavior;
×
6226
      this.prorationDate = prorationDate;
×
6227
      this.resumeAt = resumeAt;
×
6228
      this.startDate = startDate;
×
6229
      this.trialEnd = trialEnd;
×
6230
    }
×
6231

6232
    public static Builder builder() {
6233
      return new Builder();
×
6234
    }
6235

6236
    public static class Builder {
×
6237
      private Object billingCycleAnchor;
6238

6239
      private Object cancelAt;
6240

6241
      private Boolean cancelAtPeriodEnd;
6242

6243
      private Boolean cancelNow;
6244

6245
      private Object defaultTaxRates;
6246

6247
      private Map<String, Object> extraParams;
6248

6249
      private List<InvoiceCreatePreviewParams.SubscriptionDetails.Item> items;
6250

6251
      private ProrationBehavior prorationBehavior;
6252

6253
      private Long prorationDate;
6254

6255
      private ResumeAt resumeAt;
6256

6257
      private Long startDate;
6258

6259
      private Object trialEnd;
6260

6261
      /** Finalize and obtain parameter instance from this builder. */
6262
      public InvoiceCreatePreviewParams.SubscriptionDetails build() {
6263
        return new InvoiceCreatePreviewParams.SubscriptionDetails(
×
6264
            this.billingCycleAnchor,
6265
            this.cancelAt,
6266
            this.cancelAtPeriodEnd,
6267
            this.cancelNow,
6268
            this.defaultTaxRates,
6269
            this.extraParams,
6270
            this.items,
6271
            this.prorationBehavior,
6272
            this.prorationDate,
6273
            this.resumeAt,
6274
            this.startDate,
6275
            this.trialEnd);
6276
      }
6277

6278
      /**
6279
       * For new subscriptions, a future timestamp to anchor the subscription's <a
6280
       * href="https://stripe.com/docs/subscriptions/billing-cycle">billing cycle</a>. This is used
6281
       * to determine the date of the first full invoice, and, for plans with {@code month} or
6282
       * {@code year} intervals, the day of the month for subsequent invoices. For existing
6283
       * subscriptions, the value can only be set to {@code now} or {@code unchanged}.
6284
       */
6285
      public Builder setBillingCycleAnchor(
6286
          InvoiceCreatePreviewParams.SubscriptionDetails.BillingCycleAnchor billingCycleAnchor) {
6287
        this.billingCycleAnchor = billingCycleAnchor;
×
6288
        return this;
×
6289
      }
6290

6291
      /**
6292
       * For new subscriptions, a future timestamp to anchor the subscription's <a
6293
       * href="https://stripe.com/docs/subscriptions/billing-cycle">billing cycle</a>. This is used
6294
       * to determine the date of the first full invoice, and, for plans with {@code month} or
6295
       * {@code year} intervals, the day of the month for subsequent invoices. For existing
6296
       * subscriptions, the value can only be set to {@code now} or {@code unchanged}.
6297
       */
6298
      public Builder setBillingCycleAnchor(Long billingCycleAnchor) {
6299
        this.billingCycleAnchor = billingCycleAnchor;
×
6300
        return this;
×
6301
      }
6302

6303
      /**
6304
       * A timestamp at which the subscription should cancel. If set to a date before the current
6305
       * period ends, this will cause a proration if prorations have been enabled using {@code
6306
       * proration_behavior}. If set during a future period, this will always cause a proration for
6307
       * that period.
6308
       */
6309
      public Builder setCancelAt(Long cancelAt) {
6310
        this.cancelAt = cancelAt;
×
6311
        return this;
×
6312
      }
6313

6314
      /**
6315
       * A timestamp at which the subscription should cancel. If set to a date before the current
6316
       * period ends, this will cause a proration if prorations have been enabled using {@code
6317
       * proration_behavior}. If set during a future period, this will always cause a proration for
6318
       * that period.
6319
       */
6320
      public Builder setCancelAt(EmptyParam cancelAt) {
6321
        this.cancelAt = cancelAt;
×
6322
        return this;
×
6323
      }
6324

6325
      /**
6326
       * Indicate whether this subscription should cancel at the end of the current period ({@code
6327
       * current_period_end}). Defaults to {@code false}.
6328
       */
6329
      public Builder setCancelAtPeriodEnd(Boolean cancelAtPeriodEnd) {
6330
        this.cancelAtPeriodEnd = cancelAtPeriodEnd;
×
6331
        return this;
×
6332
      }
6333

6334
      /** This simulates the subscription being canceled or expired immediately. */
6335
      public Builder setCancelNow(Boolean cancelNow) {
6336
        this.cancelNow = cancelNow;
×
6337
        return this;
×
6338
      }
6339

6340
      /**
6341
       * Add an element to `defaultTaxRates` list. A list is initialized for the first `add/addAll`
6342
       * call, and subsequent calls adds additional elements to the original list. See {@link
6343
       * InvoiceCreatePreviewParams.SubscriptionDetails#defaultTaxRates} for the field
6344
       * documentation.
6345
       */
6346
      @SuppressWarnings("unchecked")
6347
      public Builder addDefaultTaxRate(String element) {
6348
        if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
×
6349
          this.defaultTaxRates = new ArrayList<String>();
×
6350
        }
6351
        ((List<String>) this.defaultTaxRates).add(element);
×
6352
        return this;
×
6353
      }
6354

6355
      /**
6356
       * Add all elements to `defaultTaxRates` list. A list is initialized for the first
6357
       * `add/addAll` call, and subsequent calls adds additional elements to the original list. See
6358
       * {@link InvoiceCreatePreviewParams.SubscriptionDetails#defaultTaxRates} for the field
6359
       * documentation.
6360
       */
6361
      @SuppressWarnings("unchecked")
6362
      public Builder addAllDefaultTaxRate(List<String> elements) {
6363
        if (this.defaultTaxRates == null || this.defaultTaxRates instanceof EmptyParam) {
×
6364
          this.defaultTaxRates = new ArrayList<String>();
×
6365
        }
6366
        ((List<String>) this.defaultTaxRates).addAll(elements);
×
6367
        return this;
×
6368
      }
6369

6370
      /**
6371
       * If provided, the invoice returned will preview updating or creating a subscription with
6372
       * these default tax rates. The default tax rates will apply to any line item that does not
6373
       * have {@code tax_rates} set.
6374
       */
6375
      public Builder setDefaultTaxRates(EmptyParam defaultTaxRates) {
6376
        this.defaultTaxRates = defaultTaxRates;
×
6377
        return this;
×
6378
      }
6379

6380
      /**
6381
       * If provided, the invoice returned will preview updating or creating a subscription with
6382
       * these default tax rates. The default tax rates will apply to any line item that does not
6383
       * have {@code tax_rates} set.
6384
       */
6385
      public Builder setDefaultTaxRates(List<String> defaultTaxRates) {
6386
        this.defaultTaxRates = defaultTaxRates;
×
6387
        return this;
×
6388
      }
6389

6390
      /**
6391
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
6392
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
6393
       * InvoiceCreatePreviewParams.SubscriptionDetails#extraParams} for the field documentation.
6394
       */
6395
      public Builder putExtraParam(String key, Object value) {
6396
        if (this.extraParams == null) {
×
6397
          this.extraParams = new HashMap<>();
×
6398
        }
6399
        this.extraParams.put(key, value);
×
6400
        return this;
×
6401
      }
6402

6403
      /**
6404
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
6405
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
6406
       * See {@link InvoiceCreatePreviewParams.SubscriptionDetails#extraParams} for the field
6407
       * documentation.
6408
       */
6409
      public Builder putAllExtraParam(Map<String, Object> map) {
6410
        if (this.extraParams == null) {
×
6411
          this.extraParams = new HashMap<>();
×
6412
        }
6413
        this.extraParams.putAll(map);
×
6414
        return this;
×
6415
      }
6416

6417
      /**
6418
       * Add an element to `items` list. A list is initialized for the first `add/addAll` call, and
6419
       * subsequent calls adds additional elements to the original list. See {@link
6420
       * InvoiceCreatePreviewParams.SubscriptionDetails#items} for the field documentation.
6421
       */
6422
      public Builder addItem(InvoiceCreatePreviewParams.SubscriptionDetails.Item element) {
6423
        if (this.items == null) {
×
6424
          this.items = new ArrayList<>();
×
6425
        }
6426
        this.items.add(element);
×
6427
        return this;
×
6428
      }
6429

6430
      /**
6431
       * Add all elements to `items` list. A list is initialized for the first `add/addAll` call,
6432
       * and subsequent calls adds additional elements to the original list. See {@link
6433
       * InvoiceCreatePreviewParams.SubscriptionDetails#items} for the field documentation.
6434
       */
6435
      public Builder addAllItem(
6436
          List<InvoiceCreatePreviewParams.SubscriptionDetails.Item> elements) {
6437
        if (this.items == null) {
×
6438
          this.items = new ArrayList<>();
×
6439
        }
6440
        this.items.addAll(elements);
×
6441
        return this;
×
6442
      }
6443

6444
      /**
6445
       * Determines how to handle <a
6446
       * href="https://stripe.com/docs/billing/subscriptions/prorations">prorations</a> when the
6447
       * billing cycle changes (e.g., when switching plans, resetting {@code
6448
       * billing_cycle_anchor=now}, or starting a trial), or if an item's {@code quantity} changes.
6449
       * The default value is {@code create_prorations}.
6450
       */
6451
      public Builder setProrationBehavior(
6452
          InvoiceCreatePreviewParams.SubscriptionDetails.ProrationBehavior prorationBehavior) {
6453
        this.prorationBehavior = prorationBehavior;
×
6454
        return this;
×
6455
      }
6456

6457
      /**
6458
       * If previewing an update to a subscription, and doing proration, {@code
6459
       * subscription_details.proration_date} forces the proration to be calculated as though the
6460
       * update was done at the specified time. The time given must be within the current
6461
       * subscription period and within the current phase of the schedule backing this subscription,
6462
       * if the schedule exists. If set, {@code subscription}, and one of {@code
6463
       * subscription_details.items}, or {@code subscription_details.trial_end} are required. Also,
6464
       * {@code subscription_details.proration_behavior} cannot be set to 'none'.
6465
       */
6466
      public Builder setProrationDate(Long prorationDate) {
6467
        this.prorationDate = prorationDate;
×
6468
        return this;
×
6469
      }
6470

6471
      /**
6472
       * For paused subscriptions, setting {@code subscription_details.resume_at} to {@code now}
6473
       * will preview the invoice that will be generated if the subscription is resumed.
6474
       */
6475
      public Builder setResumeAt(InvoiceCreatePreviewParams.SubscriptionDetails.ResumeAt resumeAt) {
6476
        this.resumeAt = resumeAt;
×
6477
        return this;
×
6478
      }
6479

6480
      /** Date a subscription is intended to start (can be future or past). */
6481
      public Builder setStartDate(Long startDate) {
6482
        this.startDate = startDate;
×
6483
        return this;
×
6484
      }
6485

6486
      /**
6487
       * If provided, the invoice returned will preview updating or creating a subscription with
6488
       * that trial end. If set, one of {@code subscription_details.items} or {@code subscription}
6489
       * is required.
6490
       */
6491
      public Builder setTrialEnd(InvoiceCreatePreviewParams.SubscriptionDetails.TrialEnd trialEnd) {
6492
        this.trialEnd = trialEnd;
×
6493
        return this;
×
6494
      }
6495

6496
      /**
6497
       * If provided, the invoice returned will preview updating or creating a subscription with
6498
       * that trial end. If set, one of {@code subscription_details.items} or {@code subscription}
6499
       * is required.
6500
       */
6501
      public Builder setTrialEnd(Long trialEnd) {
6502
        this.trialEnd = trialEnd;
×
6503
        return this;
×
6504
      }
6505
    }
6506

6507
    @Getter
6508
    public static class Item {
6509
      /**
6510
       * Define thresholds at which an invoice will be sent, and the subscription advanced to a new
6511
       * billing period. When updating, pass an empty string to remove previously-defined
6512
       * thresholds.
6513
       */
6514
      @SerializedName("billing_thresholds")
6515
      Object billingThresholds;
6516

6517
      /**
6518
       * Delete all usage for a given subscription item. You must pass this when deleting a usage
6519
       * records subscription item. {@code clear_usage} has no effect if the plan has a billing
6520
       * meter attached.
6521
       */
6522
      @SerializedName("clear_usage")
6523
      Boolean clearUsage;
6524

6525
      /** A flag that, if set to {@code true}, will delete the specified item. */
6526
      @SerializedName("deleted")
6527
      Boolean deleted;
6528

6529
      /** The coupons to redeem into discounts for the subscription item. */
6530
      @SerializedName("discounts")
6531
      Object discounts;
6532

6533
      /**
6534
       * Map of extra parameters for custom features not available in this client library. The
6535
       * content in this map is not serialized under this field's {@code @SerializedName} value.
6536
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
6537
       * name in this param object. Effectively, this map is flattened to its parent instance.
6538
       */
6539
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
6540
      Map<String, Object> extraParams;
6541

6542
      /** Subscription item to update. */
6543
      @SerializedName("id")
6544
      String id;
6545

6546
      /**
6547
       * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
6548
       * attach to an object. This can be useful for storing additional information about the object
6549
       * in a structured format. Individual keys can be unset by posting an empty value to them. All
6550
       * keys can be unset by posting an empty value to {@code metadata}.
6551
       */
6552
      @SerializedName("metadata")
6553
      Object metadata;
6554

6555
      /** Plan ID for this item, as a string. */
6556
      @SerializedName("plan")
6557
      String plan;
6558

6559
      /**
6560
       * The ID of the price object. One of {@code price} or {@code price_data} is required. When
6561
       * changing a subscription item's price, {@code quantity} is set to 1 unless a {@code
6562
       * quantity} parameter is provided.
6563
       */
6564
      @SerializedName("price")
6565
      String price;
6566

6567
      /**
6568
       * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
6569
       * inline. One of {@code price} or {@code price_data} is required.
6570
       */
6571
      @SerializedName("price_data")
6572
      PriceData priceData;
6573

6574
      /** Quantity for this item. */
6575
      @SerializedName("quantity")
6576
      Long quantity;
6577

6578
      /**
6579
       * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax Rates
6580
       * will override the <a
6581
       * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
6582
       * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to remove
6583
       * previously-defined tax rates.
6584
       */
6585
      @SerializedName("tax_rates")
6586
      Object taxRates;
6587

6588
      private Item(
6589
          Object billingThresholds,
6590
          Boolean clearUsage,
6591
          Boolean deleted,
6592
          Object discounts,
6593
          Map<String, Object> extraParams,
6594
          String id,
6595
          Object metadata,
6596
          String plan,
6597
          String price,
6598
          PriceData priceData,
6599
          Long quantity,
6600
          Object taxRates) {
×
6601
        this.billingThresholds = billingThresholds;
×
6602
        this.clearUsage = clearUsage;
×
6603
        this.deleted = deleted;
×
6604
        this.discounts = discounts;
×
6605
        this.extraParams = extraParams;
×
6606
        this.id = id;
×
6607
        this.metadata = metadata;
×
6608
        this.plan = plan;
×
6609
        this.price = price;
×
6610
        this.priceData = priceData;
×
6611
        this.quantity = quantity;
×
6612
        this.taxRates = taxRates;
×
6613
      }
×
6614

6615
      public static Builder builder() {
6616
        return new Builder();
×
6617
      }
6618

6619
      public static class Builder {
×
6620
        private Object billingThresholds;
6621

6622
        private Boolean clearUsage;
6623

6624
        private Boolean deleted;
6625

6626
        private Object discounts;
6627

6628
        private Map<String, Object> extraParams;
6629

6630
        private String id;
6631

6632
        private Object metadata;
6633

6634
        private String plan;
6635

6636
        private String price;
6637

6638
        private PriceData priceData;
6639

6640
        private Long quantity;
6641

6642
        private Object taxRates;
6643

6644
        /** Finalize and obtain parameter instance from this builder. */
6645
        public InvoiceCreatePreviewParams.SubscriptionDetails.Item build() {
6646
          return new InvoiceCreatePreviewParams.SubscriptionDetails.Item(
×
6647
              this.billingThresholds,
6648
              this.clearUsage,
6649
              this.deleted,
6650
              this.discounts,
6651
              this.extraParams,
6652
              this.id,
6653
              this.metadata,
6654
              this.plan,
6655
              this.price,
6656
              this.priceData,
6657
              this.quantity,
6658
              this.taxRates);
6659
        }
6660

6661
        /**
6662
         * Define thresholds at which an invoice will be sent, and the subscription advanced to a
6663
         * new billing period. When updating, pass an empty string to remove previously-defined
6664
         * thresholds.
6665
         */
6666
        public Builder setBillingThresholds(
6667
            InvoiceCreatePreviewParams.SubscriptionDetails.Item.BillingThresholds
6668
                billingThresholds) {
6669
          this.billingThresholds = billingThresholds;
×
6670
          return this;
×
6671
        }
6672

6673
        /**
6674
         * Define thresholds at which an invoice will be sent, and the subscription advanced to a
6675
         * new billing period. When updating, pass an empty string to remove previously-defined
6676
         * thresholds.
6677
         */
6678
        public Builder setBillingThresholds(EmptyParam billingThresholds) {
6679
          this.billingThresholds = billingThresholds;
×
6680
          return this;
×
6681
        }
6682

6683
        /**
6684
         * Delete all usage for a given subscription item. You must pass this when deleting a usage
6685
         * records subscription item. {@code clear_usage} has no effect if the plan has a billing
6686
         * meter attached.
6687
         */
6688
        public Builder setClearUsage(Boolean clearUsage) {
6689
          this.clearUsage = clearUsage;
×
6690
          return this;
×
6691
        }
6692

6693
        /** A flag that, if set to {@code true}, will delete the specified item. */
6694
        public Builder setDeleted(Boolean deleted) {
6695
          this.deleted = deleted;
×
6696
          return this;
×
6697
        }
6698

6699
        /**
6700
         * Add an element to `discounts` list. A list is initialized for the first `add/addAll`
6701
         * call, and subsequent calls adds additional elements to the original list. See {@link
6702
         * InvoiceCreatePreviewParams.SubscriptionDetails.Item#discounts} for the field
6703
         * documentation.
6704
         */
6705
        @SuppressWarnings("unchecked")
6706
        public Builder addDiscount(
6707
            InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount element) {
6708
          if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
6709
            this.discounts =
×
6710
                new ArrayList<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount>();
6711
          }
6712
          ((List<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount>) this.discounts)
×
6713
              .add(element);
×
6714
          return this;
×
6715
        }
6716

6717
        /**
6718
         * Add all elements to `discounts` list. A list is initialized for the first `add/addAll`
6719
         * call, and subsequent calls adds additional elements to the original list. See {@link
6720
         * InvoiceCreatePreviewParams.SubscriptionDetails.Item#discounts} for the field
6721
         * documentation.
6722
         */
6723
        @SuppressWarnings("unchecked")
6724
        public Builder addAllDiscount(
6725
            List<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount> elements) {
6726
          if (this.discounts == null || this.discounts instanceof EmptyParam) {
×
6727
            this.discounts =
×
6728
                new ArrayList<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount>();
6729
          }
6730
          ((List<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount>) this.discounts)
×
6731
              .addAll(elements);
×
6732
          return this;
×
6733
        }
6734

6735
        /** The coupons to redeem into discounts for the subscription item. */
6736
        public Builder setDiscounts(EmptyParam discounts) {
6737
          this.discounts = discounts;
×
6738
          return this;
×
6739
        }
6740

6741
        /** The coupons to redeem into discounts for the subscription item. */
6742
        public Builder setDiscounts(
6743
            List<InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount> discounts) {
6744
          this.discounts = discounts;
×
6745
          return this;
×
6746
        }
6747

6748
        /**
6749
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
6750
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
6751
         * map. See {@link InvoiceCreatePreviewParams.SubscriptionDetails.Item#extraParams} for the
6752
         * field documentation.
6753
         */
6754
        public Builder putExtraParam(String key, Object value) {
6755
          if (this.extraParams == null) {
×
6756
            this.extraParams = new HashMap<>();
×
6757
          }
6758
          this.extraParams.put(key, value);
×
6759
          return this;
×
6760
        }
6761

6762
        /**
6763
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
6764
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
6765
         * map. See {@link InvoiceCreatePreviewParams.SubscriptionDetails.Item#extraParams} for the
6766
         * field documentation.
6767
         */
6768
        public Builder putAllExtraParam(Map<String, Object> map) {
6769
          if (this.extraParams == null) {
×
6770
            this.extraParams = new HashMap<>();
×
6771
          }
6772
          this.extraParams.putAll(map);
×
6773
          return this;
×
6774
        }
6775

6776
        /** Subscription item to update. */
6777
        public Builder setId(String id) {
6778
          this.id = id;
×
6779
          return this;
×
6780
        }
6781

6782
        /**
6783
         * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll`
6784
         * call, and subsequent calls add additional key/value pairs to the original map. See {@link
6785
         * InvoiceCreatePreviewParams.SubscriptionDetails.Item#metadata} for the field
6786
         * documentation.
6787
         */
6788
        @SuppressWarnings("unchecked")
6789
        public Builder putMetadata(String key, String value) {
6790
          if (this.metadata == null || this.metadata instanceof EmptyParam) {
×
6791
            this.metadata = new HashMap<String, String>();
×
6792
          }
6793
          ((Map<String, String>) this.metadata).put(key, value);
×
6794
          return this;
×
6795
        }
6796

6797
        /**
6798
         * Add all map key/value pairs to `metadata` map. A map is initialized for the first
6799
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
6800
         * map. See {@link InvoiceCreatePreviewParams.SubscriptionDetails.Item#metadata} for the
6801
         * field documentation.
6802
         */
6803
        @SuppressWarnings("unchecked")
6804
        public Builder putAllMetadata(Map<String, String> map) {
6805
          if (this.metadata == null || this.metadata instanceof EmptyParam) {
×
6806
            this.metadata = new HashMap<String, String>();
×
6807
          }
6808
          ((Map<String, String>) this.metadata).putAll(map);
×
6809
          return this;
×
6810
        }
6811

6812
        /**
6813
         * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
6814
         * attach to an object. This can be useful for storing additional information about the
6815
         * object in a structured format. Individual keys can be unset by posting an empty value to
6816
         * them. All keys can be unset by posting an empty value to {@code metadata}.
6817
         */
6818
        public Builder setMetadata(EmptyParam metadata) {
6819
          this.metadata = metadata;
×
6820
          return this;
×
6821
        }
6822

6823
        /**
6824
         * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
6825
         * attach to an object. This can be useful for storing additional information about the
6826
         * object in a structured format. Individual keys can be unset by posting an empty value to
6827
         * them. All keys can be unset by posting an empty value to {@code metadata}.
6828
         */
6829
        public Builder setMetadata(Map<String, String> metadata) {
6830
          this.metadata = metadata;
×
6831
          return this;
×
6832
        }
6833

6834
        /** Plan ID for this item, as a string. */
6835
        public Builder setPlan(String plan) {
6836
          this.plan = plan;
×
6837
          return this;
×
6838
        }
6839

6840
        /**
6841
         * The ID of the price object. One of {@code price} or {@code price_data} is required. When
6842
         * changing a subscription item's price, {@code quantity} is set to 1 unless a {@code
6843
         * quantity} parameter is provided.
6844
         */
6845
        public Builder setPrice(String price) {
6846
          this.price = price;
×
6847
          return this;
×
6848
        }
6849

6850
        /**
6851
         * Data used to generate a new <a href="https://stripe.com/docs/api/prices">Price</a> object
6852
         * inline. One of {@code price} or {@code price_data} is required.
6853
         */
6854
        public Builder setPriceData(
6855
            InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData priceData) {
6856
          this.priceData = priceData;
×
6857
          return this;
×
6858
        }
6859

6860
        /** Quantity for this item. */
6861
        public Builder setQuantity(Long quantity) {
6862
          this.quantity = quantity;
×
6863
          return this;
×
6864
        }
6865

6866
        /**
6867
         * Add an element to `taxRates` list. A list is initialized for the first `add/addAll` call,
6868
         * and subsequent calls adds additional elements to the original list. See {@link
6869
         * InvoiceCreatePreviewParams.SubscriptionDetails.Item#taxRates} for the field
6870
         * documentation.
6871
         */
6872
        @SuppressWarnings("unchecked")
6873
        public Builder addTaxRate(String element) {
6874
          if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
6875
            this.taxRates = new ArrayList<String>();
×
6876
          }
6877
          ((List<String>) this.taxRates).add(element);
×
6878
          return this;
×
6879
        }
6880

6881
        /**
6882
         * Add all elements to `taxRates` list. A list is initialized for the first `add/addAll`
6883
         * call, and subsequent calls adds additional elements to the original list. See {@link
6884
         * InvoiceCreatePreviewParams.SubscriptionDetails.Item#taxRates} for the field
6885
         * documentation.
6886
         */
6887
        @SuppressWarnings("unchecked")
6888
        public Builder addAllTaxRate(List<String> elements) {
6889
          if (this.taxRates == null || this.taxRates instanceof EmptyParam) {
×
6890
            this.taxRates = new ArrayList<String>();
×
6891
          }
6892
          ((List<String>) this.taxRates).addAll(elements);
×
6893
          return this;
×
6894
        }
6895

6896
        /**
6897
         * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
6898
         * Rates will override the <a
6899
         * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
6900
         * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to remove
6901
         * previously-defined tax rates.
6902
         */
6903
        public Builder setTaxRates(EmptyParam taxRates) {
6904
          this.taxRates = taxRates;
×
6905
          return this;
×
6906
        }
6907

6908
        /**
6909
         * A list of <a href="https://stripe.com/docs/api/tax_rates">Tax Rate</a> ids. These Tax
6910
         * Rates will override the <a
6911
         * href="https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates">{@code
6912
         * default_tax_rates}</a> on the Subscription. When updating, pass an empty string to remove
6913
         * previously-defined tax rates.
6914
         */
6915
        public Builder setTaxRates(List<String> taxRates) {
6916
          this.taxRates = taxRates;
×
6917
          return this;
×
6918
        }
6919
      }
6920

6921
      @Getter
6922
      public static class BillingThresholds {
6923
        /**
6924
         * Map of extra parameters for custom features not available in this client library. The
6925
         * content in this map is not serialized under this field's {@code @SerializedName} value.
6926
         * Instead, each key/value pair is serialized as if the key is a root-level field
6927
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
6928
         * instance.
6929
         */
6930
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
6931
        Map<String, Object> extraParams;
6932

6933
        /**
6934
         * <strong>Required.</strong> Number of units that meets the billing threshold to advance
6935
         * the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 <a
6936
         * href="https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte">monetary
6937
         * threshold</a>)
6938
         */
6939
        @SerializedName("usage_gte")
6940
        Long usageGte;
6941

6942
        private BillingThresholds(Map<String, Object> extraParams, Long usageGte) {
×
6943
          this.extraParams = extraParams;
×
6944
          this.usageGte = usageGte;
×
6945
        }
×
6946

6947
        public static Builder builder() {
6948
          return new Builder();
×
6949
        }
6950

6951
        public static class Builder {
×
6952
          private Map<String, Object> extraParams;
6953

6954
          private Long usageGte;
6955

6956
          /** Finalize and obtain parameter instance from this builder. */
6957
          public InvoiceCreatePreviewParams.SubscriptionDetails.Item.BillingThresholds build() {
6958
            return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.BillingThresholds(
×
6959
                this.extraParams, this.usageGte);
6960
          }
6961

6962
          /**
6963
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
6964
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
6965
           * map. See {@link
6966
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.BillingThresholds#extraParams} for
6967
           * the field documentation.
6968
           */
6969
          public Builder putExtraParam(String key, Object value) {
6970
            if (this.extraParams == null) {
×
6971
              this.extraParams = new HashMap<>();
×
6972
            }
6973
            this.extraParams.put(key, value);
×
6974
            return this;
×
6975
          }
6976

6977
          /**
6978
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
6979
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
6980
           * map. See {@link
6981
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.BillingThresholds#extraParams} for
6982
           * the field documentation.
6983
           */
6984
          public Builder putAllExtraParam(Map<String, Object> map) {
6985
            if (this.extraParams == null) {
×
6986
              this.extraParams = new HashMap<>();
×
6987
            }
6988
            this.extraParams.putAll(map);
×
6989
            return this;
×
6990
          }
6991

6992
          /**
6993
           * <strong>Required.</strong> Number of units that meets the billing threshold to advance
6994
           * the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 <a
6995
           * href="https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte">monetary
6996
           * threshold</a>)
6997
           */
6998
          public Builder setUsageGte(Long usageGte) {
6999
            this.usageGte = usageGte;
×
7000
            return this;
×
7001
          }
7002
        }
7003
      }
7004

7005
      @Getter
7006
      public static class Discount {
7007
        /** ID of the coupon to create a new discount for. */
7008
        @SerializedName("coupon")
7009
        String coupon;
7010

7011
        /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
7012
        @SerializedName("discount")
7013
        String discount;
7014

7015
        /**
7016
         * Map of extra parameters for custom features not available in this client library. The
7017
         * content in this map is not serialized under this field's {@code @SerializedName} value.
7018
         * Instead, each key/value pair is serialized as if the key is a root-level field
7019
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
7020
         * instance.
7021
         */
7022
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
7023
        Map<String, Object> extraParams;
7024

7025
        /** ID of the promotion code to create a new discount for. */
7026
        @SerializedName("promotion_code")
7027
        String promotionCode;
7028

7029
        private Discount(
7030
            String coupon, String discount, Map<String, Object> extraParams, String promotionCode) {
×
7031
          this.coupon = coupon;
×
7032
          this.discount = discount;
×
7033
          this.extraParams = extraParams;
×
7034
          this.promotionCode = promotionCode;
×
7035
        }
×
7036

7037
        public static Builder builder() {
7038
          return new Builder();
×
7039
        }
7040

7041
        public static class Builder {
×
7042
          private String coupon;
7043

7044
          private String discount;
7045

7046
          private Map<String, Object> extraParams;
7047

7048
          private String promotionCode;
7049

7050
          /** Finalize and obtain parameter instance from this builder. */
7051
          public InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount build() {
7052
            return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount(
×
7053
                this.coupon, this.discount, this.extraParams, this.promotionCode);
7054
          }
7055

7056
          /** ID of the coupon to create a new discount for. */
7057
          public Builder setCoupon(String coupon) {
7058
            this.coupon = coupon;
×
7059
            return this;
×
7060
          }
7061

7062
          /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
7063
          public Builder setDiscount(String discount) {
7064
            this.discount = discount;
×
7065
            return this;
×
7066
          }
7067

7068
          /**
7069
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
7070
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
7071
           * map. See {@link
7072
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount#extraParams} for the field
7073
           * documentation.
7074
           */
7075
          public Builder putExtraParam(String key, Object value) {
7076
            if (this.extraParams == null) {
×
7077
              this.extraParams = new HashMap<>();
×
7078
            }
7079
            this.extraParams.put(key, value);
×
7080
            return this;
×
7081
          }
7082

7083
          /**
7084
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
7085
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
7086
           * map. See {@link
7087
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.Discount#extraParams} for the field
7088
           * documentation.
7089
           */
7090
          public Builder putAllExtraParam(Map<String, Object> map) {
7091
            if (this.extraParams == null) {
×
7092
              this.extraParams = new HashMap<>();
×
7093
            }
7094
            this.extraParams.putAll(map);
×
7095
            return this;
×
7096
          }
7097

7098
          /** ID of the promotion code to create a new discount for. */
7099
          public Builder setPromotionCode(String promotionCode) {
7100
            this.promotionCode = promotionCode;
×
7101
            return this;
×
7102
          }
7103
        }
7104
      }
7105

7106
      @Getter
7107
      public static class PriceData {
7108
        /**
7109
         * <strong>Required.</strong> Three-letter <a
7110
         * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
7111
         * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
7112
         */
7113
        @SerializedName("currency")
7114
        String currency;
7115

7116
        /**
7117
         * Map of extra parameters for custom features not available in this client library. The
7118
         * content in this map is not serialized under this field's {@code @SerializedName} value.
7119
         * Instead, each key/value pair is serialized as if the key is a root-level field
7120
         * (serialized) name in this param object. Effectively, this map is flattened to its parent
7121
         * instance.
7122
         */
7123
        @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
7124
        Map<String, Object> extraParams;
7125

7126
        /** <strong>Required.</strong> The ID of the product that this price will belong to. */
7127
        @SerializedName("product")
7128
        String product;
7129

7130
        /**
7131
         * <strong>Required.</strong> The recurring components of a price such as {@code interval}
7132
         * and {@code interval_count}.
7133
         */
7134
        @SerializedName("recurring")
7135
        Recurring recurring;
7136

7137
        /**
7138
         * Only required if a <a
7139
         * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
7140
         * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the price
7141
         * is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive}, {@code
7142
         * exclusive}, or {@code unspecified}. Once specified as either {@code inclusive} or {@code
7143
         * exclusive}, it cannot be changed.
7144
         */
7145
        @SerializedName("tax_behavior")
7146
        TaxBehavior taxBehavior;
7147

7148
        /**
7149
         * A positive integer in cents (or local equivalent) (or 0 for a free price) representing
7150
         * how much to charge.
7151
         */
7152
        @SerializedName("unit_amount")
7153
        Long unitAmount;
7154

7155
        /**
7156
         * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
7157
         * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
7158
         * unit_amount_decimal} can be set.
7159
         */
7160
        @SerializedName("unit_amount_decimal")
7161
        BigDecimal unitAmountDecimal;
7162

7163
        private PriceData(
7164
            String currency,
7165
            Map<String, Object> extraParams,
7166
            String product,
7167
            Recurring recurring,
7168
            TaxBehavior taxBehavior,
7169
            Long unitAmount,
7170
            BigDecimal unitAmountDecimal) {
×
7171
          this.currency = currency;
×
7172
          this.extraParams = extraParams;
×
7173
          this.product = product;
×
7174
          this.recurring = recurring;
×
7175
          this.taxBehavior = taxBehavior;
×
7176
          this.unitAmount = unitAmount;
×
7177
          this.unitAmountDecimal = unitAmountDecimal;
×
7178
        }
×
7179

7180
        public static Builder builder() {
7181
          return new Builder();
×
7182
        }
7183

7184
        public static class Builder {
×
7185
          private String currency;
7186

7187
          private Map<String, Object> extraParams;
7188

7189
          private String product;
7190

7191
          private Recurring recurring;
7192

7193
          private TaxBehavior taxBehavior;
7194

7195
          private Long unitAmount;
7196

7197
          private BigDecimal unitAmountDecimal;
7198

7199
          /** Finalize and obtain parameter instance from this builder. */
7200
          public InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData build() {
7201
            return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData(
×
7202
                this.currency,
7203
                this.extraParams,
7204
                this.product,
7205
                this.recurring,
7206
                this.taxBehavior,
7207
                this.unitAmount,
7208
                this.unitAmountDecimal);
7209
          }
7210

7211
          /**
7212
           * <strong>Required.</strong> Three-letter <a
7213
           * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in
7214
           * lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
7215
           * currency</a>.
7216
           */
7217
          public Builder setCurrency(String currency) {
7218
            this.currency = currency;
×
7219
            return this;
×
7220
          }
7221

7222
          /**
7223
           * Add a key/value pair to `extraParams` map. A map is initialized for the first
7224
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
7225
           * map. See {@link
7226
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData#extraParams} for the
7227
           * field documentation.
7228
           */
7229
          public Builder putExtraParam(String key, Object value) {
7230
            if (this.extraParams == null) {
×
7231
              this.extraParams = new HashMap<>();
×
7232
            }
7233
            this.extraParams.put(key, value);
×
7234
            return this;
×
7235
          }
7236

7237
          /**
7238
           * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
7239
           * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
7240
           * map. See {@link
7241
           * InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData#extraParams} for the
7242
           * field documentation.
7243
           */
7244
          public Builder putAllExtraParam(Map<String, Object> map) {
7245
            if (this.extraParams == null) {
×
7246
              this.extraParams = new HashMap<>();
×
7247
            }
7248
            this.extraParams.putAll(map);
×
7249
            return this;
×
7250
          }
7251

7252
          /** <strong>Required.</strong> The ID of the product that this price will belong to. */
7253
          public Builder setProduct(String product) {
7254
            this.product = product;
×
7255
            return this;
×
7256
          }
7257

7258
          /**
7259
           * <strong>Required.</strong> The recurring components of a price such as {@code interval}
7260
           * and {@code interval_count}.
7261
           */
7262
          public Builder setRecurring(
7263
              InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring recurring) {
7264
            this.recurring = recurring;
×
7265
            return this;
×
7266
          }
7267

7268
          /**
7269
           * Only required if a <a
7270
           * href="https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)">default
7271
           * tax behavior</a> was not provided in the Stripe Tax settings. Specifies whether the
7272
           * price is considered inclusive of taxes or exclusive of taxes. One of {@code inclusive},
7273
           * {@code exclusive}, or {@code unspecified}. Once specified as either {@code inclusive}
7274
           * or {@code exclusive}, it cannot be changed.
7275
           */
7276
          public Builder setTaxBehavior(
7277
              InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.TaxBehavior
7278
                  taxBehavior) {
7279
            this.taxBehavior = taxBehavior;
×
7280
            return this;
×
7281
          }
7282

7283
          /**
7284
           * A positive integer in cents (or local equivalent) (or 0 for a free price) representing
7285
           * how much to charge.
7286
           */
7287
          public Builder setUnitAmount(Long unitAmount) {
7288
            this.unitAmount = unitAmount;
×
7289
            return this;
×
7290
          }
7291

7292
          /**
7293
           * Same as {@code unit_amount}, but accepts a decimal value in cents (or local equivalent)
7294
           * with at most 12 decimal places. Only one of {@code unit_amount} and {@code
7295
           * unit_amount_decimal} can be set.
7296
           */
7297
          public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
7298
            this.unitAmountDecimal = unitAmountDecimal;
×
7299
            return this;
×
7300
          }
7301
        }
7302

7303
        @Getter
7304
        public static class Recurring {
7305
          /**
7306
           * Map of extra parameters for custom features not available in this client library. The
7307
           * content in this map is not serialized under this field's {@code @SerializedName} value.
7308
           * Instead, each key/value pair is serialized as if the key is a root-level field
7309
           * (serialized) name in this param object. Effectively, this map is flattened to its
7310
           * parent instance.
7311
           */
7312
          @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
7313
          Map<String, Object> extraParams;
7314

7315
          /**
7316
           * <strong>Required.</strong> Specifies billing frequency. Either {@code day}, {@code
7317
           * week}, {@code month} or {@code year}.
7318
           */
7319
          @SerializedName("interval")
7320
          Interval interval;
7321

7322
          /**
7323
           * The number of intervals between subscription billings. For example, {@code
7324
           * interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three
7325
           * years interval allowed (3 years, 36 months, or 156 weeks).
7326
           */
7327
          @SerializedName("interval_count")
7328
          Long intervalCount;
7329

7330
          private Recurring(
7331
              Map<String, Object> extraParams, Interval interval, Long intervalCount) {
×
7332
            this.extraParams = extraParams;
×
7333
            this.interval = interval;
×
7334
            this.intervalCount = intervalCount;
×
7335
          }
×
7336

7337
          public static Builder builder() {
7338
            return new Builder();
×
7339
          }
7340

7341
          public static class Builder {
×
7342
            private Map<String, Object> extraParams;
7343

7344
            private Interval interval;
7345

7346
            private Long intervalCount;
7347

7348
            /** Finalize and obtain parameter instance from this builder. */
7349
            public InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring build() {
7350
              return new InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring(
×
7351
                  this.extraParams, this.interval, this.intervalCount);
7352
            }
7353

7354
            /**
7355
             * Add a key/value pair to `extraParams` map. A map is initialized for the first
7356
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
7357
             * original map. See {@link
7358
             * InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring#extraParams}
7359
             * for the field documentation.
7360
             */
7361
            public Builder putExtraParam(String key, Object value) {
7362
              if (this.extraParams == null) {
×
7363
                this.extraParams = new HashMap<>();
×
7364
              }
7365
              this.extraParams.put(key, value);
×
7366
              return this;
×
7367
            }
7368

7369
            /**
7370
             * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
7371
             * `put/putAll` call, and subsequent calls add additional key/value pairs to the
7372
             * original map. See {@link
7373
             * InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring#extraParams}
7374
             * for the field documentation.
7375
             */
7376
            public Builder putAllExtraParam(Map<String, Object> map) {
7377
              if (this.extraParams == null) {
×
7378
                this.extraParams = new HashMap<>();
×
7379
              }
7380
              this.extraParams.putAll(map);
×
7381
              return this;
×
7382
            }
7383

7384
            /**
7385
             * <strong>Required.</strong> Specifies billing frequency. Either {@code day}, {@code
7386
             * week}, {@code month} or {@code year}.
7387
             */
7388
            public Builder setInterval(
7389
                InvoiceCreatePreviewParams.SubscriptionDetails.Item.PriceData.Recurring.Interval
7390
                    interval) {
7391
              this.interval = interval;
×
7392
              return this;
×
7393
            }
7394

7395
            /**
7396
             * The number of intervals between subscription billings. For example, {@code
7397
             * interval=month} and {@code interval_count=3} bills every 3 months. Maximum of three
7398
             * years interval allowed (3 years, 36 months, or 156 weeks).
7399
             */
7400
            public Builder setIntervalCount(Long intervalCount) {
7401
              this.intervalCount = intervalCount;
×
7402
              return this;
×
7403
            }
7404
          }
7405

7406
          public enum Interval implements ApiRequestParams.EnumParam {
×
7407
            @SerializedName("day")
×
7408
            DAY("day"),
7409

7410
            @SerializedName("month")
×
7411
            MONTH("month"),
7412

7413
            @SerializedName("week")
×
7414
            WEEK("week"),
7415

7416
            @SerializedName("year")
×
7417
            YEAR("year");
7418

7419
            @Getter(onMethod_ = {@Override})
7420
            private final String value;
7421

7422
            Interval(String value) {
×
7423
              this.value = value;
×
7424
            }
×
7425
          }
7426
        }
7427

7428
        public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
7429
          @SerializedName("exclusive")
×
7430
          EXCLUSIVE("exclusive"),
7431

7432
          @SerializedName("inclusive")
×
7433
          INCLUSIVE("inclusive"),
7434

7435
          @SerializedName("unspecified")
×
7436
          UNSPECIFIED("unspecified");
7437

7438
          @Getter(onMethod_ = {@Override})
7439
          private final String value;
7440

7441
          TaxBehavior(String value) {
×
7442
            this.value = value;
×
7443
          }
×
7444
        }
7445
      }
7446
    }
7447

7448
    public enum BillingCycleAnchor implements ApiRequestParams.EnumParam {
×
7449
      @SerializedName("now")
×
7450
      NOW("now"),
7451

7452
      @SerializedName("unchanged")
×
7453
      UNCHANGED("unchanged");
7454

7455
      @Getter(onMethod_ = {@Override})
7456
      private final String value;
7457

7458
      BillingCycleAnchor(String value) {
×
7459
        this.value = value;
×
7460
      }
×
7461
    }
7462

7463
    public enum ProrationBehavior implements ApiRequestParams.EnumParam {
×
7464
      @SerializedName("always_invoice")
×
7465
      ALWAYS_INVOICE("always_invoice"),
7466

7467
      @SerializedName("create_prorations")
×
7468
      CREATE_PRORATIONS("create_prorations"),
7469

7470
      @SerializedName("none")
×
7471
      NONE("none");
7472

7473
      @Getter(onMethod_ = {@Override})
7474
      private final String value;
7475

7476
      ProrationBehavior(String value) {
×
7477
        this.value = value;
×
7478
      }
×
7479
    }
7480

7481
    public enum ResumeAt implements ApiRequestParams.EnumParam {
×
7482
      @SerializedName("now")
×
7483
      NOW("now");
7484

7485
      @Getter(onMethod_ = {@Override})
7486
      private final String value;
7487

7488
      ResumeAt(String value) {
×
7489
        this.value = value;
×
7490
      }
×
7491
    }
7492

7493
    public enum TrialEnd implements ApiRequestParams.EnumParam {
×
7494
      @SerializedName("now")
×
7495
      NOW("now");
7496

7497
      @Getter(onMethod_ = {@Override})
7498
      private final String value;
7499

7500
      TrialEnd(String value) {
×
7501
        this.value = value;
×
7502
      }
×
7503
    }
7504
  }
7505

7506
  public enum PreviewMode implements ApiRequestParams.EnumParam {
×
7507
    @SerializedName("next")
×
7508
    NEXT("next"),
7509

7510
    @SerializedName("recurring")
×
7511
    RECURRING("recurring");
7512

7513
    @Getter(onMethod_ = {@Override})
7514
    private final String value;
7515

7516
    PreviewMode(String value) {
×
7517
      this.value = value;
×
7518
    }
×
7519
  }
7520
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc