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

stripe / stripe-java / #16707

14 Dec 2024 12:12AM UTC coverage: 15.91% (-0.08%) from 15.988%
#16707

Pull #1931

github

web-flow
Merge 90c2dfd77 into cf528f2c8
Pull Request #1931: Update generated code

43 of 1442 new or added lines in 28 files covered. (2.98%)

137 existing lines in 17 files now uncovered.

18625 of 117068 relevant lines covered (15.91%)

0.16 hits per line

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

0.0
/src/main/java/com/stripe/model/billing/CreditBalanceTransaction.java
1
// File generated from our OpenAPI spec
2
package com.stripe.model.billing;
3

4
import com.google.gson.annotations.SerializedName;
5
import com.stripe.exception.StripeException;
6
import com.stripe.model.ExpandableField;
7
import com.stripe.model.HasId;
8
import com.stripe.model.Invoice;
9
import com.stripe.model.StripeObject;
10
import com.stripe.model.testhelpers.TestClock;
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.billing.CreditBalanceTransactionListParams;
18
import com.stripe.param.billing.CreditBalanceTransactionRetrieveParams;
19
import java.util.Map;
20
import lombok.EqualsAndHashCode;
21
import lombok.Getter;
22
import lombok.Setter;
23

24
/**
25
 * A credit balance transaction is a resource representing a transaction (either a credit or a
26
 * debit) against an existing credit grant.
27
 */
28
@Getter
29
@Setter
30
@EqualsAndHashCode(callSuper = false)
31
public class CreditBalanceTransaction extends ApiResource implements HasId {
×
32
  /** Time at which the object was created. Measured in seconds since the Unix epoch. */
33
  @SerializedName("created")
34
  Long created;
35

36
  /** Credit details for this credit balance transaction. Only present if type is {@code credit}. */
37
  @SerializedName("credit")
38
  Credit credit;
39

40
  /** The credit grant associated with this credit balance transaction. */
41
  @SerializedName("credit_grant")
42
  @Getter(lombok.AccessLevel.NONE)
43
  @Setter(lombok.AccessLevel.NONE)
44
  ExpandableField<CreditGrant> creditGrant;
45

46
  /** Debit details for this credit balance transaction. Only present if type is {@code debit}. */
47
  @SerializedName("debit")
48
  Debit debit;
49

50
  /** The effective time of this credit balance transaction. */
51
  @SerializedName("effective_at")
52
  Long effectiveAt;
53

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

59
  /**
60
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
61
   * object exists in test mode.
62
   */
63
  @SerializedName("livemode")
64
  Boolean livemode;
65

66
  /**
67
   * String representing the object's type. Objects of the same type share the same value.
68
   *
69
   * <p>Equal to {@code billing.credit_balance_transaction}.
70
   */
71
  @SerializedName("object")
72
  String object;
73

74
  /** ID of the test clock this credit balance transaction belongs to. */
75
  @SerializedName("test_clock")
76
  @Getter(lombok.AccessLevel.NONE)
77
  @Setter(lombok.AccessLevel.NONE)
78
  ExpandableField<TestClock> testClock;
79

80
  /**
81
   * The type of credit balance transaction (credit or debit).
82
   *
83
   * <p>One of {@code credit}, or {@code debit}.
84
   */
85
  @SerializedName("type")
86
  String type;
87

88
  /** Get ID of expandable {@code creditGrant} object. */
89
  public String getCreditGrant() {
90
    return (this.creditGrant != null) ? this.creditGrant.getId() : null;
×
91
  }
92

93
  public void setCreditGrant(String id) {
94
    this.creditGrant = ApiResource.setExpandableFieldId(id, this.creditGrant);
×
95
  }
×
96

97
  /** Get expanded {@code creditGrant}. */
98
  public CreditGrant getCreditGrantObject() {
99
    return (this.creditGrant != null) ? this.creditGrant.getExpanded() : null;
×
100
  }
101

102
  public void setCreditGrantObject(CreditGrant expandableObject) {
103
    this.creditGrant = new ExpandableField<CreditGrant>(expandableObject.getId(), expandableObject);
×
104
  }
×
105

106
  /** Get ID of expandable {@code testClock} object. */
107
  public String getTestClock() {
108
    return (this.testClock != null) ? this.testClock.getId() : null;
×
109
  }
110

111
  public void setTestClock(String id) {
112
    this.testClock = ApiResource.setExpandableFieldId(id, this.testClock);
×
113
  }
×
114

115
  /** Get expanded {@code testClock}. */
116
  public TestClock getTestClockObject() {
117
    return (this.testClock != null) ? this.testClock.getExpanded() : null;
×
118
  }
119

120
  public void setTestClockObject(TestClock expandableObject) {
121
    this.testClock = new ExpandableField<TestClock>(expandableObject.getId(), expandableObject);
×
122
  }
×
123

124
  /** Retrieve a list of credit balance transactions. */
125
  public static CreditBalanceTransactionCollection list(Map<String, Object> params)
126
      throws StripeException {
127
    return list(params, (RequestOptions) null);
×
128
  }
129

130
  /** Retrieve a list of credit balance transactions. */
131
  public static CreditBalanceTransactionCollection list(
132
      Map<String, Object> params, RequestOptions options) throws StripeException {
133
    String path = "/v1/billing/credit_balance_transactions";
×
134
    ApiRequest request =
×
135
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
136
    return getGlobalResponseGetter().request(request, CreditBalanceTransactionCollection.class);
×
137
  }
138

139
  /** Retrieve a list of credit balance transactions. */
140
  public static CreditBalanceTransactionCollection list(CreditBalanceTransactionListParams params)
141
      throws StripeException {
142
    return list(params, (RequestOptions) null);
×
143
  }
144

145
  /** Retrieve a list of credit balance transactions. */
146
  public static CreditBalanceTransactionCollection list(
147
      CreditBalanceTransactionListParams params, RequestOptions options) throws StripeException {
148
    String path = "/v1/billing/credit_balance_transactions";
×
149
    ApiResource.checkNullTypedParams(path, params);
×
150
    ApiRequest request =
×
151
        new ApiRequest(
152
            BaseAddress.API,
153
            ApiResource.RequestMethod.GET,
154
            path,
155
            ApiRequestParams.paramsToMap(params),
×
156
            options);
157
    return getGlobalResponseGetter().request(request, CreditBalanceTransactionCollection.class);
×
158
  }
159

160
  /** Retrieves a credit balance transaction. */
161
  public static CreditBalanceTransaction retrieve(String id) throws StripeException {
162
    return retrieve(id, (Map<String, Object>) null, (RequestOptions) null);
×
163
  }
164

165
  /** Retrieves a credit balance transaction. */
166
  public static CreditBalanceTransaction retrieve(String id, RequestOptions options)
167
      throws StripeException {
168
    return retrieve(id, (Map<String, Object>) null, options);
×
169
  }
170

171
  /** Retrieves a credit balance transaction. */
172
  public static CreditBalanceTransaction retrieve(
173
      String id, Map<String, Object> params, RequestOptions options) throws StripeException {
174
    String path =
×
175
        String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id));
