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

stripe / stripe-java / #16599

29 Oct 2024 11:04PM UTC coverage: 12.519% (-0.1%) from 12.62%
#16599

push

github

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

Update generated code for beta

40 of 1580 new or added lines in 51 files covered. (2.53%)

19 existing lines in 15 files now uncovered.

18843 of 150513 relevant lines covered (12.52%)

0.13 hits per line

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

46.63
/src/main/java/com/stripe/model/Refund.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.RefundCancelParams;
13
import com.stripe.param.RefundCreateParams;
14
import com.stripe.param.RefundExpireParams;
15
import com.stripe.param.RefundListParams;
16
import com.stripe.param.RefundRetrieveParams;
17
import com.stripe.param.RefundUpdateParams;
18
import java.util.Map;
19
import lombok.EqualsAndHashCode;
20
import lombok.Getter;
21
import lombok.Setter;
22

23
/**
24
 * Refund objects allow you to refund a previously created charge that isn't refunded yet. Funds are
25
 * refunded to the credit or debit card that's initially charged.
26
 *
27
 * <p>Related guide: <a href="https://stripe.com/docs/refunds">Refunds</a>
28
 */
29
@Getter
30
@Setter
31
@EqualsAndHashCode(callSuper = false)
32
public class Refund extends ApiResource implements MetadataStore<Refund>, BalanceTransactionSource {
1✔
33
  /** Amount, in cents (or local equivalent). */
34
  @SerializedName("amount")
35
  Long amount;
36

37
  /** Balance transaction that describes the impact on your account balance. */
38
  @SerializedName("balance_transaction")
39
  @Getter(lombok.AccessLevel.NONE)
40
  @Setter(lombok.AccessLevel.NONE)
41
  ExpandableField<BalanceTransaction> balanceTransaction;
42

43
  /** ID of the charge that's refunded. */
44
  @SerializedName("charge")
45
  @Getter(lombok.AccessLevel.NONE)
46
  @Setter(lombok.AccessLevel.NONE)
47
  ExpandableField<Charge> charge;
48

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

53
  /**
54
   * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>,
55
   * in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
56
   */
57
  @SerializedName("currency")
58
  String currency;
59

60
  /**
61
   * An arbitrary string attached to the object. You can use this for displaying to users (available
62
   * on non-card refunds only).
63
   */
64
  @SerializedName("description")
65
  String description;
66

67
  @SerializedName("destination_details")
68
  DestinationDetails destinationDetails;
69

70
  /**
71
   * After the refund fails, this balance transaction describes the adjustment made on your account
72
   * balance that reverses the initial balance transaction.
73
   */
74
  @SerializedName("failure_balance_transaction")
75
  @Getter(lombok.AccessLevel.NONE)
76
  @Setter(lombok.AccessLevel.NONE)
77
  ExpandableField<BalanceTransaction> failureBalanceTransaction;
78

79
  /**
80
   * Provides the reason for the refund failure. Possible values are: {@code lost_or_stolen_card},
81
   * {@code expired_or_canceled_card}, {@code charge_for_pending_refund_disputed}, {@code
82
   * insufficient_funds}, {@code declined}, {@code merchant_request}, or {@code unknown}.
83
   */
84
  @SerializedName("failure_reason")
85
  String failureReason;
86

87
  /** Unique identifier for the object. */
88
  @Getter(onMethod_ = {@Override})
89
  @SerializedName("id")
90
  String id;
91

92
  /**
93
   * For payment methods without native refund support (for example, Konbini, PromptPay), provide an
94
   * email address for the customer to receive refund instructions.
95
   */
96
  @SerializedName("instructions_email")
97
  String instructionsEmail;
98

99
  /**
100
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
101
   * to an object. This can be useful for storing additional information about the object in a
102
   * structured format.
103
   */
104
  @Getter(onMethod_ = {@Override})
105
  @SerializedName("metadata")
106
  Map<String, String> metadata;
107

108
  @SerializedName("next_action")
109
  NextAction nextAction;
110

111
  /**
112
   * String representing the object's type. Objects of the same type share the same value.
113
   *
114
   * <p>Equal to {@code refund}.
115
   */
116
  @SerializedName("object")
117
  String object;
118

119
  /** ID of the PaymentIntent that's refunded. */
120
  @SerializedName("payment_intent")
121
  @Getter(lombok.AccessLevel.NONE)
122
  @Setter(lombok.AccessLevel.NONE)
123
  ExpandableField<PaymentIntent> paymentIntent;
124

125
  /**
126
   * Reason for the refund, which is either user-provided ({@code duplicate}, {@code fraudulent}, or
127
   * {@code requested_by_customer}) or generated by Stripe internally ({@code
128
   * expired_uncaptured_charge}).
129
   *
130
   * <p>One of {@code duplicate}, {@code expired_uncaptured_charge}, {@code fraudulent}, or {@code
131
   * requested_by_customer}.
132
   */
133
  @SerializedName("reason")
134
  String reason;
135

136
  /** This is the transaction number that appears on email receipts sent for this refund. */
137
  @SerializedName("receipt_number")
138
  String receiptNumber;
139

140
  /**
141
   * The transfer reversal that's associated with the refund. Only present if the charge came from
142
   * another Stripe account.
143
   */
144
  @SerializedName("source_transfer_reversal")
145
  @Getter(lombok.AccessLevel.NONE)
146
  @Setter(lombok.AccessLevel.NONE)
147
  ExpandableField<TransferReversal> sourceTransferReversal;
148

149
  /**
150
   * Status of the refund. This can be {@code pending}, {@code requires_action}, {@code succeeded},
151
   * {@code failed}, or {@code canceled}. Learn more about <a
152
   * href="https://stripe.com/docs/refunds#failed-refunds">failed refunds</a>.
153
   */
154
  @SerializedName("status")
155
  String status;
156

157
  /**
158
   * This refers to the transfer reversal object if the accompanying transfer reverses. This is only
159
   * applicable if the charge was created using the destination parameter.
160
   */
161
  @SerializedName("transfer_reversal")
162
  @Getter(lombok.AccessLevel.NONE)
163
  @Setter(lombok.AccessLevel.NONE)
164
  ExpandableField<TransferReversal> transferReversal;
165

166
  /** Get ID of expandable {@code balanceTransaction} object. */
167
  public String getBalanceTransaction() {
168
    return (this.balanceTransaction != null) ? this.balanceTransaction.getId() : null;
1✔
169
  }
170

171
  public void setBalanceTransaction(String id) {
172
    this.balanceTransaction = ApiResource.setExpandableFieldId(id, this.balanceTransaction);
×
173
  }
×
174

175
  /** Get expanded {@code balanceTransaction}. */
176
  public BalanceTransaction getBalanceTransactionObject() {
177
    return (this.balanceTransaction != null) ? this.balanceTransaction.getExpanded() : null;
1✔
178
  }
179

180
  public void setBalanceTransactionObject(BalanceTransaction expandableObject) {
181
    this.balanceTransaction =
×
182
        new ExpandableField<BalanceTransaction>(expandableObject.getId(), expandableObject);
×
183
  }
×
184

185
  /** Get ID of expandable {@code charge} object. */
186
  public String getCharge() {
187
    return (this.charge != null) ? this.charge.getId() : null;
1✔
188
  }
189

190
  public void setCharge(String id) {
191
    this.charge = ApiResource.setExpandableFieldId(id, this.charge);
×
192
  }
×
193

194
  /** Get expanded {@code charge}. */
195
  public Charge getChargeObject() {
196
    return (this.charge != null) ? this.charge.getExpanded() : null;
1✔
197
  }
198

199
  public void setChargeObject(Charge expandableObject) {
200
    this.charge = new ExpandableField<Charge>(expandableObject.getId(), expandableObject);
×
201
  }
×
202

203
  /** Get ID of expandable {@code failureBalanceTransaction} object. */
204
  public String getFailureBalanceTransaction() {
205
    return (this.failureBalanceTransaction != null) ? this.failureBalanceTransaction.getId() : null;
1✔
206
  }
207

208
  public void setFailureBalanceTransaction(String id) {
209
    this.failureBalanceTransaction =
×
210
        ApiResource.setExpandableFieldId(id, this.failureBalanceTransaction);
×
211
  }
×
212

213
  /** Get expanded {@code failureBalanceTransaction}. */
214
  public BalanceTransaction getFailureBalanceTransactionObject() {
215
    return (this.failureBalanceTransaction != null)
1✔
216
        ? this.failureBalanceTransaction.getExpanded()
1✔
217
        : null;
×
218
  }
219

220
  public void setFailureBalanceTransactionObject(BalanceTransaction expandableObject) {
221
    this.failureBalanceTransaction =
×
222
        new ExpandableField<BalanceTransaction>(expandableObject.getId(), expandableObject);
×
223
  }
×
224

225
  /** Get ID of expandable {@code paymentIntent} object. */
226
  public String getPaymentIntent() {
227
    return (this.paymentIntent != null) ? this.paymentIntent.getId() : null;
×
228
  }
229

230
  public void setPaymentIntent(String id) {
231
    this.paymentIntent = ApiResource.setExpandableFieldId(id, this.paymentIntent);
×
232
  }
×
233

234
  /** Get expanded {@code paymentIntent}. */
235
  public PaymentIntent getPaymentIntentObject() {
236
    return (this.paymentIntent != null) ? this.paymentIntent.getExpanded() : null;
×
237
  }
238

239
  public void setPaymentIntentObject(PaymentIntent expandableObject) {
240
    this.paymentIntent =
×
241
        new ExpandableField<PaymentIntent>(expandableObject.getId(), expandableObject);
×
242
  }
×
243

244
  /** Get ID of expandable {@code sourceTransferReversal} object. */
245
  public String getSourceTransferReversal() {
246
    return (this.sourceTransferReversal != null) ? this.sourceTransferReversal.getId() : null;
1✔
247
  }
248

249
  public void setSourceTransferReversal(String id) {
250
    this.sourceTransferReversal = ApiResource.setExpandableFieldId(id, this.sourceTransferReversal);
×
251
  }
×
252

253
  /** Get expanded {@code sourceTransferReversal}. */
254
  public TransferReversal getSourceTransferReversalObject() {
255
    return (this.sourceTransferReversal != null) ? this.sourceTransferReversal.getExpanded() : null;
1✔
256
  }
257

258
  public void setSourceTransferReversalObject(TransferReversal expandableObject) {
259
    this.sourceTransferReversal =
×
260
        new ExpandableField<TransferReversal>(expandableObject.getId(), expandableObject);
×
261
  }
×
262

263
  /** Get ID of expandable {@code transferReversal} object. */
264
  public String getTransferReversal() {
265
    return (this.transferReversal != null) ? this.transferReversal.getId() : null;
1✔
266
  }
267

268
  public void setTransferReversal(String id) {
269
    this.transferReversal = ApiResource.setExpandableFieldId(id, this.transferReversal);
×
270
  }
×
271

272
  /** Get expanded {@code transferReversal}. */
273
  public TransferReversal getTransferReversalObject() {
274
    return (this.transferReversal != null) ? this.transferReversal.getExpanded() : null;
1✔
275
  }
276

277
  public void setTransferReversalObject(TransferReversal expandableObject) {
278
    this.transferReversal =
×
279
        new ExpandableField<TransferReversal>(expandableObject.getId(), expandableObject);
×
280
  }
×
281

282
  /**
283
   * Cancels a refund with a status of {@code requires_action}.
284
   *
285
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
286
   * customer action can enter the {@code requires_action} state.
287
   */
288
  public Refund cancel() throws StripeException {
289
    return cancel((Map<String, Object>) null, (RequestOptions) null);
×
290
  }
291

292
  /**
293
   * Cancels a refund with a status of {@code requires_action}.
294
   *
295
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
296
   * customer action can enter the {@code requires_action} state.
297
   */
298
  public Refund cancel(RequestOptions options) throws StripeException {
299
    return cancel((Map<String, Object>) null, options);
×
300
  }
301

302
  /**
303
   * Cancels a refund with a status of {@code requires_action}.
304
   *
305
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
306
   * customer action can enter the {@code requires_action} state.
307
   */
308
  public Refund cancel(Map<String, Object> params) throws StripeException {
309
    return cancel(params, (RequestOptions) null);
×
310
  }
311

312
  /**
313
   * Cancels a refund with a status of {@code requires_action}.
314
   *
315
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
316
   * customer action can enter the {@code requires_action} state.
317
   */
318
  public Refund cancel(Map<String, Object> params, RequestOptions options) throws StripeException {
319
    String path = String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()));
