• 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

64.38
/src/main/java/com/stripe/model/issuing/Cardholder.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.issuing;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.Address;
7
import com.stripe.model.ExpandableField;
8
import com.stripe.model.File;
9
import com.stripe.model.HasId;
10
import com.stripe.model.MetadataStore;
11
import com.stripe.model.StripeObject;
12
import com.stripe.net.ApiRequest;
13
import com.stripe.net.ApiRequestParams;
14
import com.stripe.net.ApiResource;
15
import com.stripe.net.BaseAddress;
16
import com.stripe.net.RequestOptions;
17
import com.stripe.net.StripeResponseGetter;
18
import com.stripe.param.issuing.CardholderCreateParams;
19
import com.stripe.param.issuing.CardholderListParams;
20
import com.stripe.param.issuing.CardholderRetrieveParams;
21
import com.stripe.param.issuing.CardholderUpdateParams;
22
import java.util.List;
23
import java.util.Map;
24
import lombok.EqualsAndHashCode;
25
import lombok.Getter;
26
import lombok.Setter;
27

28
/**
29
 * An Issuing {@code Cardholder} object represents an individual or business entity who is <a
30
 * href="https://stripe.com/docs/issuing">issued</a> cards.
31
 *
32
 * <p>Related guide: <a href="https://stripe.com/docs/issuing/cards#create-cardholder">How to create
33
 * a cardholder</a>
34
 */
35
@Getter
36
@Setter
37
@EqualsAndHashCode(callSuper = false)
38
public class Cardholder extends ApiResource implements HasId, MetadataStore<Cardholder> {
1✔
39
  @SerializedName("billing")
40
  Billing billing;
41

42
  /** Additional information about a {@code company} cardholder. */
43
  @SerializedName("company")
44
  Company company;
45

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

50
  /** The cardholder's email address. */
51
  @SerializedName("email")
52
  String email;
53

54
  /** Unique identifier for the object. */
55
  @Getter(onMethod_ = {@Override})
56
  @SerializedName("id")
57
  String id;
58

59
  /** Additional information about an {@code individual} cardholder. */
60
  @SerializedName("individual")
61
  Individual individual;
62

63
  /**
64
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
65
   * object exists in test mode.
66
   */
67
  @SerializedName("livemode")
68
  Boolean livemode;
69

70
  /**
71
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
72
   * to an object. This can be useful for storing additional information about the object in a
73
   * structured format.
74
   */
75
  @Getter(onMethod_ = {@Override})
76
  @SerializedName("metadata")
77
  Map<String, String> metadata;
78

79
  /** The cardholder's name. This will be printed on cards issued to them. */
80
  @SerializedName("name")
81
  String name;
82

83
  /**
84
   * String representing the object's type. Objects of the same type share the same value.
85
   *
86
   * <p>Equal to {@code issuing.cardholder}.
87
   */
88
  @SerializedName("object")
89
  String object;
90

91
  /**
92
   * The cardholder's phone number. This is required for all cardholders who will be creating EU
93
   * cards. See the <a href="https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied">3D
94
   * Secure documentation</a> for more details.
95
   */
96
  @SerializedName("phone_number")
97
  String phoneNumber;
98

99
  /**
100
   * The cardholder’s preferred locales (languages), ordered by preference. Locales can be {@code
101
   * de}, {@code en}, {@code es}, {@code fr}, or {@code it}. This changes the language of the <a
102
   * href="https://stripe.com/docs/issuing/3d-secure">3D Secure flow</a> and one-time password
103
   * messages sent to the cardholder.
104
   */
105
  @SerializedName("preferred_locales")
106
  List<String> preferredLocales;
107

108
  @SerializedName("requirements")
109
  Requirements requirements;
110

111
  /**
112
   * Rules that control spending across this cardholder's cards. Refer to our <a
113
   * href="https://stripe.com/docs/issuing/controls/spending-controls">documentation</a> for more
114
   * details.
115
   */
116
  @SerializedName("spending_controls")
117
  SpendingControls spendingControls;
118

119
  /**
120
   * Specifies whether to permit authorizations on this cardholder's cards.
121
   *
122
   * <p>One of {@code active}, {@code blocked}, or {@code inactive}.
123
   */
124
  @SerializedName("status")
125
  String status;
126

127
  /**
128
   * One of {@code individual} or {@code company}. See <a
129
   * href="https://stripe.com/docs/issuing/other/choose-cardholder">Choose a cardholder type</a> for
130
   * more details.
131
   */
132
  @SerializedName("type")
133
  String type;
134

135
  /** Creates a new Issuing {@code Cardholder} object that can be issued cards. */
136
  public static Cardholder create(Map<String, Object> params) throws StripeException {
137
    return create(params, (RequestOptions) null);
1✔
138
  }
139

140
  /** Creates a new Issuing {@code Cardholder} object that can be issued cards. */
141
  public static Cardholder create(Map<String, Object> params, RequestOptions options)
142
      throws StripeException {
143
    String path = "/v1/issuing/cardholders";
1✔
144
    ApiRequest request =
1✔
145
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
146
    return getGlobalResponseGetter().request(request, Cardholder.class);
1✔
147
  }
148

149
  /** Creates a new Issuing {@code Cardholder} object that can be issued cards. */
150
  public static Cardholder create(CardholderCreateParams params) throws StripeException {
151
    return create(params, (RequestOptions) null);
1✔
152
  }
153

154
  /** Creates a new Issuing {@code Cardholder} object that can be issued cards. */
155
  public static Cardholder create(CardholderCreateParams params, RequestOptions options)
156
      throws StripeException {
157
    String path = "/v1/issuing/cardholders";
1✔
158
    ApiResource.checkNullTypedParams(path, params);
1✔
159
    ApiRequest request =
1✔
160
        new ApiRequest(
161
            BaseAddress.API,
162
            ApiResource.RequestMethod.POST,
163
            path,
164
            ApiRequestParams.paramsToMap(params),
1✔
165
            options);
166
    return getGlobalResponseGetter().request(request, Cardholder.class);
1✔
167
  }
168

169
  /**
170
   * Returns a list of Issuing {@code Cardholder} objects. The objects are sorted in descending
171
   * order by creation date, with the most recently created object appearing first.
172
   */
173
  public static CardholderCollection list(Map<String, Object> params) throws StripeException {
174
    return list(params, (RequestOptions) null);
1✔
175
  }
176

177
  /**
178
   * Returns a list of Issuing {@code Cardholder} objects. The objects are sorted in descending
179
   * order by creation date, with the most recently created object appearing first.
180
   */
181
  public static CardholderCollection list(Map<String, Object> params, RequestOptions options)
182
      throws StripeException {
183
    String path = "/v1/issuing/cardholders";
1✔
184
    ApiRequest request =
1✔
185
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
186
    return getGlobalResponseGetter().request(request, CardholderCollection.class);
1✔
187
  }
188

189
  /**
190
   * Returns a list of Issuing {@code Cardholder} objects. The objects are sorted in descending
191
   * order by creation date, with the most recently created object appearing first.
192
   */
193
  public static CardholderCollection list(CardholderListParams params) throws StripeException {
194
    return list(params, (RequestOptions) null);
1✔
195
  }
196

197
  /**
198
   * Returns a list of Issuing {@code Cardholder} objects. The objects are sorted in descending
199
   * order by creation date, with the most recently created object appearing first.
200
   */
201
  public static CardholderCollection list(CardholderListParams params, RequestOptions options)
202
      throws StripeException {
203
    String path = "/v1/issuing/cardholders";
1✔
204
    ApiResource.checkNullTypedParams(path, params);
1✔
205
    ApiRequest request =
1✔
206
        new ApiRequest(
207
            BaseAddress.API,
208
            ApiResource.RequestMethod.GET,
209
            path,
210
            ApiRequestParams.paramsToMap(params),
1✔
211
            options);
212
    return getGlobalResponseGetter().request(request, CardholderCollection.class);
1✔
213
  }
214

215
  /** Retrieves an Issuing {@code Cardholder} object. */
216
  public static Cardholder retrieve(String cardholder) throws StripeException {
217
    return retrieve(cardholder, (Map<String, Object>) null, (RequestOptions) null);
1✔
218
  }
219

220
  /** Retrieves an Issuing {@code Cardholder} object. */
221
  public static Cardholder retrieve(String cardholder, RequestOptions options)
222
      throws StripeException {
223
    return retrieve(cardholder, (Map<String, Object>) null, options);
×
224
  }
225

226
  /** Retrieves an Issuing {@code Cardholder} object. */
227
  public static Cardholder retrieve(
228
      String cardholder, Map<String, Object> params, RequestOptions options)
229
      throws StripeException {
230
    String path = String.format("/v1/issuing/cardholders/%s", ApiResource.urlEncodeId(cardholder));
1✔
231
    ApiRequest request =
1✔
232
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
233
    return getGlobalResponseGetter().request(request, Cardholder.class);
1✔
234
  }
235

236
  /** Retrieves an Issuing {@code Cardholder} object. */
237
  public static Cardholder retrieve(
238
      String cardholder, CardholderRetrieveParams params, RequestOptions options)
239
      throws StripeException {
240
    String path = String.format("/v1/issuing/cardholders/%s", ApiResource.urlEncodeId(cardholder));
×
241
    ApiResource.checkNullTypedParams(path, params);
×
242
    ApiRequest request =
×
243
        new ApiRequest(
244
            BaseAddress.API,
245
            ApiResource.RequestMethod.GET,
246
            path,
247
            ApiRequestParams.paramsToMap(params),
×
248
            options);
UNCOV
249
    return getGlobalResponseGetter().request(request, Cardholder.class);
×
250
  }
251

252
  /**
253
   * Updates the specified Issuing {@code Cardholder} object by setting the values of the parameters
254
   * passed. Any parameters not provided will be left unchanged.
255
   */
256
  @Override
257
  public Cardholder update(Map<String, Object> params) throws StripeException {
258
    return update(params, (RequestOptions) null);
1✔
259
  }
260

261
  /**
262
   * Updates the specified Issuing {@code Cardholder} object by setting the values of the parameters
263
   * passed. Any parameters not provided will be left unchanged.
264
   */
265
  @Override
266
  public Cardholder update(Map<String, Object> params, RequestOptions options)
267
      throws StripeException {
268
    String path =
1✔
269
        String.format("/v1/issuing/cardholders/%s", ApiResource.urlEncodeId(this.getId()));
1✔
270
    ApiRequest request =
1✔
271
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
272
    return getResponseGetter().request(request, Cardholder.class);
1✔
273
  }
274

275
  /**
276
   * Updates the specified Issuing {@code Cardholder} object by setting the values of the parameters
277
   * passed. Any parameters not provided will be left unchanged.
278
   */
279
  public Cardholder update(CardholderUpdateParams params) throws StripeException {
280
    return update(params, (RequestOptions) null);
1✔
281
  }
282

283
  /**
284
   * Updates the specified Issuing {@code Cardholder} object by setting the values of the parameters
285
   * passed. Any parameters not provided will be left unchanged.
286
   */
287
  public Cardholder update(CardholderUpdateParams params, RequestOptions options)
288
      throws StripeException {
289
    String path =
1✔
290
        String.format("/v1/issuing/cardholders/%s", ApiResource.urlEncodeId(this.getId()));
1✔
291
    ApiResource.checkNullTypedParams(path, params);
1✔
292
    ApiRequest request =
1✔
293
        new ApiRequest(
294
            BaseAddress.API,
295
            ApiResource.RequestMethod.POST,
296
            path,
297
            ApiRequestParams.paramsToMap(params),
1✔
298
            options);
299
    return getResponseGetter().request(request, Cardholder.class);
1✔
300
  }
301

302
  @Getter
303
  @Setter
304
  @EqualsAndHashCode(callSuper = false)
305
  public static class Billing extends StripeObject {
1✔
306
    @SerializedName("address")
307
    Address address;
308
  }
309

310
  @Getter
311
  @Setter
312
  @EqualsAndHashCode(callSuper = false)
313
  public static class Company extends StripeObject {
×
314
    /** Whether the company's business ID number was provided. */
315
    @SerializedName("tax_id_provided")
316
    Boolean taxIdProvided;
317
  }
318

319
  @Getter
320
  @Setter
321
  @EqualsAndHashCode(callSuper = false)
322
  public static class Individual extends StripeObject {
×
323
    /** Information related to the card_issuing program for this cardholder. */
324
    @SerializedName("card_issuing")
325
    CardIssuing cardIssuing;
326

327
    /** The date of birth of this cardholder. */
328
    @SerializedName("dob")
329
    Dob dob;
330

331
    /**
332
     * The first name of this cardholder. Required before activating Cards. This field cannot
333
     * contain any numbers, special characters (except periods, commas, hyphens, spaces and
334
     * apostrophes) or non-latin letters.
335
     */
336
    @SerializedName("first_name")
337
    String firstName;
338

339
    /**
340
     * The last name of this cardholder. Required before activating Cards. This field cannot contain
341
     * any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or
342
     * non-latin letters.
343
     */
344
    @SerializedName("last_name")
345
    String lastName;
346

347
    /** Government-issued ID document for this cardholder. */
348
    @SerializedName("verification")
349
    Verification verification;
350

351
    @Getter
352
    @Setter
353
    @EqualsAndHashCode(callSuper = false)
354
    public static class CardIssuing extends StripeObject {
×
355
      /**
356
       * Information about cardholder acceptance of Celtic <a
357
       * href="https://stripe.com/docs/issuing/cards#accept-authorized-user-terms">Authorized User
358
       * Terms</a>. Required for cards backed by a Celtic program.
359
       */
360
      @SerializedName("user_terms_acceptance")
361
      UserTermsAcceptance userTermsAcceptance;
362

363
      @Getter
364
      @Setter
365
      @EqualsAndHashCode(callSuper = false)
366
      public static class UserTermsAcceptance extends StripeObject {
×
367
        /** The Unix timestamp marking when the cardholder accepted the Authorized User Terms. */
368
        @SerializedName("date")
369
        Long date;
370

371
        /** The IP address from which the cardholder accepted the Authorized User Terms. */
372
        @SerializedName("ip")
373
        String ip;
374

375
        /**
376
         * The user agent of the browser from which the cardholder accepted the Authorized User
377
         * Terms.
378
         */
379
        @SerializedName("user_agent")
380
        String userAgent;
381
      }
382
    }
383

384
    @Getter
385
    @Setter
386
    @EqualsAndHashCode(callSuper = false)
387
    public static class Dob extends StripeObject {
×
388
      /** The day of birth, between 1 and 31. */
389
      @SerializedName("day")
390
      Long day;
391

392
      /** The month of birth, between 1 and 12. */
393
      @SerializedName("month")
394
      Long month;
395

396
      /** The four-digit year of birth. */
397
      @SerializedName("year")
398
      Long year;
399
    }
400

401
    @Getter
402
    @Setter
403
    @EqualsAndHashCode(callSuper = false)
404
    public static class Verification extends StripeObject {
×
405
      /** An identifying document, either a passport or local ID card. */
406
      @SerializedName("document")
407
      Document document;
408

409
      @Getter
410
      @Setter
411
      @EqualsAndHashCode(callSuper = false)
412
      public static class Document extends StripeObject {
×
413
        /**
414
         * The back of a document returned by a <a
415
         * href="https://stripe.com/docs/api#create_file">file upload</a> with a {@code purpose}
416
         * value of {@code identity_document}.
417
         */
418
        @SerializedName("back")
419
        @Getter(lombok.AccessLevel.NONE)
420
        @Setter(lombok.AccessLevel.NONE)
421
        ExpandableField<File> back;
422

423
        /**
424
         * The front of a document returned by a <a
425
         * href="https://stripe.com/docs/api#create_file">file upload</a> with a {@code purpose}
426
         * value of {@code identity_document}.
427
         */
428
        @SerializedName("front")
429
        @Getter(lombok.AccessLevel.NONE)
430
        @Setter(lombok.AccessLevel.NONE)
431
        ExpandableField<File> front;
432

433
        /** Get ID of expandable {@code back} object. */
434
        public String getBack() {
435
          return (this.back != null) ? this.back.getId() : null;
×
436
        }
437

438
        public void setBack(String id) {
439
          this.back = ApiResource.setExpandableFieldId(id, this.back);
×
440
        }
×
441

442
        /** Get expanded {@code back}. */
443
        public File getBackObject() {
444
          return (this.back != null) ? this.back.getExpanded() : null;
×
445
        }
446

447
        public void setBackObject(File expandableObject) {
448
          this.back = new ExpandableField<File>(expandableObject.getId(), expandableObject);
×
449
        }
×
450

451
        /** Get ID of expandable {@code front} object. */
452
        public String getFront() {
453
          return (this.front != null) ? this.front.getId() : null;
×
454
        }
455

456
        public void setFront(String id) {
457
          this.front = ApiResource.setExpandableFieldId(id, this.front);
×
458
        }
×
459

460
        /** Get expanded {@code front}. */
461
        public File getFrontObject() {
462
          return (this.front != null) ? this.front.getExpanded() : null;
×
463
        }
464

465
        public void setFrontObject(File expandableObject) {
466
          this.front = new ExpandableField<File>(expandableObject.getId(), expandableObject);
×
467
        }
×
468
      }
469
    }
470
  }
471

472
  @Getter
473
  @Setter
474
  @EqualsAndHashCode(callSuper = false)
475
  public static class Requirements extends StripeObject {
1✔
476
    /**
477
     * If {@code disabled_reason} is present, all cards will decline authorizations with {@code
478
     * cardholder_verification_required} reason.
479
     *
480
     * <p>One of {@code listed}, {@code rejected.listed}, {@code requirements.past_due}, or {@code
481
     * under_review}.
482
     */
483
    @SerializedName("disabled_reason")
484
    String disabledReason;
485

486
    /**
487
     * Array of fields that need to be collected in order to verify and re-enable the cardholder.
488
     */
489
    @SerializedName("past_due")
490
    List<String> pastDue;
491
  }
492

493
  @Getter
494
  @Setter
495
  @EqualsAndHashCode(callSuper = false)
496
  public static class SpendingControls extends StripeObject {
1✔
497
    /**
498
     * Array of strings containing <a
499
     * href="https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category">categories</a>
500
     * of authorizations to allow. All other categories will be blocked. Cannot be set with {@code
501
     * blocked_categories}.
502
     */
503
    @SerializedName("allowed_categories")
504
    List<String> allowedCategories;
505

506
    /**
507
     * Array of strings containing representing countries from which authorizations will be allowed.
508
     * Authorizations from merchants in all other countries will be declined. Country codes should
509
     * be ISO 3166 alpha-2 country codes (e.g. {@code US}). Cannot be set with {@code
510
     * blocked_merchant_countries}. Provide an empty value to unset this control.
511
     */
512
    @SerializedName("allowed_merchant_countries")
513
    List<String> allowedMerchantCountries;
514

515
    /**
516
     * Array of strings containing <a
517
     * href="https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category">categories</a>
518
     * of authorizations to decline. All other categories will be allowed. Cannot be set with {@code
519
     * allowed_categories}.
520
     */
521
    @SerializedName("blocked_categories")
522
    List<String> blockedCategories;
523

524
    /**
525
     * Array of strings containing representing countries from which authorizations will be
526
     * declined. Country codes should be ISO 3166 alpha-2 country codes (e.g. {@code US}). Cannot be
527
     * set with {@code allowed_merchant_countries}. Provide an empty value to unset this control.
528
     */
529
    @SerializedName("blocked_merchant_countries")
530
    List<String> blockedMerchantCountries;
531

532
    /** Limit spending with amount-based rules that apply across this cardholder's cards. */
533
    @SerializedName("spending_limits")
534
    List<Cardholder.SpendingControls.SpendingLimit> spendingLimits;
535

536
    /** Currency of the amounts within {@code spending_limits}. */
537
    @SerializedName("spending_limits_currency")
538
    String spendingLimitsCurrency;
539

540
    @Getter
541
    @Setter
542
    @EqualsAndHashCode(callSuper = false)
543
    public static class SpendingLimit extends StripeObject {
×
544
      /**
545
       * Maximum amount allowed to spend per interval. This amount is in the card's currency and in
546
       * the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
547
       */
548
      @SerializedName("amount")
549
      Long amount;
550

551
      /**
552
       * Array of strings containing <a
553
       * href="https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category">categories</a>
554
       * this limit applies to. Omitting this field will apply the limit to all categories.
555
       */
556
      @SerializedName("categories")
557
      List<String> categories;
558

559
      /**
560
       * Interval (or event) to which the amount applies.
561
       *
562
       * <p>One of {@code all_time}, {@code daily}, {@code monthly}, {@code per_authorization},
563
       * {@code weekly}, or {@code yearly}.
564
       */
565
      @SerializedName("interval")
566
      String interval;
567
    }
568
  }
569

570
  @Override
571
  public void setResponseGetter(StripeResponseGetter responseGetter) {
572
    super.setResponseGetter(responseGetter);
1✔
573
    trySetResponseGetter(billing, responseGetter);
1✔
574
    trySetResponseGetter(company, responseGetter);
1✔
575
    trySetResponseGetter(individual, responseGetter);
1✔
576
    trySetResponseGetter(requirements, responseGetter);
1✔
577
    trySetResponseGetter(spendingControls, responseGetter);
1✔
578
  }
1✔
579
}
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