• 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

35.06
/src/main/java/com/stripe/param/TaxRateCreateParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.net.ApiRequestParams;
6
import java.math.BigDecimal;
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 TaxRateCreateParams extends ApiRequestParams {
15
  /**
16
   * Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates
17
   * cannot be used with new applications or Checkout Sessions, but will still work for
18
   * subscriptions and invoices that already have it set.
19
   */
20
  @SerializedName("active")
21
  Boolean active;
22

23
  /**
24
   * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1
25
   * alpha-2</a>).
26
   */
27
  @SerializedName("country")
28
  String country;
29

30
  /**
31
   * An arbitrary string attached to the tax rate for your internal use only. It will not be visible
32
   * to your customers.
33
   */
34
  @SerializedName("description")
35
  String description;
36

37
  /** <strong>Required.</strong> The display name of the tax rate, which will be shown to users. */
38
  @SerializedName("display_name")
39
  String displayName;
40

41
  /** Specifies which fields in the response should be expanded. */
42
  @SerializedName("expand")
43
  List<String> expand;
44

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

54
  /** <strong>Required.</strong> This specifies if the tax rate is inclusive or exclusive. */
55
  @SerializedName("inclusive")
56
  Boolean inclusive;
57

58
  /**
59
   * The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It
60
   * also appears on your customer’s invoice.
61
   */
62
  @SerializedName("jurisdiction")
63
  String jurisdiction;
64

65
  /**
66
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
67
   * to an object. This can be useful for storing additional information about the object in a
68
   * structured format. Individual keys can be unset by posting an empty value to them. All keys can
69
   * be unset by posting an empty value to {@code metadata}.
70
   */
71
  @SerializedName("metadata")
72
  Map<String, String> metadata;
73

74
  /** <strong>Required.</strong> This represents the tax rate percent out of 100. */
75
  @SerializedName("percentage")
76
  BigDecimal percentage;
77

78
  /**
79
   * <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US">ISO 3166-2 subdivision code</a>, without
80
   * country prefix. For example, &quot;NY&quot; for New York, United States.
81
   */
82
  @SerializedName("state")
83
  String state;
84

85
  /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */
86
  @SerializedName("tax_type")
87
  TaxType taxType;
88

89
  private TaxRateCreateParams(
90
      Boolean active,
91
      String country,
92
      String description,
93
      String displayName,
94
      List<String> expand,
95
      Map<String, Object> extraParams,
96
      Boolean inclusive,
97
      String jurisdiction,
98
      Map<String, String> metadata,
99
      BigDecimal percentage,
100
      String state,
101
      TaxType taxType) {
1✔
102
    this.active = active;
1✔
103
    this.country = country;
1✔
104
    this.description = description;
1✔
105
    this.displayName = displayName;
1✔
106
    this.expand = expand;
1✔
107
    this.extraParams = extraParams;
1✔
108
    this.inclusive = inclusive;
1✔
109
    this.jurisdiction = jurisdiction;
1✔
110
    this.metadata = metadata;
1✔
111
    this.percentage = percentage;
1✔
112
    this.state = state;
1✔
113
    this.taxType = taxType;
1✔
114
  }
1✔
115

116
  public static Builder builder() {
117
    return new Builder();
1✔
118
  }
119

120
  public static class Builder {
1✔
121
    private Boolean active;
122

123
    private String country;
124

125
    private String description;
126

127
    private String displayName;
128

129
    private List<String> expand;
130

131
    private Map<String, Object> extraParams;
132

133
    private Boolean inclusive;
134

135
    private String jurisdiction;
136

137
    private Map<String, String> metadata;
138

139
    private BigDecimal percentage;
140

141
    private String state;
142

143
    private TaxType taxType;
144

145
    /** Finalize and obtain parameter instance from this builder. */
146
    public TaxRateCreateParams build() {
147
      return new TaxRateCreateParams(
1✔
148
          this.active,
149
          this.country,
150
          this.description,
151
          this.displayName,
152
          this.expand,
153
          this.extraParams,
154
          this.inclusive,
155
          this.jurisdiction,
156
          this.metadata,
157
          this.percentage,
158
          this.state,
159
          this.taxType);
160
    }
161

162
    /**
163
     * Flag determining whether the tax rate is active or inactive (archived). Inactive tax rates
164
     * cannot be used with new applications or Checkout Sessions, but will still work for
165
     * subscriptions and invoices that already have it set.
166
     */
167
    public Builder setActive(Boolean active) {
168
      this.active = active;
×
169
      return this;
×
170
    }
171

172
    /**
173
     * Two-letter country code (<a href="https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO
174
     * 3166-1 alpha-2</a>).
175
     */
176
    public Builder setCountry(String country) {
177
      this.country = country;
×
178
      return this;
×
179
    }
180

181
    /**
182
     * An arbitrary string attached to the tax rate for your internal use only. It will not be
183
     * visible to your customers.
184
     */
185
    public Builder setDescription(String description) {
186
      this.description = description;
1✔
187
      return this;
1✔
188
    }
189

190
    /**
191
     * <strong>Required.</strong> The display name of the tax rate, which will be shown to users.
192
     */
193
    public Builder setDisplayName(String displayName) {
194
      this.displayName = displayName;
1✔
195
      return this;
1✔
196
    }
197

198
    /**
199
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
200
     * subsequent calls adds additional elements to the original list. See {@link
201
     * TaxRateCreateParams#expand} for the field documentation.
202
     */
203
    public Builder addExpand(String element) {
204
      if (this.expand == null) {
×
205
        this.expand = new ArrayList<>();
×
206
      }
207
      this.expand.add(element);
×
208
      return this;
×
209
    }
210

211
    /**
212
     * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
213
     * subsequent calls adds additional elements to the original list. See {@link
214
     * TaxRateCreateParams#expand} for the field documentation.
215
     */
216
    public Builder addAllExpand(List<String> elements) {
217
      if (this.expand == null) {
×
218
        this.expand = new ArrayList<>();
×
219
      }
220
      this.expand.addAll(elements);
×
221
      return this;
×
222
    }
223

224
    /**
225
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
226
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
227
     * TaxRateCreateParams#extraParams} for the field documentation.
228
     */
229
    public Builder putExtraParam(String key, Object value) {
230
      if (this.extraParams == null) {
×
231
        this.extraParams = new HashMap<>();
×
232
      }
233
      this.extraParams.put(key, value);
×
234
      return this;
×
235
    }
236

237
    /**
238
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
239
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
240
     * See {@link TaxRateCreateParams#extraParams} for the field documentation.
241
     */
242
    public Builder putAllExtraParam(Map<String, Object> map) {
243
      if (this.extraParams == null) {
×
244
        this.extraParams = new HashMap<>();
×
245
      }
246
      this.extraParams.putAll(map);
×
247
      return this;
×
248
    }
249

250
    /** <strong>Required.</strong> This specifies if the tax rate is inclusive or exclusive. */
251
    public Builder setInclusive(Boolean inclusive) {
252
      this.inclusive = inclusive;
1✔
253
      return this;
1✔
254
    }
255

256
    /**
257
     * The jurisdiction for the tax rate. You can use this label field for tax reporting purposes.
258
     * It also appears on your customer’s invoice.
259
     */
260
    public Builder setJurisdiction(String jurisdiction) {
261
      this.jurisdiction = jurisdiction;
1✔
262
      return this;
1✔
263
    }
264

265
    /**
266
     * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call,
267
     * and subsequent calls add additional key/value pairs to the original map. See {@link
268
     * TaxRateCreateParams#metadata} for the field documentation.
269
     */
270
    public Builder putMetadata(String key, String value) {
271
      if (this.metadata == null) {
×
272
        this.metadata = new HashMap<>();
×
273
      }
274
      this.metadata.put(key, value);
×
275
      return this;
×
276
    }
277

278
    /**
279
     * Add all map key/value pairs to `metadata` map. A map is initialized for the first
280
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
281
     * See {@link TaxRateCreateParams#metadata} for the field documentation.
282
     */
283
    public Builder putAllMetadata(Map<String, String> map) {
284
      if (this.metadata == null) {
×
285
        this.metadata = new HashMap<>();
×
286
      }
287
      this.metadata.putAll(map);
×
288
      return this;
×
289
    }
290

291
    /** <strong>Required.</strong> This represents the tax rate percent out of 100. */
292
    public Builder setPercentage(BigDecimal percentage) {
293
      this.percentage = percentage;
1✔
294
      return this;
1✔
295
    }
296

297
    /**
298
     * <a href="https://en.wikipedia.org/wiki/ISO_3166-2:US">ISO 3166-2 subdivision code</a>,
299
     * without country prefix. For example, &quot;NY&quot; for New York, United States.
300
     */
301
    public Builder setState(String state) {
302
      this.state = state;
×
303
      return this;
×
304
    }
305

306
    /** The high-level tax type, such as {@code vat} or {@code sales_tax}. */
307
    public Builder setTaxType(TaxRateCreateParams.TaxType taxType) {
308
      this.taxType = taxType;
×
309
      return this;
×
310
    }
311
  }
312

313
  public enum TaxType implements ApiRequestParams.EnumParam {
×
314
    @SerializedName("amusement_tax")
×
315
    AMUSEMENT_TAX("amusement_tax"),
316

317
    @SerializedName("communications_tax")
×
318
    COMMUNICATIONS_TAX("communications_tax"),
319

320
    @SerializedName("gst")
×
321
    GST("gst"),
322

323
    @SerializedName("hst")
×
324
    HST("hst"),
325

326
    @SerializedName("igst")
×
327
    IGST("igst"),
328

329
    @SerializedName("jct")
×
330
    JCT("jct"),
331

332
    @SerializedName("lease_tax")
×
333
    LEASE_TAX("lease_tax"),
334

335
    @SerializedName("pst")
×
336
    PST("pst"),
337

338
    @SerializedName("qst")
×
339
    QST("qst"),
340

341
    @SerializedName("retail_delivery_fee")
×
342
    RETAIL_DELIVERY_FEE("retail_delivery_fee"),
343

344
    @SerializedName("rst")
×
345
    RST("rst"),
346

347
    @SerializedName("sales_tax")
×
348
    SALES_TAX("sales_tax"),
349

NEW
350
    @SerializedName("service_tax")
×
351
    SERVICE_TAX("service_tax"),
352

UNCOV
353
    @SerializedName("vat")
×
354
    VAT("vat");
355

356
    @Getter(onMethod_ = {@Override})
357
    private final String value;
358

359
    TaxType(String value) {
×
360
      this.value = value;
×
361
    }
×
362
  }
363
}
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