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

stripe / stripe-java / #16624

07 Nov 2024 10:04PM UTC coverage: 12.419% (-0.1%) from 12.519%
#16624

push

github

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

Update generated code for beta

17 of 1341 new or added lines in 57 files covered. (1.27%)

33 existing lines in 29 files now uncovered.

18855 of 151828 relevant lines covered (12.42%)

0.12 hits per line

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

21.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 ar_cuit}, {@code au_abn}, {@code au_arn}, {@code bg_uic}, {@code bh_vat}, {@code
630
       * bo_tin}, {@code br_cnpj}, {@code br_cpf}, {@code by_tin}, {@code ca_bn}, {@code
631
       * ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst},
632
       * {@code ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code co_nit}, {@code
633
       * cr_tin}, {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin}, {@code es_cif},
634
       * {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code
635
       * hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat},
636
       * {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code ke_pin}, {@code kr_brn}, {@code
637
       * kz_bin}, {@code li_uid}, {@code li_vat}, {@code ma_vat}, {@code md_vat}, {@code mx_rfc},
638
       * {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code no_vat}, {@code
639
       * no_voec}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc}, {@code ph_tin}, {@code ro_tin},
640
       * {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code
641
       * sg_uen}, {@code si_tin}, {@code sv_nit}, {@code th_vat}, {@code tr_tin}, {@code tw_vat},
642
       * {@code tz_vat}, {@code ua_vat}, {@code us_ein}, {@code uy_ruc}, {@code uz_tin}, {@code
643
       * uz_vat}, {@code ve_rif}, {@code vn_tin}, or {@code za_vat}
644
       */
645
      @SerializedName("type")
646
      Type type;
647

648
      /** <strong>Required.</strong> Value of the tax ID. */
649
      @SerializedName("value")
650
      String value;
651

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

658
      public static Builder builder() {
659
        return new Builder();
×
660
      }
661

662
      public static class Builder {
×
663
        private Map<String, Object> extraParams;
664

665
        private Type type;
666

667
        private String value;
668

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

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

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

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

726
        /** <strong>Required.</strong> Value of the tax ID. */
727
        public Builder setValue(String value) {
728
          this.value = value;
×
729
          return this;
×
730
        }
731
      }
732