×
320
    ApiRequest request =
×
321
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
322
    return getResponseGetter().request(request, Refund.class);
×
323
  }
324

325
  /**
326
   * Cancels a refund with a status of {@code requires_action}.
327
   *
328
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
329
   * customer action can enter the {@code requires_action} state.
330
   */
331
  public Refund cancel(RefundCancelParams params) throws StripeException {
332
    return cancel(params, (RequestOptions) null);
1✔
333
  }
334

335
  /**
336
   * Cancels a refund with a status of {@code requires_action}.
337
   *
338
   * <p>You can’t cancel refunds in other states. Only refunds for payment methods that require
339
   * customer action can enter the {@code requires_action} state.
340
   */
341
  public Refund cancel(RefundCancelParams params, RequestOptions options) throws StripeException {
342
    String path = String.format("/v1/refunds/%s/cancel", ApiResource.urlEncodeId(this.getId()));
1✔
343
    ApiResource.checkNullTypedParams(path, params);
1✔
344
    ApiRequest request =
1✔
345
        new ApiRequest(
346
            BaseAddress.API,
347
            ApiResource.RequestMethod.POST,
348
            path,
349
            ApiRequestParams.paramsToMap(params),
1✔
350
            options);
351
    return getResponseGetter().request(request, Refund.class);
1✔
352
  }
