• 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

48.89
/src/main/java/com/stripe/model/treasury/FinancialAccount.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.treasury;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.HasId;
7
import com.stripe.model.MetadataStore;
8
import com.stripe.model.StripeObject;
9
import com.stripe.net.ApiRequest;
10
import com.stripe.net.ApiRequestParams;
11
import com.stripe.net.ApiResource;
12
import com.stripe.net.BaseAddress;
13
import com.stripe.net.RequestOptions;
14
import com.stripe.net.StripeResponseGetter;
15
import com.stripe.param.treasury.FinancialAccountCreateParams;
16
import com.stripe.param.treasury.FinancialAccountListParams;
17
import com.stripe.param.treasury.FinancialAccountRetrieveFeaturesParams;
18
import com.stripe.param.treasury.FinancialAccountRetrieveParams;
19
import com.stripe.param.treasury.FinancialAccountUpdateFeaturesParams;
20
import com.stripe.param.treasury.FinancialAccountUpdateParams;
21
import java.util.List;
22
import java.util.Map;
23
import lombok.EqualsAndHashCode;
24
import lombok.Getter;
25
import lombok.Setter;
26

27
/**
28
 * Stripe Treasury provides users with a container for money called a FinancialAccount that is
29
 * separate from their Payments balance. FinancialAccounts serve as the source and destination of
30
 * Treasury’s money movement APIs.
31
 */
32
@Getter
33
@Setter
34
@EqualsAndHashCode(callSuper = false)
35
public class FinancialAccount extends ApiResource
1✔
36
    implements HasId, MetadataStore<FinancialAccount> {
37
  /** The array of paths to active Features in the Features hash. */
38
  @SerializedName("active_features")
39
  List<String> activeFeatures;
40

41
  /** Balance information for the FinancialAccount. */
42
  @SerializedName("balance")
43
  Balance balance;
44

45
  /**
46
   * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1
47
   * alpha-2</a>).
48
   */
49
  @SerializedName("country")
50
  String country;
51

52
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
53
  @SerializedName("created")
54
  Long created;
55

56
  /**
57
   * The display name for the FinancialAccount. Use this field to customize the names of the
58
   * FinancialAccounts for your connected accounts. Unlike the {@code nickname} field, {@code
59
   * display_name} is not internal metadata and will be exposed to connected accounts.
60
   */
61
  @SerializedName("display_name")
62
  String displayName;
63

64
  /**
65
   * Encodes whether a FinancialAccount has access to a particular Feature, with a {@code status}
66
   * enum and associated {@code status_details}. Stripe or the platform can control Features via the
67
   * requested field.
68
   */
69
  @SerializedName("features")
70
  FinancialAccountFeatures features;
71

72
  /** The set of credentials that resolve to a FinancialAccount. */
73
  @SerializedName("financial_addresses")
74
  List<FinancialAccount.FinancialAddress> financialAddresses;
75

76
  /** Unique identifier for the object. */
77
  @Getter(onMethod_ = {@Override})
78
  @SerializedName("id")
79
  String id;
80

81
  /**
82
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
83
   * object exists in test mode.
84
   */
85
  @SerializedName("livemode")
86
  Boolean livemode;
87

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

97
  /**
98
   * String representing the object's type. Objects of the same type share the same value.
99
   *
100
   * <p>Equal to {@code treasury.financial_account}.
101
   */
102
  @SerializedName("object")
103
  String object;
104

105
  /** The array of paths to pending Features in the Features hash. */
106
  @SerializedName("pending_features")
107
  List<String> pendingFeatures;
108

109
  /** The set of functionalities that the platform can restrict on the FinancialAccount. */
110
  @SerializedName("platform_restrictions")
111
  PlatformRestrictions platformRestrictions;
112

113
  /** The array of paths to restricted Features in the Features hash. */
114
  @SerializedName("restricted_features")
115
  List<String> restrictedFeatures;
116

117
  /**
118
   * The enum specifying what state the account is in.
119
   *
120
   * <p>One of {@code closed}, or {@code open}.
121
   */
122
  @SerializedName("status")
123
  String status;
124

125
  @SerializedName("status_details")
126
  StatusDetails statusDetails;
127

128
  /**
129
   * The currencies the FinancialAccount can hold a balance in. Three-letter <a
130
   * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase.
131
   */
132
  @SerializedName("supported_currencies")
133
  List<String> supportedCurrencies;
134

135
  /**
136
   * Creates a new FinancialAccount. For now, each connected account can only have one
137
   * FinancialAccount.
138
   */
139
  public static FinancialAccount create(Map<String, Object> params) throws StripeException {
140
    return create(params, (RequestOptions) null);
×
141
  }
142

143
  /**
144
   * Creates a new FinancialAccount. For now, each connected account can only have one
145
   * FinancialAccount.
146
   */
147
  public static FinancialAccount create(Map<String, Object> params, RequestOptions options)
148
      throws StripeException {
149
    String path = "/v1/treasury/financial_accounts";
×
150
    ApiRequest request =
×
151
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
152
    return getGlobalResponseGetter().request(request, FinancialAccount.class);
×
153
  }
154

155
  /**
156
   * Creates a new FinancialAccount. For now, each connected account can only have one
157
   * FinancialAccount.
158
   */
159
  public static FinancialAccount create(FinancialAccountCreateParams params)
160
      throws StripeException {
161
    return create(params, (RequestOptions) null);
1✔
162
  }
163

164
  /**
165
   * Creates a new FinancialAccount. For now, each connected account can only have one
166
   * FinancialAccount.
167
   */
168
  public static FinancialAccount create(FinancialAccountCreateParams params, RequestOptions options)
169
      throws StripeException {
170
    String path = "/v1/treasury/financial_accounts";
1✔
171
    ApiResource.checkNullTypedParams(path, params);
1✔
172
    ApiRequest request =
1✔
173
        new ApiRequest(
174
            BaseAddress.API,
175
            ApiResource.RequestMethod.POST,
176
            path,
177
            ApiRequestParams.paramsToMap(params),
1✔
178
            options);
179
    return getGlobalResponseGetter().request(request, FinancialAccount.class);
1✔
180
  }
181

182
  /** Returns a list of FinancialAccounts. */
183
  public static FinancialAccountCollection list(Map<String, Object> params) throws StripeException {
184
    return list(params, (RequestOptions) null);
×
185
  }
186

187
  /** Returns a list of FinancialAccounts. */
188
  public static FinancialAccountCollection list(Map<String, Object> params, RequestOptions options)
189
      throws StripeException {
190
    String path = "/v1/treasury/financial_accounts";
×
191
    ApiRequest request =
×
192
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
UNCOV
193
    return getGlobalResponseGetter().request(request, FinancialAccountCollection.class);
×
194
  }
195

196
  /** Returns a list of FinancialAccounts. */
197
  public static FinancialAccountCollection list(FinancialAccountListParams params)
198
      throws StripeException {
199
    return list(params, (RequestOptions) null);
1✔
200
  }
201

202
  /** Returns a list of FinancialAccounts. */
203
  public static FinancialAccountCollection list(
204
      FinancialAccountListParams params, RequestOptions options) throws StripeException {
205
    String path = "/v1/treasury/financial_accounts";
1✔
206
    ApiResource.checkNullTypedParams(path, params);
1✔
207
    ApiRequest request =
1✔
208
        new ApiRequest(
209
            BaseAddress.API,
210
            ApiResource.RequestMethod.GET,
211
            path,
212
            ApiRequestParams.paramsToMap(params),
1✔
213
            options);
214
    return getGlobalResponseGetter().request(request, FinancialAccountCollection.class);
1✔
215
  }
216

217
  /** Retrieves the details of a FinancialAccount. */
218
  public static FinancialAccount retrieve(String financialAccount) throws StripeException {
219
    return retrieve(financialAccount, (Map<String, Object>) null, (RequestOptions) null);
1✔
220
  }
221

222
  /** Retrieves the details of a FinancialAccount. */
223
  public static FinancialAccount retrieve(String financialAccount, RequestOptions options)
224
      throws StripeException {
225
    return retrieve(financialAccount, (Map<String, Object>) null, options);
×
226
  }
227

228
  /** Retrieves the details of a FinancialAccount. */
229
  public static FinancialAccount retrieve(
230
      String financialAccount, Map<String, Object> params, RequestOptions options)
231
      throws StripeException {
232
    String path =
1✔
233
        String.format(
1✔
234
            "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(financialAccount));
1✔
235
    ApiRequest request =
1✔
236
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
237
    return getGlobalResponseGetter().request(request, FinancialAccount.class);
1✔
238
  }
239

240
  /** Retrieves the details of a FinancialAccount. */
241
  public static FinancialAccount retrieve(
242
      String financialAccount, FinancialAccountRetrieveParams params, RequestOptions options)
243
      throws StripeException {
244
    String path =
×
245
        String.format(
×
246
            "/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(financialAccount));
×
247
    ApiResource.checkNullTypedParams(path, params);
×
248
    ApiRequest request =
×
249
        new ApiRequest(
250
            BaseAddress.API,
251
            ApiResource.RequestMethod.GET,
252
            path,
253
            ApiRequestParams.paramsToMap(params),
×
254
            options);
UNCOV
255
    return getGlobalResponseGetter().request(request, FinancialAccount.class);
×
256
  }
257

258
  /** Retrieves Features information associated with the FinancialAccount. */
259
  public FinancialAccountFeatures retrieveFeatures() throws StripeException {
260
    return retrieveFeatures((Map<String, Object>) null, (RequestOptions) null);
×
261
  }
262

263
  /** Retrieves Features information associated with the FinancialAccount. */
264
  public FinancialAccountFeatures retrieveFeatures(Map<String, Object> params)
265
      throws StripeException {
266
    return retrieveFeatures(params, (RequestOptions) null);
×
267
  }
268

269
  /** Retrieves Features information associated with the FinancialAccount. */
270
  public FinancialAccountFeatures retrieveFeatures(
271
      Map<String, Object> params, RequestOptions options) throws StripeException {
272
    String path =
×
273
        String.format(
×
274
            "/v1/treasury/financial_accounts/%s/features", ApiResource.urlEncodeId(this.getId()));
×
275
    ApiRequest request =
×
276
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
UNCOV
277
    return getResponseGetter().request(request, FinancialAccountFeatures.class);
×
278
  }
279

280
  /** Retrieves Features information associated with the FinancialAccount. */
281
  public FinancialAccountFeatures retrieveFeatures(FinancialAccountRetrieveFeaturesParams params)
282
      throws StripeException {
283
    return retrieveFeatures(params, (RequestOptions) null);
1✔
284
  }
285

286
  /** Retrieves Features information associated with the FinancialAccount. */
287
  public FinancialAccountFeatures retrieveFeatures(
288
      FinancialAccountRetrieveFeaturesParams params, RequestOptions options)
289
      throws StripeException {
290
    String path =
1✔
291
        String.format(
1✔
292
            "/v1/treasury/financial_accounts/%s/features", ApiResource.urlEncodeId(this.getId()));
1✔
293
    ApiResource.checkNullTypedParams(path, params);
1✔
294
    ApiRequest request =
1✔
295
        new ApiRequest(
296
            BaseAddress.API,
297
            ApiResource.RequestMethod.GET,
298
            path,
299
            ApiRequestParams.paramsToMap(params),
1✔
300
            options);
301
    return getResponseGetter().request(request, FinancialAccountFeatures.class);
1✔
302
  }
303

304
  /** Updates the details of a FinancialAccount. */
305
  @Override
306
  public FinancialAccount update(Map<String, Object> params) throws StripeException {
307
    return update(params, (RequestOptions) null);
×
308
  }
309

310
  /** Updates the details of a FinancialAccount. */
311
  @Override
312
  public FinancialAccount update(Map<String, Object> params, RequestOptions options)
313
      throws StripeException {
314
    String path =
×
315
        String.format("/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()));
×
316
    ApiRequest request =
×
317
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
318
    return getResponseGetter().request(request, FinancialAccount.class);
×
319
  }
320

321
  /** Updates the details of a FinancialAccount. */
322
  public FinancialAccount update(FinancialAccountUpdateParams params) throws StripeException {
323
    return update(params, (RequestOptions) null);
1✔
324
  }
325

326
  /** Updates the details of a FinancialAccount. */
327
  public FinancialAccount update(FinancialAccountUpdateParams params, RequestOptions options)
328
      throws StripeException {
329
    String path =
1✔
330
        String.format("/v1/treasury/financial_accounts/%s", ApiResource.urlEncodeId(this.getId()));
1✔
331
    ApiResource.checkNullTypedParams(path, params);
1✔
332
    ApiRequest request =
1✔
333
        new ApiRequest(
334
            BaseAddress.API,
335
            ApiResource.RequestMethod.POST,
336
            path,
337
            ApiRequestParams.paramsToMap(params),
1✔
338
            options);
339
    return getResponseGetter().request(request, FinancialAccount.class);
1✔
340
  }
341

342
  /** Updates the Features associated with a FinancialAccount. */
343
  public FinancialAccountFeatures updateFeatures() throws StripeException {
344
    return updateFeatures((Map<String, Object>) null, (RequestOptions) null);
×
345
  }
346

347
  /** Updates the Features associated with a FinancialAccount. */
348
  public FinancialAccountFeatures updateFeatures(RequestOptions options) throws StripeException {
349
    return updateFeatures((Map<String, Object>) null, options);
×
350
  }
351

352
  /** Updates the Features associated with a FinancialAccount. */
353
  public FinancialAccountFeatures updateFeatures(Map<String, Object> params)
354
      throws StripeException {
355
    return updateFeatures(params, (RequestOptions) null);
×
356
  }
357

358
  /** Updates the Features associated with a FinancialAccount. */
359
  public FinancialAccountFeatures updateFeatures(Map<String, Object> params, RequestOptions options)
360
      throws StripeException {
361
    String path =
×
362
        String.format(
×
363
            "/v1/treasury/financial_accounts/%s/features", ApiResource.urlEncodeId(this.getId()));
×
364
    ApiRequest request =
×
365
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
366
    return getResponseGetter().request(request, FinancialAccountFeatures.class);
×
367
  }
368

369
  /** Updates the Features associated with a FinancialAccount. */
370
  public FinancialAccountFeatures updateFeatures(FinancialAccountUpdateFeaturesParams params)
371
      throws StripeException {
372
    return updateFeatures(params, (RequestOptions) null);
×
373
  }
374

375
  /** Updates the Features associated with a FinancialAccount. */
376
  public FinancialAccountFeatures updateFeatures(
377
      FinancialAccountUpdateFeaturesParams params, RequestOptions options) throws StripeException {
378
    String path =
×
379
        String.format(
×
380
            "/v1/treasury/financial_accounts/%s/features", ApiResource.urlEncodeId(this.getId()));
×
381
    ApiResource.checkNullTypedParams(path, params);
×
382
    ApiRequest request =
×
383
        new ApiRequest(
384
            BaseAddress.API,
385
            ApiResource.RequestMethod.POST,
386
            path,
387
            ApiRequestParams.paramsToMap(params),
×
388
            options);
UNCOV
389
    return getResponseGetter().request(request, FinancialAccountFeatures.class);
×
390
  }
391

392
  /** Balance information for the FinancialAccount. */
393
  @Getter
394
  @Setter
395
  @EqualsAndHashCode(callSuper = false)
396
  public static class Balance extends StripeObject {
1✔
397
    /** Funds the user can spend right now. */
398
    @SerializedName("cash")
399
    Map<String, Long> cash;
400

401
    /** Funds not spendable yet, but will become available at a later time. */
402
    @SerializedName("inbound_pending")
403
    Map<String, Long> inboundPending;
404

405
    /**
406
     * Funds in the account, but not spendable because they are being held for pending outbound
407
     * flows.
408
     */
409
    @SerializedName("outbound_pending")
410
    Map<String, Long> outboundPending;
411
  }
412

413
  /** FinancialAddresses contain identifying information that resolves to a FinancialAccount. */
414
  @Getter
415
  @Setter
416
  @EqualsAndHashCode(callSuper = false)
417
  public static class FinancialAddress extends StripeObject {
1✔
418
    /** ABA Records contain U.S. bank account details per the ABA format. */
419
    @SerializedName("aba")
420
    Aba aba;
421

422
    /** The list of networks that the address supports. */
423
    @SerializedName("supported_networks")
424
    List<String> supportedNetworks;
425

426
    /**
427
     * The type of financial address
428
     *
429
     * <p>Equal to {@code aba}.
430
     */
431
    @SerializedName("type")
432
    String type;
433

434
    /** ABA Records contain U.S. bank account details per the ABA format. */
435
    @Getter
436
    @Setter
437
    @EqualsAndHashCode(callSuper = false)
438
    public static class Aba extends StripeObject {
1✔
439
      /** The name of the person or business that owns the bank account. */
440
      @SerializedName("account_holder_name")
441
      String accountHolderName;
442

443
      /** The account number. */
444
      @SerializedName("account_number")
445
      String accountNumber;
446

447
      /** The last four characters of the account number. */
448
      @SerializedName("account_number_last4")
449
      String accountNumberLast4;
450

451
      /** Name of the bank. */
452
      @SerializedName("bank_name")
453
      String bankName;
454

455
      /** Routing number for the account. */
456
      @SerializedName("routing_number")
457
      String routingNumber;
458
    }
459
  }
460

461
  /** Restrictions that a Connect Platform has placed on this FinancialAccount. */
462
  @Getter
463
  @Setter
464
  @EqualsAndHashCode(callSuper = false)
465
  public static class PlatformRestrictions extends StripeObject {
×
466
    /**
467
     * Restricts all inbound money movement.
468
     *
469
     * <p>One of {@code restricted}, or {@code unrestricted}.
470
     */
471
    @SerializedName("inbound_flows")
472
    String inboundFlows;
473

474
    /**
475
     * Restricts all outbound money movement.
476
     *
477
     * <p>One of {@code restricted}, or {@code unrestricted}.
478
     */
479
    @SerializedName("outbound_flows")
480
    String outboundFlows;
481
  }
482

483
  @Getter
484
  @Setter
485
  @EqualsAndHashCode(callSuper = false)
486
  public static class StatusDetails extends StripeObject {
1✔
487
    /** Details related to the closure of this FinancialAccount. */
488
    @SerializedName("closed")
489
    Closed closed;
490

491
    @Getter
492
    @Setter
493
    @EqualsAndHashCode(callSuper = false)
494
    public static class Closed extends StripeObject {
×
495
      /** The array that contains reasons for a FinancialAccount closure. */
496
      @SerializedName("reasons")
497
      List<String> reasons;
498
    }
499
  }
500

501
  @Override
502
  public void setResponseGetter(StripeResponseGetter responseGetter) {
503
    super.setResponseGetter(responseGetter);
1✔
504
    trySetResponseGetter(balance, responseGetter);
1✔
505
    trySetResponseGetter(features, responseGetter);
1✔
506
    trySetResponseGetter(platformRestrictions, responseGetter);
1✔
507
    trySetResponseGetter(statusDetails, responseGetter);
1✔
508
  }
1✔
509
}
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