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

stripe / stripe-java / #16707

14 Dec 2024 12:12AM UTC coverage: 15.91% (-0.08%) from 15.988%
#16707

Pull #1931

github

web-flow
Merge 90c2dfd77 into cf528f2c8
Pull Request #1931: Update generated code

43 of 1442 new or added lines in 28 files covered. (2.98%)

137 existing lines in 17 files now uncovered.

18625 of 117068 relevant lines covered (15.91%)

0.16 hits per line

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

20.61
/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 al_tin}, {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code
630
       * au_arn}, {@code ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin},
631
       * {@code br_cnpj}, {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code
632
       * ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst},
633
       * {@code cd_nif}, {@code ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code
634
       * co_nit}, {@code cr_tin}, {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin},
635
       * {@code es_cif}, {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code
636
       * gn_nif}, {@code hk_br}, {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code il_vat},
637
       * {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn}, {@code
638
       * ke_pin}, {@code kh_tin}, {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code li_vat},
639
       * {@code ma_vat}, {@code md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif}, {@code
640
       * mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code no_vat},
641
       * {@code no_voec}, {@code np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc}, {@code
642
       * ph_tin}, {@code ro_tin}, {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat},
643
       * {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code sr_fin}, {@code
644
       * sv_nit}, {@code th_vat}, {@code tj_tin}, {@code tr_tin}, {@code tw_vat}, {@code tz_vat},
645
       * {@code ua_vat}, {@code ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code uz_tin}, {@code
646
       * uz_vat}, {@code ve_rif}, {@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 al_tin}, {@code am_tin}, {@code ao_tin}, {@code ar_cuit}, {@code au_abn}, {@code
709
         * au_arn}, {@code ba_tin}, {@code bb_tin}, {@code bg_uic}, {@code bh_vat}, {@code bo_tin},
710
         * {@code br_cnpj}, {@code br_cpf}, {@code bs_tin}, {@code by_tin}, {@code ca_bn}, {@code
711
         * ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst},
712
         * {@code cd_nif}, {@code ch_uid}, {@code ch_vat}, {@code cl_tin}, {@code cn_tin}, {@code
713
         * co_nit}, {@code cr_tin}, {@code de_stn}, {@code do_rcn}, {@code ec_ruc}, {@code eg_tin},
714
         * {@code es_cif}, {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat},
715
         * {@code gn_nif}, {@code hk_br}, {@code hr_oib}, {@code hu_tin}, {@code id_npwp}, {@code
716
         * il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code jp_trn},
717
         * {@code ke_pin}, {@code kh_tin}, {@code kr_brn}, {@code kz_bin}, {@code li_uid}, {@code
718
         * li_vat}, {@code ma_vat}, {@code md_vat}, {@code me_pib}, {@code mk_vat}, {@code mr_nif},
719
         * {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code ng_tin}, {@code
720
         * no_vat}, {@code no_voec}, {@code np_pan}, {@code nz_gst}, {@code om_vat}, {@code pe_ruc},
721
         * {@code ph_tin}, {@code ro_tin}, {@code rs_pib}, {@code ru_inn}, {@code ru_kpp}, {@code
722
         * sa_vat}, {@code sg_gst}, {@code sg_uen}, {@code si_tin}, {@code sn_ninea}, {@code
723
         * sr_fin}, {@code sv_nit}, {@code th_vat}, {@code tj_tin}, {@code tr_tin}, {@code tw_vat},
724
         * {@code tz_vat}, {@code ua_vat}, {@code ug_tin}, {@code us_ein}, {@code uy_ruc}, {@code
725
         * uz_tin}, {@code uz_vat}, {@code ve_rif}, {@code vn_tin}, {@code za_vat}, {@code zm_tin},
726
         * or {@code zw_tin}
727
         */
728
        public Builder setType(CalculationCreateParams.CustomerDetails.TaxId.Type type) {
729
          this.type = type;
×
730
          return this;
×
731
        }
732

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

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

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

NEW
747
        @SerializedName("al_tin")
×
748
        AL_TIN("al_tin"),
749

NEW
750
        @SerializedName("am_tin")
×
751
        AM_TIN("am_tin"),
752

