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

stripe / stripe-java / #16380

30 Aug 2024 07:54PM UTC coverage: 12.882% (-0.004%) from 12.886%
#16380

push

github

web-flow
Merge from master after the changes to not pass api_mode from individual methods (#1857)

* Generate SDK for OpenAPI spec version 1230 (#1856)

* Bump version to 26.9.0

* No need for APIMode to be passed around from individual API methods (#1855)

* Generated code

* Update the code around raw request

* Update the v2 tests to use v2 path

16 of 23 new or added lines in 7 files covered. (69.57%)

706 existing lines in 213 files now uncovered.

18468 of 143365 relevant lines covered (12.88%)

0.13 hits per line

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

23.29
/src/main/java/com/stripe/model/SubscriptionSchedule.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.testhelpers.TestClock;
7
import com.stripe.net.ApiRequest;
8
import com.stripe.net.ApiRequestParams;
9
import com.stripe.net.ApiResource;
10
import com.stripe.net.BaseAddress;
11
import com.stripe.net.RequestOptions;
12
import com.stripe.net.StripeResponseGetter;
13
import com.stripe.param.SubscriptionScheduleAmendParams;
14
import com.stripe.param.SubscriptionScheduleCancelParams;
15
import com.stripe.param.SubscriptionScheduleCreateParams;
16
import com.stripe.param.SubscriptionScheduleListParams;
17
import com.stripe.param.SubscriptionScheduleReleaseParams;
18
import com.stripe.param.SubscriptionScheduleRetrieveParams;
19
import com.stripe.param.SubscriptionScheduleUpdateParams;
20
import java.math.BigDecimal;
21
import java.util.List;
22
import java.util.Map;
23
import java.util.stream.Collectors;
24
import lombok.EqualsAndHashCode;
25
import lombok.Getter;
26
import lombok.Setter;
27

28
/**
29
 * A subscription schedule allows you to create and manage the lifecycle of a subscription by
30
 * predefining expected changes.
31
 *
32
 * <p>Related guide: <a
33
 * href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">Subscription
34
 * schedules</a>
35
 */
36
@Getter
37
@Setter
38
@EqualsAndHashCode(callSuper = false)
39
public class SubscriptionSchedule extends ApiResource
1✔
40
    implements HasId, MetadataStore<SubscriptionSchedule> {
41
  /** ID of the Connect Application that created the schedule. */
42
  @SerializedName("application")
43
  @Getter(lombok.AccessLevel.NONE)
44
  @Setter(lombok.AccessLevel.NONE)
45
  ExpandableField<Application> application;
46

47
  /**
48
   * Configures when the subscription schedule generates prorations for phase transitions. Possible
49
   * values are {@code prorate_on_next_phase} or {@code prorate_up_front} with the default being
50
   * {@code prorate_on_next_phase}. {@code prorate_on_next_phase} will apply phase changes and
51
   * generate prorations at transition time. {@code prorate_up_front} will bill for all phases
52
   * within the current billing cycle up front.
53
   *
54
   * <p>One of {@code prorate_on_next_phase}, or {@code prorate_up_front}.
55
   */
56
  @SerializedName("billing_behavior")
57
  String billingBehavior;
58

59
  /**
60
   * Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
61
   */
62
  @SerializedName("canceled_at")
63
  Long canceledAt;
64

65
  /**
66
   * Time at which the subscription schedule was completed. Measured in seconds since the Unix
67
   * epoch.
68
   */
69
  @SerializedName("completed_at")
70
  Long completedAt;
71

72
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
73
  @SerializedName("created")
74
  Long created;
75

76
  /**
77
   * Object representing the start and end dates for the current phase of the subscription schedule,
78
   * if it is {@code active}.
79
   */
80
  @SerializedName("current_phase")
81
  CurrentPhase currentPhase;
82

83
  /** ID of the customer who owns the subscription schedule. */
84
  @SerializedName("customer")
85
  @Getter(lombok.AccessLevel.NONE)
86
  @Setter(lombok.AccessLevel.NONE)
87
  ExpandableField<Customer> customer;
88

89
  @SerializedName("default_settings")
90
  DefaultSettings defaultSettings;
91

92
  /**
93
   * Behavior of the subscription schedule and underlying subscription when it ends. Possible values
94
   * are {@code release} or {@code cancel} with the default being {@code release}. {@code release}
95
   * will end the subscription schedule and keep the underlying subscription running. {@code cancel}
96
   * will end the subscription schedule and cancel the underlying subscription.
97
   *
98
   * <p>One of {@code cancel}, {@code none}, {@code release}, or {@code renew}.
99
   */
100
  @SerializedName("end_behavior")
101
  String endBehavior;
102

103
  /** Unique identifier for the object. */
104
  @Getter(onMethod_ = {@Override})
105
  @SerializedName("id")
106
  String id;
107

108
  /** Details of the most recent price migration that failed for the subscription schedule. */
109
  @SerializedName("last_price_migration_error")
110
  LastPriceMigrationError lastPriceMigrationError;
111

112
  /**
113
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
114
   * object exists in test mode.
115
   */
116
  @SerializedName("livemode")
117
  Boolean livemode;
118

119
  /**
120
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
121
   * to an object. This can be useful for storing additional information about the object in a
122
   * structured format.
123
   */
124
  @Getter(onMethod_ = {@Override})
125
  @SerializedName("metadata")
126
  Map<String, String> metadata;
127

128
  /**
129
   * String representing the object's type. Objects of the same type share the same value.
130
   *
131
   * <p>Equal to {@code subscription_schedule}.
132
   */
133
  @SerializedName("object")
134
  String object;
135

136
  /** Configuration for the subscription schedule's phases. */
137
  @SerializedName("phases")
138
  List<SubscriptionSchedule.Phase> phases;
139

140
  /** Time period and invoice for a Subscription billed in advance. */
141
  @SerializedName("prebilling")
142
  Prebilling prebilling;
143

144
  /**
145
   * Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
146
   */
147
  @SerializedName("released_at")
148
  Long releasedAt;
149

150
  /** ID of the subscription once managed by the subscription schedule (if it is released). */
151
  @SerializedName("released_subscription")
152
  String releasedSubscription;
153

154
  /**
155
   * The present status of the subscription schedule. Possible values are {@code not_started},
156
   * {@code active}, {@code completed}, {@code released}, and {@code canceled}. You can read more
157
   * about the different states in our <a
158
   * href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">behavior guide</a>.
159
   *
160
   * <p>One of {@code active}, {@code canceled}, {@code completed}, {@code not_started}, or {@code
161
   * released}.
162
   */
163
  @SerializedName("status")
164
  String status;
165

166
  /** ID of the subscription managed by the subscription schedule. */
167
  @SerializedName("subscription")
168
  @Getter(lombok.AccessLevel.NONE)
169
  @Setter(lombok.AccessLevel.NONE)
170
  ExpandableField<Subscription> subscription;
171

172
  /** ID of the test clock this subscription schedule belongs to. */
173
  @SerializedName("test_clock")
174
  @Getter(lombok.AccessLevel.NONE)
175
  @Setter(lombok.AccessLevel.NONE)
176
  ExpandableField<TestClock> testClock;
177

178
  /** Get ID of expandable {@code application} object. */
179
  public String getApplication() {
180
    return (this.application != null) ? this.application.getId() : null;
×
181
  }
182

183
  public void setApplication(String id) {
184
    this.application = ApiResource.setExpandableFieldId(id, this.application);
×
185
  }
×
186

187
  /** Get expanded {@code application}. */
188
  public Application getApplicationObject() {
189
    return (this.application != null) ? this.application.getExpanded() : null;
×
190
  }
191

192
  public void setApplicationObject(Application expandableObject) {
193
    this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
×
194
  }
×
195

196
  /** Get ID of expandable {@code customer} object. */
197
  public String getCustomer() {
198
    return (this.customer != null) ? this.customer.getId() : null;
1✔
199
  }
200

201
  public void setCustomer(String id) {
202
    this.customer = ApiResource.setExpandableFieldId(id, this.customer);
×
203
  }
×
204

205
  /** Get expanded {@code customer}. */
206
  public Customer getCustomerObject() {
207
    return (this.customer != null) ? this.customer.getExpanded() : null;
1✔
208
  }
209

210
  public void setCustomerObject(Customer expandableObject) {
211
    this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
×
212
  }
×
213

214
  /** Get ID of expandable {@code subscription} object. */
215
  public String getSubscription() {
216
    return (this.subscription != null) ? this.subscription.getId() : null;
1✔
217
  }
218

219
  public void setSubscription(String id) {
220
    this.subscription = ApiResource.setExpandableFieldId(id, this.subscription);
×
221
  }
×
222

223
  /** Get expanded {@code subscription}. */
224
  public Subscription getSubscriptionObject() {
225
    return (this.subscription != null) ? this.subscription.getExpanded() : null;
1✔
226
  }
227

228
  public void setSubscriptionObject(Subscription expandableObject) {
229
    this.subscription =
×
230
        new ExpandableField<Subscription>(expandableObject.getId(), expandableObject);
×
231
  }
×
232

233
  /** Get ID of expandable {@code testClock} object. */
234
  public String getTestClock() {
235
    return (this.testClock != null) ? this.testClock.getId() : null;
×
236
  }
237

238
  public void setTestClock(String id) {
239
    this.testClock = ApiResource.setExpandableFieldId(id, this.testClock);
×
240
  }
×
241

242
  /** Get expanded {@code testClock}. */
243
  public TestClock getTestClockObject() {
244
    return (this.testClock != null) ? this.testClock.getExpanded() : null;
×
245
  }
246

247
  public void setTestClockObject(TestClock expandableObject) {
248
    this.testClock = new ExpandableField<TestClock>(expandableObject.getId(), expandableObject);
×
249
  }
×
250

251
  /** Amends an existing subscription schedule. */
252
  public SubscriptionSchedule amend() throws StripeException {
253
    return amend((Map<String, Object>) null, (RequestOptions) null);
×
254
  }
255

256
  /** Amends an existing subscription schedule. */
257
  public SubscriptionSchedule amend(RequestOptions options) throws StripeException {
258
    return amend((Map<String, Object>) null, options);
×
259
  }
260

261
  /** Amends an existing subscription schedule. */
262
  public SubscriptionSchedule amend(Map<String, Object> params) throws StripeException {
263
    return amend(params, (RequestOptions) null);
×
264
  }
265

266
  /** Amends an existing subscription schedule. */
267
  public SubscriptionSchedule amend(Map<String, Object> params, RequestOptions options)
268
      throws StripeException {
269
    String path =
×
270
        String.format("/v1/subscription_schedules/%s/amend", ApiResource.urlEncodeId(this.getId()));
×
271
    ApiRequest request =
×
272
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
273
    return getResponseGetter().request(request, SubscriptionSchedule.class);
×
274
  }
275

276
  /** Amends an existing subscription schedule. */
277
  public SubscriptionSchedule amend(SubscriptionScheduleAmendParams params) throws StripeException {
278
    return amend(params, (RequestOptions) null);
×
279
  }
280

281
  /** Amends an existing subscription schedule. */
282
  public SubscriptionSchedule amend(SubscriptionScheduleAmendParams params, RequestOptions options)
283
      throws StripeException {
284
    String path =
×
285
        String.format("/v1/subscription_schedules/%s/amend", ApiResource.urlEncodeId(this.getId()));
×
286
    ApiResource.checkNullTypedParams(path, params);
×
287
    ApiRequest request =
×
288
        new ApiRequest(
289
            BaseAddress.API,
290
            ApiResource.RequestMethod.POST,
291
            path,
292
            ApiRequestParams.paramsToMap(params),
×
293
            options);
UNCOV
294
    return getResponseGetter().request(request, SubscriptionSchedule.class);
×
295
  }
296

297
  /**
298
   * Cancels a subscription schedule and its associated subscription immediately (if the
299
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
300
   * if its status is {@code not_started} or {@code active}.
301
   */
302
  public SubscriptionSchedule cancel() throws StripeException {
303
    return cancel((Map<String, Object>) null, (RequestOptions) null);
×
304
  }
305

306
  /**
307
   * Cancels a subscription schedule and its associated subscription immediately (if the
308
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
309
   * if its status is {@code not_started} or {@code active}.
310
   */
311
  public SubscriptionSchedule cancel(RequestOptions options) throws StripeException {
312
    return cancel((Map<String, Object>) null, options);
×
313
  }
314

315
  /**
316
   * Cancels a subscription schedule and its associated subscription immediately (if the
317
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
318
   * if its status is {@code not_started} or {@code active}.
319
   */
320
  public SubscriptionSchedule cancel(Map<String, Object> params) throws StripeException {
321
    return cancel(params, (RequestOptions) null);
1✔
322
  }
323

324
  /**
325
   * Cancels a subscription schedule and its associated subscription immediately (if the
326
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
327
   * if its status is {@code not_started} or {@code active}.
328
   */
329
  public SubscriptionSchedule cancel(Map<String, Object> params, RequestOptions options)
330
      throws StripeException {
331
    String path =
1✔
332
        String.format(
1✔
333
            "/v1/subscription_schedules/%s/cancel", ApiResource.urlEncodeId(this.getId()));
1✔
334
    ApiRequest request =
1✔
335
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
336
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
337
  }
338

339
  /**
340
   * Cancels a subscription schedule and its associated subscription immediately (if the
341
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
342
   * if its status is {@code not_started} or {@code active}.
343
   */
344
  public SubscriptionSchedule cancel(SubscriptionScheduleCancelParams params)
345
      throws StripeException {
346
    return cancel(params, (RequestOptions) null);
1✔
347
  }
348

349
  /**
350
   * Cancels a subscription schedule and its associated subscription immediately (if the
351
   * subscription schedule has an active subscription). A subscription schedule can only be canceled
352
   * if its status is {@code not_started} or {@code active}.
353
   */
354
  public SubscriptionSchedule cancel(
355
      SubscriptionScheduleCancelParams params, RequestOptions options) throws StripeException {
356
    String path =
1✔
357
        String.format(
1✔
358
            "/v1/subscription_schedules/%s/cancel", ApiResource.urlEncodeId(this.getId()));
1✔
359
    ApiResource.checkNullTypedParams(path, params);
1✔
360
    ApiRequest request =
1✔
361
        new ApiRequest(
362
            BaseAddress.API,
363
            ApiResource.RequestMethod.POST,
364
            path,
365
            ApiRequestParams.paramsToMap(params),
1✔
366
            options);
367
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
368
  }
369

370
  /**
371
   * Creates a new subscription schedule object. Each customer can have up to 500 active or
372
   * scheduled subscriptions.
373
   */
374
  public static SubscriptionSchedule create(Map<String, Object> params) throws StripeException {
375
    return create(params, (RequestOptions) null);
1✔
376
  }
377

378
  /**
379
   * Creates a new subscription schedule object. Each customer can have up to 500 active or
380
   * scheduled subscriptions.
381
   */
382
  public static SubscriptionSchedule create(Map<String, Object> params, RequestOptions options)
383
      throws StripeException {
384
    String path = "/v1/subscription_schedules";
1✔
385
    ApiRequest request =
1✔
386
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
387
    return getGlobalResponseGetter().request(request, SubscriptionSchedule.class);
1✔
388
  }
389

390
  /**
391
   * Creates a new subscription schedule object. Each customer can have up to 500 active or
392
   * scheduled subscriptions.
393
   */
394
  public static SubscriptionSchedule create(SubscriptionScheduleCreateParams params)
395
      throws StripeException {
396
    return create(params, (RequestOptions) null);
1✔
397
  }
398

399
  /**
400
   * Creates a new subscription schedule object. Each customer can have up to 500 active or
401
   * scheduled subscriptions.
402
   */
403
  public static SubscriptionSchedule create(
404
      SubscriptionScheduleCreateParams params, RequestOptions options) throws StripeException {
405
    String path = "/v1/subscription_schedules";
1✔
406
    ApiResource.checkNullTypedParams(path, params);
1✔
407
    ApiRequest request =
1✔
408
        new ApiRequest(
409
            BaseAddress.API,
410
            ApiResource.RequestMethod.POST,
411
            path,
412
            ApiRequestParams.paramsToMap(params),
1✔
413
            options);
414
    return getGlobalResponseGetter().request(request, SubscriptionSchedule.class);
1✔
415
  }
416

417
  /** Retrieves the list of your subscription schedules. */
418
  public static SubscriptionScheduleCollection list(Map<String, Object> params)
419
      throws StripeException {
420
    return list(params, (RequestOptions) null);
1✔
421
  }
422

423
  /** Retrieves the list of your subscription schedules. */
424
  public static SubscriptionScheduleCollection list(
425
      Map<String, Object> params, RequestOptions options) throws StripeException {
426
    String path = "/v1/subscription_schedules";
1✔
427
    ApiRequest request =
1✔
428
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
429
    return getGlobalResponseGetter().request(request, SubscriptionScheduleCollection.class);
1✔
430
  }
431

432
  /** Retrieves the list of your subscription schedules. */
433
  public static SubscriptionScheduleCollection list(SubscriptionScheduleListParams params)
434
      throws StripeException {
435
    return list(params, (RequestOptions) null);
1✔
436
  }
437

438
  /** Retrieves the list of your subscription schedules. */
439
  public static SubscriptionScheduleCollection list(
440
      SubscriptionScheduleListParams params, RequestOptions options) throws StripeException {
441
    String path = "/v1/subscription_schedules";
1✔
442
    ApiResource.checkNullTypedParams(path, params);
1✔
443
    ApiRequest request =
1✔
444
        new ApiRequest(
445
            BaseAddress.API,
446
            ApiResource.RequestMethod.GET,
447
            path,
448
            ApiRequestParams.paramsToMap(params),
1✔
449
            options);
450
    return getGlobalResponseGetter().request(request, SubscriptionScheduleCollection.class);
1✔
451
  }
452

453
  /**
454
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
455
   * leave any existing subscription in place. A schedule can only be released if its status is
456
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
457
   * with a subscription, releasing it will remove its {@code subscription} property and set the
458
   * subscription’s ID to the {@code released_subscription} property.
459
   */
460
  public SubscriptionSchedule release() throws StripeException {
461
    return release((Map<String, Object>) null, (RequestOptions) null);
×
462
  }
463

464
  /**
465
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
466
   * leave any existing subscription in place. A schedule can only be released if its status is
467
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
468
   * with a subscription, releasing it will remove its {@code subscription} property and set the
469
   * subscription’s ID to the {@code released_subscription} property.
470
   */
471
  public SubscriptionSchedule release(RequestOptions options) throws StripeException {
472
    return release((Map<String, Object>) null, options);
×
473
  }
474

475
  /**
476
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
477
   * leave any existing subscription in place. A schedule can only be released if its status is
478
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
479
   * with a subscription, releasing it will remove its {@code subscription} property and set the
480
   * subscription’s ID to the {@code released_subscription} property.
481
   */
482
  public SubscriptionSchedule release(Map<String, Object> params) throws StripeException {
483
    return release(params, (RequestOptions) null);
1✔
484
  }
485

486
  /**
487
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
488
   * leave any existing subscription in place. A schedule can only be released if its status is
489
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
490
   * with a subscription, releasing it will remove its {@code subscription} property and set the
491
   * subscription’s ID to the {@code released_subscription} property.
492
   */
493
  public SubscriptionSchedule release(Map<String, Object> params, RequestOptions options)
494
      throws StripeException {
495
    String path =
1✔
496
        String.format(
1✔
497
            "/v1/subscription_schedules/%s/release", ApiResource.urlEncodeId(this.getId()));
1✔
498
    ApiRequest request =
1✔
499
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
500
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
501
  }
502

503
  /**
504
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
505
   * leave any existing subscription in place. A schedule can only be released if its status is
506
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
507
   * with a subscription, releasing it will remove its {@code subscription} property and set the
508
   * subscription’s ID to the {@code released_subscription} property.
509
   */
510
  public SubscriptionSchedule release(SubscriptionScheduleReleaseParams params)
511
      throws StripeException {
512
    return release(params, (RequestOptions) null);
1✔
513
  }
514

515
  /**
516
   * Releases the subscription schedule immediately, which will stop scheduling of its phases, but
517
   * leave any existing subscription in place. A schedule can only be released if its status is
518
   * {@code not_started} or {@code active}. If the subscription schedule is currently associated
519
   * with a subscription, releasing it will remove its {@code subscription} property and set the
520
   * subscription’s ID to the {@code released_subscription} property.
521
   */
522
  public SubscriptionSchedule release(
523
      SubscriptionScheduleReleaseParams params, RequestOptions options) throws StripeException {
524
    String path =
1✔
525
        String.format(
1✔
526
            "/v1/subscription_schedules/%s/release", ApiResource.urlEncodeId(this.getId()));
1✔
527
    ApiResource.checkNullTypedParams(path, params);
1✔
528
    ApiRequest request =
1✔
529
        new ApiRequest(
530
            BaseAddress.API,
531
            ApiResource.RequestMethod.POST,
532
            path,
533
            ApiRequestParams.paramsToMap(params),
1✔
534
            options);
535
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
536
  }
537

538
  /**
539
   * Retrieves the details of an existing subscription schedule. You only need to supply the unique
540
   * subscription schedule identifier that was returned upon subscription schedule creation.
541
   */
542
  public static SubscriptionSchedule retrieve(String schedule) throws StripeException {
543
    return retrieve(schedule, (Map<String, Object>) null, (RequestOptions) null);
1✔
544
  }
545

546
  /**
547
   * Retrieves the details of an existing subscription schedule. You only need to supply the unique
548
   * subscription schedule identifier that was returned upon subscription schedule creation.
549
   */
550
  public static SubscriptionSchedule retrieve(String schedule, RequestOptions options)
551
      throws StripeException {
552
    return retrieve(schedule, (Map<String, Object>) null, options);
×
553
  }
554

555
  /**
556
   * Retrieves the details of an existing subscription schedule. You only need to supply the unique
557
   * subscription schedule identifier that was returned upon subscription schedule creation.
558
   */
559
  public static SubscriptionSchedule retrieve(
560
      String schedule, Map<String, Object> params, RequestOptions options) throws StripeException {
561
    String path = String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule));
1✔
562
    ApiRequest request =
1✔
563
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
564
    return getGlobalResponseGetter().request(request, SubscriptionSchedule.class);
1✔
565
  }
566

567
  /**
568
   * Retrieves the details of an existing subscription schedule. You only need to supply the unique
569
   * subscription schedule identifier that was returned upon subscription schedule creation.
570
   */
571
  public static SubscriptionSchedule retrieve(
572
      String schedule, SubscriptionScheduleRetrieveParams params, RequestOptions options)
573
      throws StripeException {
574
    String path = String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(schedule));
×
575
    ApiResource.checkNullTypedParams(path, params);
×
576
    ApiRequest request =
×
577
        new ApiRequest(
578
            BaseAddress.API,
579
            ApiResource.RequestMethod.GET,
580
            path,
581
            ApiRequestParams.paramsToMap(params),
×
582
            options);
UNCOV
583
    return getGlobalResponseGetter().request(request, SubscriptionSchedule.class);
×
584
  }
585

586
  /** Updates an existing subscription schedule. */
587
  @Override
588
  public SubscriptionSchedule update(Map<String, Object> params) throws StripeException {
589
    return update(params, (RequestOptions) null);
1✔
590
  }
591

592
  /** Updates an existing subscription schedule. */
593
  @Override
594
  public SubscriptionSchedule update(Map<String, Object> params, RequestOptions options)
595
      throws StripeException {
596
    String path =
1✔
597
        String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()));
1✔
598
    ApiRequest request =
1✔
599
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
600
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
601
  }
602

603
  /** Updates an existing subscription schedule. */
604
  public SubscriptionSchedule update(SubscriptionScheduleUpdateParams params)
605
      throws StripeException {
606
    return update(params, (RequestOptions) null);
1✔
607
  }
608

609
  /** Updates an existing subscription schedule. */
610
  public SubscriptionSchedule update(
611
      SubscriptionScheduleUpdateParams params, RequestOptions options) throws StripeException {
612
    String path =
1✔
613
        String.format("/v1/subscription_schedules/%s", ApiResource.urlEncodeId(this.getId()));
1✔
614
    ApiResource.checkNullTypedParams(path, params);
1✔
615
    ApiRequest request =
1✔
616
        new ApiRequest(
617
            BaseAddress.API,
618
            ApiResource.RequestMethod.POST,
619
            path,
620
            ApiRequestParams.paramsToMap(params),
1✔
621
            options);
622
    return getResponseGetter().request(request, SubscriptionSchedule.class);
1✔
623
  }
624

625
  @Getter
626
  @Setter
627
  @EqualsAndHashCode(callSuper = false)
628
  public static class CurrentPhase extends StripeObject {
×
629
    /** The end of this phase of the subscription schedule. */
630
    @SerializedName("end_date")
631
    Long endDate;
632

633
    /** The start of this phase of the subscription schedule. */
634
    @SerializedName("start_date")
635
    Long startDate;
636
  }
637

638
  @Getter
639
  @Setter
640
  @EqualsAndHashCode(callSuper = false)
641
  public static class DefaultSettings extends StripeObject {
1✔
642
    /**
643
     * A non-negative decimal between 0 and 100, with at most two decimal places. This represents
644
     * the percentage of the subscription invoice total that will be transferred to the application
645
     * owner's Stripe account during this phase of the schedule.
646
     */
647
    @SerializedName("application_fee_percent")
648
    BigDecimal applicationFeePercent;
649

650
    @SerializedName("automatic_tax")
651
    AutomaticTax automaticTax;
652

653
    /**
654
     * Possible values are {@code phase_start} or {@code automatic}. If {@code phase_start} then
655
     * billing cycle anchor of the subscription is set to the start of the phase when entering the
656
     * phase. If {@code automatic} then the billing cycle anchor is automatically modified as needed
657
     * when entering the phase. For more information, see the billing cycle <a
658
     * href="https://stripe.com/docs/billing/subscriptions/billing-cycle">documentation</a>.
659
     *
660
     * <p>One of {@code automatic}, or {@code phase_start}.
661
     */
662
    @SerializedName("billing_cycle_anchor")
663
    String billingCycleAnchor;
664

665
    /**
666
     * Define thresholds at which an invoice will be sent, and the subscription advanced to a new
667
     * billing period.
668
     */
669
    @SerializedName("billing_thresholds")
670
    BillingThresholds billingThresholds;
671

672
    /**
673
     * Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
674
     * Stripe will attempt to pay the underlying subscription at the end of each billing cycle using
675
     * the default source attached to the customer. When sending an invoice, Stripe will email your
676
     * customer an invoice with payment instructions and mark the subscription as {@code active}.
677
     *
678
     * <p>One of {@code charge_automatically}, or {@code send_invoice}.
679
     */
680
    @SerializedName("collection_method")
681
    String collectionMethod;
682

683
    /**
684
     * ID of the default payment method for the subscription schedule. If not set, invoices will use
685
     * the default payment method in the customer's invoice settings.
686
     */
687
    @SerializedName("default_payment_method")
688
    @Getter(lombok.AccessLevel.NONE)
689
    @Setter(lombok.AccessLevel.NONE)
690
    ExpandableField<PaymentMethod> defaultPaymentMethod;
691

692
    /**
693
     * Subscription description, meant to be displayable to the customer. Use this field to
694
     * optionally store an explanation of the subscription for rendering in Stripe surfaces and
695
     * certain local payment methods UIs.
696
     */
697
    @SerializedName("description")
698
    String description;
699

700
    @SerializedName("invoice_settings")
701
    InvoiceSettings invoiceSettings;
702

703
    /**
704
     * The account (if any) the charge was made on behalf of for charges associated with the
705
     * schedule's subscription. See the Connect documentation for details.
706
     */
707
    @SerializedName("on_behalf_of")
708
    @Getter(lombok.AccessLevel.NONE)
709
    @Setter(lombok.AccessLevel.NONE)
710
    ExpandableField<Account> onBehalfOf;
711

712
    /**
713
     * The account (if any) the associated subscription's payments will be attributed to for tax
714
     * reporting, and where funds from each payment will be transferred to for each of the
715
     * subscription's invoices.
716
     */
717
    @SerializedName("transfer_data")
718
    TransferData transferData;
719

720
    /** Get ID of expandable {@code defaultPaymentMethod} object. */
721
    public String getDefaultPaymentMethod() {
722
      return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getId() : null;
×
723
    }
724

725
    public void setDefaultPaymentMethod(String id) {
726
      this.defaultPaymentMethod = ApiResource.setExpandableFieldId(id, this.defaultPaymentMethod);
×
727
    }
×
728

729
    /** Get expanded {@code defaultPaymentMethod}. */
730
    public PaymentMethod getDefaultPaymentMethodObject() {
731
      return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getExpanded() : null;
×
732
    }
733

734
    public void setDefaultPaymentMethodObject(PaymentMethod expandableObject) {
735
      this.defaultPaymentMethod =
×
736
          new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject);
×
737
    }
×
738

739
    /** Get ID of expandable {@code onBehalfOf} object. */
740
    public String getOnBehalfOf() {
741
      return (this.onBehalfOf != null) ? this.onBehalfOf.getId() : null;
×
742
    }
743

744
    public void setOnBehalfOf(String id) {
745
      this.onBehalfOf = ApiResource.setExpandableFieldId(id, this.onBehalfOf);
×
746
    }
×
747

748
    /** Get expanded {@code onBehalfOf}. */
