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

stripe / stripe-java / #16380

30 Aug 2024 07:54PM UTC coverage: 12.882% (-0.004%) from 12.886%
#16380

push

github

web-flow
Merge from master after the changes to not pass api_mode from individual methods (#1857)

* Generate SDK for OpenAPI spec version 1230 (#1856)

* Bump version to 26.9.0

* No need for APIMode to be passed around from individual API methods (#1855)

* Generated code

* Update the code around raw request

* Update the v2 tests to use v2 path

16 of 23 new or added lines in 7 files covered. (69.57%)

706 existing lines in 213 files now uncovered.

18468 of 143365 relevant lines covered (12.88%)

0.13 hits per line

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

57.41
/src/main/java/com/stripe/model/Review.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.net.ApiRequest;
7
import com.stripe.net.ApiRequestParams;
8
import com.stripe.net.ApiResource;
9
import com.stripe.net.BaseAddress;
10
import com.stripe.net.RequestOptions;
11
import com.stripe.net.StripeResponseGetter;
12
import com.stripe.param.ReviewApproveParams;
13
import com.stripe.param.ReviewListParams;
14
import com.stripe.param.ReviewRetrieveParams;
15
import java.math.BigDecimal;
16
import java.util.Map;
17
import lombok.EqualsAndHashCode;
18
import lombok.Getter;
19
import lombok.Setter;
20

21
/**
22
 * Reviews can be used to supplement automated fraud detection with human expertise.
23
 *
24
 * <p>Learn more about <a href="https://stripe.com/radar">Radar</a> and reviewing payments <a
25
 * href="https://stripe.com/docs/radar/reviews">here</a>.
26
 */
27
@Getter
28
@Setter
29
@EqualsAndHashCode(callSuper = false)
30
public class Review extends ApiResource implements HasId {
1✔
31
  /** The ZIP or postal code of the card used, if applicable. */
32
  @SerializedName("billing_zip")
33
  String billingZip;
34

35
  /** The charge associated with this review. */
36
  @SerializedName("charge")
37
  @Getter(lombok.AccessLevel.NONE)
38
  @Setter(lombok.AccessLevel.NONE)
39
  ExpandableField<Charge> charge;
40

41
  /**
42
   * The reason the review was closed, or null if it has not yet been closed. One of {@code
43
   * approved}, {@code refunded}, {@code refunded_as_fraud}, {@code disputed}, or {@code redacted}.
44
   */
45
  @SerializedName("closed_reason")
46
  String closedReason;
47

48
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
49
  @SerializedName("created")
50
  Long created;
51

52
  /** Unique identifier for the object. */
53
  @Getter(onMethod_ = {@Override})
54
  @SerializedName("id")
55
  String id;
56

57
  /** The IP address where the payment originated. */
58
  @SerializedName("ip_address")
59
  String ipAddress;
60

61
  /**
62
   * Information related to the location of the payment. Note that this information is an
63
   * approximation and attempts to locate the nearest population center - it should not be used to
64
   * determine a specific address.
65
   */
66
  @SerializedName("ip_address_location")
67
  IpAddressLocation ipAddressLocation;
68

69
  /**
70
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
71
   * object exists in test mode.
72
   */
73
  @SerializedName("livemode")
74
  Boolean livemode;
75

76
  /**
77
   * String representing the object's type. Objects of the same type share the same value.
78
   *
79
   * <p>Equal to {@code review}.
80
   */
81
  @SerializedName("object")
82
  String object;
83

84
  /** If {@code true}, the review needs action. */
85
  @SerializedName("open")
86
  Boolean open;
87

88
  /** The reason the review was opened. One of {@code rule} or {@code manual}. */
89
  @SerializedName("opened_reason")
90
  String openedReason;
91

92
  /** The PaymentIntent ID associated with this review, if one exists. */
93
  @SerializedName("payment_intent")
94
  @Getter(lombok.AccessLevel.NONE)
95
  @Setter(lombok.AccessLevel.NONE)
96
  ExpandableField<PaymentIntent> paymentIntent;
97

98
  /**
99
   * The reason the review is currently open or closed. One of {@code rule}, {@code manual}, {@code
100
   * approved}, {@code refunded}, {@code refunded_as_fraud}, {@code disputed}, or {@code redacted}.
101
   */
102
  @SerializedName("reason")
103
  String reason;
104

105
  /** Information related to the browsing session of the user who initiated the payment. */
106
  @SerializedName("session")
107
  Session session;
108

109
  /** Get ID of expandable {@code charge} object. */
110
  public String getCharge() {
111
    return (this.charge != null) ? this.charge.getId() : null;
×
112
  }
113

114
  public void setCharge(String id) {
115
    this.charge = ApiResource.setExpandableFieldId(id, this.charge);
×
116
  }
×
117

118
  /** Get expanded {@code charge}. */
119
  public Charge getChargeObject() {
120
    return (this.charge != null) ? this.charge.getExpanded() : null;
×
121
  }
122

123
  public void setChargeObject(Charge expandableObject) {
124
    this.charge = new ExpandableField<Charge>(expandableObject.getId(), expandableObject);
×
125
  }
×
126

127
  /** Get ID of expandable {@code paymentIntent} object. */
128
  public String getPaymentIntent() {
129
    return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
×
130
  }
131

132
  public void setPaymentIntent(String id) {
133
    this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
×
134
  }
×
135

136
  /** Get expanded {@code paymentIntent}. */
137
  public PaymentIntent getPaymentIntentObject() {
138
    return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
×
139
  }
140

141
  public void setPaymentIntentObject(PaymentIntent expandableObject) {
142
    this.paymentIntent =
×
143
        new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
×
144
  }
×
145

146
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
147
  public Review approve() throws StripeException {
148
    return approve((Map<String, Object>) null, (RequestOptions) null);
1✔
149
  }
150

151
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
152
  public Review approve(RequestOptions options) throws StripeException {
153
    return approve((Map<String, Object>) null, options);
×
154
  }
155

156
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
157
  public Review approve(Map<String, Object> params) throws StripeException {
158
    return approve(params, (RequestOptions) null);
×
159
  }
160

161
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
162
  public Review approve(Map<String, Object> params, RequestOptions options) throws StripeException {
163
    String path = String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()));
1✔
164
    ApiRequest request =
1✔
165
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
166
    return getResponseGetter().request(request, Review.class);
1✔
167
  }
168

169
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
170
  public Review approve(ReviewApproveParams params) throws StripeException {
171
    return approve(params, (RequestOptions) null);
1✔
172
  }
173

174
  /** Approves a {@code Review} object, closing it and removing it from the list of reviews. */
175
  public Review approve(ReviewApproveParams params, RequestOptions options) throws StripeException {
176
    String path = String.format("/v1/reviews/%s/approve", ApiResource.urlEncodeId(this.getId()));
1✔
177
    ApiResource.checkNullTypedParams(path, params);
1✔
178
    ApiRequest request =
1✔
179
        new ApiRequest(
180
            BaseAddress.API,
181
            ApiResource.RequestMethod.POST,
182
            path,
183
            ApiRequestParams.paramsToMap(params),
1✔
184
            options);
185
    return getResponseGetter().request(request, Review.class);
1✔
186
  }
187

188
  /**
189
   * Returns a list of {@code Review} objects that have {@code open} set to {@code true}. The
190
   * objects are sorted in descending order by creation date, with the most recently created object
191
   * appearing first.
192
   */
193
  public static ReviewCollection list(Map<String, Object> params) throws StripeException {
194
    return list(params, (RequestOptions) null);
1✔
195
  }
196

197
  /**
198
   * Returns a list of {@code Review} objects that have {@code open} set to {@code true}. The
199
   * objects are sorted in descending order by creation date, with the most recently created object
200
   * appearing first.
201
   */
202
  public static ReviewCollection list(Map<String, Object> params, RequestOptions options)
203
      throws StripeException {
204
    String path = "/v1/reviews";
1✔
205
    ApiRequest request =
1✔
206
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
207
    return getGlobalResponseGetter().request(request, ReviewCollection.class);
1✔
208
  }
209

210
  /**
211
   * Returns a list of {@code Review} objects that have {@code open} set to {@code true}. The
212
   * objects are sorted in descending order by creation date, with the most recently created object
213
   * appearing first.
214
   */
215
  public static ReviewCollection list(ReviewListParams params) throws StripeException {
216
    return list(params, (RequestOptions) null);
1✔
217
  }
218

219
  /**
220
   * Returns a list of {@code Review} objects that have {@code open} set to {@code true}. The
221
   * objects are sorted in descending order by creation date, with the most recently created object
222
   * appearing first.
223
   */
224
  public static ReviewCollection list(ReviewListParams params, RequestOptions options)
225
      throws StripeException {
226
    String path = "/v1/reviews";
1✔
227
    ApiResource.checkNullTypedParams(path, params);
1✔
228
    ApiRequest request =
1✔
229
        new ApiRequest(
230
            BaseAddress.API,
231
            ApiResource.RequestMethod.GET,
232
            path,
233
            ApiRequestParams.paramsToMap(params),
1✔
234
            options);
235
    return getGlobalResponseGetter().request(request, ReviewCollection.class);
1✔
236
  }
237

238
  /** Retrieves a {@code Review} object. */
239
  public static Review retrieve(String review) throws StripeException {
240
    return retrieve(review, (Map<String, Object>) null, (RequestOptions) null);
1✔
241
  }
242

243
  /** Retrieves a {@code Review} object. */
244
  public static Review retrieve(String review, RequestOptions options) throws StripeException {
245
    return retrieve(review, (Map<String, Object>) null, options);
×
246
  }
247

248
  /** Retrieves a {@code Review} object. */
249
  public static Review retrieve(String review, Map<String, Object> params, RequestOptions options)
250
      throws StripeException {
251
    String path = String.format("/v1/reviews/%s", ApiResource.urlEncodeId(review));
1✔
252
    ApiRequest request =
1✔
253
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
254
    return getGlobalResponseGetter().request(request, Review.class);
1✔
255
  }
256

257
  /** Retrieves a {@code Review} object. */
258
  public static Review retrieve(String review, ReviewRetrieveParams params, RequestOptions options)
259
      throws StripeException {
260
    String path = String.format("/v1/reviews/%s", ApiResource.urlEncodeId(review));
×
261
    ApiResource.checkNullTypedParams(path, params);
×
262
    ApiRequest request =
×
263
        new ApiRequest(
264
            BaseAddress.API,
265
            ApiResource.RequestMethod.GET,
266
            path,
267
            ApiRequestParams.paramsToMap(params),
×
268
            options);
UNCOV
269
    return getGlobalResponseGetter().request(request, Review.class);
×
270
  }
271

272
  @Getter
273
  @Setter
274
  @EqualsAndHashCode(callSuper = false)
275
  public static class IpAddressLocation extends StripeObject {
×
276
    /** The city where the payment originated. */
277
    @SerializedName("city")
278
    String city;
279

280
    /** Two-letter ISO code representing the country where the payment originated. */
281
    @SerializedName("country")
282
    String country;
283

284
    /** The geographic latitude where the payment originated. */
285
    @SerializedName("latitude")
286
    BigDecimal latitude;
287

288
    /** The geographic longitude where the payment originated. */
289
    @SerializedName("longitude")
290
    BigDecimal longitude;
291

292
    /** The state/county/province/region where the payment originated. */
293
    @SerializedName("region")
294
    String region;
295
  }
296

297
  @Getter
298
  @Setter
299
  @EqualsAndHashCode(callSuper = false)
300
  public static class Session extends StripeObject {
×
301
    /** The browser used in this browser session (e.g., {@code Chrome}). */
302
    @SerializedName("browser")
303
    String browser;
304

305
    /**
306
     * Information about the device used for the browser session (e.g., {@code Samsung SM-G930T}).
307
     */
308
    @SerializedName("device")
309
    String device;
310

311
    /** The platform for the browser session (e.g., {@code Macintosh}). */
312
    @SerializedName("platform")
313
    String platform;
314

315
    /** The version for the browser session (e.g., {@code 61.0.3163.100}). */
316
    @SerializedName("version")
317
    String version;
318
  }
319

320
  @Override
321
  public void setResponseGetter(StripeResponseGetter responseGetter) {
322
    super.setResponseGetter(responseGetter);
1✔
323
    trySetResponseGetter(charge, responseGetter);
1✔
324
    trySetResponseGetter(ipAddressLocation, responseGetter);
1✔
325
    trySetResponseGetter(paymentIntent, responseGetter);
1✔
326
    trySetResponseGetter(session, responseGetter);
1✔
327
  }
1✔
328
}
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