733
      public enum Type implements ApiRequestParams.EnumParam {
×
734
        @SerializedName("ad_nrt")
×
735
        AD_NRT("ad_nrt"),
736

737
        @SerializedName("ae_trn")
×
738
        AE_TRN("ae_trn"),
739

740
        @SerializedName("ar_cuit")
×
741
        AR_CUIT("ar_cuit"),
742

743
        @SerializedName("au_abn")
×
744
        AU_ABN("au_abn"),
745

746
        @SerializedName("au_arn")
×
747
        AU_ARN("au_arn"),
748

749
        @SerializedName("bg_uic")
×
750
        BG_UIC("bg_uic"),
751

752
        @SerializedName("bh_vat")
×
753
        BH_VAT("bh_vat"),
754

755
        @SerializedName("bo_tin")
×
756
        BO_TIN("bo_tin"),
757

758
        @SerializedName("br_cnpj")
×
759
        BR_CNPJ("br_cnpj"),
760

761
        @SerializedName("br_cpf")
×
762
        BR_CPF("br_cpf"),
763

764
        @SerializedName("by_tin")
×
765
        BY_TIN("by_tin"),
766

767
        @SerializedName("ca_bn")
×
768
        CA_BN("ca_bn"),
769

770
        @SerializedName("ca_gst_hst")
×
771
        CA_GST_HST("ca_gst_hst"),
772

773
        @SerializedName("ca_pst_bc")
×
774
        CA_PST_BC("ca_pst_bc"),
775

776
        @SerializedName("ca_pst_mb")
×
777
        CA_PST_MB("ca_pst_mb"),
778

779
        @SerializedName("ca_pst_sk")
×
780
        CA_PST_SK("ca_pst_sk"),
781

782
        @SerializedName("ca_qst")
×
783
        CA_QST("ca_qst"),
784

785
        @SerializedName("ch_uid")
×
786
        CH_UID("ch_uid"),
787

788
        @SerializedName("ch_vat")
×
789
        CH_VAT("ch_vat"),
790

791
        @SerializedName("cl_tin")
×
792
        CL_TIN("cl_tin"),
793

794
        @SerializedName("cn_tin")
×
795
        CN_TIN("cn_tin"),
796

797
        @SerializedName("co_nit")
×
798
        CO_NIT("co_nit"),
799

800
        @SerializedName("cr_tin")
×
801
        CR_TIN("cr_tin"),
802

803
        @SerializedName("de_stn")
×
804
        DE_STN("de_stn"),
805

806
        @SerializedName("do_rcn")
×
807
        DO_RCN("do_rcn"),
808

809
        @SerializedName("ec_ruc")
×
810
        EC_RUC("ec_ruc"),
811

812
        @SerializedName("eg_tin")
×
813
        EG_TIN("eg_tin"),
814

815
        @SerializedName("es_cif")
×
816
        ES_CIF("es_cif"),
817

818
        @SerializedName("eu_oss_vat")
×
819
        EU_OSS_VAT("eu_oss_vat"),
820

821
        @SerializedName("eu_vat")
×
822
        EU_VAT("eu_vat"),
823

824
        @SerializedName("gb_vat")
×
825
        GB_VAT("gb_vat"),
826

827
        @SerializedName("ge_vat")
×
828
        GE_VAT("ge_vat"),
829

830
        @SerializedName("hk_br")
×
831
        HK_BR("hk_br"),
832

833
        @SerializedName("hr_oib")
×
834
        HR_OIB("hr_oib"),
835

836
        @SerializedName("hu_tin")
×
837
        HU_TIN("hu_tin"),
838

839
        @SerializedName("id_npwp")
×
840
        ID_NPWP("id_npwp"),
841

842
        @SerializedName("il_vat")
×
843
        IL_VAT("il_vat"),
844

845
        @SerializedName("in_gst")
×
846
        IN_GST("in_gst"),
847

848
        @SerializedName("is_vat")
×
849
        IS_VAT("is_vat"),
850

851
        @SerializedName("jp_cn")
×
852
        JP_CN("jp_cn"),
853

854
        @SerializedName("jp_rn")
×
855
        JP_RN("jp_rn"),
856

857
        @SerializedName("jp_trn")
×
858
        JP_TRN("jp_trn"),
859

860
        @SerializedName("ke_pin")
×
861
        KE_PIN("ke_pin"),
862

863
        @SerializedName("kr_brn")
×
864
        KR_BRN("kr_brn"),
865

866
        @SerializedName("kz_bin")
×
867
        KZ_BIN("kz_bin"),
868

869
        @SerializedName("li_uid")
×
870
        LI_UID("li_uid"),
871

NEW
872
        @SerializedName("li_vat")
×
873
        LI_VAT("li_vat"),
874

UNCOV
875
        @SerializedName("ma_vat")
×
876
        MA_VAT("ma_vat"),
877

878
        @SerializedName("md_vat")
×
879
        MD_VAT("md_vat"),
880

881
        @SerializedName("mx_rfc")
×
882
        MX_RFC("mx_rfc"),
883

884
        @SerializedName("my_frp")
×
885
        MY_FRP("my_frp"),
886

887
        @SerializedName("my_itn")
×
888
        MY_ITN("my_itn"),
889

890
        @SerializedName("my_sst")
×
891
        MY_SST("my_sst"),
892

893
        @SerializedName("ng_tin")
×
894
        NG_TIN("ng_tin"),
895

896
        @SerializedName("no_vat")
×
897
        NO_VAT("no_vat"),
898

899
        @SerializedName("no_voec")
×
900
        NO_VOEC("no_voec"),
901

902
        @SerializedName("nz_gst")
×
903
        NZ_GST("nz_gst"),
904

905
        @SerializedName("om_vat")
×
906
        OM_VAT("om_vat"),
907

908
        @SerializedName("pe_ruc")
×
909
        PE_RUC("pe_ruc"),
910

911
        @SerializedName("ph_tin")
×
912
        PH_TIN("ph_tin"),
913

914
        @SerializedName("ro_tin")
×
915
        RO_TIN("ro_tin"),
916

917
        @SerializedName("rs_pib")
×
918
        RS_PIB("rs_pib"),
919

920
        @SerializedName("ru_inn")
×
921
        RU_INN("ru_inn"),
922

923
        @SerializedName("ru_kpp")
×
924
        RU_KPP("ru_kpp"),
925

926
        @SerializedName("sa_vat")
×
927
        SA_VAT("sa_vat"),
928

929
        @SerializedName("sg_gst")
×
930
        SG_GST("sg_gst"),
931

932
        @SerializedName("sg_uen")
×
933
        SG_UEN("sg_uen"),
934

935
        @SerializedName("si_tin")
×
936
        SI_TIN("si_tin"),
937

938
        @SerializedName("sv_nit")
×
939
        SV_NIT("sv_nit"),
940

941
        @SerializedName("th_vat")
×
942
        TH_VAT("th_vat"),
943

944
        @SerializedName("tr_tin")
×
945
        TR_TIN("tr_tin"),
946

947
        @SerializedName("tw_vat")
×
948
        TW_VAT("tw_vat"),
949

950
        @SerializedName("tz_vat")
×
951
        TZ_VAT("tz_vat"),
952

953
        @SerializedName("ua_vat")
×
954
        UA_VAT("ua_vat"),
955

956
        @SerializedName("us_ein")
×
957
        US_EIN("us_ein"),
958

959
        @SerializedName("uy_ruc")
×
960
        UY_RUC("uy_ruc"),
961

962
        @SerializedName("uz_tin")
×
963
        UZ_TIN("uz_tin"),
964

965
        @SerializedName("uz_vat")
×
966
        UZ_VAT("uz_vat"),
967

968
        @SerializedName("ve_rif")
×
969
        VE_RIF("ve_rif"),
970

971
        @SerializedName("vn_tin")
×
972
        VN_TIN("vn_tin"),
973

974
        @SerializedName("za_vat")
×
975
        ZA_VAT("za_vat");
976

977
        @Getter(onMethod_ = {@Override})
978
        private final String value;
979

980
        Type(String value) {
×
981
          this.value = value;
×
982
        }
×
983
      }
