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

stripe / stripe-java / #16365

29 Aug 2024 06:39AM UTC coverage: 16.372% (-0.008%) from 16.38%
#16365

Pull #1855

github

web-flow
Merge f5eb6ef4b into a6080c2d9
Pull Request #1855: No need for APIMode to be passed around from individual API methods

16 of 86 new or added lines in 6 files covered. (18.6%)

513 existing lines in 170 files now uncovered.

18149 of 110857 relevant lines covered (16.37%)

0.16 hits per line

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

53.52
/src/main/java/com/stripe/model/issuing/Transaction.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.issuing;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.BalanceTransaction;
7
import com.stripe.model.BalanceTransactionSource;
8
import com.stripe.model.ExpandableField;
9
import com.stripe.model.MetadataStore;
10
import com.stripe.model.StripeObject;
11
import com.stripe.net.ApiRequest;
12
import com.stripe.net.ApiRequestParams;
13
import com.stripe.net.ApiResource;
14
import com.stripe.net.BaseAddress;
15
import com.stripe.net.RequestOptions;
16
import com.stripe.net.StripeResponseGetter;
17
import com.stripe.param.issuing.TransactionCreateForceCaptureParams;
18
import com.stripe.param.issuing.TransactionCreateUnlinkedRefundParams;
19
import com.stripe.param.issuing.TransactionListParams;
20
import com.stripe.param.issuing.TransactionRefundParams;
21
import com.stripe.param.issuing.TransactionRetrieveParams;
22
import com.stripe.param.issuing.TransactionUpdateParams;
23
import java.math.BigDecimal;
24
import java.util.List;
25
import java.util.Map;
26
import lombok.EqualsAndHashCode;
27
import lombok.Getter;
28
import lombok.Setter;
29

30
/**
31
 * Any use of an <a href="https://stripe.com/docs/issuing">issued card</a> that results in funds
32
 * entering or leaving your Stripe account, such as a completed purchase or refund, is represented
33
 * by an Issuing {@code Transaction} object.
34
 *
35
 * <p>Related guide: <a href="https://stripe.com/docs/issuing/purchases/transactions">Issued card
36
 * transactions</a>
37
 */