353

354
  /**
355
   * When you create a new refund, you must specify a Charge or a PaymentIntent object on which to
356
   * create it.
357
   *
358
   * <p>Creating a new refund will refund a charge that has previously been created but not yet
359
   * refunded. Funds will be refunded to the credit or debit card that was originally charged.
360
   *
361
   * <p>You can optionally refund only part of a charge. You can do so multiple times, until the
362
   * entire charge has been refunded.
363
   *
364
   * <p>Once entirely refunded, a charge can’t be refunded again. This method will raise an error
365
   * when called on an already-refunded charge, or when trying to refund more money than is left on
366
   * a charge.
367
   */
368
  public static Refund create(Map<String, Object> params) throws StripeException {
369
    return create(params, (RequestOptions) null);
1✔
370
  }
371

372
  /**
373
   * When you create a new refund, you must specify a Charge or a PaymentIntent object on which to
374
   * create it.
375
   *
376
   * <p>Creating a new refund will refund a charge that has previously been created but not yet
377
   * refunded. Funds will be refunded to the credit or debit card that was originally charged.
378
   *
379
   * <p>You can optionally refund only part of a charge. You can do so multiple times, until the
380
   * entire charge has been refunded.
381
   *
382
   * <p>Once entirely refunded, a charge can’t be refunded again. This method will raise an error
383
   * when called on an already-refunded charge, or when trying to refund more money than is left on
384
   * a charge.
385
   */
386
  public static Refund create(Map<String, Object> params, RequestOptions options)
387
      throws StripeException {
388
    String path = "/v1/refunds";
1✔
389
    ApiRequest request =
1✔
390
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
391
    return getGlobalResponseGetter().request(request, Refund.class);
1✔
392
  }
393

394
  /**
395
   * When you create a new refund, you must specify a Charge or a PaymentIntent object on which to
396
   * create it.
397
   *
398
   * <p>Creating a new refund will refund a charge that has previously been created but not yet
399
   * refunded. Funds will be refunded to the credit or debit card that was originally charged.
400
   *
401
   * <p>You can optionally refund only part of a charge. You can do so multiple times, until the
402
   * entire charge has been refunded.
403
   *
404
   * <p>Once entirely refunded, a charge can’t be refunded again. This method will raise an error
405
   * when called on an already-refunded charge, or when trying to refund more money than is left on
406
   * a charge.
407
   */
408
  public static Refund create(RefundCreateParams params) throws StripeException {
409
    return create(params, (RequestOptions) null);
1✔
410
  }
411

412
  /**
413
   * When you create a new refund, you must specify a Charge or a PaymentIntent object on which to
414
   * create it.
415
   *
416
   * <p>Creating a new refund will refund a charge that has previously been created but not yet
417
   * refunded. Funds will be refunded to the credit or debit card that was originally charged.
418
   *
419
   * <p>You can optionally refund only part of a charge. You can do so multiple times, until the
420
   * entire charge has been refunded.
421
   *
422
   * <p>Once entirely refunded, a charge can’t be refunded again. This method will raise an error
423
   * when called on an already-refunded charge, or when trying to refund more money than is left on
424
   * a charge.
425
   */
426
  public static Refund create(RefundCreateParams params, RequestOptions options)