984
    }
985

986
    public enum AddressSource implements ApiRequestParams.EnumParam {
1✔
987
      @SerializedName("billing")
1✔
988
      BILLING("billing"),
989

990
      @SerializedName("shipping")
1✔
991
      SHIPPING("shipping");
992

993
      @Getter(onMethod_ = {@Override})
994
      private final String value;
995

996
      AddressSource(String value) {
1✔
997
        this.value = value;
1✔
998
      }
1✔
999
    }
1000

1001
    public enum TaxabilityOverride implements ApiRequestParams.EnumParam {
×
1002
      @SerializedName("customer_exempt")
×
1003
      CUSTOMER_EXEMPT("customer_exempt"),
1004

1005
      @SerializedName("none")
×
1006
      NONE("none"),
1007

1008
      @SerializedName("reverse_charge")
×
1009
      REVERSE_CHARGE("reverse_charge");
1010

1011
      @Getter(onMethod_ = {@Override})
1012
      private final String value;
1013

1014
      TaxabilityOverride(String value) {
×
1015
        this.value = value;
×
1016
      }
×
1017
    }
1018
  }
1019

1020
  @Getter
1021
  public static class LineItem {
1022
    /**
1023
     * <strong>Required.</strong> A positive integer representing the line item's total price in the
1024
     * <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. If
1025
     * {@code tax_behavior=inclusive}, then this amount includes taxes. Otherwise, taxes are
1026
     * calculated on top of this amount.
1027
     */
1028
    @SerializedName("amount")
1029
    Long amount;
1030

1031
    /**
1032
     * Map of extra parameters for custom features not available in this client library. The content
1033
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1034
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1035
     * param object. Effectively, this map is flattened to its parent instance.
1036
     */
1037
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1038
    Map<String, Object> extraParams;
1039

1040
    /**
1041
     * If provided, the product's {@code tax_code} will be used as the line item's {@code tax_code}.
1042
     */
1043
    @SerializedName("product")
1044
    String product;
1045

1046
    /**
1047
     * The number of units of the item being purchased. Used to calculate the per-unit price from
1048
     * the total {@code amount} for the line. For example, if {@code amount=100} and {@code
1049
     * quantity=4}, the calculated unit price is 25.
1050
     */
1051
    @SerializedName("quantity")
1052
    Long quantity;
1053

1054
    /**
1055
     * A custom identifier for this line item, which must be unique across the line items in the
1056
     * calculation. The reference helps identify each line item in exported <a
1057
     * href="https://stripe.com/docs/tax/reports">tax reports</a>.
1058
     */
1059
    @SerializedName("reference")
1060
    String reference;
1061

1062
    /** Specifies whether the {@code amount} includes taxes. Defaults to {@code exclusive}. */
1063
    @SerializedName("tax_behavior")
1064
    TaxBehavior taxBehavior;
1065

1066
    /**
1067
     * A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID to use for this line
1068
     * item. If not provided, we will use the tax code from the provided {@code product} param. If
1069
     * neither {@code tax_code} nor {@code product} is provided, we will use the default tax code
1070
     * from your Tax Settings.
1071
     */
1072
    @SerializedName("tax_code")
1073
    String taxCode;
1074

1075
    private LineItem(
1076
        Long amount,
1077
        Map<String, Object> extraParams,
1078
        String product,
1079
        Long quantity,
1080
        String reference,
1081
        TaxBehavior taxBehavior,
1082
        String taxCode) {
1✔
1083
      this.amount = amount;
1✔
1084
      this.extraParams = extraParams;
1✔
1085
      this.product = product;
1✔
1086
      this.quantity = quantity;
1✔
1087
      this.reference = reference;
1✔
1088
      this.taxBehavior = taxBehavior;
1✔
1089
      this.taxCode = taxCode;
1✔
1090
    }
1✔
1091

1092
    public static Builder builder() {
1093
      return new Builder();
1✔
1094
    }
1095

1096
    public static class Builder {
1✔
1097
      private Long amount;
1098

1099
      private Map<String, Object> extraParams;
1100

1101
      private String product;
1102

1103
      private Long quantity;
1104

1105
      private String reference;
1106

1107
      private TaxBehavior taxBehavior;
1108

1109
      private String taxCode;
1110

1111
      /** Finalize and obtain parameter instance from this builder. */
1112
      public CalculationCreateParams.LineItem build() {
1113
        return new CalculationCreateParams.LineItem(
1✔
1114
            this.amount,
1115
            this.extraParams,
1116
            this.product,
1117
            this.quantity,
1118
            this.reference,
1119
            this.taxBehavior,
1120
            this.taxCode);
1121
      }
1122

1123
      /**
1124
       * <strong>Required.</strong> A positive integer representing the line item's total price in
1125
       * the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
1126
       * If {@code tax_behavior=inclusive}, then this amount includes taxes. Otherwise, taxes are
1127
       * calculated on top of this amount.
1128
       */
1129
      public Builder setAmount(Long amount) {
1130
        this.amount = amount;
1✔
1131
        return this;
1✔
1132
      }
1133

1134
      /**
1135
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1136
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1137
       * CalculationCreateParams.LineItem#extraParams} for the field documentation.
1138
       */
1139
      public Builder putExtraParam(String key, Object value) {
1140
        if (this.extraParams == null) {
×
1141
          this.extraParams = new HashMap<>();
×
1142
        }
1143
        this.extraParams.put(key, value);
×
1144
        return this;
×
1145
      }
1146

1147
      /**
1148
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1149
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1150
       * See {@link CalculationCreateParams.LineItem#extraParams} for the field documentation.
1151
       */
1152
      public Builder putAllExtraParam(Map<String, Object> map) {
1153
        if (this.extraParams == null) {
×
1154
          this.extraParams = new HashMap<>();
×
1155
        }
1156
        this.extraParams.putAll(map);
×
1157
        return this;
×
1158
      }
1159

1160
      /**
1161
       * If provided, the product's {@code tax_code} will be used as the line item's {@code
1162
       * tax_code}.
1163
       */
1164
      public Builder setProduct(String product) {
1165
        this.product = product;
×
1166
        return this;
×
1167
      }
1168

1169
      /**
1170
       * The number of units of the item being purchased. Used to calculate the per-unit price from
1171
       * the total {@code amount} for the line. For example, if {@code amount=100} and {@code
1172
       * quantity=4}, the calculated unit price is 25.
1173
       */
1174
      public Builder setQuantity(Long quantity) {
1175
        this.quantity = quantity;
×
1176
        return this;
×
1177
      }
1178

1179
      /**
1180
       * A custom identifier for this line item, which must be unique across the line items in the
1181
       * calculation. The reference helps identify each line item in exported <a
1182
       * href="https://stripe.com/docs/tax/reports">tax reports</a>.
1183
       */
1184
      public Builder setReference(String reference) {
1185
        this.reference = reference;
1✔
1186
        return this;
1✔
1187
      }
1188

1189
      /** Specifies whether the {@code amount} includes taxes. Defaults to {@code exclusive}. */
1190
      public Builder setTaxBehavior(CalculationCreateParams.LineItem.TaxBehavior taxBehavior) {
1191
        this.taxBehavior = taxBehavior;
×
1192
        return this;
×
1193
      }
1194

1195
      /**
1196
       * A <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> ID to use for this line
1197
       * item. If not provided, we will use the tax code from the provided {@code product} param. If
1198
       * neither {@code tax_code} nor {@code product} is provided, we will use the default tax code
1199
       * from your Tax Settings.
1200
       */
1201
      public Builder setTaxCode(String taxCode) {
1202
        this.taxCode = taxCode;
×
1203
        return this;
×
1204
      }
1205
    }
1206

1207
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1208
      @SerializedName("exclusive")
×
1209
      EXCLUSIVE("exclusive"),
1210

1211
      @SerializedName("inclusive")
×
1212
      INCLUSIVE("inclusive");
1213

1214
      @Getter(onMethod_ = {@Override})
1215
      private final String value;
1216

1217
      TaxBehavior(String value) {
×
1218
        this.value = value;
×
1219
      }
×
1220
    }
