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

stripe / stripe-java / #16493

03 Oct 2024 07:15PM UTC coverage: 12.942% (+0.08%) from 12.864%
#16493

push

github

web-flow
Merge Stripe-java v27.0.0 to beta branch (#1888)

409 of 1651 new or added lines in 88 files covered. (24.77%)

31 existing lines in 7 files now uncovered.

18773 of 145050 relevant lines covered (12.94%)

0.13 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)
NEW
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 balance transaction. Only present if type is {@code credit}. */
37
  @SerializedName("credit")
38
  Credit credit;
39

40
  /** The credit grant associated with this 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 balance transaction. Only present if type is {@code debit}. */
47
  @SerializedName("debit")
48
  Debit debit;
49

50
  /** The effective time of this 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 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() {
NEW
90
    return (this.creditGrant != null) ? this.creditGrant.getId() : null;
×
91
  }
92

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

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

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

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

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

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

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

124
  /** Retrieve a list of credit balance transactions. */
125
  public static CreditBalanceTransactionCollection list(Map<String, Object> params)
126
      throws StripeException {
NEW
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 {
NEW
133
    String path = "/v1/billing/credit_balance_transactions";
×
NEW
134
    ApiRequest request =
×
135
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
NEW
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 {
NEW
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 {
NEW
148
    String path = "/v1/billing/credit_balance_transactions";
×
NEW
149
    ApiResource.checkNullTypedParams(path, params);
×
NEW
150
    ApiRequest request =
×
151
        new ApiRequest(
152
            BaseAddress.API,
153
            ApiResource.RequestMethod.GET,
154
            path,
NEW
155
            ApiRequestParams.paramsToMap(params),
×
156
            options);
NEW
157
    return getGlobalResponseGetter().request(request, CreditBalanceTransactionCollection.class);
×
158
  }
159

160
  /** Retrieves a credit balance transaction. */
161
  public static CreditBalanceTransaction retrieve(String id) throws StripeException {
NEW
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 {
NEW
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 {
NEW
174
    String path =
×
NEW
175
        String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id));
×
NEW
176
    ApiRequest request =
×
177
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
NEW
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 {
NEW
185
    String path =
×
NEW
186
        String.format("/v1/billing/credit_balance_transactions/%s", ApiResource.urlEncodeId(id));
×
NEW
187
    ApiResource.checkNullTypedParams(path, params);
×
NEW
188
    ApiRequest request =
×
189
        new ApiRequest(
190
            BaseAddress.API,
191
            ApiResource.RequestMethod.GET,
192
            path,
NEW
193
            ApiRequestParams.paramsToMap(params),
×
194
            options);
NEW
195
    return getGlobalResponseGetter().request(request, CreditBalanceTransaction.class);
×
196
  }
197

198
  @Getter
199
  @Setter
200
  @EqualsAndHashCode(callSuper = false)
NEW
201
  public static class Credit extends StripeObject {
×
202
    @SerializedName("amount")
203
    Amount amount;
204

205
    /**
206
     * The type of credit transaction.
207
     *
208
     * <p>Equal to {@code credits_granted}.
209
     */
210
    @SerializedName("type")
211
    String type;
212

213
    @Getter
214
    @Setter
215
    @EqualsAndHashCode(callSuper = false)
NEW
216
    public static class Amount extends StripeObject {
×
217
      /** The monetary amount. */
218
      @SerializedName("monetary")
219
      Monetary monetary;
220

221
      /**
222
       * The type of this amount. We currently only support {@code monetary} credits.
223
       *
224
       * <p>Equal to {@code monetary}.
225
       */
226
      @SerializedName("type")
227
      String type;
228

229
      @Getter
230
      @Setter
231
      @EqualsAndHashCode(callSuper = false)
NEW
232
      public static class Monetary extends StripeObject {
×
233
        /**
234
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
235
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
236
         * currency</a>.
237
         */
238
        @SerializedName("currency")
239
        String currency;
240

241
        /** A positive integer representing the amount. */
242
        @SerializedName("value")
243
        Long value;
244
      }
245
    }
246
  }
247

248
  @Getter
249
  @Setter
250
  @EqualsAndHashCode(callSuper = false)
NEW
251
  public static class Debit extends StripeObject {
×
252
    @SerializedName("amount")
253
    Amount amount;
254

255
    /**
256
     * Details of how the credits were applied to an invoice. Only present if {@code type} is {@code
257
     * credits_applied}.
258
     */
259
    @SerializedName("credits_applied")
260
    CreditsApplied creditsApplied;
261

262
    /**
263
     * The type of debit transaction.
264
     *
265
     * <p>One of {@code credits_applied}, {@code credits_expired}, or {@code credits_voided}.
266
     */
267
    @SerializedName("type")
268
    String type;
269

270
    @Getter
271
    @Setter
272
    @EqualsAndHashCode(callSuper = false)
NEW
273
    public static class Amount extends StripeObject {
×
274
      /** The monetary amount. */
275
      @SerializedName("monetary")
276
      Monetary monetary;
277

278
      /**
279
       * The type of this amount. We currently only support {@code monetary} credits.
280
       *
281
       * <p>Equal to {@code monetary}.
282
       */
283
      @SerializedName("type")
284
      String type;
285

286
      @Getter
287
      @Setter
288
      @EqualsAndHashCode(callSuper = false)
NEW
289
      public static class Monetary extends StripeObject {
×
290
        /**
291
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
292
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
293
         * currency</a>.
294
         */
295
        @SerializedName("currency")
296
        String currency;
297

298
        /** A positive integer representing the amount. */
299
        @SerializedName("value")
300
        Long value;
301
      }
302
    }
303

304
    @Getter
305
    @Setter
306
    @EqualsAndHashCode(callSuper = false)
NEW
307
    public static class CreditsApplied extends StripeObject {
×
308
      /** The invoice to which the credits were applied. */
309
      @SerializedName("invoice")
310
      @Getter(lombok.AccessLevel.NONE)
311
      @Setter(lombok.AccessLevel.NONE)
312
      ExpandableField<Invoice> invoice;
313

314
      /** The invoice line item to which the credits were applied. */
315
      @SerializedName("invoice_line_item")
316
      String invoiceLineItem;
317

318
      /** Get ID of expandable {@code invoice} object. */
319
      public String getInvoice() {
NEW
320
        return (this.invoice != null) ? this.invoice.getId() : null;
×
321
      }
322

323
      public void setInvoice(String id) {
NEW
324
        this.invoice = ApiResource.setExpandableFieldId(id, this.invoice);
×
NEW
325
      }
×
326

327
      /** Get expanded {@code invoice}. */
328
      public Invoice getInvoiceObject() {
NEW
329
        return (this.invoice != null) ? this.invoice.getExpanded() : null;
×
330
      }
331

332
      public void setInvoiceObject(Invoice expandableObject) {
NEW
333
        this.invoice = new ExpandableField<Invoice>(expandableObject.getId(), expandableObject);
×
NEW
334
      }
×
335
    }
336
  }
337

338
  @Override
339
  public void setResponseGetter(StripeResponseGetter responseGetter) {
NEW
340
    super.setResponseGetter(responseGetter);
×
NEW
341
    trySetResponseGetter(credit, responseGetter);
×
NEW
342
    trySetResponseGetter(creditGrant, responseGetter);
×
NEW
343
    trySetResponseGetter(debit, responseGetter);
×
NEW
344
    trySetResponseGetter(testClock, responseGetter);
×
NEW
345
  }
×
346
}
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