×
176
    ApiRequest request =
×
177
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
178
    return getGlobalResponseGetter().request(request, CreditBalanceTransaction.class);
×
179
  }
180

181
  /** Retrieves a credit balance transaction. */
182
  public static CreditBalanceTransaction retrieve(
183
      String id, CreditBalanceTransactionRetrieveParams params, RequestOptions options)
184
      throws StripeException {
185
    String path =
×
186
        String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id));
×
187
    ApiResource.checkNullTypedParams(path, params);
×
188
    ApiRequest request =
×
189
        new ApiRequest(
190
            BaseAddress.API,
191
            ApiResource.RequestMethod.GET,
192
            path,
193
            ApiRequestParams.paramsToMap(params),
×
194
            options);
195
    return getGlobalResponseGetter().request(request, CreditBalanceTransaction.class);
×
196
  }
197

198
  /**
199
   * For more details about Credit, please refer to the <a href="https://docs.stripe.com/api">API
200
   * Reference.</a>
201
   */
202
  @Getter
203
  @Setter
204
  @EqualsAndHashCode(callSuper = false)
205
  public static class Credit extends StripeObject {
×
206
    @SerializedName("amount")
207
    Amount amount;
208

209
    /**
210
     * Details of the invoice to which the reinstated credits were originally applied. Only present
211
     * if {@code type} is {@code credits_application_invoice_voided}.
212
     */
213
    @SerializedName("credits_application_invoice_voided")
214
    CreditsApplicationInvoiceVoided creditsApplicationInvoiceVoided;
215

216
    /**
217
     * The type of credit transaction.
218
     *
219
     * <p>One of {@code credits_application_invoice_voided}, or {@code credits_granted}.
220
     */
221
    @SerializedName("type")
222
    String type;
223

224
    /**
225
     * For more details about Amount, please refer to the <a href="https://docs.stripe.com/api">API
226
     * Reference.</a>
227
     */
228
    @Getter
229
    @Setter
230
    @EqualsAndHashCode(callSuper = false)
231
    public static class Amount extends StripeObject {
×
232
      /** The monetary amount. */
233
      @SerializedName("monetary")
234
      Monetary monetary;
235

236
      /**
237
       * The type of this amount. We currently only support {@code monetary} billing credits.
238
       *
239
       * <p>Equal to {@code monetary}.
240
       */
241
      @SerializedName("type")
242
      String type;
243

244
      /**
245
       * For more details about Monetary, please refer to the <a
246
       * href="https://docs.stripe.com/api">API Reference.</a>
247
       */
248
      @Getter
249
      @Setter
250
      @EqualsAndHashCode(callSuper = false)
251
      public static class Monetary extends StripeObject {
×
252
        /**
253
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
254
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
255
         * currency</a>.
256
         */
257
        @SerializedName("currency")
258
        String currency;
259

260
        /** A positive integer representing the amount. */
261
        @SerializedName("value")
262
        Long value;
263
      }
264
    }
265

266
    /**
267
     * For more details about CreditsApplicationInvoiceVoided, please refer to the <a
268
     * href="https://docs.stripe.com/api">API Reference.</a>
269
     */
270
    @Getter
271
    @Setter
272
    @EqualsAndHashCode(callSuper = false)
NEW
273
    public static class CreditsApplicationInvoiceVoided extends StripeObject {
×
274
      /** The invoice to which the reinstated billing credits were originally applied. */
275
      @SerializedName("invoice")
276
      @Getter(lombok.AccessLevel.NONE)
277
      @Setter(lombok.AccessLevel.NONE)
278
      ExpandableField<Invoice> invoice;
279

280
      /** The invoice line item to which the reinstated billing credits were originally applied. */
281
      @SerializedName("invoice_line_item")
282
      String invoiceLineItem;
283

284
      /** Get ID of expandable {@code invoice} object. */
285
      public String getInvoice() {
NEW
286
        return (this.invoice != null) ? this.invoice.getId() : null;
×
287
      }
288

289
      public void setInvoice(String id) {
NEW
290
        this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
NEW
291
      }
×
292

293
      /** Get expanded {@code invoice}. */
294
      public Invoice getInvoiceObject() {
NEW
295
        return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
296
      }
297

298
      public void setInvoiceObject(Invoice expandableObject) {
NEW
299
        this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
NEW
300
      }
×
301
    }
302
  }