1221
  }
1222

1223
  @Getter
1224
  public static class ShipFromDetails {
1225
    /** <strong>Required.</strong> The address from which the goods are being shipped from. */
1226
    @SerializedName("address")
1227
    Address address;
1228

1229
    /**
1230
     * Map of extra parameters for custom features not available in this client library. The content
1231
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1232
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1233
     * param object. Effectively, this map is flattened to its parent instance.
1234
     */
1235
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1236
    Map<String, Object> extraParams;
1237

1238
    private ShipFromDetails(Address address, Map<String, Object> extraParams) {
×
1239
      this.address = address;
×
1240
      this.extraParams = extraParams;
×
1241
    }
×
1242

1243
    public static Builder builder() {
1244
      return new Builder();
×
1245
    }
1246

1247
    public static class Builder {
×
1248
      private Address address;
1249

1250
      private Map<String, Object> extraParams;
1251

1252
      /** Finalize and obtain parameter instance from this builder. */
1253
      public CalculationCreateParams.ShipFromDetails build() {
1254
        return new CalculationCreateParams.ShipFromDetails(this.address, this.extraParams);
×
1255
      }
1256

1257
      /** <strong>Required.</strong> The address from which the goods are being shipped from. */
1258
      public Builder setAddress(CalculationCreateParams.ShipFromDetails.Address address) {
1259
        this.address = address;
×
1260
        return this;
×
1261
      }
1262

1263
      /**
1264
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1265
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1266
       * CalculationCreateParams.ShipFromDetails#extraParams} for the field documentation.
1267
       */
1268
      public Builder putExtraParam(String key, Object value) {
1269
        if (this.extraParams == null) {
×
1270
          this.extraParams = new HashMap<>();
×
1271
        }
1272
        this.extraParams.put(key, value);
×
1273
        return this;
×
1274
      }
1275

1276
      /**
1277
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1278
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1279
       * See {@link CalculationCreateParams.ShipFromDetails#extraParams} for the field
1280
       * documentation.
1281
       */
1282
      public Builder putAllExtraParam(Map<String, Object> map) {
1283
        if (this.extraParams == null) {
×
1284
          this.extraParams = new HashMap<>();
×
1285
        }
1286
        this.extraParams.putAll(map);
×
1287
        return this;
×
1288
      }
1289
    }
1290

1291
    @Getter
1292
    public static class Address {
1293
      /** City, district, suburb, town, or village. */
1294
      @SerializedName("city")
1295
      Object city;
1296

1297
      /**
1298
       * <strong>Required.</strong> Two-letter country code (<a
1299
       * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1300
       */
1301
      @SerializedName("country")
1302
      String country;
1303

1304
      /**
1305
       * Map of extra parameters for custom features not available in this client library. The
1306
       * content in this map is not serialized under this field's {@code @SerializedName} value.
1307
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
1308
       * name in this param object. Effectively, this map is flattened to its parent instance.
1309
       */
1310
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1311
      Map<String, Object> extraParams;
1312

1313
      /** Address line 1 (e.g., street, PO Box, or company name). */
1314
      @SerializedName("line1")
1315
      Object line1;
1316

1317
      /** Address line 2 (e.g., apartment, suite, unit, or building). */
1318
      @SerializedName("line2")
1319
      Object line2;
1320

1321
      /** ZIP or postal code. */
1322
      @SerializedName("postal_code")
1323
      Object postalCode;
1324

1325
      /**
1326
       * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1327
       * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1328
       */
1329
      @SerializedName("state")
1330
      Object state;
1331

1332
      private Address(
1333
          Object city,
1334
          String country,
1335
          Map<String, Object> extraParams,
1336
          Object line1,
1337
          Object line2,
1338
          Object postalCode,
1339
          Object state) {
×
1340
        this.city = city;
×
1341
        this.country = country;
×
1342
        this.extraParams = extraParams;
×
1343
        this.line1 = line1;
×
1344
        this.line2 = line2;
×
1345
        this.postalCode = postalCode;
×
1346
        this.state = state;
×
1347
      }
×
1348

1349
      public static Builder builder() {
1350
        return new Builder();
×
1351
      }
1352

1353
      public static class Builder {
×
1354
        private Object city;
1355

1356
        private String country;
1357

1358
        private Map<String, Object> extraParams;
1359

1360
        private Object line1;
1361

1362
        private Object line2;
1363

1364
        private Object postalCode;
1365

1366
        private Object state;
1367

1368
        /** Finalize and obtain parameter instance from this builder. */
1369
        public CalculationCreateParams.ShipFromDetails.Address build() {
1370
          return new CalculationCreateParams.ShipFromDetails.Address(
×
1371
              this.city,
1372
              this.country,
1373
              this.extraParams,
1374
              this.line1,
1375
              this.line2,
1376
              this.postalCode,
1377
              this.state);
1378
        }
1379

1380
        /** City, district, suburb, town, or village. */
1381
        public Builder setCity(String city) {
1382
          this.city = city;
×
1383
          return this;
×
1384
        }
1385

1386
        /** City, district, suburb, town, or village. */
1387
        public Builder setCity(EmptyParam city) {
1388
          this.city = city;
×
1389
          return this;
×
1390
        }
1391

1392
        /**
1393
         * <strong>Required.</strong> Two-letter country code (<a
1394
         * href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha-2</a>).
1395
         */
1396
        public Builder setCountry(String country) {
1397
          this.country = country;
×
1398
          return this;
×
1399
        }
1400

1401
        /**
1402
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
1403
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1404
         * map. See {@link CalculationCreateParams.ShipFromDetails.Address#extraParams} for the
1405
         * field documentation.
1406
         */
1407
        public Builder putExtraParam(String key, Object value) {
1408
          if (this.extraParams == null) {
×
1409
            this.extraParams = new HashMap<>();
×
1410
          }
1411
          this.extraParams.put(key, value);
×
1412
          return this;
×
1413
        }
1414

1415
        /**
1416
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1417
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
1418
         * map. See {@link CalculationCreateParams.ShipFromDetails.Address#extraParams} for the
1419
         * field documentation.
1420
         */
1421
        public Builder putAllExtraParam(Map<String, Object> map) {
1422
          if (this.extraParams == null) {
×
1423
            this.extraParams = new HashMap<>();
×
1424
          }
1425
          this.extraParams.putAll(map);
×
1426
          return this;
×
1427
        }
1428

1429
        /** Address line 1 (e.g., street, PO Box, or company name). */
1430
        public Builder setLine1(String line1) {
1431
          this.line1 = line1;
×
1432
          return this;
×
1433
        }
1434

1435
        /** Address line 1 (e.g., street, PO Box, or company name). */
1436
        public Builder setLine1(EmptyParam line1) {
1437
          this.line1 = line1;
×
1438
          return this;
×
1439
        }
1440

1441
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1442
        public Builder setLine2(String line2) {
1443
          this.line2 = line2;
×
1444
          return this;
×
1445
        }
1446

1447
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1448
        public Builder setLine2(EmptyParam line2) {
1449
          this.line2 = line2;
×
1450
          return this;
×
1451
        }
1452

1453
        /** ZIP or postal code. */
1454
        public Builder setPostalCode(String postalCode) {
1455
          this.postalCode = postalCode;
×
1456
          return this;
×
1457
        }
1458

1459
        /** ZIP or postal code. */
1460
        public Builder setPostalCode(EmptyParam postalCode) {
1461
          this.postalCode = postalCode;
×
1462
          return this;
×
1463
        }
1464

1465
        /**
1466
         * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1467
         * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1468
         */
1469
        public Builder setState(String state) {
1470
          this.state = state;
×
1471
          return this;
×
1472
        }
1473

1474
        /**
1475
         * State/province as an <a href="https://en.wikipedia.org/wiki/ISO_3166-2">ISO 3166-2</a>
1476
         * subdivision code, without country prefix. Example: &quot;NY&quot; or &quot;TX&quot;.
1477
         */
1478
        public Builder setState(EmptyParam state) {
1479
          this.state = state;
×
1480
          return this;
×
1481
        }
1482
      }
1483
    }
1484
  }