38
@Getter
39
@Setter
40
@EqualsAndHashCode(callSuper = false)
41
public class Transaction extends ApiResource
1✔
42
    implements MetadataStore<Transaction>, BalanceTransactionSource {
43
  /**
44
   * The transaction amount, which will be reflected in your balance. This amount is in your
45
   * currency and in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency
46
   * unit</a>.
47
   */
48
  @SerializedName("amount")
49
  Long amount;
50

51
  /**
52
   * Detailed breakdown of amount components. These amounts are denominated in {@code currency} and
53
   * in the <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>.
54
   */
55
  @SerializedName("amount_details")
56
  AmountDetails amountDetails;
57

58
  /** The {@code Authorization} object that led to this transaction. */
59
  @SerializedName("authorization")
60
  @Getter(lombok.AccessLevel.NONE)
61
  @Setter(lombok.AccessLevel.NONE)
62
  ExpandableField<Authorization> authorization;
63

64
  /**
65
   * ID of the <a href="https://stripe.com/docs/api/balance_transactions">balance transaction</a>
66
   * associated with this transaction.
67
   */
68
  @SerializedName("balance_transaction")
69
  @Getter(lombok.AccessLevel.NONE)
70
  @Setter(lombok.AccessLevel.NONE)
71
  ExpandableField<BalanceTransaction> balanceTransaction;
72

73
  /** The card used to make this transaction. */
74
  @SerializedName("card")
75
  @Getter(lombok.AccessLevel.NONE)
76
  @Setter(lombok.AccessLevel.NONE)
77
  ExpandableField<Card> card;
78

79
  /** The cardholder to whom this transaction belongs. */
80
  @SerializedName("cardholder")
81
  @Getter(lombok.AccessLevel.NONE)
82
  @Setter(lombok.AccessLevel.NONE)
83
  ExpandableField<Cardholder> cardholder;
84

85
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
86
  @SerializedName("created")
87
  Long created;
88

89
  /**
90
   * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>,
91
   * in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
92
   */
93
  @SerializedName("currency")
94
  String currency;
95

96
  /** If you've disputed the transaction, the ID of the dispute. */
97
  @SerializedName("dispute")
98
  @Getter(lombok.AccessLevel.NONE)
99
  @Setter(lombok.AccessLevel.NONE)
100
  ExpandableField<Dispute> dispute;
101

102
  /** Unique identifier for the object. */
103
  @Getter(onMethod_ = {@Override})
104
  @SerializedName("id")
105
  String id;
106

107
  /**
108
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
109
   * object exists in test mode.
110
   */
111
  @SerializedName("livemode")
112
  Boolean livemode;
113

114
  /**
115
   * The amount that the merchant will receive, denominated in {@code merchant_currency} and in the
116
   * <a href="https://stripe.com/docs/currencies#zero-decimal">smallest currency unit</a>. It will
117
   * be different from {@code amount} if the merchant is taking payment in a different currency.
118
   */
119
  @SerializedName("merchant_amount")
120
  Long merchantAmount;
121

122
  /** The currency with which the merchant is taking payment. */
123
  @SerializedName("merchant_currency")
124
  String merchantCurrency;
125

126
  @SerializedName("merchant_data")
127
  MerchantData merchantData;
128

129
  /**
130
   * Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach
131
   * to an object. This can be useful for storing additional information about the object in a
132
   * structured format.
133
   */
134
  @Getter(onMethod_ = {@Override})
135
  @SerializedName("metadata")
136
  Map<String, String> metadata;
137

138
  /** Details about the transaction, such as processing dates, set by the card network. */
139
  @SerializedName("network_data")
140
  NetworkData networkData;
141

142
  /**
143
   * String representing the object's type. Objects of the same type share the same value.
144
   *
145
   * <p>Equal to {@code issuing.transaction}.
146
   */
147
  @SerializedName("object")
148
  String object;
149

150
  /** Additional purchase information that is optionally provided by the merchant. */
151
  @SerializedName("purchase_details")
152
  PurchaseDetails purchaseDetails;
153

154
  /**
155
   * <a href="https://stripe.com/docs/api/issuing/tokens/object">Token</a> object used for this
156
   * transaction. If a network token was not used for this transaction, this field will be null.
157
   */
158
  @SerializedName("token")
159
  @Getter(lombok.AccessLevel.NONE)
160
  @Setter(lombok.AccessLevel.NONE)
161
  ExpandableField<Token> token;
162

163
  /**
164
   * <a href="https://stripe.com/docs/api/treasury">Treasury</a> details related to this transaction
165
   * if it was created on a [FinancialAccount](/docs/api/treasury/financial_accounts
166
   */
167
  @SerializedName("treasury")
168
  Treasury treasury;
169

170
  /**
171
   * The nature of the transaction.
172
   *
173
   * <p>One of {@code capture}, or {@code refund}.
174
   */
175
  @SerializedName("type")
176
  String type;
177

178
  /**
179
   * The digital wallet used for this transaction. One of {@code apple_pay}, {@code google_pay}, or
180
   * {@code samsung_pay}.
181
   */
182
  @SerializedName("wallet")
183
  String wallet;
184

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

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

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

199
  public void setAuthorizationObject(Authorization expandableObject) {
200
    this.authorization =
×
201
        new ExpandableField<Authorization>(expandableObject.getId(), expandableObject);
×
202
  }
×
203

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

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

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

218
  public void setBalanceTransactionObject(BalanceTransaction expandableObject) {
219
    this.balanceTransaction =
×
220
        new ExpandableField<BalanceTransaction>(expandableObject.getId(), expandableObject);
×
221
  }
×
222

223
  /** Get ID of expandable {@code card} object. */
224
  public String getCard() {
225
    return (this.card != null) ? this.card.getId() : null;
1✔
226
  }
227

228
  public void setCard(String id) {
229
    this.card = ApiResource.setExpandableFieldId(id, this.card);
×
230
  }
×
231

232
  /** Get expanded {@code card}. */
233
  public Card getCardObject() {
234
    return (this.card != null) ? this.card.getExpanded() : null;
1✔
235
  }
236

237
  public void setCardObject(Card expandableObject) {
238
    this.card = new ExpandableField<Card>(expandableObject.getId(), expandableObject);
×
239
  }
×
240

241
  /** Get ID of expandable {@code cardholder} object. */
242
  public String getCardholder() {
243
    return (this.cardholder != null) ? this.cardholder.getId() : null;
1✔
244
  }
245

246
  public void setCardholder(String id) {
247
    this.cardholder = ApiResource.setExpandableFieldId(id, this.cardholder);
×
248
  }
×
249

250
  /** Get expanded {@code cardholder}. */
251
  public Cardholder getCardholderObject() {
252
    return (this.cardholder != null) ? this.cardholder.getExpanded() : null;
1✔
253
  }
254

255
  public void setCardholderObject(Cardholder expandableObject) {
256
    this.cardholder = new ExpandableField<Cardholder>(expandableObject.getId(), expandableObject);
×
257
  }
×
258

259
  /** Get ID of expandable {@code dispute} object. */
260
  public String getDispute() {
261
    return (this.dispute != null) ? this.dispute.getId() : null;
×
262
  }
263

264
  public void setDispute(String id) {
265
    this.dispute = ApiResource.setExpandableFieldId(id, this.dispute);
×
266
  }
×
267

268
  /** Get expanded {@code dispute}. */
269
  public Dispute getDisputeObject() {
270
    return (this.dispute != null) ? this.dispute.getExpanded() : null;
×
271
  }
272

273
  public void setDisputeObject(Dispute expandableObject) {
274
    this.dispute = new ExpandableField<Dispute>(expandableObject.getId(), expandableObject);
×
275
  }
×
276

277
  /** Get ID of expandable {@code token} object. */
278
  public String getToken() {
279
    return (this.token != null) ? this.token.getId() : null;
×
280
  }
281

282
  public void setToken(String id) {
283
    this.token = ApiResource.setExpandableFieldId(id, this.token);
×
284
  }
×
285

286
  /** Get expanded {@code token}. */
287
  public Token getTokenObject() {
288
    return (this.token != null) ? this.token.getExpanded() : null;
×
289
  }
290

291
  public void setTokenObject(Token expandableObject) {
292
    this.token = new ExpandableField<Token>(expandableObject.getId(), expandableObject);
×
293
  }
×
294

295
  /**
296
   * Returns a list of Issuing {@code Transaction} objects. The objects are sorted in descending
297
   * order by creation date, with the most recently created object appearing first.
298
   */
299
  public static TransactionCollection list(Map<String, Object> params) throws StripeException {
300
    return list(params, (RequestOptions) null);
1✔
301
  }
302

303
  /**
304
   * Returns a list of Issuing {@code Transaction} objects. The objects are sorted in descending
305
   * order by creation date, with the most recently created object appearing first.
306
   */
307
  public static TransactionCollection list(Map<String, Object> params, RequestOptions options)
308
      throws StripeException {
309
    String path = "/v1/issuing/transactions";
1✔
310
    ApiRequest request =
1✔
311
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
312
    return getGlobalResponseGetter().request(request, TransactionCollection.class);
1✔
313
  }
314

315
  /**
316
   * Returns a list of Issuing {@code Transaction} objects. The objects are sorted in descending
317
   * order by creation date, with the most recently created object appearing first.
318
   */
319
  public static TransactionCollection list(TransactionListParams params) throws StripeException {
320
    return list(params, (RequestOptions) null);
1✔
321
  }
322

323
  /**
324
   * Returns a list of Issuing {@code Transaction} objects. The objects are sorted in descending
325
   * order by creation date, with the most recently created object appearing first.
326
   */
327
  public static TransactionCollection list(TransactionListParams params, RequestOptions options)
328
      throws StripeException {
329
    String path = "/v1/issuing/transactions";
1✔
330
    ApiResource.checkNullTypedParams(path, params);
1✔
331
    ApiRequest request =
1✔
332
        new ApiRequest(
333
            BaseAddress.API,
334
            ApiResource.RequestMethod.GET,
335
            path,
336
            ApiRequestParams.paramsToMap(params),
1✔
337
            options);
338
    return getGlobalResponseGetter().request(request, TransactionCollection.class);
1✔
339
  }
340

341
  /** Retrieves an Issuing {@code Transaction} object. */
342
  public static Transaction retrieve(String transaction) throws StripeException {
343
    return retrieve(transaction, (Map<String, Object>) null, (RequestOptions) null);
1✔
344
  }
345

346
  /** Retrieves an Issuing {@code Transaction} object. */
347
  public static Transaction retrieve(String transaction, RequestOptions options)
348
      throws StripeException {
349
    return retrieve(transaction, (Map<String, Object>) null, options);
×
350
  }
351

352
  /** Retrieves an Issuing {@code Transaction} object. */
353
  public static Transaction retrieve(
354
      String transaction, Map<String, Object> params, RequestOptions options)
355
      throws StripeException {
356
    String path =
1✔
357
        String.format("/v1/issuing/transactions/%s", ApiResource.urlEncodeId(transaction));
1✔
358
    ApiRequest request =
1✔
359
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
360
    return getGlobalResponseGetter().request(request, Transaction.class);
1✔
361
  }
362

363
  /** Retrieves an Issuing {@code Transaction} object. */
364
  public static Transaction retrieve(
365
      String transaction, TransactionRetrieveParams params, RequestOptions options)
366
      throws StripeException {
367
    String path =
×
368
        String.format("/v1/issuing/transactions/%s", ApiResource.urlEncodeId(transaction));
×
369
    ApiResource.checkNullTypedParams(path, params);
×
370
    ApiRequest request =
×
371
        new ApiRequest(
372
            BaseAddress.API,
373
            ApiResource.RequestMethod.GET,
374
            path,
375
            ApiRequestParams.paramsToMap(params),
×
376
            options);
UNCOV
377
    return getGlobalResponseGetter().request(request, Transaction.class);
×
378
  }
379

380
  /**
381
   * Updates the specified Issuing {@code Transaction} object by setting the values of the
382
   * parameters passed. Any parameters not provided will be left unchanged.
383
   */
384
  @Override
385
  public Transaction update(Map<String, Object> params) throws StripeException {
386
    return update(params, (RequestOptions) null);
1✔
387
  }
388

389
  /**
390
   * Updates the specified Issuing {@code Transaction} object by setting the values of the
391
   * parameters passed. Any parameters not provided will be left unchanged.
392
   */
393
  @Override
394
  public Transaction update(Map<String, Object> params, RequestOptions options)
395
      throws StripeException {
396
    String path =
1✔
397
        String.format("/v1/issuing/transactions/%s", ApiResource.urlEncodeId(this.getId()));
1✔
398
    ApiRequest request =
1✔
399
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
400
    return getResponseGetter().request(request, Transaction.class);
1✔
401
  }
402

403
  /**
404
   * Updates the specified Issuing {@code Transaction} object by setting the values of the
405
   * parameters passed. Any parameters not provided will be left unchanged.
406
   */
407
  public Transaction update(TransactionUpdateParams params) throws StripeException {
408
    return update(params, (RequestOptions) null);
1✔
409
  }
410

411
  /**
412
   * Updates the specified Issuing {@code Transaction} object by setting the values of the
413
   * parameters passed. Any parameters not provided will be left unchanged.
414
   */
415
  public Transaction update(TransactionUpdateParams params, RequestOptions options)
416
      throws StripeException {
417
    String path =
1✔
418
        String.format("/v1/issuing/transactions/%s", ApiResource.urlEncodeId(this.getId()));
1✔
419
    ApiResource.checkNullTypedParams(path, params);
1✔
420
    ApiRequest request =
1✔
421
        new ApiRequest(
422
            BaseAddress.API,
423
            ApiResource.RequestMethod.POST,
424
            path,
425
            ApiRequestParams.paramsToMap(params),
1✔
426
            options);
427
    return getResponseGetter().request(request, Transaction.class);
1✔
428
  }
429

430
  @Getter
431
  @Setter
432
  @EqualsAndHashCode(callSuper = false)
433
  public static class AmountDetails extends StripeObject {
1✔
434
    /** The fee charged by the ATM for the cash withdrawal. */
435
    @SerializedName("atm_fee")
436
    Long atmFee;
437

438
    /** The amount of cash requested by the cardholder. */
439
    @SerializedName("cashback_amount")
440
    Long cashbackAmount;
441
  }
442

443
  @Getter
444
  @Setter
445
  @EqualsAndHashCode(callSuper = false)
446
  public static class MerchantData extends StripeObject {
1✔
447
    /**
448
     * A categorization of the seller's type of business. See our <a
449
     * href="https://stripe.com/docs/issuing/merchant-categories">merchant categories guide</a> for
450
     * a list of possible values.
451
     */
452
    @SerializedName("category")
453
    String category;
454

455
    /** The merchant category code for the seller’s business. */
456
    @SerializedName("category_code")
457
    String categoryCode;
458

459
    /** City where the seller is located. */
460
    @SerializedName("city")
461
    String city;
462

463
    /** Country where the seller is located. */
464
    @SerializedName("country")
465
    String country;
466

467
    /** Name of the seller. */
468
    @SerializedName("name")
469
    String name;
470

471
    /**
472
     * Identifier assigned to the seller by the card network. Different card networks may assign
473
     * different network_id fields to the same merchant.
474
     */
475
    @SerializedName("network_id")
476
    String networkId;
477

478
    /** Postal code where the seller is located. */
479
    @SerializedName("postal_code")
480
    String postalCode;
481

482
    /** State where the seller is located. */
483
    @SerializedName("state")
484
    String state;
485

486
    /** An ID assigned by the seller to the location of the sale. */
487
    @SerializedName("terminal_id")
488
    String terminalId;
489

490
    /** URL provided by the merchant on a 3DS request. */
491
    @SerializedName("url")
492
    String url;
493
  }
494

495
  @Getter
496
  @Setter
497
  @EqualsAndHashCode(callSuper = false)
498
  public static class NetworkData extends StripeObject {
1✔
499
    /**
500
     * A code created by Stripe which is shared with the merchant to validate the authorization.
501
     * This field will be populated if the authorization message was approved. The code typically
502
     * starts with the letter &quot;S&quot;, followed by a six-digit number. For example,
503
     * &quot;S498162&quot;. Please note that the code is not guaranteed to be unique across
504
     * authorizations.
505
     */
506
    @SerializedName("authorization_code")
507
    String authorizationCode;
508

509
    /**
510
     * The date the transaction was processed by the card network. This can be different from the
511
     * date the seller recorded the transaction depending on when the acquirer submits the
512
     * transaction to the network.
513
     */
514
    @SerializedName("processing_date")
515
    String processingDate;
516

517
    /**
518
     * Unique identifier for the authorization assigned by the card network used to match subsequent
519
     * messages, disputes, and transactions.
520
     */
521
    @SerializedName("transaction_id")
522
    String transactionId;
523
  }
524

525
  @Getter
526
  @Setter
527
  @EqualsAndHashCode(callSuper = false)
528
  public static class PurchaseDetails extends StripeObject {
×
529
    /** Fleet-specific information for transactions using Fleet cards. */
530
    @SerializedName("fleet")
531
    Fleet fleet;
532

533
    /** Information about the flight that was purchased with this transaction. */
534
    @SerializedName("flight")
535
    Flight flight;
536

537
    /** Information about fuel that was purchased with this transaction. */
538
    @SerializedName("fuel")
539
    Fuel fuel;
540

541
    /** Information about lodging that was purchased with this transaction. */
542
    @SerializedName("lodging")
543
    Lodging lodging;
544

545
    /** The line items in the purchase. */
546
    @SerializedName("receipt")
547
    List<Transaction.PurchaseDetails.Receipt> receipt;
548

549
    /** A merchant-specific order number. */
550
    @SerializedName("reference")
551
    String reference;
552

553
    @Getter
554
    @Setter
555
    @EqualsAndHashCode(callSuper = false)
556
    public static class Fleet extends StripeObject {
×
557
      /** Answers to prompts presented to cardholder at point of sale. */
558
      @SerializedName("cardholder_prompt_data")
559
      CardholderPromptData cardholderPromptData;
560

561
      /**
562
       * The type of purchase. One of {@code fuel_purchase}, {@code non_fuel_purchase}, or {@code
563
       * fuel_and_non_fuel_purchase}.
564
       */
565
      @SerializedName("purchase_type")
566
      String purchaseType;
567

568
      /**
569
       * More information about the total amount. This information is not guaranteed to be accurate
570
       * as some merchants may provide unreliable data.
571
       */
572
      @SerializedName("reported_breakdown")
573
      ReportedBreakdown reportedBreakdown;
574

575
      /**
576
       * The type of fuel service. One of {@code non_fuel_transaction}, {@code full_service}, or
577
       * {@code self_service}.
578
       */
579
      @SerializedName("service_type")
580
      String serviceType;
581

582
      @Getter
583
      @Setter
584
      @EqualsAndHashCode(callSuper = false)
585
      public static class CardholderPromptData extends StripeObject {
×
586
        /** Driver ID. */
587
        @SerializedName("driver_id")
588
        String driverId;
589

590
        /** Odometer reading. */
591
        @SerializedName("odometer")
592
        Long odometer;
593

594
        /**
595
         * An alphanumeric ID. This field is used when a vehicle ID, driver ID, or generic ID is
596
         * entered by the cardholder, but the merchant or card network did not specify the prompt
597
         * type.
598
         */
599
        @SerializedName("unspecified_id")
600
        String unspecifiedId;
601

602
        /** User ID. */
603
        @SerializedName("user_id")
604
        String userId;
605

606
        /** Vehicle number. */
607
        @SerializedName("vehicle_number")
608
        String vehicleNumber;
609
      }
610

611
      @Getter
612
      @Setter
613
      @EqualsAndHashCode(callSuper = false)
614
      public static class ReportedBreakdown extends StripeObject {
×
615
        /** Breakdown of fuel portion of the purchase. */
616
        @SerializedName("fuel")
617
        Fuel fuel;
618

619
        /** Breakdown of non-fuel portion of the purchase. */
620
        @SerializedName("non_fuel")
621
        NonFuel nonFuel;
622

623
        /** Information about tax included in this transaction. */
624
        @SerializedName("tax")
625
        Tax tax;
626

627
        @Getter
628
        @Setter
629
        @EqualsAndHashCode(callSuper = false)
630
        public static class Fuel extends StripeObject {
×
631
          /**
632
           * Gross fuel amount that should equal Fuel Volume multipled by Fuel Unit Cost, inclusive
633
           * of taxes.
634
           */
635
          @SerializedName("gross_amount_decimal")
636
          BigDecimal grossAmountDecimal;
637
        }
638

639
        @Getter
640
        @Setter
641
        @EqualsAndHashCode(callSuper = false)
642
        public static class NonFuel extends StripeObject {
×
643
          /**
644
           * Gross non-fuel amount that should equal the sum of the line items, inclusive of taxes.
645
           */
646
          @SerializedName("gross_amount_decimal")
647
          BigDecimal grossAmountDecimal;
648
        }
649

650
        @Getter
651
        @Setter
652
        @EqualsAndHashCode(callSuper = false)
653
        public static class Tax extends StripeObject {
×
654
          /**
655
           * Amount of state or provincial Sales Tax included in the transaction amount. Null if not
656
           * reported by merchant or not subject to tax.
657
           */
658
          @SerializedName("local_amount_decimal")
659
          BigDecimal localAmountDecimal;
660

661
          /**
662
           * Amount of national Sales Tax or VAT included in the transaction amount. Null if not
663
           * reported by merchant or not subject to tax.
664
           */
665
          @SerializedName("national_amount_decimal")
666
          BigDecimal nationalAmountDecimal;
667
        }
668
      }
669
    }
670

671
    @Getter
672
    @Setter
673
    @EqualsAndHashCode(callSuper = false)
674
    public static class Flight extends StripeObject {
×
675
      /** The time that the flight departed. */
676
      @SerializedName("departure_at")
677
      Long departureAt;
678

679
      /** The name of the passenger. */
680
      @SerializedName("passenger_name")
681
      String passengerName;
682

683
      /** Whether the ticket is refundable. */
684
      @SerializedName("refundable")
685
      Boolean refundable;
686

687
      /** The legs of the trip. */
688
      @SerializedName("segments")
689
      List<Transaction.PurchaseDetails.Flight.Segment> segments;
690

691
      /** The travel agency that issued the ticket. */
692
      @SerializedName("travel_agency")
693
      String travelAgency;
694

695
      @Getter
696
      @Setter
697
      @EqualsAndHashCode(callSuper = false)
698
      public static class Segment extends StripeObject {
×
699
        /** The three-letter IATA airport code of the flight's destination. */
700
        @SerializedName("arrival_airport_code")
701
        String arrivalAirportCode;
702

703
        /** The airline carrier code. */
704
        @SerializedName("carrier")
705
        String carrier;
706

707
        /** The three-letter IATA airport code that the flight departed from. */
708
        @SerializedName("departure_airport_code")
709
        String departureAirportCode;
710

711
        /** The flight number. */
712
        @SerializedName("flight_number")
713
        String flightNumber;
714

715
        /** The flight's service class. */
716
        @SerializedName("service_class")
717
        String serviceClass;
718

719
        /** Whether a stopover is allowed on this flight. */
720
        @SerializedName("stopover_allowed")
721
        Boolean stopoverAllowed;
722
      }
723
    }
724

725
    @Getter
726
    @Setter
727
    @EqualsAndHashCode(callSuper = false)
728
    public static class Fuel extends StripeObject {
×
729
      /**
730
       * <a href="https://www.conexxus.org/conexxus-payment-system-product-codes">Conexxus Payment
731
       * System Product Code</a> identifying the primary fuel product purchased.
732
       */
733
      @SerializedName("industry_product_code")
734
      String industryProductCode;
735

736
      /**
737
       * The quantity of {@code unit}s of fuel that was dispensed, represented as a decimal string
738
       * with at most 12 decimal places.
739
       */
740
      @SerializedName("quantity_decimal")
741
      BigDecimal quantityDecimal;
742

743
      /**
744
       * The type of fuel that was purchased. One of {@code diesel}, {@code unleaded_plus}, {@code
745
       * unleaded_regular}, {@code unleaded_super}, or {@code other}.
746
       */
747
      @SerializedName("type")
748
      String type;
749

750
      /**
751
       * The units for {@code quantity_decimal}. One of {@code charging_minute}, {@code
752
       * imperial_gallon}, {@code kilogram}, {@code kilowatt_hour}, {@code liter}, {@code pound},
753
       * {@code us_gallon}, or {@code other}.
754
       */
755
      @SerializedName("unit")
756
      String unit;
757

758
      /**
759
       * The cost in cents per each unit of fuel, represented as a decimal string with at most 12
760
       * decimal places.
761
       */
762
      @SerializedName("unit_cost_decimal")
763
      BigDecimal unitCostDecimal;
764
    }
765

766
    @Getter
767
    @Setter
768
    @EqualsAndHashCode(callSuper = false)
769
    public static class Lodging extends StripeObject {
×
770
      /** The time of checking into the lodging. */
771
      @SerializedName("check_in_at")
772
      Long checkInAt;
773

774
      /** The number of nights stayed at the lodging. */
775
      @SerializedName("nights")
776
      Long nights;
777
    }
778

779
    @Getter
780
    @Setter
781
    @EqualsAndHashCode(callSuper = false)
782
    public static class Receipt extends StripeObject {
×
783
      /** The description of the item. The maximum length of this field is 26 characters. */
784
      @SerializedName("description")
785
      String description;
786

787
      /** The quantity of the item. */
788
      @SerializedName("quantity")
789
      BigDecimal quantity;
790

791
      /** The total for this line item in cents. */
792
      @SerializedName("total")
793
      Long total;
794

795
      /** The unit cost of the item in cents. */
796
      @SerializedName("unit_cost")
797
      Long unitCost;
798
    }
799
  }
800

801
  @Getter
802
  @Setter
803
  @EqualsAndHashCode(callSuper = false)
804
  public static class Treasury extends StripeObject {
×
805
    /**
806
     * The Treasury <a
807
     * href="https://stripe.com/docs/api/treasury/received_credits">ReceivedCredit</a> representing
808
     * this Issuing transaction if it is a refund
809
     */
810
    @SerializedName("received_credit")
811
    String receivedCredit;
812

813
    /**
814
     * The Treasury <a href="https://stripe.com/docs/api/treasury/received_debits">ReceivedDebit</a>
815
     * representing this Issuing transaction if it is a capture
816
     */
817
    @SerializedName("received_debit")
818
    String receivedDebit;
819
  }
820

821
  public TestHelpers getTestHelpers() {
822
    return new TestHelpers(this);
1✔
823
  }
824

825
  public static class TestHelpers {
826
    private final Transaction resource;
827

828
    private TestHelpers(Transaction resource) {
1✔
829
      this.resource = resource;
1✔
830
    }
1✔
831

832
    /** Refund a test-mode Transaction. */
833
    public Transaction refund() throws StripeException {
834
      return refund((Map<String, Object>) null, (RequestOptions) null);
×
835
    }
836

837
    /** Refund a test-mode Transaction. */
838
    public Transaction refund(RequestOptions options) throws StripeException {
839
      return refund((Map<String, Object>) null, options);
×
840
    }
841

842
    /** Refund a test-mode Transaction. */
843
    public Transaction refund(Map<String, Object> params) throws StripeException {
844
      return refund(params, (RequestOptions) null);
×
845
    }
846

847
    /** Refund a test-mode Transaction. */
848
    public Transaction refund(Map<String, Object> params, RequestOptions options)
849
        throws StripeException {
850
      String path =
×
851
          String.format(
×
852
              "/v1/test_helpers/issuing/transactions/%s/refund",
853
              ApiResource.urlEncodeId(this.resource.getId()));
×
854
      ApiRequest request =
×
855
          new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
856
      return resource.getResponseGetter().request(request, Transaction.class);
×
857
    }
858

859
    /** Refund a test-mode Transaction. */
860
    public Transaction refund(TransactionRefundParams params) throws StripeException {
861
      return refund(params, (RequestOptions) null);
1✔
862
    }
863

864
    /** Refund a test-mode Transaction. */
865
    public Transaction refund(TransactionRefundParams params, RequestOptions options)
866
        throws StripeException {
867
      String path =
1✔
868
          String.format(
1✔
869
              "/v1/test_helpers/issuing/transactions/%s/refund",
870
              ApiResource.urlEncodeId(this.resource.getId()));
1✔
871
      ApiResource.checkNullTypedParams(path, params);
1✔
872
      ApiRequest request =
1✔
873
          new ApiRequest(
874
              BaseAddress.API,
875
              ApiResource.RequestMethod.POST,
876
              path,
877
              ApiRequestParams.paramsToMap(params),
1✔
878
              options);
879
      return resource.getResponseGetter().request(request, Transaction.class);
1✔
880
    }
881

882
    /** Allows the user to capture an arbitrary amount, also known as a forced capture. */
883
    public static Transaction createForceCapture(Map<String, Object> params)
884
        throws StripeException {
885
      return createForceCapture(params, (RequestOptions) null);
×
886
    }
887

888
    /** Allows the user to capture an arbitrary amount, also known as a forced capture. */
889
    public static Transaction createForceCapture(Map<String, Object> params, RequestOptions options)
890
        throws StripeException {
891
      String path = "/v1/test_helpers/issuing/transactions/create_force_capture";
×
892
      ApiRequest request =
×
893
          new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
894
      return getGlobalResponseGetter().request(request, Transaction.class);
×
895
    }
896

897
    /** Allows the user to capture an arbitrary amount, also known as a forced capture. */
898
    public static Transaction createForceCapture(TransactionCreateForceCaptureParams params)
899
        throws StripeException {
900
      return createForceCapture(params, (RequestOptions) null);
1✔
901
    }
902

903
    /** Allows the user to capture an arbitrary amount, also known as a forced capture. */
904
    public static Transaction createForceCapture(
905
        TransactionCreateForceCaptureParams params, RequestOptions options) throws StripeException {
906
      String path = "/v1/test_helpers/issuing/transactions/create_force_capture";
1✔
907
      ApiResource.checkNullTypedParams(path, params);
1✔
908
      ApiRequest request =
1✔
909
          new ApiRequest(
910
              BaseAddress.API,
911
              ApiResource.RequestMethod.POST,
912
              path,
913
              ApiRequestParams.paramsToMap(params),
1✔
914
              options);
915
      return getGlobalResponseGetter().request(request, Transaction.class);
1✔
916
    }
917

918
    /** Allows the user to refund an arbitrary amount, also known as a unlinked refund. */
919
    public static Transaction createUnlinkedRefund(Map<String, Object> params)
920
        throws StripeException {
921
      return createUnlinkedRefund(params, (RequestOptions) null);
×
922
    }
923

924
    /** Allows the user to refund an arbitrary amount, also known as a unlinked refund. */
925
    public static Transaction createUnlinkedRefund(
926
        Map<String, Object> params, RequestOptions options) throws StripeException {
927
      String path = "/v1/test_helpers/issuing/transactions/create_unlinked_refund";
×
928
      ApiRequest request =
×
929
          new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options);
UNCOV
930
      return getGlobalResponseGetter().request(request, Transaction.class);
×
931
    }
932

933
    /** Allows the user to refund an arbitrary amount, also known as a unlinked refund. */
934
    public static Transaction createUnlinkedRefund(TransactionCreateUnlinkedRefundParams params)
935
        throws StripeException {
936
      return createUnlinkedRefund(params, (RequestOptions) null);
1✔
937
    }
938

939
    /** Allows the user to refund an arbitrary amount, also known as a unlinked refund. */
940
    public static Transaction createUnlinkedRefund(
941
        TransactionCreateUnlinkedRefundParams params, RequestOptions options)
942
        throws StripeException {
943
      String path = "/v1/test_helpers/issuing/transactions/create_unlinked_refund";
1✔
944
      ApiResource.checkNullTypedParams(path, params);
1✔
945
      ApiRequest request =
1✔
946
          new ApiRequest(
947
              BaseAddress.API,
948
              ApiResource.RequestMethod.POST,
949
              path,
950
              ApiRequestParams.paramsToMap(params),
1✔
951
              options);
952
      return getGlobalResponseGetter().request(request, Transaction.class);
1✔
953
    }
954
  }
955

956
  @Override
957
  public void setResponseGetter(StripeResponseGetter responseGetter) {
958
    super.setResponseGetter(responseGetter);
1✔
959
    trySetResponseGetter(amountDetails, responseGetter);
1✔
960
    trySetResponseGetter(authorization, responseGetter);
1✔
961
    trySetResponseGetter(balanceTransaction, responseGetter);
1✔
962
    trySetResponseGetter(card, responseGetter);
1✔
963
    trySetResponseGetter(cardholder, responseGetter);
1✔
964
    trySetResponseGetter(dispute, responseGetter);
1✔
965
    trySetResponseGetter(merchantData, responseGetter);
1✔
966
    trySetResponseGetter(networkData, responseGetter);
1✔
967
    trySetResponseGetter(purchaseDetails, responseGetter);
1✔
968
    trySetResponseGetter(token, responseGetter);
1✔
969
    trySetResponseGetter(treasury, responseGetter);
1✔
970
  }
1✔
971
}
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

© 2024 Coveralls, Inc