NEW
753
        @SerializedName("ao_tin")
×
754
        AO_TIN("ao_tin"),
755

UNCOV
756
        @SerializedName("ar_cuit")
×
757
        AR_CUIT("ar_cuit"),
758

759
        @SerializedName("au_abn")
×
760
        AU_ABN("au_abn"),
761

762
        @SerializedName("au_arn")
×
763
        AU_ARN("au_arn"),
764

NEW
765
        @SerializedName("ba_tin")
×
766
        BA_TIN("ba_tin"),
767

NEW
768
        @SerializedName("bb_tin")
×
769
        BB_TIN("bb_tin"),
770

UNCOV
771
        @SerializedName("bg_uic")
×
772
        BG_UIC("bg_uic"),
773

774
        @SerializedName("bh_vat")
×
775
        BH_VAT("bh_vat"),
776

777
        @SerializedName("bo_tin")
×
778
        BO_TIN("bo_tin"),
779

780
        @SerializedName("br_cnpj")
×
781
        BR_CNPJ("br_cnpj"),
782

783
        @SerializedName("br_cpf")
×
784
        BR_CPF("br_cpf"),
785

NEW
786
        @SerializedName("bs_tin")
×
787
        BS_TIN("bs_tin"),
788

UNCOV
789
        @SerializedName("by_tin")
×
790
        BY_TIN("by_tin"),
791

792
        @SerializedName("ca_bn")
×
793
        CA_BN("ca_bn"),
794

795
        @SerializedName("ca_gst_hst")
×
796
        CA_GST_HST("ca_gst_hst"),
797

798
        @SerializedName("ca_pst_bc")
×
799
        CA_PST_BC("ca_pst_bc"),
800

801
        @SerializedName("ca_pst_mb")
×
802
        CA_PST_MB("ca_pst_mb"),
803

804
        @SerializedName("ca_pst_sk")
×
805
        CA_PST_SK("ca_pst_sk"),
806

807
        @SerializedName("ca_qst")
×
808
        CA_QST("ca_qst"),
809

NEW
810
        @SerializedName("cd_nif")
×
811
        CD_NIF("cd_nif"),
812

UNCOV
813
        @SerializedName("ch_uid")
×
814
        CH_UID("ch_uid"),
815

816
        @SerializedName("ch_vat")
×
817
        CH_VAT("ch_vat"),
818

819
        @SerializedName("cl_tin")
×
820
        CL_TIN("cl_tin"),
821

822
        @SerializedName("cn_tin")
×
823
        CN_TIN("cn_tin"),
824

825
        @SerializedName("co_nit")
×
826
        CO_NIT("co_nit"),
827

828
        @SerializedName("cr_tin")
×
829
        CR_TIN("cr_tin"),
830

831
        @SerializedName("de_stn")
×
832
        DE_STN("de_stn"),
833

834
        @SerializedName("do_rcn")
×
835
        DO_RCN("do_rcn"),
836

837
        @SerializedName("ec_ruc")
×
838
        EC_RUC("ec_ruc"),
839

840
        @SerializedName("eg_tin")
×
841
        EG_TIN("eg_tin"),
842

843
        @SerializedName("es_cif")
×
844
        ES_CIF("es_cif"),
845

846
        @SerializedName("eu_oss_vat")
×
847
        EU_OSS_VAT("eu_oss_vat"),
848

849
        @SerializedName("eu_vat")
×
850
        EU_VAT("eu_vat"),
851

852
        @SerializedName("gb_vat")
×
853
        GB_VAT("gb_vat"),
854

855
        @SerializedName("ge_vat")
×
856
        GE_VAT("ge_vat"),
857

NEW
858
        @SerializedName("gn_nif")
×
859
        GN_NIF("gn_nif"),
860

UNCOV
861
        @SerializedName("hk_br")
×
862
        HK_BR("hk_br"),
863

864
        @SerializedName("hr_oib")
×
865
        HR_OIB("hr_oib"),
866

867
        @SerializedName("hu_tin")
×
868
        HU_TIN("hu_tin"),
869

870
        @SerializedName("id_npwp")
×
871
        ID_NPWP("id_npwp"),
872

873
        @SerializedName("il_vat")