427
      throws StripeException {
428
    String path = "/v1/refunds";
1✔
429
    ApiResource.checkNullTypedParams(path, params);
1✔
430
    ApiRequest request =
1✔
431
        new ApiRequest(
432
            BaseAddress.API,
433
            ApiResource.RequestMethod.POST,
434
            path,
435
            ApiRequestParams.paramsToMap(params),
1✔
436
            options);
437
    return getGlobalResponseGetter().request(request, Refund.class);
1✔
438
  }
439

440
  /**
441
   * Returns a list of all refunds you created. We return the refunds in sorted order, with the most
442
   * recent refunds appearing first. The 10 most recent refunds are always available by default on
443
   * the Charge object.
444
   */
445
  public static RefundCollection list(Map<String, Object> params) throws StripeException {
446
    return list(params, (RequestOptions) null);
1✔
447
  }
448

449
  /**
450
   * Returns a list of all refunds you created. We return the refunds in sorted order, with the most
451
   * recent refunds appearing first. The 10 most recent refunds are always available by default on
452
   * the Charge object.
453
   */
454
  public static RefundCollection list(Map<String, Object> params, RequestOptions options)
455
      throws StripeException {
456
    String path = "/v1/refunds";
1✔
457
    ApiRequest request =
1✔
458
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
459
    return getGlobalResponseGetter().request(request, RefundCollection.class);
1✔
460
  }
461

462
  /**
463
   * Returns a list of all refunds you created. We return the refunds in sorted order, with the most
464
   * recent refunds appearing first. The 10 most recent refunds are always available by default on
465
   * the Charge object.
466
   */
467
  public static RefundCollection list(RefundListParams params) throws StripeException {
468
    return list(params, (RequestOptions) null);
1✔
469
  }
470

471
  /**
472
   * Returns a list of all refunds you created. We return the refunds in sorted order, with the most
473
   * recent refunds appearing first. The 10 most recent refunds are always available by default on
474
   * the Charge object.
475
   */
476
  public static RefundCollection list(RefundListParams params, RequestOptions options)
477
      throws StripeException {
478
    String path = "/v1/refunds";
1✔
479
    ApiResource.checkNullTypedParams(path, params);
1✔
480
    ApiRequest request =
1✔
481
        new ApiRequest(
482
            BaseAddress.API,
483
            ApiResource.RequestMethod.GET,
484
            path,
485
            ApiRequestParams.paramsToMap(params),
1✔
486
            options);
487
    return getGlobalResponseGetter().request(request, RefundCollection.class);
1✔
488
  }
489

490
  /** Retrieves the details of an existing refund. */
491
  public static Refund retrieve(String refund) throws StripeException {
492
    return retrieve(refund, (Map<String, Object>) null, (RequestOptions) null);
1✔
493
  }
494

495
  /** Retrieves the details of an existing refund. */
496
  public static Refund retrieve(String refund, RequestOptions options) throws StripeException {
497
    return retrieve(refund, (Map<String, Object>) null, options);
×
498
  }
499

500
  /** Retrieves the details of an existing refund. */
501
  public static Refund retrieve(String refund, Map<String, Object> params, RequestOptions options)
502
      throws StripeException {
503
    String path = String.format("/v1/refunds/%s", ApiResource.urlEncodeId(refund));
1✔
504
    ApiRequest request =
1✔
505
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
506
    return getGlobalResponseGetter().request(request, Refund.class);
1✔
507
  }
508

509
  /** Retrieves the details of an existing refund. */
510
  public static Refund retrieve(String refund, RefundRetrieveParams params, RequestOptions options)
511
      throws StripeException {
512
    String path = String.format("/v1/refunds/%s", ApiResource.urlEncodeId(refund));
×
513
    ApiResource.checkNullTypedParams(path, params);
×
514
    ApiRequest request =
×
515
        new ApiRequest(
516
            BaseAddress.API,
517
            ApiResource.RequestMethod.GET,
518
            path,
519
            ApiRequestParams.paramsToMap(params),
×
520
            options);
521
    return getGlobalResponseGetter().request(request, Refund.class);
×
522
  }
523

524
  /**
525
   * Updates the refund that you specify by setting the values of the passed parameters. Any
526
   * parameters that you don’t provide remain unchanged.
527
   *
528
   * <p>This request only accepts {@code metadata} as an argument.
529
   */
530
  @Override
531
  public Refund update(Map<String, Object> params) throws StripeException {
532
    return update(params, (RequestOptions) null);
1✔
533
  }
534

535
  /**
536
   * Updates the refund that you specify by setting the values of the passed parameters. Any
537
   * parameters that you don’t provide remain unchanged.
538
   *
539
   * <p>This request only accepts {@code metadata} as an argument.
540
   */
541
  @Override
542
  public Refund update(Map<String, Object> params, RequestOptions options) throws StripeException {
543
    String path = String.format("/v1/refunds/%s", ApiResource.urlEncodeId(this.getId()));
1✔
544
    ApiRequest request =
1✔
545
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
546
    return getResponseGetter().request(request, Refund.class);
1✔
547
  }
548

549
  /**
550
   * Updates the refund that you specify by setting the values of the passed parameters. Any
551
   * parameters that you don’t provide remain unchanged.
552
   *
553
   * <p>This request only accepts {@code metadata} as an argument.
554
   */
555
  public Refund update(RefundUpdateParams params) throws StripeException {
556
    return update(params, (RequestOptions) null);
1✔
557
  }
558

559
  /**
560
   * Updates the refund that you specify by setting the values of the passed parameters. Any
561
   * parameters that you don’t provide remain unchanged.
562
   *
563
   * <p>This request only accepts {@code metadata} as an argument.
564
   */
565
  public Refund update(RefundUpdateParams params, RequestOptions options) throws StripeException {
566
    String path = String.format("/v1/refunds/%s", ApiResource.urlEncodeId(this.getId()));
1✔
567
    ApiResource.checkNullTypedParams(path, params);
1✔
568
    ApiRequest request =
1✔
569
        new ApiRequest(
570
            BaseAddress.API,
571
            ApiResource.RequestMethod.POST,
572
            path,
573
            ApiRequestParams.paramsToMap(params),
1✔
574
            options);
575
    return getResponseGetter().request(request, Refund.class);
1✔
576
  }
577

578
  /**
579
   * For more details about DestinationDetails, please refer to the <a
580
   * href="https://docs.stripe.com/api">API Reference.</a>
581
   */
582
  @Getter
583
  @Setter
584
  @EqualsAndHashCode(callSuper = false)
585
  public static class DestinationDetails extends StripeObject {
1✔
586
    @SerializedName("affirm")
587
    Affirm affirm;
588

589
    @SerializedName("afterpay_clearpay")
590
    AfterpayClearpay afterpayClearpay;
591

592
    @SerializedName("alipay")
593
    Alipay alipay;
594

595
    @SerializedName("alma")
596
    Alma alma;
597

598
    @SerializedName("amazon_pay")
599
    AmazonPay amazonPay;
600

601
    @SerializedName("au_bank_transfer")
602
    AuBankTransfer auBankTransfer;
603

604
    @SerializedName("blik")
605
    Blik blik;
606

607
    @SerializedName("br_bank_transfer")
608
    BrBankTransfer brBankTransfer;
609

610
    @SerializedName("card")
611
    Card card;
612

613
    @SerializedName("cashapp")
614
    Cashapp cashapp;
615

616
    @SerializedName("customer_cash_balance")
617
    CustomerCashBalance customerCashBalance;
618

619
    @SerializedName("eps")
620
    Eps eps;
621

622
    @SerializedName("eu_bank_transfer")
623
    EuBankTransfer euBankTransfer;
624

625
    @SerializedName("gb_bank_transfer")
626
    GbBankTransfer gbBankTransfer;
627

628
    @SerializedName("giropay")
629
    Giropay giropay;
630

631
    @SerializedName("grabpay")
632
    Grabpay grabpay;
633

634
    @SerializedName("id_bank_transfer")
635
    IdBankTransfer idBankTransfer;
636

637
    @SerializedName("jp_bank_transfer")
638
    JpBankTransfer jpBankTransfer;
639

640
    @SerializedName("klarna")
641
    Klarna klarna;
642

643
    @SerializedName("multibanco")
644
    Multibanco multibanco;
645

646
    @SerializedName("mx_bank_transfer")
647
    MxBankTransfer mxBankTransfer;
648

649
    @SerializedName("p24")
650
    P24 p24;
651

652
    @SerializedName("paynow")
653
    Paynow paynow;
654

655
    @SerializedName("paypal")
656
    Paypal paypal;
657

658
    @SerializedName("pix")
659
    Pix pix;
660

661
    @SerializedName("revolut")
662
    Revolut revolut;
663

664
    @SerializedName("sofort")
665
    Sofort sofort;
666

667
    @SerializedName("swish")
668
    Swish swish;
669

670
    @SerializedName("th_bank_transfer")
671
    ThBankTransfer thBankTransfer;
672

673
    /**
674
     * The type of transaction-specific details of the payment method used in the refund (e.g.,
675
     * {@code card}). An additional hash is included on {@code destination_details} with a name
676
     * matching this value. It contains information specific to the refund transaction.
677
     */
678
    @SerializedName("type")
679
    String type;
680

681
    @SerializedName("us_bank_transfer")
682
    UsBankTransfer usBankTransfer;
683

684
    @SerializedName("wechat_pay")
685
    WechatPay wechatPay;
686

687
    @SerializedName("zip")
688
    Zip zip;
689

690
    /**
691
     * For more details about Affirm, please refer to the <a href="https://docs.stripe.com/api">API
692
     * Reference.</a>
693
     */
694
    @Getter
695
    @Setter
696
    @EqualsAndHashCode(callSuper = false)
697
    public static class Affirm extends StripeObject {}
×
698

699
    /**
700
     * For more details about AfterpayClearpay, please refer to the <a
701
     * href="https://docs.stripe.com/api">API Reference.</a>
702
     */
703
    @Getter
704
    @Setter
705
    @EqualsAndHashCode(callSuper = false)
706
    public static class AfterpayClearpay extends StripeObject {}
×
707

708
    /**
709
     * For more details about Alipay, please refer to the <a href="https://docs.stripe.com/api">API
710
     * Reference.</a>
711
     */
712
    @Getter
713
    @Setter
714
    @EqualsAndHashCode(callSuper = false)
715
    public static class Alipay extends StripeObject {}
×
716

717
    /**
718
     * For more details about Alma, please refer to the <a href="https://docs.stripe.com/api">API
719
     * Reference.</a>
720
     */
721
    @Getter
722
    @Setter
723
    @EqualsAndHashCode(callSuper = false)
724
    public static class Alma extends StripeObject {}
×
725

726
    /**
727
     * For more details about AmazonPay, please refer to the <a
728
     * href="https://docs.stripe.com/api">API Reference.</a>
729
     */
730
    @Getter
731
    @Setter
732
    @EqualsAndHashCode(callSuper = false)
733
    public static class AmazonPay extends StripeObject {}
×
734

735
    /**
736
     * For more details about AuBankTransfer, please refer to the <a
737
     * href="https://docs.stripe.com/api">API Reference.</a>
738
     */
739
    @Getter
740
    @Setter
741
    @EqualsAndHashCode(callSuper = false)
742
    public static class AuBankTransfer extends StripeObject {}
×
743

744
    /**
745
     * For more details about Blik, please refer to the <a href="https://docs.stripe.com/api">API
746
     * Reference.</a>
747
     */
748
    @Getter
749
    @Setter
750
    @EqualsAndHashCode(callSuper = false)
751
    public static class Blik extends StripeObject {
×
752
      /** The reference assigned to the refund. */
753
      @SerializedName("reference")
754
      String reference;
755

756
      /**
757
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
758
       * {@code unavailable}.
759
       */
760
      @SerializedName("reference_status")
761
      String referenceStatus;
762
    }
763

764
    /**
765
     * For more details about BrBankTransfer, please refer to the <a
766
     * href="https://docs.stripe.com/api">API Reference.</a>
767
     */
768
    @Getter
769
    @Setter
770
    @EqualsAndHashCode(callSuper = false)
771
    public static class BrBankTransfer extends StripeObject {
×
772
      /** The reference assigned to the refund. */
773
      @SerializedName("reference")
774
      String reference;
775

776
      /**
777
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
778
       * {@code unavailable}.
779
       */
780
      @SerializedName("reference_status")
781
      String referenceStatus;
782
    }
783

784
    /**
785
     * For more details about Card, please refer to the <a href="https://docs.stripe.com/api">API
786
     * Reference.</a>
787
     */
788
    @Getter
789
    @Setter
790
    @EqualsAndHashCode(callSuper = false)
791
    public static class Card extends StripeObject {
1✔
792
      /** Value of the reference number assigned to the refund. */
793
      @SerializedName("reference")
794
      String reference;
795

796
      /**
797
       * Status of the reference number on the refund. This can be {@code pending}, {@code
798
       * available} or {@code unavailable}.
799
       */
800
      @SerializedName("reference_status")
801
      String referenceStatus;
802

803
      /** Type of the reference number assigned to the refund. */
804
      @SerializedName("reference_type")
805
      String referenceType;
806

807
      /**
808
       * The type of refund. This can be {@code refund}, {@code reversal}, or {@code pending}.
809
       *
810
       * <p>One of {@code pending}, {@code refund}, or {@code reversal}.
811
       */
812
      @SerializedName("type")
813
      String type;
814
    }
815

816
    /**
817
     * For more details about Cashapp, please refer to the <a href="https://docs.stripe.com/api">API
818
     * Reference.</a>
819
     */
820
    @Getter
821
    @Setter
822
    @EqualsAndHashCode(callSuper = false)
823
    public static class Cashapp extends StripeObject {}
×
824

825
    /**
826
     * For more details about CustomerCashBalance, please refer to the <a
827
     * href="https://docs.stripe.com/api">API Reference.</a>
828
     */
829
    @Getter
830
    @Setter
831
    @EqualsAndHashCode(callSuper = false)
832
    public static class CustomerCashBalance extends StripeObject {}
×
833

834
    /**
835
     * For more details about Eps, please refer to the <a href="https://docs.stripe.com/api">API
836
     * Reference.</a>
837
     */
838
    @Getter
839
    @Setter
840
    @EqualsAndHashCode(callSuper = false)
841
    public static class Eps extends StripeObject {}
×
842

843
    /**
844
     * For more details about EuBankTransfer, please refer to the <a
845
     * href="https://docs.stripe.com/api">API Reference.</a>
846
     */
847
    @Getter
848
    @Setter
849
    @EqualsAndHashCode(callSuper = false)
850
    public static class EuBankTransfer extends StripeObject {
×
851
      /** The reference assigned to the refund. */
852
      @SerializedName("reference")
853
      String reference;
854

855
      /**
856
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
857
       * {@code unavailable}.
858
       */
859
      @SerializedName("reference_status")
860
      String referenceStatus;
861
    }
862

863
    /**
864
     * For more details about GbBankTransfer, please refer to the <a
865
     * href="https://docs.stripe.com/api">API Reference.</a>
866
     */
867
    @Getter
868
    @Setter
869
    @EqualsAndHashCode(callSuper = false)
870
    public static class GbBankTransfer extends StripeObject {
×
871
      /** The reference assigned to the refund. */
872
      @SerializedName("reference")
873
      String reference;
874

875
      /**
876
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
877
       * {@code unavailable}.
878
       */
879
      @SerializedName("reference_status")
880
      String referenceStatus;
881
    }
882

883
    /**
884
     * For more details about Giropay, please refer to the <a href="https://docs.stripe.com/api">API
885
     * Reference.</a>
886
     */
887
    @Getter
888
    @Setter
889
    @EqualsAndHashCode(callSuper = false)
890
    public static class Giropay extends StripeObject {}
×
891

892
    /**
893
     * For more details about Grabpay, please refer to the <a href="https://docs.stripe.com/api">API
894
     * Reference.</a>
895
     */
896
    @Getter
897
    @Setter
898
    @EqualsAndHashCode(callSuper = false)
899
    public static class Grabpay extends StripeObject {}
×
900

901
    /**
902
     * For more details about IdBankTransfer, please refer to the <a
903
     * href="https://docs.stripe.com/api">API Reference.</a>
904
     */
905
    @Getter
906
    @Setter
907
    @EqualsAndHashCode(callSuper = false)
NEW
908
    public static class IdBankTransfer extends StripeObject {
×
909
      /** The reference assigned to the refund. */
910
      @SerializedName("reference")
911
      String reference;
912

913
      /**
914
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
915
       * {@code unavailable}.
916
       */
917
      @SerializedName("reference_status")
918
      String referenceStatus;
919
    }
920

921
    /**
922
     * For more details about JpBankTransfer, please refer to the <a
923
     * href="https://docs.stripe.com/api">API Reference.</a>
924
     */
925
    @Getter
926
    @Setter
927
    @EqualsAndHashCode(callSuper = false)
928
    public static class JpBankTransfer extends StripeObject {
×
929
      /** The reference assigned to the refund. */
930
      @SerializedName("reference")
931
      String reference;
932

933
      /**
934
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
935
       * {@code unavailable}.
936
       */
937
      @SerializedName("reference_status")
938
      String referenceStatus;
939
    }
940

941
    /**
942
     * For more details about Klarna, please refer to the <a href="https://docs.stripe.com/api">API
943
     * Reference.</a>
944
     */
945
    @Getter
946
    @Setter
947
    @EqualsAndHashCode(callSuper = false)
948
    public static class Klarna extends StripeObject {}
×
949

950
    /**
951
     * For more details about Multibanco, please refer to the <a
952
     * href="https://docs.stripe.com/api">API Reference.</a>
953
     */
954
    @Getter
955
    @Setter
956
    @EqualsAndHashCode(callSuper = false)
957
    public static class Multibanco extends StripeObject {
×
958
      /** The reference assigned to the refund. */
959
      @SerializedName("reference")
960
      String reference;
961

962
      /**
963
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
964
       * {@code unavailable}.
965
       */
966
      @SerializedName("reference_status")
967
      String referenceStatus;
968
    }
969

970
    /**
971
     * For more details about MxBankTransfer, please refer to the <a
972
     * href="https://docs.stripe.com/api">API Reference.</a>
973
     */
974
    @Getter
975
    @Setter
976
    @EqualsAndHashCode(callSuper = false)
977
    public static class MxBankTransfer extends StripeObject {
×
978
      /** The reference assigned to the refund. */
979
      @SerializedName("reference")
980
      String reference;
981

982
      /**
983
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
984
       * {@code unavailable}.
985
       */
986
      @SerializedName("reference_status")
987
      String referenceStatus;
988
    }
989

990
    /**
991
     * For more details about P24, please refer to the <a href="https://docs.stripe.com/api">API
992
     * Reference.</a>
993
     */
994
    @Getter
995
    @Setter
996
    @EqualsAndHashCode(callSuper = false)
997
    public static class P24 extends StripeObject {
×
998
      /** The reference assigned to the refund. */
999
      @SerializedName("reference")
1000
      String reference;
1001

1002
      /**
1003
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
1004
       * {@code unavailable}.
1005
       */
1006
      @SerializedName("reference_status")
1007
      String referenceStatus;
1008
    }
1009

1010
    /**
1011
     * For more details about Paynow, please refer to the <a href="https://docs.stripe.com/api">API
1012
     * Reference.</a>
1013
     */
1014
    @Getter
1015
    @Setter
1016
    @EqualsAndHashCode(callSuper = false)
1017
    public static class Paynow extends StripeObject {}
×
1018

1019
    /**
1020
     * For more details about Paypal, please refer to the <a href="https://docs.stripe.com/api">API
1021
     * Reference.</a>
1022
     */
1023
    @Getter
1024
    @Setter
1025
    @EqualsAndHashCode(callSuper = false)
1026
    public static class Paypal extends StripeObject {}
×
1027

1028
    /**
1029
     * For more details about Pix, please refer to the <a href="https://docs.stripe.com/api">API
1030
     * Reference.</a>
1031
     */
1032
    @Getter
1033
    @Setter
1034
    @EqualsAndHashCode(callSuper = false)
1035
    public static class Pix extends StripeObject {}
×
1036

1037
    /**
1038
     * For more details about Revolut, please refer to the <a href="https://docs.stripe.com/api">API
1039
     * Reference.</a>
1040
     */
1041
    @Getter
1042
    @Setter
1043
    @EqualsAndHashCode(callSuper = false)
1044
    public static class Revolut extends StripeObject {}
×
1045

1046
    /**
1047
     * For more details about Sofort, please refer to the <a href="https://docs.stripe.com/api">API
1048
     * Reference.</a>
1049
     */
1050
    @Getter
1051
    @Setter
1052
    @EqualsAndHashCode(callSuper = false)
1053
    public static class Sofort extends StripeObject {}
×
1054

1055
    /**
1056
     * For more details about Swish, please refer to the <a href="https://docs.stripe.com/api">API
1057
     * Reference.</a>
1058
     */
1059
    @Getter
1060
    @Setter
1061
    @EqualsAndHashCode(callSuper = false)
1062
    public static class Swish extends StripeObject {
×
1063
      /** The reference assigned to the refund. */
1064
      @SerializedName("reference")
1065
      String reference;
1066

1067
      /**
1068
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
1069
       * {@code unavailable}.
1070
       */
1071
      @SerializedName("reference_status")
1072
      String referenceStatus;
1073
    }
1074

1075
    /**
1076
     * For more details about ThBankTransfer, please refer to the <a
1077
     * href="https://docs.stripe.com/api">API Reference.</a>
1078
     */
1079
    @Getter
1080
    @Setter
1081
    @EqualsAndHashCode(callSuper = false)
1082
    public static class ThBankTransfer extends StripeObject {
×
1083
      /** The reference assigned to the refund. */
1084
      @SerializedName("reference")
1085
      String reference;
1086

1087
      /**
1088
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
1089
       * {@code unavailable}.
1090
       */
1091
      @SerializedName("reference_status")
1092
      String referenceStatus;
1093
    }
1094

1095
    /**
1096
     * For more details about UsBankTransfer, please refer to the <a
1097
     * href="https://docs.stripe.com/api">API Reference.</a>
1098
     */
1099
    @Getter
1100
    @Setter
1101
    @EqualsAndHashCode(callSuper = false)
1102
    public static class UsBankTransfer extends StripeObject {
×
1103
      /** The reference assigned to the refund. */
1104
      @SerializedName("reference")
1105
      String reference;
1106

1107
      /**
1108
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
1109
       * {@code unavailable}.
1110
       */
1111
      @SerializedName("reference_status")
1112
      String referenceStatus;
1113
    }
1114

1115
    /**
1116
     * For more details about WechatPay, please refer to the <a
1117
     * href="https://docs.stripe.com/api">API Reference.</a>
1118
     */
1119
    @Getter
1120
    @Setter
1121
    @EqualsAndHashCode(callSuper = false)
1122
    public static class WechatPay extends StripeObject {}
×
1123

1124
    /**
1125
     * For more details about Zip, please refer to the <a href="https://docs.stripe.com/api">API
1126
     * Reference.</a>
1127
     */
1128
    @Getter
1129
    @Setter
1130
    @EqualsAndHashCode(callSuper = false)
1131
    public static class Zip extends StripeObject {}
×
1132
  }
1133

1134
  /**
1135
   * For more details about NextAction, please refer to the <a
1136
   * href="https://docs.stripe.com/api">API Reference.</a>
1137
   */
1138
  @Getter
1139
  @Setter
1140
  @EqualsAndHashCode(callSuper = false)
1141
  public static class NextAction extends StripeObject {
×
1142
    @SerializedName("display_details")
1143
    DisplayDetails displayDetails;
1144

1145
    /** Type of the next action to perform. */
1146
    @SerializedName("type")
1147
    String type;
1148

1149
    /**
1150
     * For more details about DisplayDetails, please refer to the <a
1151
     * href="https://docs.stripe.com/api">API Reference.</a>
1152
     */
1153
    @Getter
1154
    @Setter
1155
    @EqualsAndHashCode(callSuper = false)
1156
    public static class DisplayDetails extends StripeObject {
×
1157
      @SerializedName("email_sent")
1158
      EmailSent emailSent;
1159

1160
      /** The expiry timestamp. */
1161
      @SerializedName("expires_at")
1162
      Long expiresAt;
1163

1164
      /**
1165
       * For more details about EmailSent, please refer to the <a
1166
       * href="https://docs.stripe.com/api">API Reference.</a>
1167
       */
1168
      @Getter
1169
      @Setter
1170
      @EqualsAndHashCode(callSuper = false)
1171
      public static class EmailSent extends StripeObject {
×
1172
        /** The timestamp when the email was sent. */
1173
        @SerializedName("email_sent_at")
1174
        Long emailSentAt;
1175

1176
        /** The recipient's email address. */
1177
        @SerializedName("email_sent_to")
1178
        String emailSentTo;
1179
      }
1180
    }
1181
  }
1182

1183
  public TestHelpers getTestHelpers() {
1184
    return new TestHelpers(this);
1✔
1185
  }
1186

1187
  public static class TestHelpers {
1188
    private final Refund resource;
1189

1190
    private TestHelpers(Refund resource) {
1✔
1191
      this.resource = resource;
1✔
1192
    }
1✔
1193

1194
    /** Expire a refund with a status of {@code requires_action}. */
1195
    public Refund expire() throws StripeException {
1196
      return expire((Map<String, Object>) null, (RequestOptions) null);
×
1197
    }
1198

1199
    /** Expire a refund with a status of {@code requires_action}. */
1200
    public Refund expire(RequestOptions options) throws StripeException {
1201
      return expire((Map<String, Object>) null, options);
×
1202
    }
1203

1204
    /** Expire a refund with a status of {@code requires_action}. */
1205
    public Refund expire(Map<String, Object> params) throws StripeException {
1206
      return expire(params, (RequestOptions) null);
×
1207
    }
1208

1209
    /** Expire a refund with a status of {@code requires_action}. */
1210
    public Refund expire(Map<String, Object> params, RequestOptions options)
1211
        throws StripeException {
1212
      String path =
×
1213
          String.format(
×
1214
              "/v1/test_helpers/refunds/%s/expire", ApiResource.urlEncodeId(this.resource.getId()));
×
1215
      ApiRequest request =
×
1216
          new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1217
      return resource.getResponseGetter().request(request, Refund.class);
×
1218
    }
1219

1220
    /** Expire a refund with a status of {@code requires_action}. */
1221
    public Refund expire(RefundExpireParams params) throws StripeException {
1222
      return expire(params, (RequestOptions) null);
1✔
1223
    }
1224

1225
    /** Expire a refund with a status of {@code requires_action}. */
1226
    public Refund expire(RefundExpireParams params, RequestOptions options) throws StripeException {
1227
      String path =
1✔
1228
          String.format(
1✔
1229
              "/v1/test_helpers/refunds/%s/expire", ApiResource.urlEncodeId(this.resource.getId()));
1✔
1230
      ApiResource.checkNullTypedParams(path, params);
1✔
1231
      ApiRequest request =
1✔
1232
          new ApiRequest(
1233
              BaseAddress.API,
1234
              ApiResource.RequestMethod.POST,
1235
              path,
1236
              ApiRequestParams.paramsToMap(params),
1✔
1237
              options);
1238
      return resource.getResponseGetter().request(request, Refund.class);
1✔
1239
    }
1240
  }
1241

1242
  @Override
1243
  public void setResponseGetter(StripeResponseGetter responseGetter) {
1244
    super.setResponseGetter(responseGetter);
1✔
1245
    trySetResponseGetter(balanceTransaction, responseGetter);
1✔
1246
    trySetResponseGetter(charge, responseGetter);
1✔
1247
    trySetResponseGetter(destinationDetails, responseGetter);
1✔
1248
    trySetResponseGetter(failureBalanceTransaction, responseGetter);
1✔
1249
    trySetResponseGetter(nextAction, responseGetter);
1✔
1250
    trySetResponseGetter(paymentIntent, responseGetter);
1✔
1251
    trySetResponseGetter(sourceTransferReversal, responseGetter);
1✔
1252
    trySetResponseGetter(transferReversal, responseGetter);
1✔
1253
  }
1✔
1254
}
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