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

stripe / stripe-java / #16562

18 Oct 2024 07:00PM UTC coverage: 12.614% (-0.1%) from 12.74%
#16562

push

github

web-flow
Merge pull request #1897 from stripe/latest-codegen-beta

Update generated code for beta

49 of 1978 new or added lines in 47 files covered. (2.48%)

68 existing lines in 20 files now uncovered.

18798 of 149026 relevant lines covered (12.61%)

0.13 hits per line

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

63.01
/src/main/java/com/stripe/model/billingportal/Configuration.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.billingportal;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.Application;
7
import com.stripe.model.ExpandableField;
8
import com.stripe.model.HasId;
9
import com.stripe.model.MetadataStore;
10
import com.stripe.model.StripeObject;
11
import com.stripe.net.ApiRequest;
12
import com.stripe.net.ApiRequestParams;
13
import com.stripe.net.ApiResource;
14
import com.stripe.net.BaseAddress;
15
import com.stripe.net.RequestOptions;
16
import com.stripe.net.StripeResponseGetter;
17
import com.stripe.param.billingportal.ConfigurationCreateParams;
18
import com.stripe.param.billingportal.ConfigurationListParams;
19
import com.stripe.param.billingportal.ConfigurationRetrieveParams;
20
import com.stripe.param.billingportal.ConfigurationUpdateParams;
21
import java.util.List;
22
import java.util.Map;
23
import lombok.EqualsAndHashCode;
24
import lombok.Getter;
25
import lombok.Setter;
26