×
874
        IL_VAT("il_vat"),
875

876
        @SerializedName("in_gst")
×
877
        IN_GST("in_gst"),
878

879
        @SerializedName("is_vat")
×
880
        IS_VAT("is_vat"),
881

882
        @SerializedName("jp_cn")
×
883
        JP_CN("jp_cn"),
884

885
        @SerializedName("jp_rn")
×
886
        JP_RN("jp_rn"),
887

888
        @SerializedName("jp_trn")
×
889
        JP_TRN("jp_trn"),
890

891
        @SerializedName("ke_pin")
×
892
        KE_PIN("ke_pin"),
893

NEW
894
        @SerializedName("kh_tin")
×
895
        KH_TIN("kh_tin"),
896

UNCOV
897
        @SerializedName("kr_brn")
×
898
        KR_BRN("kr_brn"),
899

900
        @SerializedName("kz_bin")
×
901
        KZ_BIN("kz_bin"),
902

903
        @SerializedName("li_uid")
×
904
        LI_UID("li_uid"),
905

906
        @SerializedName("li_vat")
×
907
        LI_VAT("li_vat"),
908

909
        @SerializedName("ma_vat")
×
910
        MA_VAT("ma_vat"),
911

912
        @SerializedName("md_vat")
×
913
        MD_VAT("md_vat"),
914

NEW
915
        @SerializedName("me_pib")
×
916
        ME_PIB("me_pib"),
917

NEW
918
        @SerializedName("mk_vat")
×
919
        MK_VAT("mk_vat"),
920

NEW
921
        @SerializedName("mr_nif")
×
922
        MR_NIF("mr_nif"),
923

UNCOV
924
        @SerializedName("mx_rfc")
×
925
        MX_RFC("mx_rfc"),
926

927
        @SerializedName("my_frp")
×
928
        MY_FRP("my_frp"),
929

930
        @SerializedName("my_itn")
×
931
        MY_ITN("my_itn"),
932

933
        @SerializedName("my_sst")
×
934
        MY_SST("my_sst"),
935

936
        @SerializedName("ng_tin")
×
937
        NG_TIN("ng_tin"),
938

939
        @SerializedName("no_vat")
×
940
        NO_VAT("no_vat"),
941

942
        @SerializedName("no_voec")
×
943
        NO_VOEC("no_voec"),
944

NEW
945
        @SerializedName("np_pan")
×
946
        NP_PAN("np_pan"),
947

UNCOV
948
        @SerializedName("nz_gst")
×
949
        NZ_GST("nz_gst"),
950

951
        @SerializedName("om_vat")
×
952
        OM_VAT("om_vat"),
953

954
        @SerializedName("pe_ruc")
×
955
        PE_RUC("pe_ruc"),
956

957
        @SerializedName("ph_tin")
×
958
        PH_TIN("ph_tin"),
959

960
        @SerializedName("ro_tin")
×
961
        RO_TIN("ro_tin"),
962

963
        @SerializedName("rs_pib")
×
964
        RS_PIB("rs_pib"),
965

966
        @SerializedName("ru_inn")
×
967
        RU_INN("ru_inn"),
968

969
        @SerializedName("ru_kpp")
×
970
        RU_KPP("ru_kpp"),
971

972
        @SerializedName("sa_vat")
×
973
        SA_VAT("sa_vat"),
974

975
        @SerializedName("sg_gst")
×
976
        SG_GST("sg_gst"),
977

978
        @SerializedName("sg_uen")
×
979
        SG_UEN("sg_uen"),
980

981
        @SerializedName("si_tin")
×
982
        SI_TIN("si_tin"),
983

NEW
984
        @SerializedName("sn_ninea")
×
985
        SN_NINEA("sn_ninea"),
986

NEW
987
        @SerializedName("sr_fin")
×
988
        SR_FIN("sr_fin"),
989

UNCOV
990
        @SerializedName("sv_nit")
×
991
        SV_NIT("sv_nit"),
992

993
        @SerializedName("th_vat")
×
994
        TH_VAT("th_vat"),
995

NEW
996
        @SerializedName("tj_tin")
×
997
        TJ_TIN("tj_tin"),
998

UNCOV
999
        @SerializedName("tr_tin")
×
1000
        TR_TIN("tr_tin"),
1001

1002
        @SerializedName("tw_vat")
×
1003
        TW_VAT("tw_vat"),
1004

1005
        @SerializedName("tz_vat")
×
1006
        TZ_VAT("tz_vat"),
1007

1008
        @SerializedName("ua_vat")
×
1009
        UA_VAT("ua_vat"),
1010

NEW
1011
        @SerializedName("ug_tin")
×
1012
        UG_TIN("ug_tin"),
1013

UNCOV
1014
        @SerializedName("us_ein")
×
1015
        US_EIN("us_ein"),
1016

1017
        @SerializedName("uy_ruc")
×
1018
        UY_RUC("uy_ruc"),
1019

1020
        @SerializedName("uz_tin")
×
1021
        UZ_TIN("uz_tin"),
1022

1023
        @SerializedName("uz_vat")
×
1024
        UZ_VAT("uz_vat"),
1025

1026
        @SerializedName("ve_rif")
×
1027
        VE_RIF("ve_rif"),
1028

1029
        @SerializedName("vn_tin")
×
1030
        VN_TIN("vn_tin"),
1031

1032
        @SerializedName("za_vat")
×
1033
        ZA_VAT("za_vat"),
1034

NEW
1035
        @SerializedName("zm_tin")
×
1036
        ZM_TIN("zm_tin"),
1037

NEW
1038
        @SerializedName("zw_tin")
×
1039
        ZW_TIN("zw_tin");
1040

1041
        @Getter(onMethod_ = {@Override})
1042
        private final String value;
1043

1044
        Type(String value) {
×
1045
          this.value = value;
×
1046
        }
×
1047
      }
1048
    }
1049

1050
    public enum AddressSource implements ApiRequestParams.EnumParam {
1✔
1051
      @SerializedName("billing")
1✔
1052
      BILLING("billing"),
1053

1054
      @SerializedName("shipping")
1✔
1055
      SHIPPING("shipping");
1056

1057
      @Getter(onMethod_ = {@Override})
1058
      private final String value;
1059

1060
      AddressSource(String value) {
1✔
1061
        this.value = value;
1✔
1062
      }
1✔
1063
    }
1064

1065
    public enum TaxabilityOverride implements ApiRequestParams.EnumParam {
×
1066
      @SerializedName("customer_exempt")
×
1067
      CUSTOMER_EXEMPT("customer_exempt"),
1068

1069
      @SerializedName("none")
×
1070
      NONE("none"),
1071

1072
      @SerializedName("reverse_charge")
×
1073
      REVERSE_CHARGE("reverse_charge");
1074

1075
      @Getter(onMethod_ = {@Override})
1076
      private final String value;
1077

1078
      TaxabilityOverride(String value) {
×
1079
        this.value = value;
×
1080
      }
×
1081
    }
1082
  }
1083

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

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

1104
    /**
1105
     * If provided, the product's {@code tax_code} will be used as the line item's {@code tax_code}.
1106
     */
1107
    @SerializedName("product")
1108
    String product;
1109

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

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

1126
    /** Specifies whether the {@code amount} includes taxes. Defaults to {@code exclusive}. */
1127
    @SerializedName("tax_behavior")
1128
    TaxBehavior taxBehavior;
1129

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

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

1156
    public static Builder builder() {
1157
      return new Builder();
1✔
1158
    }
1159

1160
    public static class Builder {
1✔
1161
      private Long amount;
1162

1163
      private Map<String, Object> extraParams;
1164

1165
      private String product;
1166

1167
      private Long quantity;
1168

1169
      private String reference;
1170

1171
      private TaxBehavior taxBehavior;
1172

1173
      private String taxCode;
1174

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

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

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

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

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

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

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

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

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

1271
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1272
      @SerializedName("exclusive")
×
1273
      EXCLUSIVE("exclusive"),
1274

1275
      @SerializedName("inclusive")
×
1276
      INCLUSIVE("inclusive");
1277

1278
      @Getter(onMethod_ = {@Override})
1279
      private final String value;
1280

1281
      TaxBehavior(String value) {
×
1282
        this.value = value;
×
1283
      }
×
1284
    }