1485

1486
  @Getter
1487
  public static class ShippingCost {
1488
    /**
1489
     * A positive integer in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest
1490
     * currency unit</a> representing the shipping charge. If {@code tax_behavior=inclusive}, then
1491
     * this amount includes taxes. Otherwise, taxes are calculated on top of this amount.
1492
     */
1493
    @SerializedName("amount")
1494
    Long amount;
1495

1496
    /**
1497
     * Map of extra parameters for custom features not available in this client library. The content
1498
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
1499
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
1500
     * param object. Effectively, this map is flattened to its parent instance.
1501
     */
1502
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
1503
    Map<String, Object> extraParams;
1504

1505
    /**
1506
     * If provided, the <a href="https://stripe.com/docs/api/shipping_rates/object">shipping
1507
     * rate</a>'s {@code amount}, {@code tax_code} and {@code tax_behavior} are used. If you provide
1508
     * a shipping rate, then you cannot pass the {@code amount}, {@code tax_code}, or {@code
1509
     * tax_behavior} parameters.
1510
     */
1511
    @SerializedName("shipping_rate")
1512
    String shippingRate;
1513

1514
    /**
1515
     * Specifies whether the {@code amount} includes taxes. If {@code tax_behavior=inclusive}, then
1516
     * the amount includes taxes. Defaults to {@code exclusive}.
1517
     */
1518
    @SerializedName("tax_behavior")
1519
    TaxBehavior taxBehavior;
1520

1521
    /**
1522
     * The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> used to calculate tax
1523
     * on shipping. If not provided, the default shipping tax code from your <a
1524
     * href="https://dashboard.stripe.com/settings/tax">Tax Settings</a> is used.
1525
     */
1526
    @SerializedName("tax_code")
1527
    String taxCode;
1528

1529
    private ShippingCost(
1530
        Long amount,
1531
        Map<String, Object> extraParams,
1532
        String shippingRate,
1533
        TaxBehavior taxBehavior,
1534
        String taxCode) {
×
1535
      this.amount = amount;
×
1536
      this.extraParams = extraParams;
×
1537
      this.shippingRate = shippingRate;
×
1538
      this.taxBehavior = taxBehavior;
×
1539
      this.taxCode = taxCode;
×
1540
    }
×
1541

1542
    public static Builder builder() {
1543
      return new Builder();
×
1544
    }
1545

1546
    public static class Builder {
×
1547
      private Long amount;
1548

1549
      private Map<String, Object> extraParams;
1550

1551
      private String shippingRate;
1552

1553
      private TaxBehavior taxBehavior;
1554

1555
      private String taxCode;
1556

1557
      /** Finalize and obtain parameter instance from this builder. */
1558
      public CalculationCreateParams.ShippingCost build() {
1559
        return new CalculationCreateParams.ShippingCost(
×
1560
            this.amount, this.extraParams, this.shippingRate, this.taxBehavior, this.taxCode);
1561
      }
1562

1563
      /**
1564
       * A positive integer in the <a
1565
       * href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>
1566
       * representing the shipping charge. If {@code tax_behavior=inclusive}, then this amount
1567
       * includes taxes. Otherwise, taxes are calculated on top of this amount.
1568
       */
1569
      public Builder setAmount(Long amount) {
1570
        this.amount = amount;
×
1571
        return this;
×
1572
      }
1573

1574
      /**
1575
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
1576
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
1577
       * CalculationCreateParams.ShippingCost#extraParams} for the field documentation.
1578
       */
1579
      public Builder putExtraParam(String key, Object value) {
1580
        if (this.extraParams == null) {
×
1581
          this.extraParams = new HashMap<>();
×
1582
        }
1583
        this.extraParams.put(key, value);
×
1584
        return this;
×
1585
      }
1586

1587
      /**
1588
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
1589
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
1590
       * See {@link CalculationCreateParams.ShippingCost#extraParams} for the field documentation.
1591
       */
1592
      public Builder putAllExtraParam(Map<String, Object> map) {
1593
        if (this.extraParams == null) {
×
1594
          this.extraParams = new HashMap<>();
×
1595
        }
1596
        this.extraParams.putAll(map);
×
1597
        return this;
×
1598
      }
1599

1600
      /**
1601
       * If provided, the <a href="https://stripe.com/docs/api/shipping_rates/object">shipping
1602
       * rate</a>'s {@code amount}, {@code tax_code} and {@code tax_behavior} are used. If you
1603
       * provide a shipping rate, then you cannot pass the {@code amount}, {@code tax_code}, or
1604
       * {@code tax_behavior} parameters.
1605
       */
1606
      public Builder setShippingRate(String shippingRate) {
1607
        this.shippingRate = shippingRate;
×
1608
        return this;
×
1609
      }
1610

1611
      /**
1612
       * Specifies whether the {@code amount} includes taxes. If {@code tax_behavior=inclusive},
1613
       * then the amount includes taxes. Defaults to {@code exclusive}.
1614
       */
1615
      public Builder setTaxBehavior(CalculationCreateParams.ShippingCost.TaxBehavior taxBehavior) {
1616
        this.taxBehavior = taxBehavior;
×
1617
        return this;
×
1618
      }
1619

1620
      /**
1621
       * The <a href="https://stripe.com/docs/tax/tax-categories">tax code</a> used to calculate tax
1622
       * on shipping. If not provided, the default shipping tax code from your <a
1623
       * href="https://dashboard.stripe.com/settings/tax">Tax Settings</a> is used.
1624
       */
1625
      public Builder setTaxCode(String taxCode) {
1626
        this.taxCode = taxCode;
×
1627
        return this;
×
1628
      }
1629
    }
1630

1631
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1632
      @SerializedName("exclusive")
×
1633
      EXCLUSIVE("exclusive"),
1634

1635
      @SerializedName("inclusive")
×
1636
      INCLUSIVE("inclusive");
1637

1638
      @Getter(onMethod_ = {@Override})
1639
      private final String value;
1640

1641
      TaxBehavior(String value) {
×
1642
        this.value = value;
×
1643
      }
×
1644
    }
1645
  }
1646
}
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