27
/** A portal configuration describes the functionality and behavior of a portal session. */
28
@Getter
29
@Setter
30
@EqualsAndHashCode(callSuper = false)
31
public class Configuration extends ApiResource implements HasId, MetadataStore<Configuration> {
1✔
32
  /** Whether the configuration is active and can be used to create portal sessions. */
33
  @SerializedName("active")
34
  Boolean active;
35

36
  /** ID of the Connect Application that created the configuration. */
37
  @SerializedName("application")
38
  @Getter(lombok.AccessLevel.NONE)
39
  @Setter(lombok.AccessLevel.NONE)
40
  ExpandableField<Application> application;
41

42
  @SerializedName("business_profile")
43
  BusinessProfile businessProfile;
44

45
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
46
  @SerializedName("created")
47
  Long created;
48

49
  /**
50
   * The default URL to redirect customers to when they click on the portal's link to return to your
51
   * website. This can be <a
52
   * href="https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url">overriden</a>
53
   * when creating the session.
54
   */
55
  @SerializedName("default_return_url")
56
  String defaultReturnUrl;
57

58
  @SerializedName("features")
59
  Features features;
60

61
  /** Unique identifier for the object. */
62
  @Getter(onMethod_ = {@Override})
63
  @SerializedName("id")
64
  String id;
65

66
  /**
67
   * Whether the configuration is the default. If {@code true}, this configuration can be managed in
68
   * the Dashboard and portal sessions will use this configuration unless it is overriden when
69
   * creating the session.
70
   */
71
  @SerializedName("is_default")
72
  Boolean isDefault;
73

74
  /**
75
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
76
   * object exists in test mode.
77
   */
78
  @SerializedName("livemode")
79
  Boolean livemode;
80

81
  @SerializedName("login_page")
82
  LoginPage loginPage;
83

84
  /**
85
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
86
   * to an object. This can be useful for storing additional information about the object in a
87
   * structured format.
88
   */
89
  @Getter(onMethod_ = {@Override})
90
  @SerializedName("metadata")
91
  Map<String, String> metadata;
92

93
  /**
94
   * String representing the object's type. Objects of the same type share the same value.
95
   *
96
   * <p>Equal to {@code billing_portal.configuration}.
97
   */
98
  @SerializedName("object")
99
  String object;
100

101
  /** Time at which the object was last updated. Measured in seconds since the Unix epoch. */
102
  @SerializedName("updated")
103
  Long updated;
104

105
  /** Get ID of expandable {@code application} object. */
106
  public String getApplication() {
107
    return (this.application != null) ? this.application.getId() : null;
×
108
  }
109

110
  public void setApplication(String id) {
111
    this.application = ApiResource.setExpandableFieldId(id, this.application);
×
112
  }
×
113

114
  /** Get expanded {@code application}. */
115
  public Application getApplicationObject() {
116
    return (this.application != null) ? this.application.getExpanded() : null;
×
117
  }
118

119
  public void setApplicationObject(Application expandableObject) {
120
    this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
×
121
  }
×
122

123
  /** Creates a configuration that describes the functionality and behavior of a PortalSession. */
124
  public static Configuration create(Map<String, Object> params) throws StripeException {
125
    return create(params, (RequestOptions) null);
×
126
  }
127

128
  /** Creates a configuration that describes the functionality and behavior of a PortalSession. */
129
  public static Configuration create(Map<String, Object> params, RequestOptions options)
130
      throws StripeException {
131
    String path = "/v1/billing_portal/configurations";
×
132
    ApiRequest request =
×
133
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
134
    return getGlobalResponseGetter().request(request, Configuration.class);
×
135
  }
136

137
  /** Creates a configuration that describes the functionality and behavior of a PortalSession. */
138
  public static Configuration create(ConfigurationCreateParams params) throws StripeException {
139
    return create(params, (RequestOptions) null);
1✔
140
  }
141

142
  /** Creates a configuration that describes the functionality and behavior of a PortalSession. */
143
  public static Configuration create(ConfigurationCreateParams params, RequestOptions options)
144
      throws StripeException {
145
    String path = "/v1/billing_portal/configurations";
1✔
146
    ApiResource.checkNullTypedParams(path, params);
1✔
147
    ApiRequest request =
1✔
148
        new ApiRequest(
149
            BaseAddress.API,
150
            ApiResource.RequestMethod.POST,
151
            path,
152
            ApiRequestParams.paramsToMap(params),
1✔
153
            options);
154
    return getGlobalResponseGetter().request(request, Configuration.class);
1✔
155
  }
156

157
  /** Returns a list of configurations that describe the functionality of the customer portal. */
158
  public static ConfigurationCollection list(Map<String, Object> params) throws StripeException {
159
    return list(params, (RequestOptions) null);
1✔
160
  }
161

162
  /** Returns a list of configurations that describe the functionality of the customer portal. */
163
  public static ConfigurationCollection list(Map<String, Object> params, RequestOptions options)
164
      throws StripeException {
165
    String path = "/v1/billing_portal/configurations";
1✔
166
    ApiRequest request =
1✔
167
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
168
    return getGlobalResponseGetter().request(request, ConfigurationCollection.class);
1✔
169
  }
170

171
  /** Returns a list of configurations that describe the functionality of the customer portal. */
172
  public static ConfigurationCollection list(ConfigurationListParams params)
173
      throws StripeException {
174
    return list(params, (RequestOptions) null);
1✔
175
  }
176

177
  /** Returns a list of configurations that describe the functionality of the customer portal. */
178
  public static ConfigurationCollection list(ConfigurationListParams params, RequestOptions options)
179
      throws StripeException {
180
    String path = "/v1/billing_portal/configurations";
1✔
181
    ApiResource.checkNullTypedParams(path, params);
1✔
182
    ApiRequest request =
1✔
183
        new ApiRequest(
184
            BaseAddress.API,
185
            ApiResource.RequestMethod.GET,
186
            path,
187
            ApiRequestParams.paramsToMap(params),
1✔
188
            options);
189
    return getGlobalResponseGetter().request(request, ConfigurationCollection.class);
1✔
190
  }
191

192
  /** Retrieves a configuration that describes the functionality of the customer portal. */
193
  public static Configuration retrieve(String configuration) throws StripeException {
194
    return retrieve(configuration, (Map<String, Object>) null, (RequestOptions) null);
1✔
195
  }
196

197
  /** Retrieves a configuration that describes the functionality of the customer portal. */
198
  public static Configuration retrieve(String configuration, RequestOptions options)
199
      throws StripeException {
200
    return retrieve(configuration, (Map<String, Object>) null, options);
×
201
  }
202

203
  /** Retrieves a configuration that describes the functionality of the customer portal. */
204
  public static Configuration retrieve(
205
      String configuration, Map<String, Object> params, RequestOptions options)
206
      throws StripeException {
207
    String path =
1✔
208
        String.format(
1✔
209
            "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(configuration));
1✔
210
    ApiRequest request =
1✔
211
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
212
    return getGlobalResponseGetter().request(request, Configuration.class);
1✔
213
  }
214

215
  /** Retrieves a configuration that describes the functionality of the customer portal. */
216
  public static Configuration retrieve(
217
      String configuration, ConfigurationRetrieveParams params, RequestOptions options)
218
      throws StripeException {
219
    String path =
×
220
        String.format(
×
221
            "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(configuration));
×
222
    ApiResource.checkNullTypedParams(path, params);
×
223
    ApiRequest request =
×
224
        new ApiRequest(
225
            BaseAddress.API,
226
            ApiResource.RequestMethod.GET,
227
            path,
228
            ApiRequestParams.paramsToMap(params),
×
229
            options);
230
    return getGlobalResponseGetter().request(request, Configuration.class);
×
231
  }
232

233
  /** Updates a configuration that describes the functionality of the customer portal. */
234
  @Override
235
  public Configuration update(Map<String, Object> params) throws StripeException {
236
    return update(params, (RequestOptions) null);
×
237
  }
238

239
  /** Updates a configuration that describes the functionality of the customer portal. */
240
  @Override
241
  public Configuration update(Map<String, Object> params, RequestOptions options)
242
      throws StripeException {
243
    String path =
×
244
        String.format(
×
245
            "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()));
×
246
    ApiRequest request =
×
247
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
248
    return getResponseGetter().request(request, Configuration.class);
×
249
  }
250

251
  /** Updates a configuration that describes the functionality of the customer portal. */
252
  public Configuration update(ConfigurationUpdateParams params) throws StripeException {
253
    return update(params, (RequestOptions) null);
1✔
254
  }
255

256
  /** Updates a configuration that describes the functionality of the customer portal. */
257
  public Configuration update(ConfigurationUpdateParams params, RequestOptions options)
258
      throws StripeException {
259
    String path =
1✔
260
        String.format(
1✔
261
            "/v1/billing_portal/configurations/%s", ApiResource.urlEncodeId(this.getId()));
1✔
262
    ApiResource.checkNullTypedParams(path, params);
1✔
263
    ApiRequest request =
1✔
264
        new ApiRequest(
265
            BaseAddress.API,
266
            ApiResource.RequestMethod.POST,
267
            path,
268
            ApiRequestParams.paramsToMap(params),
1✔
269
            options);
270
    return getResponseGetter().request(request, Configuration.class);
1✔
271
  }
272

273
  /**
274
   * For more details about BusinessProfile, please refer to the <a
275
   * href="https://docs.stripe.com/api">API Reference.</a>
276
   */
277
  @Getter
278
  @Setter
279
  @EqualsAndHashCode(callSuper = false)
280
  public static class BusinessProfile extends StripeObject {
1✔
281
    /** The messaging shown to customers in the portal. */
282
    @SerializedName("headline")
283
    String headline;
284

285
    /** A link to the business’s publicly available privacy policy. */
286
    @SerializedName("privacy_policy_url")
287
    String privacyPolicyUrl;
288

289
    /** A link to the business’s publicly available terms of service. */
290
    @SerializedName("terms_of_service_url")
291
    String termsOfServiceUrl;
292
  }
293

294
  /**
295
   * For more details about Features, please refer to the <a href="https://docs.stripe.com/api">API
296
   * Reference.</a>
297
   */
298
  @Getter
299
  @Setter
300
  @EqualsAndHashCode(callSuper = false)
301
  public static class Features extends StripeObject {
1✔
302
    @SerializedName("customer_update")
303
    CustomerUpdate customerUpdate;
304

305
    @SerializedName("invoice_history")
306
    InvoiceHistory invoiceHistory;
307

308
    @SerializedName("payment_method_update")
309
    PaymentMethodUpdate paymentMethodUpdate;
310

311
    @SerializedName("subscription_cancel")
312
    SubscriptionCancel subscriptionCancel;
313

314
    @SerializedName("subscription_update")
315
    SubscriptionUpdate subscriptionUpdate;
316

317
    /**
318
     * For more details about CustomerUpdate, please refer to the <a
319
     * href="https://docs.stripe.com/api">API Reference.</a>
320
     */
321
    @Getter
322
    @Setter
323
    @EqualsAndHashCode(callSuper = false)
324
    public static class CustomerUpdate extends StripeObject {
1✔
325
      /**
326
       * The types of customer updates that are supported. When empty, customers are not updateable.
327
       */
328
      @SerializedName("allowed_updates")
329
      List<String> allowedUpdates;
330

331
      /** Whether the feature is enabled. */
332
      @SerializedName("enabled")
333
      Boolean enabled;
334
    }
335

336
    /**
337
     * For more details about InvoiceHistory, please refer to the <a
338
     * href="https://docs.stripe.com/api">API Reference.</a>
339
     */
340
    @Getter
341
    @Setter
342
    @EqualsAndHashCode(callSuper = false)
343
    public static class InvoiceHistory extends StripeObject {
1✔
344
      /** Whether the feature is enabled. */
345
      @SerializedName("enabled")
346
      Boolean enabled;
347
    }
348

349
    /**
350
     * For more details about PaymentMethodUpdate, please refer to the <a
351
     * href="https://docs.stripe.com/api">API Reference.</a>
352
     */
353
    @Getter
354
    @Setter
355
    @EqualsAndHashCode(callSuper = false)
356
    public static class PaymentMethodUpdate extends StripeObject {
1✔
357
      /** Whether the feature is enabled. */
358
      @SerializedName("enabled")
359
      Boolean enabled;
360
    }
361

362
    /**
363
     * For more details about SubscriptionCancel, please refer to the <a
364
     * href="https://docs.stripe.com/api">API Reference.</a>
365
     */
366
    @Getter
367
    @Setter
368
    @EqualsAndHashCode(callSuper = false)
369
    public static class SubscriptionCancel extends StripeObject {
1✔
370
      @SerializedName("cancellation_reason")
371
      CancellationReason cancellationReason;
372

373
      /** Whether the feature is enabled. */
374
      @SerializedName("enabled")
375
      Boolean enabled;
376

377
      /**
378
       * Whether to cancel subscriptions immediately or at the end of the billing period.
379
       *
380
       * <p>One of {@code at_period_end}, or {@code immediately}.
381
       */
382
      @SerializedName("mode")
383
      String mode;
384

385
      /**
386
       * Whether to create prorations when canceling subscriptions. Possible values are {@code none}
387
       * and {@code create_prorations}.
388
       *
389
       * <p>One of {@code always_invoice}, {@code create_prorations}, or {@code none}.
390
       */
391
      @SerializedName("proration_behavior")
392
      String prorationBehavior;
393

394
      /**
395
       * For more details about CancellationReason, please refer to the <a
396
       * href="https://docs.stripe.com/api">API Reference.</a>
397
       */
398
      @Getter
399
      @Setter
400
      @EqualsAndHashCode(callSuper = false)
401
      public static class CancellationReason extends StripeObject {
1✔
402
        /** Whether the feature is enabled. */
403
        @SerializedName("enabled")
404
        Boolean enabled;
405

406
        /** Which cancellation reasons will be given as options to the customer. */
407
        @SerializedName("options")
408
        List<String> options;
409
      }
410
    }
411

412
    /**
413
     * For more details about SubscriptionUpdate, please refer to the <a
414
     * href="https://docs.stripe.com/api">API Reference.</a>
415
     */
416
    @Getter
417
    @Setter
418
    @EqualsAndHashCode(callSuper = false)
419
    public static class SubscriptionUpdate extends StripeObject {
1✔
420
      /**
421
       * The types of subscription updates that are supported for items listed in the {@code
422
       * products} attribute. When empty, subscriptions are not updateable.
423
       */
424
      @SerializedName("default_allowed_updates")
425
      List<String> defaultAllowedUpdates;
426

427
      /** Whether the feature is enabled. */
428
      @SerializedName("enabled")
429
      Boolean enabled;
430

431
      /** The list of up to 10 products that support subscription updates. */
432
      @SerializedName("products")
433
      List<Configuration.Features.SubscriptionUpdate.Product> products;
434

435
      /**
436
       * Determines how to handle prorations resulting from subscription updates. Valid values are
437
       * {@code none}, {@code create_prorations}, and {@code always_invoice}. Defaults to a value of
438
       * {@code none} if you don't set it during creation.
439
       *
440
       * <p>One of {@code always_invoice}, {@code create_prorations}, or {@code none}.
441
       */
442
      @SerializedName("proration_behavior")
443
      String prorationBehavior;
444

445
      @SerializedName("schedule_at_period_end")
446
      ScheduleAtPeriodEnd scheduleAtPeriodEnd;
447

448
      /**
449
       * For more details about Product, please refer to the <a
450
       * href="https://docs.stripe.com/api">API Reference.</a>
451
       */
452
      @Getter
453
      @Setter
454
      @EqualsAndHashCode(callSuper = false)
455
      public static class Product extends StripeObject {
×
456
        /** The list of price IDs which, when subscribed to, a subscription can be updated. */
457
        @SerializedName("prices")
458
        List<String> prices;
459

460
        /** The product ID. */
461
        @SerializedName("product")
462
        String product;
463
      }
464

465
      /**
466
       * For more details about ScheduleAtPeriodEnd, please refer to the <a
467
       * href="https://docs.stripe.com/api">API Reference.</a>
468
       */
469
      @Getter
470
      @Setter
471
      @EqualsAndHashCode(callSuper = false)
NEW
472
      public static class ScheduleAtPeriodEnd extends StripeObject {
×
473
        /**
474
         * List of conditions. When any condition is true, an update will be scheduled at the end of
475
         * the current period.
476
         */
477
        @SerializedName("conditions")
478
        List<Configuration.Features.SubscriptionUpdate.ScheduleAtPeriodEnd.Condition> conditions;
479

480
        /**
481
         * For more details about Condition, please refer to the <a
482
         * href="https://docs.stripe.com/api">API Reference.</a>
483
         */
484
        @Getter
485
        @Setter
486
        @EqualsAndHashCode(callSuper = false)
NEW
487
        public static class Condition extends StripeObject {
×
488
          /**
489
           * The type of condition.
490
           *
491
           * <p>One of {@code decreasing_item_amount}, or {@code shortening_interval}.
492
           */
493
          @SerializedName("type")
494
          String type;
495
        }
496
      }
497
    }
498
  }
499

500
  /**
501
   * For more details about LoginPage, please refer to the <a href="https://docs.stripe.com/api">API
502
   * Reference.</a>
503
   */
504
  @Getter
505
  @Setter
506
  @EqualsAndHashCode(callSuper = false)
507
  public static class LoginPage extends StripeObject {
1✔
508
    /**
509
     * If {@code true}, a shareable {@code url} will be generated that will take your customers to a
510
     * hosted login page for the customer portal.
511
     *
512
     * <p>If {@code false}, the previously generated {@code url}, if any, will be deactivated.
513
     */
514
    @SerializedName("enabled")
515
    Boolean enabled;
516

517
    /**
518
     * A shareable URL to the hosted portal login page. Your customers will be able to log in with
519
     * their <a href="https://stripe.com/docs/api/customers/object#customer_object-email">email</a>
520
     * and receive a link to their customer portal.
521
     */
522
    @SerializedName("url")
523
    String url;
524
  }
525

526
  @Override
527
  public void setResponseGetter(StripeResponseGetter responseGetter) {
528
    super.setResponseGetter(responseGetter);
1✔
529
    trySetResponseGetter(application, responseGetter);
1✔
530
    trySetResponseGetter(businessProfile, responseGetter);
1✔
531
    trySetResponseGetter(features, responseGetter);
1✔
532
    trySetResponseGetter(loginPage, responseGetter);
1✔
533
  }
1✔
534
}
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