• 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

40.3
/src/main/java/com/stripe/model/tax/Form.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.tax;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.Account;
7
import com.stripe.model.ExpandableField;
8
import com.stripe.model.HasId;
9
import com.stripe.model.StripeObject;
10
import com.stripe.net.ApiRequest;
11
import com.stripe.net.ApiRequestParams;
12
import com.stripe.net.ApiResource;
13
import com.stripe.net.BaseAddress;
14
import com.stripe.net.RequestOptions;
15
import com.stripe.net.StripeResponseGetter;
16
import com.stripe.param.tax.FormListParams;
17
import com.stripe.param.tax.FormPdfParams;
18
import com.stripe.param.tax.FormRetrieveParams;
19
import java.io.InputStream;
20
import java.util.List;
21
import java.util.Map;
22
import lombok.EqualsAndHashCode;
23
import lombok.Getter;
24
import lombok.Setter;
25

26
/**
27
 * Tax forms are legal documents which are delivered to one or more tax authorities for information
28
 * reporting purposes.
29
 *
30
 * <p>Related guide: <a href="https://stripe.com/docs/connect/tax-reporting">US tax reporting for
31
 * Connect platforms</a>
32
 */
33
@Getter
34
@Setter
35
@EqualsAndHashCode(callSuper = false)
36
public class Form extends ApiResource implements HasId {
1✔
37
  @SerializedName("au_serr")
38
  AuSerr auSerr;
39

40
  @SerializedName("ca_mrdp")
41
  CaMrdp caMrdp;
42

43
  /** The form that corrects this form, if any. */
44
  @SerializedName("corrected_by")
45
  @Getter(lombok.AccessLevel.NONE)
46
  @Setter(lombok.AccessLevel.NONE)
47
  ExpandableField<Form> correctedBy;
48

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

53
  @SerializedName("eu_dac7")
54
  EuDac7 euDac7;
55

56
  /**
57
   * A list of tax filing statuses. Note that a filing status will only be included if the form has
58
   * been filed directly with the jurisdiction’s tax authority.
59
   */
60
  @SerializedName("filing_statuses")
61
  List<Form.FilingStatus> filingStatuses;
62

63
  @SerializedName("gb_mrdp")
64
  GbMrdp gbMrdp;
65

66
  /** Unique identifier for the object. */
67
  @Getter(onMethod_ = {@Override})
68
  @SerializedName("id")
69
  String id;
70

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

78
  @SerializedName("nz_mrdp")
79
  NzMrdp nzMrdp;
80

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

89
  @SerializedName("payee")
90
  Payee payee;
91

92
  /**
93
   * The type of the tax form. An additional hash is included on the tax form with a name matching
94
   * this value. It contains additional information specific to the tax form type.
95
   *
96
   * <p>One of {@code au_serr}, {@code ca_mrdp}, {@code eu_dac7}, {@code gb_mrdp}, {@code nz_mrdp},
97
   * {@code us_1099_k}, {@code us_1099_misc}, or {@code us_1099_nec}.
98
   */
99
  @SerializedName("type")
100
  String type;
101

102
  @SerializedName("us_1099_k")
103
  Us1099K us1099K;
104

105
  @SerializedName("us_1099_misc")
106
  Us1099Misc us1099Misc;
107

108
  @SerializedName("us_1099_nec")
109
  Us1099Nec us1099Nec;
110

111
  /** Get ID of expandable {@code correctedBy} object. */
112
  public String getCorrectedBy() {
113
    return (this.correctedBy != null) ? this.correctedBy.getId() : null;
×
114
  }
115

116
  public void setCorrectedBy(String id) {
117
    this.correctedBy = ApiResource.setExpandableFieldId(id, this.correctedBy);
×
118
  }
×
119

120
  /** Get expanded {@code correctedBy}. */
121
  public Form getCorrectedByObject() {
122
    return (this.correctedBy != null) ? this.correctedBy.getExpanded() : null;
×
123
  }
124

125
  public void setCorrectedByObject(Form expandableObject) {
126
    this.correctedBy = new ExpandableField<Form>(expandableObject.getId(), expandableObject);
×
127
  }
×
128

129
  /**
130
   * Returns a list of tax forms which were previously created. The tax forms are returned in sorted
131
   * order, with the oldest tax forms appearing first.
132
   */
133
  public static FormCollection list(Map<String, Object> params) throws StripeException {
134
    return list(params, (RequestOptions) null);
×
135
  }
136

137
  /**
138
   * Returns a list of tax forms which were previously created. The tax forms are returned in sorted
139
   * order, with the oldest tax forms appearing first.
140
   */
141
  public static FormCollection list(Map<String, Object> params, RequestOptions options)
142
      throws StripeException {
143
    String path = "/v1/tax/forms";
×
144
    ApiRequest request =
×
145
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
146
    return getGlobalResponseGetter().request(request, FormCollection.class);
×
147
  }
148

149
  /**
150
   * Returns a list of tax forms which were previously created. The tax forms are returned in sorted
151
   * order, with the oldest tax forms appearing first.
152
   */
153
  public static FormCollection list(FormListParams params) throws StripeException {
154
    return list(params, (RequestOptions) null);
×
155
  }
156

157
  /**
158
   * Returns a list of tax forms which were previously created. The tax forms are returned in sorted
159
   * order, with the oldest tax forms appearing first.
160
   */
161
  public static FormCollection list(FormListParams params, RequestOptions options)
162
      throws StripeException {
163
    String path = "/v1/tax/forms";
×
164
    ApiResource.checkNullTypedParams(path, params);
×
165
    ApiRequest request =
×
166
        new ApiRequest(
167
            BaseAddress.API,
168
            ApiResource.RequestMethod.GET,
169
            path,
170
            ApiRequestParams.paramsToMap(params),
×
171
            options);
172
    return getGlobalResponseGetter().request(request, FormCollection.class);
×
173
  }
174

175
  /** Download the PDF for a tax form. */
176
  public InputStream pdf() throws StripeException {
177
    return pdf((Map<String, Object>) null, (RequestOptions) null);
×
178
  }
179

180
  /** Download the PDF for a tax form. */
181
  public InputStream pdf(Map<String, Object> params) throws StripeException {
182
    return pdf(params, (RequestOptions) null);
×
183
  }
184

185
  /** Download the PDF for a tax form. */
186
  public InputStream pdf(Map<String, Object> params, RequestOptions options)
187
      throws StripeException {
188
    String path = String.format("/v1/tax/forms/%s/pdf", ApiResource.urlEncodeId(this.getId()));
×
189
    ApiRequest request =
×
190
        new ApiRequest(BaseAddress.FILES, ApiResource.RequestMethod.GET, path, params, options);
191
    return getResponseGetter().requestStream(request);
×
192
  }
193

194
  /** Download the PDF for a tax form. */
195
  public InputStream pdf(FormPdfParams params) throws StripeException {
196
    return pdf(params, (RequestOptions) null);
1✔
197
  }
198

199
  /** Download the PDF for a tax form. */
200
  public InputStream pdf(FormPdfParams params, RequestOptions options) throws StripeException {
201
    String path = String.format("/v1/tax/forms/%s/pdf", ApiResource.urlEncodeId(this.getId()));
1✔
202
    ApiResource.checkNullTypedParams(path, params);
1✔
203
    ApiRequest request =
1✔
204
        new ApiRequest(
205
            BaseAddress.FILES,
206
            ApiResource.RequestMethod.GET,
207
            path,
208
            ApiRequestParams.paramsToMap(params),
1✔
209
            options);
210
    return getResponseGetter().requestStream(request);
1✔
211
  }
212

213
  /**
214
   * Retrieves the details of a tax form that has previously been created. Supply the unique tax
215
   * form ID that was returned from your previous request, and Stripe will return the corresponding
216
   * tax form information.
217
   */
218
  public static Form retrieve(String id) throws StripeException {
219
    return retrieve(id, (Map<String, Object>) null, (RequestOptions) null);
1✔
220
  }
221

222
  /**
223
   * Retrieves the details of a tax form that has previously been created. Supply the unique tax
224
   * form ID that was returned from your previous request, and Stripe will return the corresponding
225
   * tax form information.
226
   */
227
  public static Form retrieve(String id, RequestOptions options) throws StripeException {
228
    return retrieve(id, (Map<String, Object>) null, options);
×
229
  }
230

231
  /**
232
   * Retrieves the details of a tax form that has previously been created. Supply the unique tax
233
   * form ID that was returned from your previous request, and Stripe will return the corresponding
234
   * tax form information.
235
   */
236
  public static Form retrieve(String id, Map<String, Object> params, RequestOptions options)
237
      throws StripeException {
238
    String path = String.format("/v1/tax/forms/%s", ApiResource.urlEncodeId(id));
1✔
239
    ApiRequest request =
1✔
240
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
241
    return getGlobalResponseGetter().request(request, Form.class);
1✔
242
  }
243

244
  /**
245
   * Retrieves the details of a tax form that has previously been created. Supply the unique tax
246
   * form ID that was returned from your previous request, and Stripe will return the corresponding
247
   * tax form information.
248
   */
249
  public static Form retrieve(String id, FormRetrieveParams params, RequestOptions options)
250
      throws StripeException {
251
    String path = String.format("/v1/tax/forms/%s", ApiResource.urlEncodeId(id));
×
252
    ApiResource.checkNullTypedParams(path, params);
×
253
    ApiRequest request =
×
254
        new ApiRequest(
255
            BaseAddress.API,
256
            ApiResource.RequestMethod.GET,
257
            path,
258
            ApiRequestParams.paramsToMap(params),
×
259
            options);
260
    return getGlobalResponseGetter().request(request, Form.class);
×
261
  }
262

263
  /**
264
   * For more details about AuSerr, please refer to the <a href="https://docs.stripe.com/api">API
265
   * Reference.</a>
266
   */
267
  @Getter
268
  @Setter
269
  @EqualsAndHashCode(callSuper = false)
NEW
270
  public static class AuSerr extends StripeObject {
×
271
    /** End date of the period represented by the information reported on the tax form. */
272
    @SerializedName("reporting_period_end_date")
273
    String reportingPeriodEndDate;
274

275
    /** Start date of the period represented by the information reported on the tax form. */
276
    @SerializedName("reporting_period_start_date")
277
    String reportingPeriodStartDate;
278
  }
279

280
  /**
281
   * For more details about CaMrdp, please refer to the <a href="https://docs.stripe.com/api">API
282
   * Reference.</a>
283
   */
284
  @Getter
285
  @Setter
286
  @EqualsAndHashCode(callSuper = false)
NEW
287
  public static class CaMrdp extends StripeObject {
×
288
    /** End date of the period represented by the information reported on the tax form. */
289
    @SerializedName("reporting_period_end_date")
290
    String reportingPeriodEndDate;
291

292
    /** Start date of the period represented by the information reported on the tax form. */
293
    @SerializedName("reporting_period_start_date")
294
    String reportingPeriodStartDate;
295
  }
296

297
  /**
298
   * For more details about EuDac7, please refer to the <a href="https://docs.stripe.com/api">API
299
   * Reference.</a>
300
   */
301
  @Getter
302
  @Setter
303
  @EqualsAndHashCode(callSuper = false)
NEW
304
  public static class EuDac7 extends StripeObject {
×
305
    /** End date of the period represented by the information reported on the tax form. */
306
    @SerializedName("reporting_period_end_date")
307
    String reportingPeriodEndDate;
308

309
    /** Start date of the period represented by the information reported on the tax form. */
310
    @SerializedName("reporting_period_start_date")
311
    String reportingPeriodStartDate;
312
  }
313

314
  /**
315
   * For more details about FilingStatus, please refer to the <a
316
   * href="https://docs.stripe.com/api">API Reference.</a>
317
   */
318
  @Getter
319
  @Setter
320
  @EqualsAndHashCode(callSuper = false)
321
  public static class FilingStatus extends StripeObject {
1✔
322
    /** Time when the filing status was updated. */
323
    @SerializedName("effective_at")
324
    Long effectiveAt;
325

326
    @SerializedName("jurisdiction")
327
    Jurisdiction jurisdiction;
328

329
    /**
330
     * The current status of the filed form.
331
     *
332
     * <p>One of {@code accepted}, {@code filed}, or {@code rejected}.
333
     */
334
    @SerializedName("value")
335
    String value;
336

337
    /**
338
     * For more details about Jurisdiction, please refer to the <a
339
     * href="https://docs.stripe.com/api">API Reference.</a>
340
     */
341
    @Getter
342
    @Setter
343
    @EqualsAndHashCode(callSuper = false)
344
    public static class Jurisdiction extends StripeObject {
1✔
345
      /**
346
       * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO
347
       * 3166-1 alpha-2</a>). Always {@code US}.
348
       */
349
      @SerializedName("country")
350
      String country;
351

352
      /**
353
       * Indicates the level of the jurisdiction where the form was filed.
354
       *
355
       * <p>One of {@code country}, or {@code state}.
356
       */
357
      @SerializedName("level")
358
      String level;
359

360
      /**
361
       * <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US">ISO 3166-2 U.S. state code</a>,
362
       * without country prefix, if any. For example, &quot;NY&quot; for New York, United States.
363
       */
364
      @SerializedName("state")
365
      String state;
366
    }
367
  }
368

369
  /**
370
   * For more details about GbMrdp, please refer to the <a href="https://docs.stripe.com/api">API
371
   * Reference.</a>
372
   */
373
  @Getter
374
  @Setter
375
  @EqualsAndHashCode(callSuper = false)
NEW
376
  public static class GbMrdp extends StripeObject {
×
377
    /** End date of the period represented by the information reported on the tax form. */
378
    @SerializedName("reporting_period_end_date")
379
    String reportingPeriodEndDate;
380

381
    /** Start date of the period represented by the information reported on the tax form. */
382
    @SerializedName("reporting_period_start_date")
383
    String reportingPeriodStartDate;
384
  }
385

386
  /**
387
   * For more details about NzMrdp, please refer to the <a href="https://docs.stripe.com/api">API
388
   * Reference.</a>
389
   */
390
  @Getter
391
  @Setter
392
  @EqualsAndHashCode(callSuper = false)
NEW
393
  public static class NzMrdp extends StripeObject {
×
394
    /** End date of the period represented by the information reported on the tax form. */
395
    @SerializedName("reporting_period_end_date")
396
    String reportingPeriodEndDate;
397

398
    /** Start date of the period represented by the information reported on the tax form. */
399
    @SerializedName("reporting_period_start_date")
400
    String reportingPeriodStartDate;
401
  }
402

403
  /**
404
   * For more details about Payee, please refer to the <a href="https://docs.stripe.com/api">API
405
   * Reference.</a>
406
   */
407
  @Getter
408
  @Setter
409
  @EqualsAndHashCode(callSuper = false)
410
  public static class Payee extends StripeObject {
1✔
411
    /** The ID of the payee's Stripe account. */
412
    @SerializedName("account")
413
    @Getter(lombok.AccessLevel.NONE)
414
    @Setter(lombok.AccessLevel.NONE)
415
    ExpandableField<Account> account;
416

417
    /** The external reference to this payee. */
418
    @SerializedName("external_reference")
419
    String externalReference;
420

421
    /**
422
     * Either {@code account} or {@code external_reference}.
423
     *
424
     * <p>One of {@code account}, or {@code external_reference}.
425
     */
426
    @SerializedName("type")
427
    String type;
428

429
    /** Get ID of expandable {@code account} object. */
430
    public String getAccount() {
431
      return (this.account != null) ? this.account.getId() : null;
×
432
    }
433

434
    public void setAccount(String id) {
435
      this.account = ApiResource.setExpandableFieldId(id, this.account);
×
436
    }
×
437

438
    /** Get expanded {@code account}. */
439
    public Account getAccountObject() {
440
      return (this.account != null) ? this.account.getExpanded() : null;
×
441
    }
442

443
    public void setAccountObject(Account expandableObject) {
444
      this.account = new ExpandableField<Account>(expandableObject.getId(), expandableObject);
×
445
    }
×
446
  }
447

448
  /**
449
   * For more details about Us1099K, please refer to the <a href="https://docs.stripe.com/api">API
450
   * Reference.</a>
451
   */
452
  @Getter
453
  @Setter
454
  @EqualsAndHashCode(callSuper = false)
455
  public static class Us1099K extends StripeObject {
1✔
456
    /** Year represented by the information reported on the tax form. */
457
    @SerializedName("reporting_year")
458
    Long reportingYear;
459
  }
460

461
  /**
462
   * For more details about Us1099Misc, please refer to the <a
463
   * href="https://docs.stripe.com/api">API Reference.</a>
464
   */
465
  @Getter
466
  @Setter
467
  @EqualsAndHashCode(callSuper = false)
468
  public static class Us1099Misc extends StripeObject {
×
469
    /** Year represented by the information reported on the tax form. */
470
    @SerializedName("reporting_year")
471
    Long reportingYear;
472
  }
473

474
  /**
475
   * For more details about Us1099Nec, please refer to the <a href="https://docs.stripe.com/api">API
476
   * Reference.</a>
477
   */
478
  @Getter
479
  @Setter
480
  @EqualsAndHashCode(callSuper = false)
481
  public static class Us1099Nec extends StripeObject {
×
482
    /** Year represented by the information reported on the tax form. */
483
    @SerializedName("reporting_year")
484
    Long reportingYear;
485
  }
486

487
  @Override
488
  public void setResponseGetter(StripeResponseGetter responseGetter) {
489
    super.setResponseGetter(responseGetter);
1✔
490
    trySetResponseGetter(auSerr, responseGetter);
1✔
491
    trySetResponseGetter(caMrdp, responseGetter);
1✔
492
    trySetResponseGetter(correctedBy, responseGetter);
1✔
493
    trySetResponseGetter(euDac7, responseGetter);
1✔
494
    trySetResponseGetter(gbMrdp, responseGetter);
1✔
495
    trySetResponseGetter(nzMrdp, responseGetter);
1✔
496
    trySetResponseGetter(payee, responseGetter);
1✔
497
    trySetResponseGetter(us1099K, responseGetter);
1✔
498
    trySetResponseGetter(us1099Misc, responseGetter);
1✔
499
    trySetResponseGetter(us1099Nec, responseGetter);
1✔
500
  }
1✔
501
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc