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

stripe / stripe-java / #16562

18 Oct 2024 07:00PM UTC coverage: 12.614% (-0.1%) from 12.74%
#16562

push

github

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

Update generated code for beta

49 of 1978 new or added lines in 47 files covered. (2.48%)

68 existing lines in 20 files now uncovered.

18798 of 149026 relevant lines covered (12.61%)

0.13 hits per line

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

46.91
/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("jp_bank_transfer")
635
    JpBankTransfer jpBankTransfer;
636

637
    @SerializedName("klarna")
638
    Klarna klarna;
639

640
    @SerializedName("multibanco")
641
    Multibanco multibanco;
642

643
    @SerializedName("mx_bank_transfer")
644
    MxBankTransfer mxBankTransfer;
645

646
    @SerializedName("p24")
647
    P24 p24;
648

649
    @SerializedName("paynow")
650
    Paynow paynow;
651

652
    @SerializedName("paypal")
653
    Paypal paypal;
654

655
    @SerializedName("pix")
656
    Pix pix;
657

658
    @SerializedName("revolut")
659
    Revolut revolut;
660

661
    @SerializedName("sofort")
662
    Sofort sofort;
663

664
    @SerializedName("swish")
665
    Swish swish;
666

667
    @SerializedName("th_bank_transfer")
668
    ThBankTransfer thBankTransfer;
669

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

678
    @SerializedName("us_bank_transfer")
679
    UsBankTransfer usBankTransfer;
680

681
    @SerializedName("wechat_pay")
682
    WechatPay wechatPay;
683

684
    @SerializedName("zip")
685
    Zip zip;
686

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

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

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

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

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

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

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

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

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

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

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

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

800
      /** Type of the reference number assigned to the refund. */
801
      @SerializedName("reference_type")
802
      String referenceType;
803

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

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

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

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

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

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

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

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

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

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

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

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

918
    /**
919
     * For more details about Klarna, please refer to the <a href="https://docs.stripe.com/api">API
920
     * Reference.</a>
921
     */
922
    @Getter
923
    @Setter
924
    @EqualsAndHashCode(callSuper = false)
925
    public static class Klarna extends StripeObject {}
×
926

927
    /**
928
     * For more details about Multibanco, please refer to the <a
929
     * href="https://docs.stripe.com/api">API Reference.</a>
930
     */
931
    @Getter
932
    @Setter
933
    @EqualsAndHashCode(callSuper = false)
934
    public static class Multibanco extends StripeObject {
×
935
      /** The reference assigned to the refund. */
936
      @SerializedName("reference")
937
      String reference;
938

939
      /**
940
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
941
       * {@code unavailable}.
942
       */
943
      @SerializedName("reference_status")
944
      String referenceStatus;
945
    }
946

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

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

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

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

987
    /**
988
     * For more details about Paynow, please refer to the <a href="https://docs.stripe.com/api">API
989
     * Reference.</a>
990
     */
991
    @Getter
992
    @Setter
993
    @EqualsAndHashCode(callSuper = false)
994
    public static class Paynow extends StripeObject {}
×
995

996
    /**
997
     * For more details about Paypal, please refer to the <a href="https://docs.stripe.com/api">API
998
     * Reference.</a>
999
     */
1000
    @Getter
1001
    @Setter
1002
    @EqualsAndHashCode(callSuper = false)
1003
    public static class Paypal extends StripeObject {}
×
1004

1005
    /**
1006
     * For more details about Pix, please refer to the <a href="https://docs.stripe.com/api">API
1007
     * Reference.</a>
1008
     */
1009
    @Getter
1010
    @Setter
1011
    @EqualsAndHashCode(callSuper = false)
1012
    public static class Pix extends StripeObject {}
×
1013

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

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

1032
    /**
1033
     * For more details about Swish, please refer to the <a href="https://docs.stripe.com/api">API
1034
     * Reference.</a>
1035
     */
1036
    @Getter
1037
    @Setter
1038
    @EqualsAndHashCode(callSuper = false)
1039
    public static class Swish extends StripeObject {
×
1040
      /** The reference assigned to the refund. */
1041
      @SerializedName("reference")
1042
      String reference;
1043

1044
      /**
1045
       * Status of the reference on the refund. This can be {@code pending}, {@code available} or
1046
       * {@code unavailable}.
1047
       */
1048
      @SerializedName("reference_status")
1049
      String referenceStatus;
1050
    }
1051

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

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

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

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

1092
    /**
1093
     * For more details about WechatPay, please refer to the <a
1094
     * href="https://docs.stripe.com/api">API Reference.</a>
1095
     */
1096
    @Getter
1097
    @Setter
1098
    @EqualsAndHashCode(callSuper = false)
1099
    public static class WechatPay extends StripeObject {}
×
1100

1101
    /**
1102
     * For more details about Zip, please refer to the <a href="https://docs.stripe.com/api">API
1103
     * Reference.</a>
1104
     */
1105
    @Getter
1106
    @Setter
1107
    @EqualsAndHashCode(callSuper = false)
1108
    public static class Zip extends StripeObject {}
×
1109
  }
1110

1111
  /**
1112
   * For more details about NextAction, please refer to the <a
1113
   * href="https://docs.stripe.com/api">API Reference.</a>
1114
   */
1115
  @Getter
1116
  @Setter
1117
  @EqualsAndHashCode(callSuper = false)
1118
  public static class NextAction extends StripeObject {
×
1119
    /** Contains the refund details. */
1120
    @SerializedName("display_details")
1121
    DisplayDetails displayDetails;
1122

1123
    /** Type of the next action to perform. */
1124
    @SerializedName("type")
1125
    String type;
1126

1127
    /**
1128
     * For more details about DisplayDetails, please refer to the <a
1129
     * href="https://docs.stripe.com/api">API Reference.</a>
1130
     */
1131
    @Getter
1132
    @Setter
1133
    @EqualsAndHashCode(callSuper = false)
1134
    public static class DisplayDetails extends StripeObject {
×
1135
      @SerializedName("email_sent")
1136
      EmailSent emailSent;
1137

1138
      /** The expiry timestamp. */
1139
      @SerializedName("expires_at")
1140
      Long expiresAt;
1141

1142
      /**
1143
       * For more details about EmailSent, please refer to the <a
1144
       * href="https://docs.stripe.com/api">API Reference.</a>
1145
       */
1146
      @Getter
1147
      @Setter
1148
      @EqualsAndHashCode(callSuper = false)
1149
      public static class EmailSent extends StripeObject {
×
1150
        /** The timestamp when the email was sent. */
1151
        @SerializedName("email_sent_at")
1152
        Long emailSentAt;
1153

1154
        /** The recipient's email address. */
1155
        @SerializedName("email_sent_to")
1156
        String emailSentTo;
1157
      }
1158
    }
1159
  }
1160

1161
  public TestHelpers getTestHelpers() {
1162
    return new TestHelpers(this);
1✔
1163
  }
1164

1165
  public static class TestHelpers {
1166
    private final Refund resource;
1167

1168
    private TestHelpers(Refund resource) {
1✔
1169
      this.resource = resource;
1✔
1170
    }
1✔
1171

1172
    /** Expire a refund with a status of {@code requires_action}. */
1173
    public Refund expire() throws StripeException {
1174
      return expire((Map<String, Object>) null, (RequestOptions) null);
×
1175
    }
1176

1177
    /** Expire a refund with a status of {@code requires_action}. */
1178
    public Refund expire(RequestOptions options) throws StripeException {
1179
      return expire((Map<String, Object>) null, options);
×
1180
    }
1181

1182
    /** Expire a refund with a status of {@code requires_action}. */
1183
    public Refund expire(Map<String, Object> params) throws StripeException {
1184
      return expire(params, (RequestOptions) null);
×
1185
    }
1186

1187
    /** Expire a refund with a status of {@code requires_action}. */
1188
    public Refund expire(Map<String, Object> params, RequestOptions options)
1189
        throws StripeException {
1190
      String path =
×
1191
          String.format(
×
1192
              "/v1/test_helpers/refunds/%s/expire", ApiResource.urlEncodeId(this.resource.getId()));
×
1193
      ApiRequest request =
×
1194
          new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
1195
      return resource.getResponseGetter().request(request, Refund.class);
×
1196
    }
1197

1198
    /** Expire a refund with a status of {@code requires_action}. */
1199
    public Refund expire(RefundExpireParams params) throws StripeException {
1200
      return expire(params, (RequestOptions) null);
1✔
1201
    }
1202

1203
    /** Expire a refund with a status of {@code requires_action}. */
1204
    public Refund expire(RefundExpireParams params, RequestOptions options) throws StripeException {
1205
      String path =
1✔
1206
          String.format(
1✔
1207
              "/v1/test_helpers/refunds/%s/expire", ApiResource.urlEncodeId(this.resource.getId()));
1✔
1208
      ApiResource.checkNullTypedParams(path, params);
1✔
1209
      ApiRequest request =
1✔
1210
          new ApiRequest(
1211
              BaseAddress.API,
1212
              ApiResource.RequestMethod.POST,
1213
              path,
1214
              ApiRequestParams.paramsToMap(params),
1✔
1215
              options);
1216
      return resource.getResponseGetter().request(request, Refund.class);
1✔
1217
    }
1218
  }
1219

1220
  @Override
1221
  public void setResponseGetter(StripeResponseGetter responseGetter) {
1222
    super.setResponseGetter(responseGetter);
1✔
1223
    trySetResponseGetter(balanceTransaction, responseGetter);
1✔
1224
    trySetResponseGetter(charge, responseGetter);
1✔
1225
    trySetResponseGetter(destinationDetails, responseGetter);
1✔
1226
    trySetResponseGetter(failureBalanceTransaction, responseGetter);
1✔
1227
    trySetResponseGetter(nextAction, responseGetter);
1✔
1228
    trySetResponseGetter(paymentIntent, responseGetter);
1✔
1229
    trySetResponseGetter(sourceTransferReversal, responseGetter);
1✔
1230
    trySetResponseGetter(transferReversal, responseGetter);
1✔
1231
  }
1✔
1232
}
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