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

stripe / stripe-java / #16698

12 Dec 2024 10:54PM UTC coverage: 12.384% (-0.007%) from 12.391%
#16698

push

github

web-flow
Update generated code for beta (#1929)

* Update generated code for v1386

* Update generated code for v1387

* Update generated code for v1388

* Update generated code for v1388

* Update generated code for v1389

* Update generated code for v1390

* Update generated code for v1392

* Update generated code for v1394

* Update generated code for v1395

* Update generated code for v1396

* Update generated code for v1397

* Update generated code for v1398

* Update generated code for v1400

* Update generated code for v1401

* Update generated code for v1405

* Update generated code for v1406

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>

18 of 230 new or added lines in 16 files covered. (7.83%)

111 existing lines in 11 files now uncovered.

18879 of 152444 relevant lines covered (12.38%)

0.12 hits per line

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

20.66
/src/main/java/com/stripe/param/tax/CalculationCreateParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param.tax;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.net.ApiRequestParams;
6
import com.stripe.param.common.EmptyParam;
7
import java.util.ArrayList;
8
import java.util.HashMap;
9
import java.util.List;
10
import java.util.Map;
11
import lombok.Getter;
12

13
@Getter
14
public class CalculationCreateParams extends ApiRequestParams {
15
  /**
16
   * <strong>Required.</strong> Three-letter <a
17
   * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase.
18
   * Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
19
   */
20
  @SerializedName("currency")
21
  String currency;
22

23
  /**
24
   * The ID of an existing customer to use for this calculation. If provided, the customer's address
25
   * and tax IDs are copied to {@code customer_details}.
26
   */
27
  @SerializedName("customer")
28
  String customer;
29

30
  /** Details about the customer, including address and tax IDs. */
31
  @SerializedName("customer_details")
32
  CustomerDetails customerDetails;
33

34
  /** Specifies which fields in the response should be expanded. */
35
  @SerializedName("expand")
36
  List<String> expand;
37

38
  /**
39
   * Map of extra parameters for custom features not available in this client library. The content
40
   * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
41
   * key/value pair is serialized as if the key is a root-level field (serialized) name in this
42
   * param object. Effectively, this map is flattened to its parent instance.
43
   */
44
  @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
45
  Map<String, Object> extraParams;
46

47
  /** <strong>Required.</strong> A list of items the customer is purchasing. */
48
  @SerializedName("line_items")
49
  List<CalculationCreateParams.LineItem> lineItems;
50

51
  /** Details about the address from which the goods are being shipped. */
52
  @SerializedName("ship_from_details")
53
  ShipFromDetails shipFromDetails;
54

55
  /** Shipping cost details to be used for the calculation. */
56
  @SerializedName("shipping_cost")
57
  ShippingCost shippingCost;
58

59
  /**
60
   * Timestamp of date at which the tax rules and rates in effect applies for the calculation.
61
   * Measured in seconds since the Unix epoch. Can be up to 48 hours in the past, and up to 48 hours
62
   * in the future.
63
   */
64
  @SerializedName("tax_date")
65
  Long taxDate;
66

67
  private CalculationCreateParams(
68
      String currency,
69
      String customer,
70
      CustomerDetails customerDetails,
71
      List<String> expand,
72
      Map<String, Object> extraParams,
73
      List<CalculationCreateParams.LineItem> lineItems,
74
      ShipFromDetails shipFromDetails,
75
      ShippingCost shippingCost,
76
      Long taxDate) {
1✔
77
    this.currency = currency;
1✔
78
    this.customer = customer;
1✔
79
    this.customerDetails = customerDetails;
1✔
80
    this.expand = expand;
1✔
81
    this.extraParams = extraParams;
1✔
82
    this.lineItems = lineItems;
1✔
83
    this.shipFromDetails = shipFromDetails;
1✔
84
    this.shippingCost = shippingCost;
1✔
85
    this.taxDate = taxDate;
1✔
86
  }
1✔
87

88
  public static Builder builder() {
89
    return new Builder();
1✔
90
  }
91

92
  public static class Builder {
1✔
93
    private String currency;
94

95
    private String customer;
96

97
    private CustomerDetails customerDetails;
98

99
    private List<String> expand;
100

101
    private Map<String, Object> extraParams;
102

103
    private List<CalculationCreateParams.LineItem> lineItems;
104

105
    private ShipFromDetails shipFromDetails;
106

107
    private ShippingCost shippingCost;
108

109
    private Long taxDate;
110

111
    /** Finalize and obtain parameter instance from this builder. */
112
    public CalculationCreateParams build() {
113
      return new CalculationCreateParams(
1✔
114
          this.currency,
115
          this.customer,
116
          this.customerDetails,
117
          this.expand,
118
          this.extraParams,
119
          this.lineItems,
120
          this.shipFromDetails,
121
          this.shippingCost,
122
          this.taxDate);
123
    }
124

125
    /**
126
     * <strong>Required.</strong> Three-letter <a
127
     * href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase.
128
     * Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
129
     */
130
    public Builder setCurrency(String currency) {
131
      this.currency = currency;
1✔
132
      return this;
1✔
133
    }
134

135
    /**
136
     * The ID of an existing customer to use for this calculation. If provided, the customer's
137
     * address and tax IDs are copied to {@code customer_details}.
138
     */
139
    public Builder setCustomer(String customer) {
140
      this.customer = customer;
×
141
      return this;
×
142
    }
143

144
    /** Details about the customer, including address and tax IDs. */
145
    public Builder setCustomerDetails(CalculationCreateParams.CustomerDetails customerDetails) {
146
      this.customerDetails = customerDetails;
1✔
147
      return this;
1✔
148
    }
149

150
    /**
151
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
152
     * subsequent calls adds additional elements to the original list. See {@link
153
     * CalculationCreateParams#expand} for the field documentation.
154
     */
155
    public Builder addExpand(String element) {
156
      if (this.expand == null) {
×
157
        this.expand = new ArrayList<>();
×
158
      }
159
      this.expand.add(element);
×
160
      return this;
×
161
    }
162

163
    /**
164
     * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
165
     * subsequent calls adds additional elements to the original list. See {@link
166
     * CalculationCreateParams#expand} for the field documentation.
167
     */
168
    public Builder addAllExpand(List<String> elements) {
169
      if (this.expand == null) {
×
170
        this.expand = new ArrayList<>();
×
171
      }
172
      this.expand.addAll(elements);
×
173
      return this;
×
174
    }
175

176
    /**
177
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
178
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
179
     * CalculationCreateParams#extraParams} for the field documentation.
180
     */
181
    public Builder putExtraParam(String key, Object value) {
182
      if (this.extraParams == null) {
×
183
        this.extraParams = new HashMap<>();
×
184
      }
185
      this.extraParams.put(key, value);
×
186
      return this;
×
187
    }
188

189
    /**
190
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
191
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
192
     * See {@link CalculationCreateParams#extraParams} for the field documentation.
193
     */
194
    public Builder putAllExtraParam(Map<String, Object> map) {
195
      if (this.extraParams == null) {
×
196
        this.extraParams = new HashMap<>();
×
197
      }
198
      this.extraParams.putAll(map);
×
199
      return this;
×
200
    }
201

202
    /**
203
     * Add an element to `lineItems` list. A list is initialized for the first `add/addAll` call,
204
     * and subsequent calls adds additional elements to the original list. See {@link
205
     * CalculationCreateParams#lineItems} for the field documentation.
206
     */
207
    public Builder addLineItem(CalculationCreateParams.LineItem element) {
208
      if (this.lineItems == null) {
1✔
209
        this.lineItems = new ArrayList<>();
1✔
210
      }
211
      this.lineItems.add(element);
1✔
212
      return this;
1✔
213
    }
214

215
    /**
216
     * Add all elements to `lineItems` list. A list is initialized for the first `add/addAll` call,
217
     * and subsequent calls adds additional elements to the original list. See {@link
218
     * CalculationCreateParams#lineItems} for the field documentation.
219
     */
220
    public Builder addAllLineItem(List<CalculationCreateParams.LineItem> elements) {
221
      if (this.lineItems == null) {
×
222
        this.lineItems = new ArrayList<>();
×
223
      }
224
      this.lineItems.addAll(elements);
×
225
      return this;
×
226
    }
227

228
    /** Details about the address from which the goods are being shipped. */
229
    public Builder setShipFromDetails(CalculationCreateParams.ShipFromDetails shipFromDetails) {
230
      this.shipFromDetails = shipFromDetails;
×
231
      return this;
×
232
    }
233

234
    /** Shipping cost details to be used for the calculation. */
235
    public Builder setShippingCost(CalculationCreateParams.ShippingCost shippingCost) {
236
      this.shippingCost = shippingCost;
×
237
      return this;
×
238
    }
239

240
    /**
241
     * Timestamp of date at which the tax rules and rates in effect applies for the calculation.
242
     * Measured in seconds since the Unix epoch. Can be up to 48 hours in the past, and up to 48
243
     * hours in the future.
244
     */
245
    public Builder setTaxDate(Long taxDate) {
246
      this.taxDate = taxDate;
×
247
      return this;
×
248
    }
249
  }
250

251
  @Getter
252
  public static class CustomerDetails {
253
    /** The customer's postal address (for example, home or business location). */
254
    @SerializedName("address")
255
    Address address;
256

257
    /** The type of customer address provided. */
258
    @SerializedName("address_source")
259
    AddressSource addressSource;
260

261
    /**
262
     * Map of extra parameters for custom features not available in this client library. The content
263
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
264
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
265
     * param object. Effectively, this map is flattened to its parent instance.
266
     */
267
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
268
    Map<String, Object> extraParams;
269

270
    /** The customer's IP address (IPv4 or IPv6). */
271
    @SerializedName("ip_address")
272
    String ipAddress;
273

274
    /**
275
     * The customer's tax IDs. Stripe Tax might consider a transaction with applicable tax IDs to be
276
     * B2B, which might affect the tax calculation result. Stripe Tax doesn't validate tax IDs for
277
     * correctness.
278
     */
279
    @SerializedName("tax_ids")
280
    List<CalculationCreateParams.CustomerDetails.TaxId> taxIds;
281

282
    /**
283
     * Overrides the tax calculation result to allow you to not collect tax from your customer. Use
284
     * this if you've manually checked your customer's tax exemptions. Prefer providing the
285
     * customer's {@code tax_ids} where possible, which automatically determines whether {@code
286
     * reverse_charge} applies.
287
     */
288
    @SerializedName("taxability_override")
289
    TaxabilityOverride taxabilityOverride;
290

291
    private CustomerDetails(
292
        Address address,
293
        AddressSource addressSource,
294
        Map<String, Object> extraParams,
295
        String ipAddress,
296
        List<CalculationCreateParams.CustomerDetails.TaxId> taxIds,
297
        TaxabilityOverride taxabilityOverride) {
1✔
298
      this.address = address;
1✔
299
      this.addressSource = addressSource;
1✔
300
      this.extraParams = extraParams;
1✔
301
      this.ipAddress = ipAddress;
1✔
302
      this.taxIds = taxIds;
1✔
303
      this.taxabilityOverride = taxabilityOverride;
1✔
304
    }
1✔
305

306
    public static Builder builder() {
307
      return new Builder();
1✔
308
    }
309

310
    public static class Builder {
1✔
311
      private Address address;
312

313
      private AddressSource addressSource;
314

315
      private Map<String, Object> extraParams;
316

317
      private String ipAddress;
318

319
      private List<CalculationCreateParams.CustomerDetails.TaxId> taxIds;
320

321
      private TaxabilityOverride taxabilityOverride;
322

323
      /** Finalize and obtain parameter instance from this builder. */
324
      public CalculationCreateParams.CustomerDetails build() {
325
        return new CalculationCreateParams.CustomerDetails(
1✔
326
            this.address,
327
            this.addressSource,
328
            this.extraParams,
329
            this.ipAddress,
330
            this.taxIds,
331
            this.taxabilityOverride);
332
      }
333

334
      /** The customer's postal address (for example, home or business location). */
335
      public Builder setAddress(CalculationCreateParams.CustomerDetails.Address address) {
336
        this.address = address;
1✔
337
        return this;
1✔
338
      }
339

340
      /** The type of customer address provided. */
341
      public Builder setAddressSource(
342
          CalculationCreateParams.CustomerDetails.AddressSource addressSource) {
343
        this.addressSource = addressSource;
1✔
344
        return this;
1✔
345
      }
346

347
      /**
348
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
349
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
350
       * CalculationCreateParams.CustomerDetails#extraParams} for the field documentation.
351
       */
352
      public Builder putExtraParam(String key, Object value) {
353
        if (this.extraParams == null) {
×
354
          this.extraParams = new HashMap<>();
×
355
        }
356
        this.extraParams.put(key, value);
×
357
        return this;
×
358
      }
359

360
      /**
361
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
362
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
363
       * See {@link CalculationCreateParams.CustomerDetails#extraParams} for the field
364
       * documentation.
365
       */
366
      public Builder putAllExtraParam(Map<String, Object> map) {
367
        if (this.extraParams == null) {
×
368
          this.extraParams = new HashMap<>();
×
369
        }
370
        this.extraParams.putAll(map);
×
371
        return this;
×
372
      }
373

374
      /** The customer's IP address (IPv4 or IPv6). */
375
      public Builder setIpAddress(String ipAddress) {
376
        this.ipAddress = ipAddress;
×
377
        return this;
×
378
      }
379

380
      /**
381
       * Add an element to `taxIds` list. A list is initialized for the first `add/addAll` call, and
382
       * subsequent calls adds additional elements to the original list. See {@link
383
       * CalculationCreateParams.CustomerDetails#taxIds} for the field documentation.
384
       */
385
      public Builder addTaxId(CalculationCreateParams.CustomerDetails.TaxId element) {
386
        if (this.taxIds == null) {
×
387
          this.taxIds = new ArrayList<>();
×
388
        }
389
        this.taxIds.add(element);
×
390
        return this;
×
391
      }
392

393
      /**
394
       * Add all elements to `taxIds` list. A list is initialized for the first `add/addAll` call,
395
       * and subsequent calls adds additional elements to the original list. See {@link
396
       * CalculationCreateParams.CustomerDetails#taxIds} for the field documentation.
397
       */
398
      public Builder addAllTaxId(List<CalculationCreateParams.CustomerDetails.TaxId> elements) {
399
        if (this.taxIds == null) {
×
400
          this.taxIds = new ArrayList<>();
×
401
        }
402
        this.taxIds.addAll(elements);
×
403
        return this;
×
404
      }
405

406
      /**
407
       * Overrides the tax calculation result to allow you to not collect tax from your customer.
408
       * Use this if you've manually checked your customer's tax exemptions. Prefer providing the
409
       * customer's {@code tax_ids} where possible, which automatically determines whether {@code
410
       * reverse_charge} applies.
411
       */
412
      public Builder setTaxabilityOverride(
413
          CalculationCreateParams.CustomerDetails.TaxabilityOverride taxabilityOverride) {
414
        this.taxabilityOverride = taxabilityOverride;
×
415
        return this;
×
416
      }
417
    }
418

419
    @Getter
420
    public static class Address {
421
      /** City, district, suburb, town, or village. */
422
      @SerializedName("city")
423
      Object city;
424

425
      /**
426
       * <strong>Required.</strong> Two-letter country code (<a
427
       * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
428
       */
429
      @SerializedName("country")
430
      String country;
431

432
      /**
433
       * Map of extra parameters for custom features not available in this client library. The
434
       * content in this map is not serialized under this field's {@code @SerializedName} value.
435
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
436
       * name in this param object. Effectively, this map is flattened to its parent instance.
437
       */
438
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
439
      Map<String, Object> extraParams;
440

441
      /** Address line 1 (e.g., street, PO Box, or company name). */
442
      @SerializedName("line1")
443
      Object line1;
444

445
      /** Address line 2 (e.g., apartment, suite, unit, or building). */
446
      @SerializedName("line2")
447
      Object line2;
448

449
      /** ZIP or postal code. */
450
      @SerializedName("postal_code")
451
      Object postalCode;
452

453
      /**
454
       * State, county, province, or region. We recommend sending <a
455
       * href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a> subdivision code value when
456
       * possible.
457
       */
458
      @SerializedName("state")
459
      Object state;
460

461
      private Address(
462
          Object city,
463
          String country,
464
          Map<String, Object> extraParams,
465
          Object line1,
466
          Object line2,
467
          Object postalCode,
468
          Object state) {
1✔
469
        this.city = city;
1✔
470
        this.country = country;
1✔
471
        this.extraParams = extraParams;
1✔
472
        this.line1 = line1;
1✔
473
        this.line2 = line2;
1✔
474
        this.postalCode = postalCode;
1✔
475
        this.state = state;
1✔
476
      }
1✔
477

478
      public static Builder builder() {
479
        return new Builder();
1✔
480
      }
481

482
      public static class Builder {
1✔
483
        private Object city;
484

485
        private String country;
486

487
        private Map<String, Object> extraParams;
488

489
        private Object line1;
490

491
        private Object line2;
492

493
        private Object postalCode;
494

495
        private Object state;
496

497
        /** Finalize and obtain parameter instance from this builder. */
498
        public CalculationCreateParams.CustomerDetails.Address build() {
499
          return new CalculationCreateParams.CustomerDetails.Address(
1✔
500
              this.city,
501
              this.country,
502
              this.extraParams,
503
              this.line1,
504
              this.line2,
505
              this.postalCode,
506
              this.state);
507
        }
508

509
        /** City, district, suburb, town, or village. */
510
        public Builder setCity(String city) {
511
          this.city = city;
1✔
512
          return this;
1✔
513
        }
514

515
        /** City, district, suburb, town, or village. */
516
        public Builder setCity(EmptyParam city) {
517
          this.city = city;
×
518
          return this;
×
519
        }
520

521
        /**
522
         * <strong>Required.</strong> Two-letter country code (<a
523
         * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
524
         */
525
        public Builder setCountry(String country) {
526
          this.country = country;
1✔
527
          return this;
1✔
528
        }
529

530
        /**
531
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
532
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
533
         * map. See {@link CalculationCreateParams.CustomerDetails.Address#extraParams} for the
534
         * field documentation.
535
         */
536
        public Builder putExtraParam(String key, Object value) {
537
          if (this.extraParams == null) {
×
538
            this.extraParams = new HashMap<>();
×
539
          }
540
          this.extraParams.put(key, value);
×
541
          return this;
×
542
        }
543

544
        /**
545
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
546
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
547
         * map. See {@link CalculationCreateParams.CustomerDetails.Address#extraParams} for the
548
         * field documentation.
549
         */
550
        public Builder putAllExtraParam(Map<String, Object> map) {
551
          if (this.extraParams == null) {
×
552
            this.extraParams = new HashMap<>();
×
553
          }
554
          this.extraParams.putAll(map);
×
555
          return this;
×
556
        }
557

558
        /** Address line 1 (e.g., street, PO Box, or company name). */
559
        public Builder setLine1(String line1) {
560
          this.line1 = line1;
1✔
561
          return this;
1✔
562
        }
563

564
        /** Address line 1 (e.g., street, PO Box, or company name). */
565
        public Builder setLine1(EmptyParam line1) {
566
          this.line1 = line1;
×
567
          return this;
×
568
        }
569

570
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
571
        public Builder setLine2(String line2) {
572
          this.line2 = line2;
×
573
          return this;
×
574
        }
575

576
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
577
        public Builder setLine2(EmptyParam line2) {
578
          this.line2 = line2;
×
579
          return this;
×
580
        }
581

582
        /** ZIP or postal code. */
583
        public Builder setPostalCode(String postalCode) {
584
          this.postalCode = postalCode;
1✔
585
          return this;
1✔
586
        }
587

588
        /** ZIP or postal code. */
589
        public Builder setPostalCode(EmptyParam postalCode) {
590
          this.postalCode = postalCode;
×
591
          return this;
×
592
        }
593

594
        /**
595
         * State, county, province, or region. We recommend sending <a
596
         * href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a> subdivision code value
597
         * when possible.
598
         */
599
        public Builder setState(String state) {
600
          this.state = state;
1✔
601
          return this;
1✔
602
        }
603

604
        /**
605
         * State, county, province, or region. We recommend sending <a
606
         * href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a> subdivision code value
607
         * when possible.
608
         */
609
        public Builder setState(EmptyParam state) {
610
          this.state = state;
×
611
          return this;
×
612
        }
613
      }
614
    }
615

616
    @Getter
617
    public static class TaxId {
618
      /**
619
       * Map of extra parameters for custom features not available in this client library. The
620
       * content in this map is not serialized under this field's {@code @SerializedName} value.
621
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
622
       * name in this param object. Effectively, this map is flattened to its parent instance.
623
       */
624
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
625
      Map<String, Object> extraParams;
626

627
      /**
628
       * <strong>Required.</strong> Type of the tax ID, one of {@code ad_nrt}, {@code ae_trn},
629
       * {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code au_arn}, {@code
630
       * ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin}, {@code br_cnpj},
631
       * {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code ca_gst_hst}, {@code
632
       * ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code cd_nif}, {@code
633
       * ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code co_nit}, {@code cr_tin},
634
       * {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin}, {@code es_cif}, {@code
635
       * eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code gn_nif}, {@code hk_br},
636
       * {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code
637
       * is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code ke_pin}, {@code kh_tin},
638
       * {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code li_vat}, {@code ma_vat}, {@code
639
       * md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif}, {@code mx_rfc}, {@code my_frp},
640
       * {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code no_vat}, {@code no_voec}, {@code
641
       * np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc}, {@code ph_tin}, {@code ro_tin},
642
       * {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code
643
       * sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code sr_fin}, {@code sv_nit}, {@code th_vat},
644
       * {@code tj_tin}, {@code tr_tin}, {@code tw_vat}, {@code tz_vat}, {@code ua_vat}, {@code
645
       * ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code uz_tin}, {@code uz_vat}, {@code ve_rif},
646
       * {@code vn_tin}, {@code za_vat}, {@code zm_tin}, or {@code zw_tin}
647
       */
648
      @SerializedName("type")
649
      Type type;
650

651
      /** <strong>Required.</strong> Value of the tax ID. */
652
      @SerializedName("value")
653
      String value;
654

655
      private TaxId(Map<String, Object> extraParams, Type type, String value) {
×
656
        this.extraParams = extraParams;
×
657
        this.type = type;
×
658
        this.value = value;
×
659
      }
×
660

661
      public static Builder builder() {
662
        return new Builder();
×
663
      }
664

665
      public static class Builder {
×
666
        private Map<String, Object> extraParams;
667

668
        private Type type;
669

670
        private String value;
671

672
        /** Finalize and obtain parameter instance from this builder. */
673
        public CalculationCreateParams.CustomerDetails.TaxId build() {
674
          return new CalculationCreateParams.CustomerDetails.TaxId(
×
675
              this.extraParams, this.type, this.value);
676
        }
677

678
        /**
679
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
680
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
681
         * map. See {@link CalculationCreateParams.CustomerDetails.TaxId#extraParams} for the field
682
         * documentation.
683
         */
684
        public Builder putExtraParam(String key, Object value) {
685
          if (this.extraParams == null) {
×
686
            this.extraParams = new HashMap<>();
×
687
          }
688
          this.extraParams.put(key, value);
×
689
          return this;
×
690
        }
691

692
        /**
693
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
694
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
695
         * map. See {@link CalculationCreateParams.CustomerDetails.TaxId#extraParams} for the field
696
         * documentation.
697
         */
698
        public Builder putAllExtraParam(Map<String, Object> map) {
699
          if (this.extraParams == null) {
×
700
            this.extraParams = new HashMap<>();
×
701
          }
702
          this.extraParams.putAll(map);
×
703
          return this;
×
704
        }
705

706
        /**
707
         * <strong>Required.</strong> Type of the tax ID, one of {@code ad_nrt}, {@code ae_trn},
708
         * {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code au_arn}, {@code
709
         * ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin}, {@code br_cnpj},
710
         * {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code ca_gst_hst}, {@code
711
         * ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code cd_nif}, {@code
712
         * ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code co_nit}, {@code cr_tin},
713
         * {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin}, {@code es_cif}, {@code
714
         * eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code gn_nif}, {@code
715
         * hk_br}, {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst},
716
         * {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code ke_pin}, {@code
717
         * kh_tin}, {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code li_vat}, {@code ma_vat},
718
         * {@code md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif}, {@code mx_rfc}, {@code
719
         * my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code no_vat}, {@code no_voec},
720
         * {@code np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc}, {@code ph_tin}, {@code
721
         * ro_tin}, {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst},
722
         * {@code sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code sr_fin}, {@code sv_nit}, {@code
723
         * th_vat}, {@code tj_tin}, {@code tr_tin}, {@code tw_vat}, {@code tz_vat}, {@code ua_vat},
724
         * {@code ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code uz_tin}, {@code uz_vat}, {@code
725
         * ve_rif}, {@code vn_tin}, {@code za_vat}, {@code zm_tin}, or {@code zw_tin}
726
         */
727
        public Builder setType(CalculationCreateParams.CustomerDetails.TaxId.Type type) {
728
          this.type = type;
×
729
          return this;
×
730
        }
731

732
        /** <strong>Required.</strong> Value of the tax ID. */
733
        public Builder setValue(String value) {
734
          this.value = value;
×
735
          return this;
×
736
        }
737
      }
738

739
      public enum Type implements ApiRequestParams.EnumParam {
×
740
        @SerializedName("ad_nrt")
×
741
        AD_NRT("ad_nrt"),
742

743
        @SerializedName("ae_trn")
×
744
        AE_TRN("ae_trn"),
745

NEW
746
        @SerializedName("am_tin")
×
747
        AM_TIN("am_tin"),
748

NEW
749
        @SerializedName("ao_tin")
×
750
        AO_TIN("ao_tin"),
751

UNCOV
752
        @SerializedName("ar_cuit")
×
753
        AR_CUIT("ar_cuit"),
754

755
        @SerializedName("au_abn")
×
756
        AU_ABN("au_abn"),
757

758
        @SerializedName("au_arn")
×
759
        AU_ARN("au_arn"),
760

NEW
761
        @SerializedName("ba_tin")
×
762
        BA_TIN("ba_tin"),
763

NEW
764
        @SerializedName("bb_tin")
×
765
        BB_TIN("bb_tin"),
766

UNCOV
767
        @SerializedName("bg_uic")
×
768
        BG_UIC("bg_uic"),
769

770
        @SerializedName("bh_vat")
×
771
        BH_VAT("bh_vat"),
772

773
        @SerializedName("bo_tin")
×
774
        BO_TIN("bo_tin"),
775

776
        @SerializedName("br_cnpj")
×
777
        BR_CNPJ("br_cnpj"),
778

779
        @SerializedName("br_cpf")
×
780
        BR_CPF("br_cpf"),
781

NEW
782
        @SerializedName("bs_tin")
×
783
        BS_TIN("bs_tin"),
784

UNCOV
785
        @SerializedName("by_tin")
×
786
        BY_TIN("by_tin"),
787

788
        @SerializedName("ca_bn")
×
789
        CA_BN("ca_bn"),
790

791
        @SerializedName("ca_gst_hst")
×
792
        CA_GST_HST("ca_gst_hst"),
793

794
        @SerializedName("ca_pst_bc")
×
795
        CA_PST_BC("ca_pst_bc"),
796

797
        @SerializedName("ca_pst_mb")
×
798
        CA_PST_MB("ca_pst_mb"),
799

800
        @SerializedName("ca_pst_sk")
×
801
        CA_PST_SK("ca_pst_sk"),
802

803
        @SerializedName("ca_qst")
×
804
        CA_QST("ca_qst"),
805

NEW
806
        @SerializedName("cd_nif")
×
807
        CD_NIF("cd_nif"),
808

UNCOV
809
        @SerializedName("ch_uid")
×
810
        CH_UID("ch_uid"),
811

812
        @SerializedName("ch_vat")
×
813
        CH_VAT("ch_vat"),
814

815
        @SerializedName("cl_tin")
×
816
        CL_TIN("cl_tin"),
817

818
        @SerializedName("cn_tin")
×
819
        CN_TIN("cn_tin"),
820

821
        @SerializedName("co_nit")
×
822
        CO_NIT("co_nit"),
823

824
        @SerializedName("cr_tin")
×
825
        CR_TIN("cr_tin"),
826

827
        @SerializedName("de_stn")
×
828
        DE_STN("de_stn"),
829

830
        @SerializedName("do_rcn")
×
831
        DO_RCN("do_rcn"),
832

833
        @SerializedName("ec_ruc")
×
834
        EC_RUC("ec_ruc"),
835

836
        @SerializedName("eg_tin")
×
837
        EG_TIN("eg_tin"),
838

839
        @SerializedName("es_cif")
×
840
        ES_CIF("es_cif"),
841

842
        @SerializedName("eu_oss_vat")
×
843
        EU_OSS_VAT("eu_oss_vat"),
844

845
        @SerializedName("eu_vat")
×
846
        EU_VAT("eu_vat"),
847

848
        @SerializedName("gb_vat")
×
849
        GB_VAT("gb_vat"),
850

851
        @SerializedName("ge_vat")
×
852
        GE_VAT("ge_vat"),
853

NEW
854
        @SerializedName("gn_nif")
×
855
        GN_NIF("gn_nif"),
856

UNCOV
857
        @SerializedName("hk_br")
×
858
        HK_BR("hk_br"),
859

860
        @SerializedName("hr_oib")
×
861
        HR_OIB("hr_oib"),
862

863
        @SerializedName("hu_tin")
×
864
        HU_TIN("hu_tin"),
865

866
        @SerializedName("id_npwp")
×
867
        ID_NPWP("id_npwp"),
868

869
        @SerializedName("il_vat")
×
870
        IL_VAT("il_vat"),
871

872
        @SerializedName("in_gst")
×
873
        IN_GST("in_gst"),
874

875
        @SerializedName("is_vat")
×
876
        IS_VAT("is_vat"),
877

878
        @SerializedName("jp_cn")
×
879
        JP_CN("jp_cn"),
880

881
        @SerializedName("jp_rn")
×
882
        JP_RN("jp_rn"),
883

884
        @SerializedName("jp_trn")
×
885
        JP_TRN("jp_trn"),
886

887
        @SerializedName("ke_pin")
×
888
        KE_PIN("ke_pin"),
889

NEW
890
        @SerializedName("kh_tin")
×
891
        KH_TIN("kh_tin"),
892

UNCOV
893
        @SerializedName("kr_brn")
×
894
        KR_BRN("kr_brn"),
895

896
        @SerializedName("kz_bin")
×
897
        KZ_BIN("kz_bin"),
898

899
        @SerializedName("li_uid")
×
900
        LI_UID("li_uid"),
901

902
        @SerializedName("li_vat")
×
903
        LI_VAT("li_vat"),
904

905
        @SerializedName("ma_vat")
×
906
        MA_VAT("ma_vat"),
907

908
        @SerializedName("md_vat")
×
909
        MD_VAT("md_vat"),
910

NEW
911
        @SerializedName("me_pib")
×
912
        ME_PIB("me_pib"),
913

NEW
914
        @SerializedName("mk_vat")
×
915
        MK_VAT("mk_vat"),
916

NEW
917
        @SerializedName("mr_nif")
×
918
        MR_NIF("mr_nif"),
919

UNCOV
920
        @SerializedName("mx_rfc")
×
921
        MX_RFC("mx_rfc"),
922

923
        @SerializedName("my_frp")
×
924
        MY_FRP("my_frp"),
925

926
        @SerializedName("my_itn")
×
927
        MY_ITN("my_itn"),
928

929
        @SerializedName("my_sst")
×
930
        MY_SST("my_sst"),
931

932
        @SerializedName("ng_tin")
×
933
        NG_TIN("ng_tin"),
934

935
        @SerializedName("no_vat")
×
936
        NO_VAT("no_vat"),
937

938
        @SerializedName("no_voec")
×
939
        NO_VOEC("no_voec"),
940

NEW
941
        @SerializedName("np_pan")
×
942
        NP_PAN("np_pan"),
943

UNCOV
944
        @SerializedName("nz_gst")
×
945
        NZ_GST("nz_gst"),
946

947
        @SerializedName("om_vat")
×
948
        OM_VAT("om_vat"),
949

950
        @SerializedName("pe_ruc")
×
951
        PE_RUC("pe_ruc"),
952

953
        @SerializedName("ph_tin")
×
954
        PH_TIN("ph_tin"),
955

956
        @SerializedName("ro_tin")
×
957
        RO_TIN("ro_tin"),
958

959
        @SerializedName("rs_pib")
×
960
        RS_PIB("rs_pib"),
961

962
        @SerializedName("ru_inn")
×
963
        RU_INN("ru_inn"),
964

965
        @SerializedName("ru_kpp")
×
966
        RU_KPP("ru_kpp"),
967

968
        @SerializedName("sa_vat")
×
969
        SA_VAT("sa_vat"),
970

971
        @SerializedName("sg_gst")
×
972
        SG_GST("sg_gst"),
973

974
        @SerializedName("sg_uen")
×
975
        SG_UEN("sg_uen"),
976

977
        @SerializedName("si_tin")
×
978
        SI_TIN("si_tin"),
979

NEW
980
        @SerializedName("sn_ninea")
×
981
        SN_NINEA("sn_ninea"),
982

NEW
983
        @SerializedName("sr_fin")
×
984
        SR_FIN("sr_fin"),
985

UNCOV
986
        @SerializedName("sv_nit")
×
987
        SV_NIT("sv_nit"),
988

989
        @SerializedName("th_vat")
×
990
        TH_VAT("th_vat"),
991

NEW
992
        @SerializedName("tj_tin")
×
993
        TJ_TIN("tj_tin"),
994

UNCOV
995
        @SerializedName("tr_tin")
×
996
        TR_TIN("tr_tin"),
997

998
        @SerializedName("tw_vat")
×
999
        TW_VAT("tw_vat"),
1000

1001
        @SerializedName("tz_vat")
×
1002
        TZ_VAT("tz_vat"),
1003

1004
        @SerializedName("ua_vat")
×
1005
        UA_VAT("ua_vat"),
1006

NEW
1007
        @SerializedName("ug_tin")
×
1008
        UG_TIN("ug_tin"),
1009

UNCOV
1010
        @SerializedName("us_ein")
×
1011
        US_EIN("us_ein"),
1012

1013
        @SerializedName("uy_ruc")
×
1014
        UY_RUC("uy_ruc"),
1015

1016
        @SerializedName("uz_tin")
×
1017
        UZ_TIN("uz_tin"),
1018

1019
        @SerializedName("uz_vat")
×
1020
        UZ_VAT("uz_vat"),
1021

1022
        @SerializedName("ve_rif")
×
1023
        VE_RIF("ve_rif"),
1024

1025
        @SerializedName("vn_tin")
×
1026
        VN_TIN("vn_tin"),
1027

1028
        @SerializedName("za_vat")
×
1029
        ZA_VAT("za_vat"),
1030

NEW
1031
        @SerializedName("zm_tin")
×
1032
        ZM_TIN("zm_tin"),
1033

NEW
1034
        @SerializedName("zw_tin")
×
1035
        ZW_TIN("zw_tin");
1036

1037
        @Getter(onMethod_ = {@Override})
1038
        private final String value;
1039

1040
        Type(String value) {
×
1041
          this.value = value;
×
1042
        }
×
1043
      }
1044
    }
1045

1046
    public enum AddressSource implements ApiRequestParams.EnumParam {
1✔
1047
      @SerializedName("billing")
1✔
1048
      BILLING("billing"),
1049

1050
      @SerializedName("shipping")
1✔
1051
      SHIPPING("shipping");
1052

1053
      @Getter(onMethod_ = {@Override})
1054
      private final String value;
1055

1056
      AddressSource(String value) {
1✔
1057
        this.value = value;
1✔
1058
      }
1✔
1059
    }
1060

1061
    public enum TaxabilityOverride implements ApiRequestParams.EnumParam {
×
1062
      @SerializedName("customer_exempt")
×
1063
      CUSTOMER_EXEMPT("customer_exempt"),
1064

1065
      @SerializedName("none")
×
1066
      NONE("none"),
1067

1068
      @SerializedName("reverse_charge")
×
1069
      REVERSE_CHARGE("reverse_charge");
1070

1071
      @Getter(onMethod_ = {@Override})
1072
      private final String value;
1073

1074
      TaxabilityOverride(String value) {
×
1075
        this.value = value;
×
1076
      }
×
1077
    }
1078
  }
1079

1080
  @Getter
1081
  public static class LineItem {
1082
    /**
1083
     * <strong>Required.</strong> A positive integer representing the line item's total price in the
1084
     * <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. If
1085
     * {@code tax_behavior=inclusive}, then this amount includes taxes. Otherwise, taxes are
1086
     * calculated on top of this amount.
1087
     */
1088
    @SerializedName("amount")
1089
    Long amount;
1090

1091
    /**
1092
     * Map of extra parameters for custom features not available in this client library. The content
1093
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1094
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1095
     * param object. Effectively, this map is flattened to its parent instance.
1096
     */
1097
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1098
    Map<String, Object> extraParams;
1099

1100
    /**
1101
     * If provided, the product's {@code tax_code} will be used as the line item's {@code tax_code}.
1102
     */
1103
    @SerializedName("product")
1104
    String product;
1105

1106
    /**
1107
     * The number of units of the item being purchased. Used to calculate the per-unit price from
1108
     * the total {@code amount} for the line. For example, if {@code amount=100} and {@code
1109
     * quantity=4}, the calculated unit price is 25.
1110
     */
1111
    @SerializedName("quantity")
1112
    Long quantity;
1113

1114
    /**
1115
     * A custom identifier for this line item, which must be unique across the line items in the
1116
     * calculation. The reference helps identify each line item in exported <a
1117
     * href="https://stripe.com/docs/tax/reports">tax reports</a>.
1118
     */
1119
    @SerializedName("reference")
1120
    String reference;
1121

1122
    /** Specifies whether the {@code amount} includes taxes. Defaults to {@code exclusive}. */
1123
    @SerializedName("tax_behavior")
1124
    TaxBehavior taxBehavior;
1125

1126
    /**
1127
     * A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID to use for this line
1128
     * item. If not provided, we will use the tax code from the provided {@code product} param. If
1129
     * neither {@code tax_code} nor {@code product} is provided, we will use the default tax code
1130
     * from your Tax Settings.
1131
     */
1132
    @SerializedName("tax_code")
1133
    String taxCode;
1134

1135
    private LineItem(
1136
        Long amount,
1137
        Map<String, Object> extraParams,
1138
        String product,
1139
        Long quantity,
1140
        String reference,
1141
        TaxBehavior taxBehavior,
1142
        String taxCode) {
1✔
1143
      this.amount = amount;
1✔
1144
      this.extraParams = extraParams;
1✔
1145
      this.product = product;
1✔
1146
      this.quantity = quantity;
1✔
1147
      this.reference = reference;
1✔
1148
      this.taxBehavior = taxBehavior;
1✔
1149
      this.taxCode = taxCode;
1✔
1150
    }
1✔
1151

1152
    public static Builder builder() {
1153
      return new Builder();
1✔
1154
    }
1155

1156
    public static class Builder {
1✔
1157
      private Long amount;
1158

1159
      private Map<String, Object> extraParams;
1160

1161
      private String product;
1162

1163
      private Long quantity;
1164

1165
      private String reference;
1166

1167
      private TaxBehavior taxBehavior;
1168

1169
      private String taxCode;
1170

1171
      /** Finalize and obtain parameter instance from this builder. */
1172
      public CalculationCreateParams.LineItem build() {
1173
        return new CalculationCreateParams.LineItem(
1✔
1174
            this.amount,
1175
            this.extraParams,
1176
            this.product,
1177
            this.quantity,
1178
            this.reference,
1179
            this.taxBehavior,
1180
            this.taxCode);
1181
      }
1182

1183
      /**
1184
       * <strong>Required.</strong> A positive integer representing the line item's total price in
1185
       * the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
1186
       * If {@code tax_behavior=inclusive}, then this amount includes taxes. Otherwise, taxes are
1187
       * calculated on top of this amount.
1188
       */
1189
      public Builder setAmount(Long amount) {
1190
        this.amount = amount;
1✔
1191
        return this;
1✔
1192
      }
1193

1194
      /**
1195
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1196
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1197
       * CalculationCreateParams.LineItem#extraParams} for the field documentation.
1198
       */
1199
      public Builder putExtraParam(String key, Object value) {
1200
        if (this.extraParams == null) {
×
1201
          this.extraParams = new HashMap<>();
×
1202
        }
1203
        this.extraParams.put(key, value);
×
1204
        return this;
×
1205
      }
1206

1207
      /**
1208
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1209
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1210
       * See {@link CalculationCreateParams.LineItem#extraParams} for the field documentation.
1211
       */
1212
      public Builder putAllExtraParam(Map<String, Object> map) {
1213
        if (this.extraParams == null) {
×
1214
          this.extraParams = new HashMap<>();
×
1215
        }
1216
        this.extraParams.putAll(map);
×
1217
        return this;
×
1218
      }
1219

1220
      /**
1221
       * If provided, the product's {@code tax_code} will be used as the line item's {@code
1222
       * tax_code}.
1223
       */
1224
      public Builder setProduct(String product) {
1225
        this.product = product;
×
1226
        return this;
×
1227
      }
1228

1229
      /**
1230
       * The number of units of the item being purchased. Used to calculate the per-unit price from
1231
       * the total {@code amount} for the line. For example, if {@code amount=100} and {@code
1232
       * quantity=4}, the calculated unit price is 25.
1233
       */
1234
      public Builder setQuantity(Long quantity) {
1235
        this.quantity = quantity;
×
1236
        return this;
×
1237
      }
1238

1239
      /**
1240
       * A custom identifier for this line item, which must be unique across the line items in the
1241
       * calculation. The reference helps identify each line item in exported <a
1242
       * href="https://stripe.com/docs/tax/reports">tax reports</a>.
1243
       */
1244
      public Builder setReference(String reference) {
1245
        this.reference = reference;
1✔
1246
        return this;
1✔
1247
      }
1248

1249
      /** Specifies whether the {@code amount} includes taxes. Defaults to {@code exclusive}. */
1250
      public Builder setTaxBehavior(CalculationCreateParams.LineItem.TaxBehavior taxBehavior) {
1251
        this.taxBehavior = taxBehavior;
×
1252
        return this;
×
1253
      }
1254

1255
      /**
1256
       * A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID to use for this line
1257
       * item. If not provided, we will use the tax code from the provided {@code product} param. If
1258
       * neither {@code tax_code} nor {@code product} is provided, we will use the default tax code
1259
       * from your Tax Settings.
1260
       */
1261
      public Builder setTaxCode(String taxCode) {
1262
        this.taxCode = taxCode;
×
1263
        return this;
×
1264
      }
1265
    }
1266

1267
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1268
      @SerializedName("exclusive")
×
1269
      EXCLUSIVE("exclusive"),
1270

1271
      @SerializedName("inclusive")
×
1272
      INCLUSIVE("inclusive");
1273

1274
      @Getter(onMethod_ = {@Override})
1275
      private final String value;
1276

1277
      TaxBehavior(String value) {
×
1278
        this.value = value;
×
1279
      }
×
1280
    }
1281
  }
1282

1283
  @Getter
1284
  public static class ShipFromDetails {
1285
    /** <strong>Required.</strong> The address from which the goods are being shipped from. */
1286
    @SerializedName("address")
1287
    Address address;
1288

1289
    /**
1290
     * Map of extra parameters for custom features not available in this client library. The content
1291
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1292
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1293
     * param object. Effectively, this map is flattened to its parent instance.
1294
     */
1295
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1296
    Map<String, Object> extraParams;
1297

1298
    private ShipFromDetails(Address address, Map<String, Object> extraParams) {
×
1299
      this.address = address;
×
1300
      this.extraParams = extraParams;
×
1301
    }
×
1302

1303
    public static Builder builder() {
1304
      return new Builder();
×
1305
    }
1306

1307
    public static class Builder {
×
1308
      private Address address;
1309

1310
      private Map<String, Object> extraParams;
1311

1312
      /** Finalize and obtain parameter instance from this builder. */
1313
      public CalculationCreateParams.ShipFromDetails build() {
1314
        return new CalculationCreateParams.ShipFromDetails(this.address, this.extraParams);
×
1315
      }
1316

1317
      /** <strong>Required.</strong> The address from which the goods are being shipped from. */
1318
      public Builder setAddress(CalculationCreateParams.ShipFromDetails.Address address) {
1319
        this.address = address;
×
1320
        return this;
×
1321
      }
1322

1323
      /**
1324
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1325
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1326
       * CalculationCreateParams.ShipFromDetails#extraParams} for the field documentation.
1327
       */
1328
      public Builder putExtraParam(String key, Object value) {
1329
        if (this.extraParams == null) {
×
1330
          this.extraParams = new HashMap<>();
×
1331
        }
1332
        this.extraParams.put(key, value);
×
1333
        return this;
×
1334
      }
1335

1336
      /**
1337
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1338
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1339
       * See {@link CalculationCreateParams.ShipFromDetails#extraParams} for the field
1340
       * documentation.
1341
       */
1342
      public Builder putAllExtraParam(Map<String, Object> map) {
1343
        if (this.extraParams == null) {
×
1344
          this.extraParams = new HashMap<>();
×
1345
        }
1346
        this.extraParams.putAll(map);
×
1347
        return this;
×
1348
      }
1349
    }
1350

1351
    @Getter
1352
    public static class Address {
1353
      /** City, district, suburb, town, or village. */
1354
      @SerializedName("city")
1355
      Object city;
1356

1357
      /**
1358
       * <strong>Required.</strong> Two-letter country code (<a
1359
       * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1360
       */
1361
      @SerializedName("country")
1362
      String country;
1363

1364
      /**
1365
       * Map of extra parameters for custom features not available in this client library. The
1366
       * content in this map is not serialized under this field's {@code @SerializedName} value.
1367
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
1368
       * name in this param object. Effectively, this map is flattened to its parent instance.
1369
       */
1370
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1371
      Map<String, Object> extraParams;
1372

1373
      /** Address line 1 (e.g., street, PO Box, or company name). */
1374
      @SerializedName("line1")
1375
      Object line1;
1376

1377
      /** Address line 2 (e.g., apartment, suite, unit, or building). */
1378
      @SerializedName("line2")
1379
      Object line2;
1380

1381
      /** ZIP or postal code. */
1382
      @SerializedName("postal_code")
1383
      Object postalCode;
1384

1385
      /**
1386
       * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1387
       * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1388
       */
1389
      @SerializedName("state")
1390
      Object state;
1391

1392
      private Address(
1393
          Object city,
1394
          String country,
1395
          Map<String, Object> extraParams,
1396
          Object line1,
1397
          Object line2,
1398
          Object postalCode,
1399
          Object state) {
×
1400
        this.city = city;
×
1401
        this.country = country;
×
1402
        this.extraParams = extraParams;
×
1403
        this.line1 = line1;
×
1404
        this.line2 = line2;
×
1405
        this.postalCode = postalCode;
×
1406
        this.state = state;
×
1407
      }
×
1408

1409
      public static Builder builder() {
1410
        return new Builder();
×
1411
      }
1412

1413
      public static class Builder {
×
1414
        private Object city;
1415

1416
        private String country;
1417

1418
        private Map<String, Object> extraParams;
1419

1420
        private Object line1;
1421

1422
        private Object line2;
1423

1424
        private Object postalCode;
1425

1426
        private Object state;
1427

1428
        /** Finalize and obtain parameter instance from this builder. */
1429
        public CalculationCreateParams.ShipFromDetails.Address build() {
1430
          return new CalculationCreateParams.ShipFromDetails.Address(
×
1431
              this.city,
1432
              this.country,
1433
              this.extraParams,
1434
              this.line1,
1435
              this.line2,
1436
              this.postalCode,
1437
              this.state);
1438
        }
1439

1440
        /** City, district, suburb, town, or village. */
1441
        public Builder setCity(String city) {
1442
          this.city = city;
×
1443
          return this;
×
1444
        }
1445

1446
        /** City, district, suburb, town, or village. */
1447
        public Builder setCity(EmptyParam city) {
1448
          this.city = city;
×
1449
          return this;
×
1450
        }
1451

1452
        /**
1453
         * <strong>Required.</strong> Two-letter country code (<a
1454
         * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1455
         */
1456
        public Builder setCountry(String country) {
1457
          this.country = country;
×
1458
          return this;
×
1459
        }
1460

1461
        /**
1462
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
1463
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1464
         * map. See {@link CalculationCreateParams.ShipFromDetails.Address#extraParams} for the
1465
         * field documentation.
1466
         */
1467
        public Builder putExtraParam(String key, Object value) {
1468
          if (this.extraParams == null) {
×
1469
            this.extraParams = new HashMap<>();
×
1470
          }
1471
          this.extraParams.put(key, value);
×
1472
          return this;
×
1473
        }
1474

1475
        /**
1476
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1477
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1478
         * map. See {@link CalculationCreateParams.ShipFromDetails.Address#extraParams} for the
1479
         * field documentation.
1480
         */
1481
        public Builder putAllExtraParam(Map<String, Object> map) {
1482
          if (this.extraParams == null) {
×
1483
            this.extraParams = new HashMap<>();
×
1484
          }
1485
          this.extraParams.putAll(map);
×
1486
          return this;
×
1487
        }
1488

1489
        /** Address line 1 (e.g., street, PO Box, or company name). */
1490
        public Builder setLine1(String line1) {
1491
          this.line1 = line1;
×
1492
          return this;
×
1493
        }
1494

1495
        /** Address line 1 (e.g., street, PO Box, or company name). */
1496
        public Builder setLine1(EmptyParam line1) {
1497
          this.line1 = line1;
×
1498
          return this;
×
1499
        }
1500

1501
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1502
        public Builder setLine2(String line2) {
1503
          this.line2 = line2;
×
1504
          return this;
×
1505
        }
1506

1507
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1508
        public Builder setLine2(EmptyParam line2) {
1509
          this.line2 = line2;
×
1510
          return this;
×
1511
        }
1512

1513
        /** ZIP or postal code. */
1514
        public Builder setPostalCode(String postalCode) {
1515
          this.postalCode = postalCode;
×
1516
          return this;
×
1517
        }
1518

1519
        /** ZIP or postal code. */
1520
        public Builder setPostalCode(EmptyParam postalCode) {
1521
          this.postalCode = postalCode;
×
1522
          return this;
×
1523
        }
1524

1525
        /**
1526
         * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1527
         * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1528
         */
1529
        public Builder setState(String state) {
1530
          this.state = state;
×
1531
          return this;
×
1532
        }
1533

1534
        /**
1535
         * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1536
         * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1537
         */
1538
        public Builder setState(EmptyParam state) {
1539
          this.state = state;
×
1540
          return this;
×
1541
        }
1542
      }
1543
    }
1544
  }
1545

1546
  @Getter
1547
  public static class ShippingCost {
1548
    /**
1549
     * A positive integer in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest
1550
     * currency unit</a> representing the shipping charge. If {@code tax_behavior=inclusive}, then
1551
     * this amount includes taxes. Otherwise, taxes are calculated on top of this amount.
1552
     */
1553
    @SerializedName("amount")
1554
    Long amount;
1555

1556
    /**
1557
     * Map of extra parameters for custom features not available in this client library. The content
1558
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1559
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1560
     * param object. Effectively, this map is flattened to its parent instance.
1561
     */
1562
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1563
    Map<String, Object> extraParams;
1564

1565
    /**
1566
     * If provided, the <a href="https://stripe.com/docs/api/shipping_rates/object">shipping
1567
     * rate</a>'s {@code amount}, {@code tax_code} and {@code tax_behavior} are used. If you provide
1568
     * a shipping rate, then you cannot pass the {@code amount}, {@code tax_code}, or {@code
1569
     * tax_behavior} parameters.
1570
     */
1571
    @SerializedName("shipping_rate")
1572
    String shippingRate;
1573

1574
    /**
1575
     * Specifies whether the {@code amount} includes taxes. If {@code tax_behavior=inclusive}, then
1576
     * the amount includes taxes. Defaults to {@code exclusive}.
1577
     */
1578
    @SerializedName("tax_behavior")
1579
    TaxBehavior taxBehavior;
1580

1581
    /**
1582
     * The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> used to calculate tax
1583
     * on shipping. If not provided, the default shipping tax code from your <a
1584
     * href="https://dashboard.stripe.com/settings/tax">Tax Settings</a> is used.
1585
     */
1586
    @SerializedName("tax_code")
1587
    String taxCode;
1588

1589
    private ShippingCost(
1590
        Long amount,
1591
        Map<String, Object> extraParams,
1592
        String shippingRate,
1593
        TaxBehavior taxBehavior,
1594
        String taxCode) {
×
1595
      this.amount = amount;
×
1596
      this.extraParams = extraParams;
×
1597
      this.shippingRate = shippingRate;
×
1598
      this.taxBehavior = taxBehavior;
×
1599
      this.taxCode = taxCode;
×
1600
    }
×
1601

1602
    public static Builder builder() {
1603
      return new Builder();
×
1604
    }
1605

1606
    public static class Builder {
×
1607
      private Long amount;
1608

1609
      private Map<String, Object> extraParams;
1610

1611
      private String shippingRate;
1612

1613
      private TaxBehavior taxBehavior;
1614

1615
      private String taxCode;
1616

1617
      /** Finalize and obtain parameter instance from this builder. */
1618
      public CalculationCreateParams.ShippingCost build() {
1619
        return new CalculationCreateParams.ShippingCost(
×
1620
            this.amount, this.extraParams, this.shippingRate, this.taxBehavior, this.taxCode);
1621
      }
1622

1623
      /**
1624
       * A positive integer in the <a
1625
       * href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>
1626
       * representing the shipping charge. If {@code tax_behavior=inclusive}, then this amount
1627
       * includes taxes. Otherwise, taxes are calculated on top of this amount.
1628
       */
1629
      public Builder setAmount(Long amount) {
1630
        this.amount = amount;
×
1631
        return this;
×
1632
      }
1633

1634
      /**
1635
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1636
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1637
       * CalculationCreateParams.ShippingCost#extraParams} for the field documentation.
1638
       */
1639
      public Builder putExtraParam(String key, Object value) {
1640
        if (this.extraParams == null) {
×
1641
          this.extraParams = new HashMap<>();
×
1642
        }
1643
        this.extraParams.put(key, value);
×
1644
        return this;
×
1645
      }
1646

1647
      /**
1648
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1649
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1650
       * See {@link CalculationCreateParams.ShippingCost#extraParams} for the field documentation.
1651
       */
1652
      public Builder putAllExtraParam(Map<String, Object> map) {
1653
        if (this.extraParams == null) {
×
1654
          this.extraParams = new HashMap<>();
×
1655
        }
1656
        this.extraParams.putAll(map);
×
1657
        return this;
×
1658
      }
1659

1660
      /**
1661
       * If provided, the <a href="https://stripe.com/docs/api/shipping_rates/object">shipping
1662
       * rate</a>'s {@code amount}, {@code tax_code} and {@code tax_behavior} are used. If you
1663
       * provide a shipping rate, then you cannot pass the {@code amount}, {@code tax_code}, or
1664
       * {@code tax_behavior} parameters.
1665
       */
1666
      public Builder setShippingRate(String shippingRate) {
1667
        this.shippingRate = shippingRate;
×
1668
        return this;
×
1669
      }
1670

1671
      /**
1672
       * Specifies whether the {@code amount} includes taxes. If {@code tax_behavior=inclusive},
1673
       * then the amount includes taxes. Defaults to {@code exclusive}.
1674
       */
1675
      public Builder setTaxBehavior(CalculationCreateParams.ShippingCost.TaxBehavior taxBehavior) {
1676
        this.taxBehavior = taxBehavior;
×
1677
        return this;
×
1678
      }
1679

1680
      /**
1681
       * The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> used to calculate tax
1682
       * on shipping. If not provided, the default shipping tax code from your <a
1683
       * href="https://dashboard.stripe.com/settings/tax">Tax Settings</a> is used.
1684
       */
1685
      public Builder setTaxCode(String taxCode) {
1686
        this.taxCode = taxCode;
×
1687
        return this;
×
1688
      }
1689
    }
1690

1691
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1692
      @SerializedName("exclusive")
×
1693
      EXCLUSIVE("exclusive"),
1694

1695
      @SerializedName("inclusive")
×
1696
      INCLUSIVE("inclusive");
1697

1698
      @Getter(onMethod_ = {@Override})
1699
      private final String value;
1700

1701
      TaxBehavior(String value) {
×
1702
        this.value = value;
×
1703
      }
×
1704
    }
1705
  }
1706
}
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