749
    public Account getOnBehalfOfObject() {
750
      return (this.onBehalfOf != null) ? this.onBehalfOf.getExpanded() : null;
×
751
    }
752

753
    public void setOnBehalfOfObject(Account expandableObject) {
754
      this.onBehalfOf = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
755
    }
×
756

757
    @Getter
758
    @Setter
759
    @EqualsAndHashCode(callSuper = false)
760
    public static class AutomaticTax extends StripeObject {
1✔
761
      /** Whether Stripe automatically computes tax on invoices created during this phase. */
762
      @SerializedName("enabled")
763
      Boolean enabled;
764

765
      /**
766
       * The account that's liable for tax. If set, the business address and tax registrations
767
       * required to perform the tax calculation are loaded from this account. The tax transaction
768
       * is returned in the report of the connected account.
769
       */
770
      @SerializedName("liability")
771
      Liability liability;
772

773
      @Getter
774
      @Setter
775
      @EqualsAndHashCode(callSuper = false)
776
      public static class Liability extends StripeObject {
×
777
        /** The connected account being referenced when {@code type} is {@code account}. */
778
        @SerializedName("account")
779
        @Getter(lombok.AccessLevel.NONE)
780
        @Setter(lombok.AccessLevel.NONE)
781
        ExpandableField<Account> account;
782

783
        /**
784
         * Type of the account referenced.
785
         *
786
         * <p>One of {@code account}, or {@code self}.
787
         */
788
        @SerializedName("type")
789
        String type;
790

791
        /** Get ID of expandable {@code account} object. */
792
        public String getAccount() {
793
          return (this.account != null) ? this.account.getId() : null;
×
794
        }
795

796
        public void setAccount(String id) {
797
          this.account = ApiResource.setExpandableFieldId(id, this.account);
×
798
        }
×
799

800
        /** Get expanded {@code account}. */
801
        public Account getAccountObject() {
802
          return (this.account != null) ? this.account.getExpanded() : null;
×
803
        }
804

805
        public void setAccountObject(Account expandableObject) {
806
          this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
807
        }
×
808
      }
809
    }
810

811
    @Getter
812
    @Setter
813
    @EqualsAndHashCode(callSuper = false)
814
    public static class BillingThresholds extends StripeObject {
×
815
      /** Monetary threshold that triggers the subscription to create an invoice. */
816
      @SerializedName("amount_gte")
817
      Long amountGte;
818

819
      /**
820
       * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is reached.
821
       * If true, {@code billing_cycle_anchor} will be updated to the date/time the threshold was
822
       * last reached; otherwise, the value will remain unchanged. This value may not be {@code
823
       * true} if the subscription contains items with plans that have {@code
824
       * aggregate_usage=last_ever}.
825
       */
826
      @SerializedName("reset_billing_cycle_anchor")
827
      Boolean resetBillingCycleAnchor;
828
    }
829

830
    @Getter
831
    @Setter
832
    @EqualsAndHashCode(callSuper = false)
833
    public static class InvoiceSettings extends StripeObject {
1✔
834
      /**
835
       * The account tax IDs associated with the subscription schedule. Will be set on invoices
836
       * generated by the subscription schedule.
837
       */
838
      @SerializedName("account_tax_ids")
839
      List<ExpandableField<TaxId>> accountTaxIds;
840

841
      /**
842
       * Number of days within which a customer must pay invoices generated by this subscription
843
       * schedule. This value will be {@code null} for subscription schedules where {@code
844
       * billing=charge_automatically}.
845
       */
846
      @SerializedName("days_until_due")
847
      Long daysUntilDue;
848

849
      @SerializedName("issuer")
850
      Issuer issuer;
851

852
      /** Get IDs of expandable {@code accountTaxIds} object list. */
853
      public List<String> getAccountTaxIds() {
854
        return (this.accountTaxIds != null)
×
855
            ? this.accountTaxIds.stream().map(x -> x.getId()).collect(Collectors.toList())
×
856
            : null;
×
857
      }
858

859
      public void setAccountTaxIds(List<String> ids) {
860
        if (ids == null) {
×
861
          this.accountTaxIds = null;
×
862
          return;
×
863
        }
864
        if (this.accountTaxIds != null
×
865
            && this.accountTaxIds.stream()
×
866
                .map(x -> x.getId())
×
867
                .collect(Collectors.toList())
×
868
                .equals(ids)) {
×
869
          // noop if the ids are equal to what are already present
870
          return;
×
871
        }
872
        this.accountTaxIds =
×
873
            (ids != null)
×
874
                ? ids.stream()
×
875
                    .map(id -> new ExpandableField<TaxId>(id, null))
×
876
                    .collect(Collectors.toList())
×
877
                : null;
×
878
      }
×
879

880
      /** Get expanded {@code accountTaxIds}. */
881
      public List<TaxId> getAccountTaxIdObjects() {
882
        return (this.accountTaxIds != null)
×
883
            ? this.accountTaxIds.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
×
884
            : null;
×
885
      }
886

887
      public void setAccountTaxIdObjects(List<TaxId> objs) {
888
        this.accountTaxIds =
×
889
            objs != null
×
890
                ? objs.stream()
×
891
                    .map(x -> new ExpandableField<TaxId>(x.getId(), x))
×
892
                    .collect(Collectors.toList())
×
893
                : null;
×
894
      }
×
895

896
      @Getter
897
      @Setter
898
      @EqualsAndHashCode(callSuper = false)
899
      public static class Issuer extends StripeObject {
1✔
900
        /** The connected account being referenced when {@code type} is {@code account}. */
901
        @SerializedName("account")
902
        @Getter(lombok.AccessLevel.NONE)
903
        @Setter(lombok.AccessLevel.NONE)
904
        ExpandableField<Account> account;
905

906
        /**
907
         * Type of the account referenced.
908
         *
909
         * <p>One of {@code account}, or {@code self}.
910
         */
911
        @SerializedName("type")
912
        String type;
913

914
        /** Get ID of expandable {@code account} object. */
915
        public String getAccount() {
916
          return (this.account != null) ? this.account.getId() : null;
×
917
        }
918

919
        public void setAccount(String id) {
920
          this.account = ApiResource.setExpandableFieldId(id, this.account);
×
921
        }
×
922

923
        /** Get expanded {@code account}. */
924
        public Account getAccountObject() {
925
          return (this.account != null) ? this.account.getExpanded() : null;
×
926
        }
927

928
        public void setAccountObject(Account expandableObject) {
929
          this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
930
        }
×
931
      }
932
    }
933

934
    @Getter
935
    @Setter
936
    @EqualsAndHashCode(callSuper = false)
937
    public static class TransferData extends StripeObject {
×
938
      /**
939
       * A non-negative decimal between 0 and 100, with at most two decimal places. This represents
940
       * the percentage of the subscription invoice total that will be transferred to the
941
       * destination account. By default, the entire amount is transferred to the destination.
942
       */
943
      @SerializedName("amount_percent")
944
      BigDecimal amountPercent;
945

946
      /** The account where funds from the payment will be transferred to upon payment success. */
947
      @SerializedName("destination")
948
      @Getter(lombok.AccessLevel.NONE)
949
      @Setter(lombok.AccessLevel.NONE)
950
      ExpandableField<Account> destination;
951

952
      /** Get ID of expandable {@code destination} object. */
953
      public String getDestination() {
954
        return (this.destination != null) ? this.destination.getId() : null;
×
955
      }
956

957
      public void setDestination(String id) {
958
        this.destination = ApiResource.setExpandableFieldId(id, this.destination);
×
959
      }
×
960

961
      /** Get expanded {@code destination}. */
962
      public Account getDestinationObject() {
963
        return (this.destination != null) ? this.destination.getExpanded() : null;
×
964
      }
965

966
      public void setDestinationObject(Account expandableObject) {
967
        this.destination = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
968
      }
×
969
    }
970
  }
971

972
  @Getter
973
  @Setter
974
  @EqualsAndHashCode(callSuper = false)
975
  public static class LastPriceMigrationError extends StripeObject {
×
976
    /** The time at which the price migration encountered an error. */
977
    @SerializedName("errored_at")
978
    Long erroredAt;
979

980
    /** The involved price pairs in each failed transition. */
981
    @SerializedName("failed_transitions")
982
    List<SubscriptionSchedule.LastPriceMigrationError.FailedTransition> failedTransitions;
983

984
    /**
985
     * The type of error encountered by the price migration.
986
     *
987
     * <p>Equal to {@code price_uniqueness_violation}.
988
     */
989
    @SerializedName("type")
990
    String type;
991

992
    @Getter
993
    @Setter
994
    @EqualsAndHashCode(callSuper = false)
995
    public static class FailedTransition extends StripeObject {
×
996
      /** The original price to be migrated. */
997
      @SerializedName("source_price")
998
      String sourcePrice;
999

1000
      /** The intended resulting price of the migration. */
1001
      @SerializedName("target_price")
1002
      String targetPrice;
1003
    }
1004
  }
1005

1006
  /**
1007
   * A phase describes the plans, coupon, and trialing status of a subscription for a predefined
1008
   * time period.
1009
   */
1010
  @Getter
1011
  @Setter
1012
  @EqualsAndHashCode(callSuper = false)
1013
  public static class Phase extends StripeObject {
1✔
1014
    /**
1015
     * A list of prices and quantities that will generate invoice items appended to the next invoice
1016
     * for this phase.
1017
     */
1018
    @SerializedName("add_invoice_items")
1019
    List<SubscriptionSchedule.Phase.AddInvoiceItem> addInvoiceItems;
1020

1021
    /**
1022
     * A non-negative decimal between 0 and 100, with at most two decimal places. This represents
1023
     * the percentage of the subscription invoice total that will be transferred to the application
1024
     * owner's Stripe account during this phase of the schedule.
1025
     */
1026
    @SerializedName("application_fee_percent")
1027
    BigDecimal applicationFeePercent;
1028

1029
    @SerializedName("automatic_tax")
1030
    AutomaticTax automaticTax;
1031

1032
    /**
1033
     * Possible values are {@code phase_start} or {@code automatic}. If {@code phase_start} then
1034
     * billing cycle anchor of the subscription is set to the start of the phase when entering the
1035
     * phase. If {@code automatic} then the billing cycle anchor is automatically modified as needed
1036
     * when entering the phase. For more information, see the billing cycle <a
1037
     * href="https://stripe.com/docs/billing/subscriptions/billing-cycle">documentation</a>.
1038
     *
1039
     * <p>One of {@code automatic}, or {@code phase_start}.
1040
     */
1041
    @SerializedName("billing_cycle_anchor")
1042
    String billingCycleAnchor;
1043

1044
    /**
1045
     * Define thresholds at which an invoice will be sent, and the subscription advanced to a new
1046
     * billing period.
1047
     */
1048
    @SerializedName("billing_thresholds")
1049
    BillingThresholds billingThresholds;
1050

1051
    /**
1052
     * Either {@code charge_automatically}, or {@code send_invoice}. When charging automatically,
1053
     * Stripe will attempt to pay the underlying subscription at the end of each billing cycle using
1054
     * the default source attached to the customer. When sending an invoice, Stripe will email your
1055
     * customer an invoice with payment instructions and mark the subscription as {@code active}.
1056
     *
1057
     * <p>One of {@code charge_automatically}, or {@code send_invoice}.
1058
     */
1059
    @SerializedName("collection_method")
1060
    String collectionMethod;
1061

1062
    /** ID of the coupon to use during this phase of the subscription schedule. */
1063
    @SerializedName("coupon")
1064
    @Getter(lombok.AccessLevel.NONE)
1065
    @Setter(lombok.AccessLevel.NONE)
1066
    ExpandableField<Coupon> coupon;
1067

1068
    /**
1069
     * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
1070
     * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
1071
     * currency</a>.
1072
     */
1073
    @SerializedName("currency")
1074
    String currency;
1075

1076
    /**
1077
     * ID of the default payment method for the subscription schedule. It must belong to the
1078
     * customer associated with the subscription schedule. If not set, invoices will use the default
1079
     * payment method in the customer's invoice settings.
1080
     */
1081
    @SerializedName("default_payment_method")
1082
    @Getter(lombok.AccessLevel.NONE)
1083
    @Setter(lombok.AccessLevel.NONE)
1084
    ExpandableField<PaymentMethod> defaultPaymentMethod;
1085

1086
    /**
1087
     * The default tax rates to apply to the subscription during this phase of the subscription
1088
     * schedule.
1089
     */
1090
    @SerializedName("default_tax_rates")
1091
    List<TaxRate> defaultTaxRates;
1092

1093
    /**
1094
     * Subscription description, meant to be displayable to the customer. Use this field to
1095
     * optionally store an explanation of the subscription for rendering in Stripe surfaces and
1096
     * certain local payment methods UIs.
1097
     */
1098
    @SerializedName("description")
1099
    String description;
1100

1101
    /**
1102
     * The stackable discounts that will be applied to the subscription on this phase. Subscription
1103
     * item discounts are applied before subscription discounts.
1104
     */
1105
    @SerializedName("discounts")
1106
    List<SubscriptionSchedule.Phase.Discount> discounts;
1107

1108
    /** The end of this phase of the subscription schedule. */
1109
    @SerializedName("end_date")
1110
    Long endDate;
1111

1112
    /** The invoice settings applicable during this phase. */
1113
    @SerializedName("invoice_settings")
1114
    InvoiceSettings invoiceSettings;
1115

1116
    /**
1117
     * Subscription items to configure the subscription to during this phase of the subscription
1118
     * schedule.
1119
     */
1120
    @SerializedName("items")
1121
    List<SubscriptionSchedule.Phase.Item> items;
1122

1123
    /**
1124
     * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
1125
     * to a phase. Metadata on a schedule's phase will update the underlying subscription's {@code
1126
     * metadata} when the phase is entered. Updating the underlying subscription's {@code metadata}
1127
     * directly will not affect the current phase's {@code metadata}.
1128
     */
1129
    @SerializedName("metadata")
1130
    Map<String, String> metadata;
1131

1132
    /**
1133
     * The account (if any) the charge was made on behalf of for charges associated with the
1134
     * schedule's subscription. See the Connect documentation for details.
1135
     */
1136
    @SerializedName("on_behalf_of")
1137
    @Getter(lombok.AccessLevel.NONE)
1138
    @Setter(lombok.AccessLevel.NONE)
1139
    ExpandableField<Account> onBehalfOf;
1140

1141
    /**
1142
     * If specified, payment collection for this subscription will be paused. Note that the
1143
     * subscription status will be unchanged and will not be updated to {@code paused}. Learn more
1144
     * about <a href="https://stripe.com/billing/subscriptions/pause-payment">pausing
1145
     * collection</a>.
1146
     */
1147
    @SerializedName("pause_collection")
1148
    PauseCollection pauseCollection;
1149

1150
    /**
1151
     * If the subscription schedule will prorate when transitioning to this phase. Possible values
1152
     * are {@code create_prorations} and {@code none}.
1153
     *
1154
     * <p>One of {@code always_invoice}, {@code create_prorations}, or {@code none}.
1155
     */
1156
    @SerializedName("proration_behavior")
1157
    String prorationBehavior;
1158

1159
    /** The start of this phase of the subscription schedule. */
1160
    @SerializedName("start_date")
1161
    Long startDate;
1162

1163
    /**
1164
     * The account (if any) the associated subscription's payments will be attributed to for tax
1165
     * reporting, and where funds from each payment will be transferred to for each of the
1166
     * subscription's invoices.
1167
     */
1168
    @SerializedName("transfer_data")
1169
    TransferData transferData;
1170

1171
    /**
1172
     * Specify behavior of the trial when crossing schedule phase boundaries
1173
     *
1174
     * <p>One of {@code continue}, or {@code none}.
1175
     */
1176
    @SerializedName("trial_continuation")
1177
    String trialContinuation;
1178

1179
    /** When the trial ends within the phase. */
1180
    @SerializedName("trial_end")
1181
    Long trialEnd;
1182

1183
    /** Settings related to any trials on the subscription during this phase. */
1184
    @SerializedName("trial_settings")
1185
    TrialSettings trialSettings;
1186

1187
    /** Get ID of expandable {@code coupon} object. */
1188
    public String getCoupon() {
1189
      return (this.coupon != null) ? this.coupon.getId() : null;
×
1190
    }
1191

1192
    public void setCoupon(String id) {
1193
      this.coupon = ApiResource.setExpandableFieldId(id, this.coupon);
×
1194
    }
×
1195

1196
    /** Get expanded {@code coupon}. */
1197
    public Coupon getCouponObject() {
1198
      return (this.coupon != null) ? this.coupon.getExpanded() : null;
×
1199
    }
1200

1201
    public void setCouponObject(Coupon expandableObject) {
1202
      this.coupon = new ExpandableField<Coupon>(expandableObject.getId(), expandableObject);
×
1203
    }
×
1204

1205
    /** Get ID of expandable {@code defaultPaymentMethod} object. */
1206
    public String getDefaultPaymentMethod() {
1207
      return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getId() : null;
×
1208
    }
1209

1210
    public void setDefaultPaymentMethod(String id) {
1211
      this.defaultPaymentMethod = ApiResource.setExpandableFieldId(id, this.defaultPaymentMethod);
×
1212
    }
×
1213

1214
    /** Get expanded {@code defaultPaymentMethod}. */
1215
    public PaymentMethod getDefaultPaymentMethodObject() {
1216
      return (this.defaultPaymentMethod != null) ? this.defaultPaymentMethod.getExpanded() : null;
×
1217
    }
1218

1219
    public void setDefaultPaymentMethodObject(PaymentMethod expandableObject) {
1220
      this.defaultPaymentMethod =
×
1221
          new ExpandableField<PaymentMethod>(expandableObject.getId(), expandableObject);
×
1222
    }
×
1223

1224
    /** Get ID of expandable {@code onBehalfOf} object. */
1225
    public String getOnBehalfOf() {
1226
      return (this.onBehalfOf != null) ? this.onBehalfOf.getId() : null;
×
1227
    }
1228

1229
    public void setOnBehalfOf(String id) {
1230
      this.onBehalfOf = ApiResource.setExpandableFieldId(id, this.onBehalfOf);
×
1231
    }
×
1232

1233
    /** Get expanded {@code onBehalfOf}. */
1234
    public Account getOnBehalfOfObject() {
1235
      return (this.onBehalfOf != null) ? this.onBehalfOf.getExpanded() : null;
×
1236
    }
1237

1238
    public void setOnBehalfOfObject(Account expandableObject) {
1239
      this.onBehalfOf = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
1240
    }
×
1241

1242
    /**
1243
     * An Add Invoice Item describes the prices and quantities that will be added as pending invoice
1244
     * items when entering a phase.
1245
     */
1246
    @Getter
1247
    @Setter
1248
    @EqualsAndHashCode(callSuper = false)
1249
    public static class AddInvoiceItem extends StripeObject {
×
1250
      /** The stackable discounts that will be applied to the item. */
1251
      @SerializedName("discounts")
1252
      List<SubscriptionSchedule.Phase.AddInvoiceItem.Discount> discounts;
1253

1254
      /** ID of the price used to generate the invoice item. */
1255
      @SerializedName("price")
1256
      @Getter(lombok.AccessLevel.NONE)
1257
      @Setter(lombok.AccessLevel.NONE)
1258
      ExpandableField<Price> price;
1259

1260
      /** The quantity of the invoice item. */
1261
      @SerializedName("quantity")
1262
      Long quantity;
1263

1264
      /**
1265
       * The tax rates which apply to the item. When set, the {@code default_tax_rates} do not apply
1266
       * to this item.
1267
       */
1268
      @SerializedName("tax_rates")
1269
      List<TaxRate> taxRates;
1270

1271
      /** Get ID of expandable {@code price} object. */
1272
      public String getPrice() {
1273
        return (this.price != null) ? this.price.getId() : null;
×
1274
      }
1275

1276
      public void setPrice(String id) {
1277
        this.price = ApiResource.setExpandableFieldId(id, this.price);
×
1278
      }
×
1279

1280
      /** Get expanded {@code price}. */
1281
      public Price getPriceObject() {
1282
        return (this.price != null) ? this.price.getExpanded() : null;
×
1283
      }
1284

1285
      public void setPriceObject(Price expandableObject) {
1286
        this.price = new ExpandableField<Price>(expandableObject.getId(), expandableObject);
×
1287
      }
×
1288

1289
      @Getter
1290
      @Setter
1291
      @EqualsAndHashCode(callSuper = false)
1292
      public static class Discount extends StripeObject {
×
1293
        /** ID of the coupon to create a new discount for. */
1294
        @SerializedName("coupon")
1295
        @Getter(lombok.AccessLevel.NONE)
1296
        @Setter(lombok.AccessLevel.NONE)
1297
        ExpandableField<Coupon> coupon;
1298

1299
        /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
1300
        @SerializedName("discount")
1301
        @Getter(lombok.AccessLevel.NONE)
1302
        @Setter(lombok.AccessLevel.NONE)
1303
        ExpandableField<com.stripe.model.Discount> discount;
1304

1305
        /** Details to determine how long the discount should be applied for. */
1306
        @SerializedName("discount_end")
1307
        DiscountEnd discountEnd;
1308

1309
        /** ID of the promotion code to create a new discount for. */
1310
        @SerializedName("promotion_code")
1311
        @Getter(lombok.AccessLevel.NONE)
1312
        @Setter(lombok.AccessLevel.NONE)
1313
        ExpandableField<PromotionCode> promotionCode;
1314

1315
        /** Get ID of expandable {@code coupon} object. */
1316
        public String getCoupon() {
1317
          return (this.coupon != null) ? this.coupon.getId() : null;
×
1318
        }
1319

1320
        public void setCoupon(String id) {
1321
          this.coupon = ApiResource.setExpandableFieldId(id, this.coupon);
×
1322
        }
×
1323

1324
        /** Get expanded {@code coupon}. */
1325
        public Coupon getCouponObject() {
1326
          return (this.coupon != null) ? this.coupon.getExpanded() : null;
×
1327
        }
1328

1329
        public void setCouponObject(Coupon expandableObject) {
1330
          this.coupon = new ExpandableField<Coupon>(expandableObject.getId(), expandableObject);
×
1331
        }
×
1332

1333
        /** Get ID of expandable {@code discount} object. */
1334
        public String getDiscount() {
1335
          return (this.discount != null) ? this.discount.getId() : null;
×
1336
        }
1337

1338
        public void setDiscount(String id) {
1339
          this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
1340
        }
×
1341

1342
        /** Get expanded {@code discount}. */
1343
        public com.stripe.model.Discount getDiscountObject() {
1344
          return (this.discount != null) ? this.discount.getExpanded() : null;
×
1345
        }
1346

1347
        public void setDiscountObject(com.stripe.model.Discount expandableObject) {
1348
          this.discount =
×
1349
              new ExpandableField<com.stripe.model.Discount>(
1350
                  expandableObject.getId(), expandableObject);
×
1351
        }
×
1352

1353
        /** Get ID of expandable {@code promotionCode} object. */
1354
        public String getPromotionCode() {
1355
          return (this.promotionCode != null) ? this.promotionCode.getId() : null;
×
1356
        }
1357

1358
        public void setPromotionCode(String id) {
1359
          this.promotionCode = ApiResource.setExpandableFieldId(id, this.promotionCode);
×
1360
        }
×
1361

1362
        /** Get expanded {@code promotionCode}. */
1363
        public PromotionCode getPromotionCodeObject() {
1364
          return (this.promotionCode != null) ? this.promotionCode.getExpanded() : null;
×
1365
        }
1366

1367
        public void setPromotionCodeObject(PromotionCode expandableObject) {
1368
          this.promotionCode =
×
1369
              new ExpandableField<PromotionCode>(expandableObject.getId(), expandableObject);
×
1370
        }
×
1371

1372
        @Getter
1373
        @Setter
1374
        @EqualsAndHashCode(callSuper = false)
1375
        public static class DiscountEnd extends StripeObject {
×
1376
          /** The discount end timestamp. */
1377
          @SerializedName("timestamp")
1378
          Long timestamp;
1379

1380
          /**
1381
           * The discount end type.
1382
           *
1383
           * <p>Equal to {@code timestamp}.
1384
           */
1385
          @SerializedName("type")
1386
          String type;
1387
        }
1388
      }
1389
    }
1390

1391
    @Getter
1392
    @Setter
1393
    @EqualsAndHashCode(callSuper = false)
1394
    public static class AutomaticTax extends StripeObject {
×
1395
      /** Whether Stripe automatically computes tax on invoices created during this phase. */
1396
      @SerializedName("enabled")
1397
      Boolean enabled;
1398

1399
      /**
1400
       * The account that's liable for tax. If set, the business address and tax registrations
1401
       * required to perform the tax calculation are loaded from this account. The tax transaction
1402
       * is returned in the report of the connected account.
1403
       */
1404
      @SerializedName("liability")
1405
      Liability liability;
1406

1407
      @Getter
1408
      @Setter
1409
      @EqualsAndHashCode(callSuper = false)
1410
      public static class Liability extends StripeObject {
×
1411
        /** The connected account being referenced when {@code type} is {@code account}. */
1412
        @SerializedName("account")
1413
        @Getter(lombok.AccessLevel.NONE)
1414
        @Setter(lombok.AccessLevel.NONE)
1415
        ExpandableField<Account> account;
1416

1417
        /**
1418
         * Type of the account referenced.
1419
         *
1420
         * <p>One of {@code account}, or {@code self}.
1421
         */
1422
        @SerializedName("type")
1423
        String type;
1424

1425
        /** Get ID of expandable {@code account} object. */
1426
        public String getAccount() {
1427
          return (this.account != null) ? this.account.getId() : null;
×
1428
        }
1429

1430
        public void setAccount(String id) {
1431
          this.account = ApiResource.setExpandableFieldId(id, this.account);
×
1432
        }
×
1433

1434
        /** Get expanded {@code account}. */
1435
        public Account getAccountObject() {
1436
          return (this.account != null) ? this.account.getExpanded() : null;
×
1437
        }
1438

1439
        public void setAccountObject(Account expandableObject) {
1440
          this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
1441
        }
×
1442
      }
1443
    }
1444

1445
    @Getter
1446
    @Setter
1447
    @EqualsAndHashCode(callSuper = false)
1448
    public static class BillingThresholds extends StripeObject {
×
1449
      /** Monetary threshold that triggers the subscription to create an invoice. */
1450
      @SerializedName("amount_gte")
1451
      Long amountGte;
1452

1453
      /**
1454
       * Indicates if the {@code billing_cycle_anchor} should be reset when a threshold is reached.
1455
       * If true, {@code billing_cycle_anchor} will be updated to the date/time the threshold was
1456
       * last reached; otherwise, the value will remain unchanged. This value may not be {@code
1457
       * true} if the subscription contains items with plans that have {@code
1458
       * aggregate_usage=last_ever}.
1459
       */
1460
      @SerializedName("reset_billing_cycle_anchor")
1461
      Boolean resetBillingCycleAnchor;
1462
    }
1463

1464
    @Getter
1465
    @Setter
1466
    @EqualsAndHashCode(callSuper = false)
1467
    public static class Discount extends StripeObject {
×
1468
      /** ID of the coupon to create a new discount for. */
1469
      @SerializedName("coupon")
1470
      @Getter(lombok.AccessLevel.NONE)
1471
      @Setter(lombok.AccessLevel.NONE)
1472
      ExpandableField<Coupon> coupon;
1473

1474
      /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
1475
      @SerializedName("discount")
1476
      @Getter(lombok.AccessLevel.NONE)
1477
      @Setter(lombok.AccessLevel.NONE)
1478
      ExpandableField<com.stripe.model.Discount> discount;
1479

1480
      /** Details to determine how long the discount should be applied for. */
1481
      @SerializedName("discount_end")
1482
      DiscountEnd discountEnd;
1483

1484
      /** ID of the promotion code to create a new discount for. */
1485
      @SerializedName("promotion_code")
1486
      @Getter(lombok.AccessLevel.NONE)
1487
      @Setter(lombok.AccessLevel.NONE)
1488
      ExpandableField<PromotionCode> promotionCode;
1489

1490
      /** Get ID of expandable {@code coupon} object. */
1491
      public String getCoupon() {
1492
        return (this.coupon != null) ? this.coupon.getId() : null;
×
1493
      }
1494

1495
      public void setCoupon(String id) {
1496
        this.coupon = ApiResource.setExpandableFieldId(id, this.coupon);
×
1497
      }
×
1498

1499
      /** Get expanded {@code coupon}. */
1500
      public Coupon getCouponObject() {
1501
        return (this.coupon != null) ? this.coupon.getExpanded() : null;
×
1502
      }
1503

1504
      public void setCouponObject(Coupon expandableObject) {
1505
        this.coupon = new ExpandableField<Coupon>(expandableObject.getId(), expandableObject);
×
1506
      }
×
1507

1508
      /** Get ID of expandable {@code discount} object. */
1509
      public String getDiscount() {
1510
        return (this.discount != null) ? this.discount.getId() : null;
×
1511
      }
1512

1513
      public void setDiscount(String id) {
1514
        this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
1515
      }
×
1516

1517
      /** Get expanded {@code discount}. */
1518
      public com.stripe.model.Discount getDiscountObject() {
1519
        return (this.discount != null) ? this.discount.getExpanded() : null;
×
1520
      }
1521

1522
      public void setDiscountObject(com.stripe.model.Discount expandableObject) {
1523
        this.discount =
×
1524
            new ExpandableField<com.stripe.model.Discount>(
1525
                expandableObject.getId(), expandableObject);
×
1526
      }
×
1527

1528
      /** Get ID of expandable {@code promotionCode} object. */
1529
      public String getPromotionCode() {
1530
        return (this.promotionCode != null) ? this.promotionCode.getId() : null;
×
1531
      }
1532

1533
      public void setPromotionCode(String id) {
1534
        this.promotionCode = ApiResource.setExpandableFieldId(id, this.promotionCode);
×
1535
      }
×
1536

1537
      /** Get expanded {@code promotionCode}. */
1538
      public PromotionCode getPromotionCodeObject() {
1539
        return (this.promotionCode != null) ? this.promotionCode.getExpanded() : null;
×
1540
      }
1541

1542
      public void setPromotionCodeObject(PromotionCode expandableObject) {
1543
        this.promotionCode =
×
1544
            new ExpandableField<PromotionCode>(expandableObject.getId(), expandableObject);
×
1545
      }
×
1546

1547
      @Getter
1548
      @Setter
1549
      @EqualsAndHashCode(callSuper = false)
1550
      public static class DiscountEnd extends StripeObject {
×
1551
        /** The discount end timestamp. */
1552
        @SerializedName("timestamp")
1553
        Long timestamp;
1554

1555
        /**
1556
         * The discount end type.
1557
         *
1558
         * <p>Equal to {@code timestamp}.
1559
         */
1560
        @SerializedName("type")
1561
        String type;
1562
      }
1563
    }
1564

1565
    @Getter
1566
    @Setter
1567
    @EqualsAndHashCode(callSuper = false)
1568
    public static class InvoiceSettings extends StripeObject {
×
1569
      /**
1570
       * The account tax IDs associated with this phase of the subscription schedule. Will be set on
1571
       * invoices generated by this phase of the subscription schedule.
1572
       */
1573
      @SerializedName("account_tax_ids")
1574
      List<ExpandableField<TaxId>> accountTaxIds;
1575

1576
      /**
1577
       * Number of days within which a customer must pay invoices generated by this subscription
1578
       * schedule. This value will be {@code null} for subscription schedules where {@code
1579
       * billing=charge_automatically}.
1580
       */
1581
      @SerializedName("days_until_due")
1582
      Long daysUntilDue;
1583

1584
      /**
1585
       * The connected account that issues the invoice. The invoice is presented with the branding
1586
       * and support information of the specified account.
1587
       */
1588
      @SerializedName("issuer")
1589
      Issuer issuer;
1590

1591
      /** Get IDs of expandable {@code accountTaxIds} object list. */
1592
      public List<String> getAccountTaxIds() {
1593
        return (this.accountTaxIds != null)
×
1594
            ? this.accountTaxIds.stream().map(x -> x.getId()).collect(Collectors.toList())
×
1595
            : null;
×
1596
      }
1597

1598
      public void setAccountTaxIds(List<String> ids) {
1599
        if (ids == null) {
×
1600
          this.accountTaxIds = null;
×
1601
          return;
×
1602
        }
1603
        if (this.accountTaxIds != null
×
1604
            && this.accountTaxIds.stream()
×
1605
                .map(x -> x.getId())
×
1606
                .collect(Collectors.toList())
×
1607
                .equals(ids)) {
×
1608
          // noop if the ids are equal to what are already present
1609
          return;
×
1610
        }
1611
        this.accountTaxIds =
×
1612
            (ids != null)
×
1613
                ? ids.stream()
×
1614
                    .map(id -> new ExpandableField<TaxId>(id, null))
×
1615
                    .collect(Collectors.toList())
×
1616
                : null;
×
1617
      }
×
1618

1619
      /** Get expanded {@code accountTaxIds}. */
1620
      public List<TaxId> getAccountTaxIdObjects() {
1621
        return (this.accountTaxIds != null)
×
1622
            ? this.accountTaxIds.stream().map(x -> x.getExpanded()).collect(Collectors.toList())
×
1623
            : null;
×
1624
      }
1625

1626
      public void setAccountTaxIdObjects(List<TaxId> objs) {
1627
        this.accountTaxIds =
×
1628
            objs != null
×
1629
                ? objs.stream()
×
1630
                    .map(x -> new ExpandableField<TaxId>(x.getId(), x))
×
1631
                    .collect(Collectors.toList())
×
1632
                : null;
×
1633
      }
×
1634

1635
      @Getter
1636
      @Setter
1637
      @EqualsAndHashCode(callSuper = false)
1638
      public static class Issuer extends StripeObject {
×
1639
        /** The connected account being referenced when {@code type} is {@code account}. */
1640
        @SerializedName("account")
1641
        @Getter(lombok.AccessLevel.NONE)
1642
        @Setter(lombok.AccessLevel.NONE)
1643
        ExpandableField<Account> account;
1644

1645
        /**
1646
         * Type of the account referenced.
1647
         *
1648
         * <p>One of {@code account}, or {@code self}.
1649
         */
1650
        @SerializedName("type")
1651
        String type;
1652

1653
        /** Get ID of expandable {@code account} object. */
1654
        public String getAccount() {
1655
          return (this.account != null) ? this.account.getId() : null;
×
1656
        }
1657

1658
        public void setAccount(String id) {
1659
          this.account = ApiResource.setExpandableFieldId(id, this.account);
×
1660
        }
×
1661

1662
        /** Get expanded {@code account}. */
1663
        public Account getAccountObject() {
1664
          return (this.account != null) ? this.account.getExpanded() : null;
×
1665
        }
1666

1667
        public void setAccountObject(Account expandableObject) {
1668
          this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
1669
        }
×
1670
      }
1671
    }
1672

1673
    /** A phase item describes the price and quantity of a phase. */
1674
    @Getter
1675
    @Setter
1676
    @EqualsAndHashCode(callSuper = false)
1677
    public static class Item extends StripeObject {
1✔
1678
      /**
1679
       * Define thresholds at which an invoice will be sent, and the related subscription advanced
1680
       * to a new billing period.
1681
       */
1682
      @SerializedName("billing_thresholds")
1683
      BillingThresholds billingThresholds;
1684

1685
      /**
1686
       * The discounts applied to the subscription item. Subscription item discounts are applied
1687
       * before subscription discounts. Use {@code expand[]=discounts} to expand each discount.
1688
       */
1689
      @SerializedName("discounts")
1690
      List<SubscriptionSchedule.Phase.Item.Discount> discounts;
1691

1692
      /**
1693
       * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can
1694
       * attach to an item. Metadata on this item will update the underlying subscription item's
1695
       * {@code metadata} when the phase is entered.
1696
       */
1697
      @SerializedName("metadata")
1698
      Map<String, String> metadata;
1699

1700
      /** ID of the plan to which the customer should be subscribed. */
1701
      @SerializedName("plan")
1702
      @Getter(lombok.AccessLevel.NONE)
1703
      @Setter(lombok.AccessLevel.NONE)
1704
      ExpandableField<Plan> plan;
1705

1706
      /** ID of the price to which the customer should be subscribed. */
1707
      @SerializedName("price")
1708
      @Getter(lombok.AccessLevel.NONE)
1709
      @Setter(lombok.AccessLevel.NONE)
1710
      ExpandableField<Price> price;
1711

1712
      /** Quantity of the plan to which the customer should be subscribed. */
1713
      @SerializedName("quantity")
1714
      Long quantity;
1715

1716
      /**
1717
       * The tax rates which apply to this {@code phase_item}. When set, the {@code
1718
       * default_tax_rates} on the phase do not apply to this {@code phase_item}.
1719
       */
1720
      @SerializedName("tax_rates")
1721
      List<TaxRate> taxRates;
1722

1723
      /** Options that configure the trial on the subscription item. */
1724
      @SerializedName("trial")
1725
      Trial trial;
1726

1727
      /** Get ID of expandable {@code plan} object. */
1728
      public String getPlan() {
1729
        return (this.plan != null) ? this.plan.getId() : null;
×
1730
      }
1731

1732
      public void setPlan(String id) {
1733
        this.plan = ApiResource.setExpandableFieldId(id, this.plan);
×
1734
      }
×
1735

1736
      /** Get expanded {@code plan}. */
1737
      public Plan getPlanObject() {
1738
        return (this.plan != null) ? this.plan.getExpanded() : null;
×
1739
      }
1740

1741
      public void setPlanObject(Plan expandableObject) {
1742
        this.plan = new ExpandableField<Plan>(expandableObject.getId(), expandableObject);
×
1743
      }
×
1744

1745
      /** Get ID of expandable {@code price} object. */
1746
      public String getPrice() {
1747
        return (this.price != null) ? this.price.getId() : null;
×
1748
      }
1749

1750
      public void setPrice(String id) {
1751
        this.price = ApiResource.setExpandableFieldId(id, this.price);
×
1752
      }
×
1753

1754
      /** Get expanded {@code price}. */
1755
      public Price getPriceObject() {
1756
        return (this.price != null) ? this.price.getExpanded() : null;
×
1757
      }
1758

1759
      public void setPriceObject(Price expandableObject) {
1760
        this.price = new ExpandableField<Price>(expandableObject.getId(), expandableObject);
×
1761
      }
×
1762

1763
      @Getter
1764
      @Setter
1765
      @EqualsAndHashCode(callSuper = false)
1766
      public static class BillingThresholds extends StripeObject {
×
1767
        /** Usage threshold that triggers the subscription to create an invoice. */
1768
        @SerializedName("usage_gte")
1769
        Long usageGte;
1770
      }
1771

1772
      @Getter
1773
      @Setter
1774
      @EqualsAndHashCode(callSuper = false)
1775
      public static class Discount extends StripeObject {
×
1776
        /** ID of the coupon to create a new discount for. */
1777
        @SerializedName("coupon")
1778
        @Getter(lombok.AccessLevel.NONE)
1779
        @Setter(lombok.AccessLevel.NONE)
1780
        ExpandableField<Coupon> coupon;
1781

1782
        /** ID of an existing discount on the object (or one of its ancestors) to reuse. */
1783
        @SerializedName("discount")
1784
        @Getter(lombok.AccessLevel.NONE)
1785
        @Setter(lombok.AccessLevel.NONE)
1786
        ExpandableField<com.stripe.model.Discount> discount;
1787

1788
        /** Details to determine how long the discount should be applied for. */
1789
        @SerializedName("discount_end")
1790
        DiscountEnd discountEnd;
1791

1792
        /** ID of the promotion code to create a new discount for. */
1793
        @SerializedName("promotion_code")
1794
        @Getter(lombok.AccessLevel.NONE)
1795
        @Setter(lombok.AccessLevel.NONE)
1796
        ExpandableField<PromotionCode> promotionCode;
1797

1798
        /** Get ID of expandable {@code coupon} object. */
1799
        public String getCoupon() {
1800
          return (this.coupon != null) ? this.coupon.getId() : null;
×
1801
        }
1802

1803
        public void setCoupon(String id) {
1804
          this.coupon = ApiResource.setExpandableFieldId(id, this.coupon);
×
1805
        }
×
1806

1807
        /** Get expanded {@code coupon}. */
1808
        public Coupon getCouponObject() {
1809
          return (this.coupon != null) ? this.coupon.getExpanded() : null;
×
1810
        }
1811

1812
        public void setCouponObject(Coupon expandableObject) {
1813
          this.coupon = new ExpandableField<Coupon>(expandableObject.getId(), expandableObject);
×
1814
        }
×
1815

1816
        /** Get ID of expandable {@code discount} object. */
1817
        public String getDiscount() {
1818
          return (this.discount != null) ? this.discount.getId() : null;
×
1819
        }
1820

1821
        public void setDiscount(String id) {
1822
          this.discount = ApiResource.setExpandableFieldId(id, this.discount);
×
1823
        }
×
1824

1825
        /** Get expanded {@code discount}. */
1826
        public com.stripe.model.Discount getDiscountObject() {
1827
          return (this.discount != null) ? this.discount.getExpanded() : null;
×
1828
        }
1829

1830
        public void setDiscountObject(com.stripe.model.Discount expandableObject) {
1831
          this.discount =
×
1832
              new ExpandableField<com.stripe.model.Discount>(
1833
                  expandableObject.getId(), expandableObject);
×
1834
        }
×
1835

1836
        /** Get ID of expandable {@code promotionCode} object. */
1837
        public String getPromotionCode() {
1838
          return (this.promotionCode != null) ? this.promotionCode.getId() : null;
×
1839
        }
1840

1841
        public void setPromotionCode(String id) {
1842
          this.promotionCode = ApiResource.setExpandableFieldId(id, this.promotionCode);
×
1843
        }
×
1844

1845
        /** Get expanded {@code promotionCode}. */
1846
        public PromotionCode getPromotionCodeObject() {
1847
          return (this.promotionCode != null) ? this.promotionCode.getExpanded() : null;
×
1848
        }
1849

1850
        public void setPromotionCodeObject(PromotionCode expandableObject) {
1851
          this.promotionCode =
×
1852
              new ExpandableField<PromotionCode>(expandableObject.getId(), expandableObject);
×
1853
        }
×
1854

1855
        @Getter
1856
        @Setter
1857
        @EqualsAndHashCode(callSuper = false)
1858
        public static class DiscountEnd extends StripeObject {
×
1859
          /** The discount end timestamp. */
1860
          @SerializedName("timestamp")
1861
          Long timestamp;
1862

1863
          /**
1864
           * The discount end type.
1865
           *
1866
           * <p>Equal to {@code timestamp}.
1867
           */
1868
          @SerializedName("type")
1869
          String type;
1870
        }
1871
      }
1872

1873
      @Getter
1874
      @Setter
1875
      @EqualsAndHashCode(callSuper = false)
1876
      public static class Trial extends StripeObject {
×
1877
        /**
1878
         * List of price IDs which, if present on the subscription following a paid trial,
1879
         * constitute opting-in to the paid trial.
1880
         */
1881
        @SerializedName("converts_to")
1882
        List<String> convertsTo;
1883

1884
        /**
1885
         * Determines the type of trial for this item.
1886
         *
1887
         * <p>One of {@code free}, or {@code paid}.
1888
         */
1889
        @SerializedName("type")
1890
        String type;
1891
      }
1892
    }
1893

1894
    /**
1895
     * The Pause Collection settings specify how to pause collection for a subscription during a
1896
     * phase by modifying the behavior of the invoices that are generated during the paused period.
1897
     */
1898
    @Getter
1899
    @Setter
1900
    @EqualsAndHashCode(callSuper = false)
1901
    public static class PauseCollection extends StripeObject {
×
1902
      /**
1903
       * The payment collection behavior for this subscription while paused. One of {@code
1904
       * keep_as_draft}, {@code mark_uncollectible}, or {@code void}.
1905
       */
1906
      @SerializedName("behavior")
1907
      String behavior;
1908
    }
1909

1910
    @Getter
1911
    @Setter
1912
    @EqualsAndHashCode(callSuper = false)
1913
    public static class TransferData extends StripeObject {
×
1914
      /**
1915
       * A non-negative decimal between 0 and 100, with at most two decimal places. This represents
1916
       * the percentage of the subscription invoice total that will be transferred to the
1917
       * destination account. By default, the entire amount is transferred to the destination.
1918
       */
1919
      @SerializedName("amount_percent")
1920
      BigDecimal amountPercent;
1921

1922
      /** The account where funds from the payment will be transferred to upon payment success. */
1923
      @SerializedName("destination")
1924
      @Getter(lombok.AccessLevel.NONE)
1925
      @Setter(lombok.AccessLevel.NONE)
1926
      ExpandableField<Account> destination;
1927

1928
      /** Get ID of expandable {@code destination} object. */
1929
      public String getDestination() {
1930
        return (this.destination != null) ? this.destination.getId() : null;
×
1931
      }
1932

1933
      public void setDestination(String id) {
1934
        this.destination = ApiResource.setExpandableFieldId(id, this.destination);
×
1935
      }
×
1936

1937
      /** Get expanded {@code destination}. */
1938
      public Account getDestinationObject() {
1939
        return (this.destination != null) ? this.destination.getExpanded() : null;
×
1940
      }
1941

1942
      public void setDestinationObject(Account expandableObject) {
1943
        this.destination = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
1944
      }
×
1945
    }
1946

1947
    /** Configures how the scheduled subscription behaves during the trial period. */
1948
    @Getter
1949
    @Setter
1950
    @EqualsAndHashCode(callSuper = false)
1951
    public static class TrialSettings extends StripeObject {
×
1952
      /** Defines how the subscription should behave when a trial ends. */
1953
      @SerializedName("end_behavior")
1954
      EndBehavior endBehavior;
1955

1956
      /** Defines how the scheduled subscription behaves when a trial ends. */
1957
      @Getter
1958
      @Setter
1959
      @EqualsAndHashCode(callSuper = false)
1960
      public static class EndBehavior extends StripeObject {
×
1961
        /**
1962
         * Configure how an opt-in following a paid trial is billed when using {@code
1963
         * billing_behavior: prorate_up_front}.
1964
         *
1965
         * <p>One of {@code defer}, or {@code include}.
1966
         */
1967
        @SerializedName("prorate_up_front")
1968
        String prorateUpFront;
1969
      }
1970
    }
1971
  }
1972

1973
  /** Prebilling stores the time period and invoice for a Subscription billed in advance. */
1974
  @Getter
1975
  @Setter
1976
  @EqualsAndHashCode(callSuper = false)
1977
  public static class Prebilling extends StripeObject {
×
1978
    /** ID of the prebilling invoice. */
1979
    @SerializedName("invoice")
1980
    @Getter(lombok.AccessLevel.NONE)
1981
    @Setter(lombok.AccessLevel.NONE)
1982
    ExpandableField<Invoice> invoice;
1983

1984
    /** The end of the last period for which the invoice pre-bills. */
1985
    @SerializedName("period_end")
1986
    Long periodEnd;
1987

1988
    /** The start of the first period for which the invoice pre-bills. */
1989
    @SerializedName("period_start")
1990
    Long periodStart;
1991

1992
    /**
1993
     * Whether to cancel or preserve {@code prebilling} if the subscription is updated during the
1994
     * prebilled period.
1995
     *
1996
     * <p>One of {@code prebill}, or {@code reset}.
1997
     */
1998
    @SerializedName("update_behavior")
1999
    String updateBehavior;
2000

2001
    /** Get ID of expandable {@code invoice} object. */
2002
    public String getInvoice() {
2003
      return (this.invoice != null) ? this.invoice.getId() : null;
×
2004
    }
2005

2006
    public void setInvoice(String id) {
2007
      this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
2008
    }
×
2009

2010
    /** Get expanded {@code invoice}. */
2011
    public Invoice getInvoiceObject() {
2012
      return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
2013
    }
2014

2015
    public void setInvoiceObject(Invoice expandableObject) {
2016
      this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
2017
    }
×
2018
  }
2019

2020
  @Override
2021
  public void setResponseGetter(StripeResponseGetter responseGetter) {
2022
    super.setResponseGetter(responseGetter);
1✔
2023
    trySetResponseGetter(application, responseGetter);
1✔
2024
    trySetResponseGetter(currentPhase, responseGetter);
1✔
2025
    trySetResponseGetter(customer, responseGetter);
1✔
2026
    trySetResponseGetter(defaultSettings, responseGetter);
1✔
2027
    trySetResponseGetter(lastPriceMigrationError, responseGetter);
1✔
2028
    trySetResponseGetter(prebilling, responseGetter);
1✔
2029
    trySetResponseGetter(subscription, responseGetter);
1✔
2030
    trySetResponseGetter(testClock, responseGetter);
1✔
2031
  }
1✔
2032
}
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

© 2026 Coveralls, Inc