• 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

0.0
/src/main/java/com/stripe/param/forwarding/RequestCreateParams.java
1
// File generated from our OpenAPI spec
2
package com.stripe.param.forwarding;
3

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

12
@Getter
13
public class RequestCreateParams extends ApiRequestParams {
14
  /** Specifies which fields in the response should be expanded. */
15
  @SerializedName("expand")
16
  List<String> expand;
17

18
  /**
19
   * Map of extra parameters for custom features not available in this client library. The content
20
   * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
21
   * key/value pair is serialized as if the key is a root-level field (serialized) name in this
22
   * param object. Effectively, this map is flattened to its parent instance.
23
   */
24
  @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
25
  Map<String, Object> extraParams;
26

27
  /**
28
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
29
   * to an object. This can be useful for storing additional information about the object in a
30
   * structured format. Individual keys can be unset by posting an empty value to them. All keys can
31
   * be unset by posting an empty value to {@code metadata}.
32
   */
33
  @SerializedName("metadata")
34
  Map<String, String> metadata;
35

36
  /**
37
   * <strong>Required.</strong> The PaymentMethod to insert into the forwarded request. Forwarding
38
   * previously consumed PaymentMethods is allowed.
39
   */
40
  @SerializedName("payment_method")
41
  String paymentMethod;
42

43
  /** <strong>Required.</strong> The field kinds to be replaced in the forwarded request. */
44
  @SerializedName("replacements")
45
  List<RequestCreateParams.Replacement> replacements;
46

47
  /**
48
   * <strong>Required.</strong> The request body and headers to be sent to the destination endpoint.
49
   */
50
  @SerializedName("request")
51
  Request request;
52

53
  /**
54
   * <strong>Required.</strong> The destination URL for the forwarded request. Must be supported by
55
   * the config.
56
   */
57
  @SerializedName("url")
58
  String url;
59

60
  private RequestCreateParams(
61
      List<String> expand,
62
      Map<String, Object> extraParams,
63
      Map<String, String> metadata,
64
      String paymentMethod,
65
      List<RequestCreateParams.Replacement> replacements,
66
      Request request,
67
      String url) {
×
68
    this.expand = expand;
×
69
    this.extraParams = extraParams;
×
70
    this.metadata = metadata;
×
71
    this.paymentMethod = paymentMethod;
×
72
    this.replacements = replacements;
×
73
    this.request = request;
×
74
    this.url = url;
×
75
  }
×
76

77
  public static Builder builder() {
78
    return new Builder();
×
79
  }
80

81
  public static class Builder {
×
82
    private List<String> expand;
83

84
    private Map<String, Object> extraParams;
85

86
    private Map<String, String> metadata;
87

88
    private String paymentMethod;
89

90
    private List<RequestCreateParams.Replacement> replacements;
91

92
    private Request request;
93

94
    private String url;
95

96
    /** Finalize and obtain parameter instance from this builder. */
97
    public RequestCreateParams build() {
98
      return new RequestCreateParams(
×
99
          this.expand,
100
          this.extraParams,
101
          this.metadata,
102
          this.paymentMethod,
103
          this.replacements,
104
          this.request,
105
          this.url);
106
    }
107

108
    /**
109
     * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
110
     * subsequent calls adds additional elements to the original list. See {@link
111
     * RequestCreateParams#expand} for the field documentation.
112
     */
113
    public Builder addExpand(String element) {
114
      if (this.expand == null) {
×
115
        this.expand = new ArrayList<>();
×
116
      }
117
      this.expand.add(element);
×
118
      return this;
×
119
    }
120

121
    /**
122
     * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
123
     * subsequent calls adds additional elements to the original list. See {@link
124
     * RequestCreateParams#expand} for the field documentation.
125
     */
126
    public Builder addAllExpand(List<String> elements) {
127
      if (this.expand == null) {
×
128
        this.expand = new ArrayList<>();
×
129
      }
130
      this.expand.addAll(elements);
×
131
      return this;
×
132
    }
133

134
    /**
135
     * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
136
     * call, and subsequent calls add additional key/value pairs to the original map. See {@link
137
     * RequestCreateParams#extraParams} for the field documentation.
138
     */
139
    public Builder putExtraParam(String key, Object value) {
140
      if (this.extraParams == null) {
×
141
        this.extraParams = new HashMap<>();
×
142
      }
143
      this.extraParams.put(key, value);
×
144
      return this;
×
145
    }
146

147
    /**
148
     * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
149
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
150
     * See {@link RequestCreateParams#extraParams} for the field documentation.
151
     */
152
    public Builder putAllExtraParam(Map<String, Object> map) {
153
      if (this.extraParams == null) {
×
154
        this.extraParams = new HashMap<>();
×
155
      }
156
      this.extraParams.putAll(map);
×
157
      return this;
×
158
    }
159

160
    /**
161
     * Add a key/value pair to `metadata` map. A map is initialized for the first `put/putAll` call,
162
     * and subsequent calls add additional key/value pairs to the original map. See {@link
163
     * RequestCreateParams#metadata} for the field documentation.
164
     */
165
    public Builder putMetadata(String key, String value) {
166
      if (this.metadata == null) {
×
167
        this.metadata = new HashMap<>();
×
168
      }
169
      this.metadata.put(key, value);
×
170
      return this;
×
171
    }
172

173
    /**
174
     * Add all map key/value pairs to `metadata` map. A map is initialized for the first
175
     * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
176
     * See {@link RequestCreateParams#metadata} for the field documentation.
177
     */
178
    public Builder putAllMetadata(Map<String, String> map) {
179
      if (this.metadata == null) {
×
180
        this.metadata = new HashMap<>();
×
181
      }
182
      this.metadata.putAll(map);
×
183
      return this;
×
184
    }
185

186
    /**
187
     * <strong>Required.</strong> The PaymentMethod to insert into the forwarded request. Forwarding
188
     * previously consumed PaymentMethods is allowed.
189
     */
190
    public Builder setPaymentMethod(String paymentMethod) {
191
      this.paymentMethod = paymentMethod;
×
192
      return this;
×
193
    }
194

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

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

221
    /**
222
     * <strong>Required.</strong> The request body and headers to be sent to the destination
223
     * endpoint.
224
     */
225
    public Builder setRequest(RequestCreateParams.Request request) {
226
      this.request = request;
×
227
      return this;
×
228
    }
229

230
    /**
231
     * <strong>Required.</strong> The destination URL for the forwarded request. Must be supported
232
     * by the config.
233
     */
234
    public Builder setUrl(String url) {
235
      this.url = url;
×
236
      return this;
×
237
    }
238
  }
239

240
  @Getter
241
  public static class Request {
242
    /** The body payload to send to the destination endpoint. */
243
    @SerializedName("body")
244
    String body;
245

246
    /**
247
     * Map of extra parameters for custom features not available in this client library. The content
248
     * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
249
     * key/value pair is serialized as if the key is a root-level field (serialized) name in this
250
     * param object. Effectively, this map is flattened to its parent instance.
251
     */
252
    @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
253
    Map<String, Object> extraParams;
254

255
    /**
256
     * The headers to include in the forwarded request. Can be omitted if no additional headers
257
     * (excluding Stripe-generated ones such as the Content-Type header) should be included.
258
     */
259
    @SerializedName("headers")
260
    List<RequestCreateParams.Request.Header> headers;
261

262
    private Request(
263
        String body,
264
        Map<String, Object> extraParams,
265
        List<RequestCreateParams.Request.Header> headers) {
×
266
      this.body = body;
×
267
      this.extraParams = extraParams;
×
268
      this.headers = headers;
×
269
    }
×
270

271
    public static Builder builder() {
272
      return new Builder();
×
273
    }
274

275
    public static class Builder {
×
276
      private String body;
277

278
      private Map<String, Object> extraParams;
279

280
      private List<RequestCreateParams.Request.Header> headers;
281

282
      /** Finalize and obtain parameter instance from this builder. */
283
      public RequestCreateParams.Request build() {
284
        return new RequestCreateParams.Request(this.body, this.extraParams, this.headers);
×
285
      }
286

287
      /** The body payload to send to the destination endpoint. */
288
      public Builder setBody(String body) {
289
        this.body = body;
×
290
        return this;
×
291
      }
292

293
      /**
294
       * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
295
       * call, and subsequent calls add additional key/value pairs to the original map. See {@link
296
       * RequestCreateParams.Request#extraParams} for the field documentation.
297
       */
298
      public Builder putExtraParam(String key, Object value) {
299
        if (this.extraParams == null) {
×
300
          this.extraParams = new HashMap<>();
×
301
        }
302
        this.extraParams.put(key, value);
×
303
        return this;
×
304
      }
305

306
      /**
307
       * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
308
       * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
309
       * See {@link RequestCreateParams.Request#extraParams} for the field documentation.
310
       */
311
      public Builder putAllExtraParam(Map<String, Object> map) {
312
        if (this.extraParams == null) {
×
313
          this.extraParams = new HashMap<>();
×
314
        }
315
        this.extraParams.putAll(map);
×
316
        return this;
×
317
      }
318

319
      /**
320
       * Add an element to `headers` list. A list is initialized for the first `add/addAll` call,
321
       * and subsequent calls adds additional elements to the original list. See {@link
322
       * RequestCreateParams.Request#headers} for the field documentation.
323
       */
324
      public Builder addHeader(RequestCreateParams.Request.Header element) {
325
        if (this.headers == null) {
×
326
          this.headers = new ArrayList<>();
×
327
        }
328
        this.headers.add(element);
×
329
        return this;
×
330
      }
331

332
      /**
333
       * Add all elements to `headers` list. A list is initialized for the first `add/addAll` call,
334
       * and subsequent calls adds additional elements to the original list. See {@link
335
       * RequestCreateParams.Request#headers} for the field documentation.
336
       */
337
      public Builder addAllHeader(List<RequestCreateParams.Request.Header> elements) {
338
        if (this.headers == null) {
×
339
          this.headers = new ArrayList<>();
×
340
        }
341
        this.headers.addAll(elements);
×
342
        return this;
×
343
      }
344
    }
345

346
    @Getter
347
    public static class Header {
348
      /**
349
       * Map of extra parameters for custom features not available in this client library. The
350
       * content in this map is not serialized under this field's {@code @SerializedName} value.
351
       * Instead, each key/value pair is serialized as if the key is a root-level field (serialized)
352
       * name in this param object. Effectively, this map is flattened to its parent instance.
353
       */
354
      @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
355
      Map<String, Object> extraParams;
356

357
      /** <strong>Required.</strong> The header name. */
358
      @SerializedName("name")
359
      String name;
360

361
      /** <strong>Required.</strong> The header value. */
362
      @SerializedName("value")
363
      String value;
364

365
      private Header(Map<String, Object> extraParams, String name, String value) {
×
366
        this.extraParams = extraParams;
×
367
        this.name = name;
×
368
        this.value = value;
×
369
      }
×
370

371
      public static Builder builder() {
372
        return new Builder();
×
373
      }
374

375
      public static class Builder {
×
376
        private Map<String, Object> extraParams;
377

378
        private String name;
379

380
        private String value;
381

382
        /** Finalize and obtain parameter instance from this builder. */
383
        public RequestCreateParams.Request.Header build() {
384
          return new RequestCreateParams.Request.Header(this.extraParams, this.name, this.value);
×
385
        }
386

387
        /**
388
         * Add a key/value pair to `extraParams` map. A map is initialized for the first
389
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
390
         * map. See {@link RequestCreateParams.Request.Header#extraParams} for the field
391
         * documentation.
392
         */
393
        public Builder putExtraParam(String key, Object value) {
394
          if (this.extraParams == null) {
×
395
            this.extraParams = new HashMap<>();
×
396
          }
397
          this.extraParams.put(key, value);
×
398
          return this;
×
399
        }
400

401
        /**
402
         * Add all map key/value pairs to `extraParams` map. A map is initialized for the first
403
         * `put/putAll` call, and subsequent calls add additional key/value pairs to the original
404
         * map. See {@link RequestCreateParams.Request.Header#extraParams} for the field
405
         * documentation.
406
         */
407
        public Builder putAllExtraParam(Map<String, Object> map) {
408
          if (this.extraParams == null) {
×
409
            this.extraParams = new HashMap<>();
×
410
          }
411
          this.extraParams.putAll(map);
×
412
          return this;
×
413
        }
414

415
        /** <strong>Required.</strong> The header name. */
416
        public Builder setName(String name) {
417
          this.name = name;
×
418
          return this;
×
419
        }
420

421
        /** <strong>Required.</strong> The header value. */
422
        public Builder setValue(String value) {
423
          this.value = value;
×
424
          return this;
×
425
        }
426
      }
427
    }
428
  }
429

430
  public enum Replacement implements ApiRequestParams.EnumParam {
×
431
    @SerializedName("card_cvc")
×
432
    CARD_CVC("card_cvc"),
433

434
    @SerializedName("card_expiry")
×
435
    CARD_EXPIRY("card_expiry"),
436

437
    @SerializedName("card_number")
×
438
    CARD_NUMBER("card_number"),
439

440
    @SerializedName("cardholder_name")
×
441
    CARDHOLDER_NAME("cardholder_name"),
442

NEW
443
    @SerializedName("request_signature")
×
444
    REQUEST_SIGNATURE("request_signature");
445

446
    @Getter(onMethod_ = {@Override})
447
    private final String value;
448

449
    Replacement(String value) {
×
450
      this.value = value;
×
451
    }
×
452
  }
453
}
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