1285
  }
1286

1287
  @Getter
1288
  public static class ShipFromDetails {
1289
    /** <strong>Required.</strong> The address from which the goods are being shipped from. */
1290
    @SerializedName("address")
1291
    Address address;
1292

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

1302
    private ShipFromDetails(Address address, Map<String, Object> extraParams) {
×
1303
      this.address = address;
×
1304
      this.extraParams = extraParams;
×
1305
    }
×
1306

1307
    public static Builder builder() {
1308
      return new Builder();
×
1309
    }
1310

1311
    public static class Builder {
×
1312
      private Address address;
1313

1314
      private Map<String, Object> extraParams;
1315

1316
      /** Finalize and obtain parameter instance from this builder. */
1317
      public CalculationCreateParams.ShipFromDetails build() {
1318
        return new CalculationCreateParams.ShipFromDetails(this.address, this.extraParams);
×
1319
      }
1320

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

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

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

1355
    @Getter
1356
    public static class Address {
1357
      /** City, district, suburb, town, or village. */
1358
      @SerializedName("city")
1359
      Object city;
1360

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

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

1377
      /** Address line 1 (e.g., street, PO Box, or company name). */
1378
      @SerializedName("line1")
1379
      Object line1;
1380

1381
      /** Address line 2 (e.g., apartment, suite, unit, or building). */
1382
      @SerializedName("line2")
1383
      Object line2;
1384

1385
      /** ZIP or postal code. */
1386
      @SerializedName("postal_code")
1387
      Object postalCode;
1388

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

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

1413
      public static Builder builder() {
1414
        return new Builder();
×
1415
      }
1416

1417
      public static class Builder {
×
1418
        private Object city;
1419

1420
        private String country;
1421

1422
        private Map<String, Object> extraParams;
1423

1424
        private Object line1;
1425

1426
        private Object line2;
1427

1428
        private Object postalCode;
1429

1430
        private Object state;
1431

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

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

1450
        /** City, district, suburb, town, or village. */
1451
        public Builder setCity(EmptyParam city) {
1452
          this.city = city;
×
1453
          return this;
×
1454
        }
1455

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

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

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

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

1499
        /** Address line 1 (e.g., street, PO Box, or company name). */
1500
        public Builder setLine1(EmptyParam line1) {
1501
          this.line1 = line1;
×
1502
          return this;
×
1503
        }
1504

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

1511
        /** Address line 2 (e.g., apartment, suite, unit, or building). */
1512
        public Builder setLine2(EmptyParam line2) {
1513
          this.line2 = line2;
×
1514
          return this;
×
1515
        }
1516

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

1523
        /** ZIP or postal code. */
1524
        public Builder setPostalCode(EmptyParam postalCode) {
1525
          this.postalCode = postalCode;
×
1526
          return this;
×
1527
        }
1528

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

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

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

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

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

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

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

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

1606
    public static Builder builder() {
1607
      return new Builder();
×
1608
    }
1609

1610
    public static class Builder {
×
1611
      private Long amount;
1612

1613
      private Map<String, Object> extraParams;
1614

1615
      private String shippingRate;
1616

1617
      private TaxBehavior taxBehavior;
1618

1619
      private String taxCode;
1620

1621
      /** Finalize and obtain parameter instance from this builder. */
1622
      public CalculationCreateParams.ShippingCost build() {
1623
        return new CalculationCreateParams.ShippingCost(
×
1624
            this.amount, this.extraParams, this.shippingRate, this.taxBehavior, this.taxCode);
1625
      }
1626

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

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

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

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

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

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

1695
    public enum TaxBehavior implements ApiRequestParams.EnumParam {
×
1696
      @SerializedName("exclusive")
×
1697
      EXCLUSIVE("exclusive"),
1698

1699
      @SerializedName("inclusive")
×
1700
      INCLUSIVE("inclusive");
1701

1702
      @Getter(onMethod_ = {@Override})
1703
      private final String value;
1704

1705
      TaxBehavior(String value) {
×
1706
        this.value = value;
×
1707
      }
×
1708
    }
1709
  }
1710
}
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