303

304
  /**
305
   * For more details about Debit, please refer to the <a href="https://docs.stripe.com/api">API
306
   * Reference.</a>
307
   */
308
  @Getter
309
  @Setter
310
  @EqualsAndHashCode(callSuper = false)
311
  public static class Debit extends StripeObject {
×
312
    @SerializedName("amount")
313
    Amount amount;
314

315
    /**
316
     * Details of how the billing credits were applied to an invoice. Only present if {@code type}
317
     * is {@code credits_applied}.
318
     */
319
    @SerializedName("credits_applied")
320
    CreditsApplied creditsApplied;
321

322
    /**
323
     * The type of debit transaction.
324
     *
325
     * <p>One of {@code credits_applied}, {@code credits_expired}, or {@code credits_voided}.
326
     */
327
    @SerializedName("type")
328
    String type;
329

330
    /**
331
     * For more details about Amount, please refer to the <a href="https://docs.stripe.com/api">API
332
     * Reference.</a>
333
     */
334
    @Getter
335
    @Setter
336
    @EqualsAndHashCode(callSuper = false)
337
    public static class Amount extends StripeObject {
×
338
      /** The monetary amount. */
339
      @SerializedName("monetary")
340
      Monetary monetary;
341

342
      /**
343
       * The type of this amount. We currently only support {@code monetary} billing credits.
344
       *
345
       * <p>Equal to {@code monetary}.
346
       */
347
      @SerializedName("type")
348
      String type;
349

350
      /**
351
       * For more details about Monetary, please refer to the <a
352
       * href="https://docs.stripe.com/api">API Reference.</a>
353
       */
354
      @Getter
355
      @Setter
356
      @EqualsAndHashCode(callSuper = false)
357
      public static class Monetary extends StripeObject {
×
358
        /**
359
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
360
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
361
         * currency</a>.
362
         */
363
        @SerializedName("currency")
364
        String currency;
365

366
        /** A positive integer representing the amount. */
367
        @SerializedName("value")
368
        Long value;
369
      }
370
    }
371

372
    /**
373
     * For more details about CreditsApplied, please refer to the <a
374
     * href="https://docs.stripe.com/api">API Reference.</a>
375
     */
376
    @Getter
377
    @Setter
378
    @EqualsAndHashCode(callSuper = false)
379
    public static class CreditsApplied extends StripeObject {
×
380
      /** The invoice to which the billing credits were applied. */
381
      @SerializedName("invoice")
382
      @Getter(lombok.AccessLevel.NONE)
383
      @Setter(lombok.AccessLevel.NONE)
384
      ExpandableField<Invoice> invoice;
385

386
      /** The invoice line item to which the billing credits were applied. */
387
      @SerializedName("invoice_line_item")
388
      String invoiceLineItem;
389

390
      /** Get ID of expandable {@code invoice} object. */
391
      public String getInvoice() {
392
        return (this.invoice != null) ? this.invoice.getId() : null;
×
393
      }
394

395
      public void setInvoice(String id) {
396
        this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
397
      }
×
398

399
      /** Get expanded {@code invoice}. */
400
      public Invoice getInvoiceObject() {
401
        return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
402
      }
403

404
      public void setInvoiceObject(Invoice expandableObject) {
405
        this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
406
      }
×
407
    }
408
  }
409

410
  @Override
411
  public void setResponseGetter(StripeResponseGetter responseGetter) {
412
    super.setResponseGetter(responseGetter);
×
413
    trySetResponseGetter(credit, responseGetter);
×
414
    trySetResponseGetter(creditGrant, responseGetter);
×
415
    trySetResponseGetter(debit, responseGetter);
×
416
    trySetResponseGetter(testClock, responseGetter);
×
417
  }
×
418
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc