• 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/CreditBalanceSummary.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.Customer;
7
import com.stripe.model.ExpandableField;
8
import com.stripe.model.StripeObject;
9
import com.stripe.net.ApiRequest;
10
import com.stripe.net.ApiRequestParams;
11
import com.stripe.net.ApiResource;
12
import com.stripe.net.BaseAddress;
13
import com.stripe.net.RequestOptions;
14
import com.stripe.net.StripeResponseGetter;
15
import com.stripe.param.billing.CreditBalanceSummaryRetrieveParams;
16
import java.util.List;
17
import java.util.Map;
18
import lombok.EqualsAndHashCode;
19
import lombok.Getter;
20
import lombok.Setter;
21

22
/** Indicates the credit balance for credits granted to a customer. */
23
@Getter
24
@Setter
25
@EqualsAndHashCode(callSuper = false)
NEW
26
public class CreditBalanceSummary extends ApiResource {
×
27
  /**
28
   * The credit balances. One entry per credit grant currency. If a customer only has credit grants
29
   * in a single currency, then this will have a single balance entry.
30
   */
31
  @SerializedName("balances")
32
  List<CreditBalanceSummary.Balance> balances;
33

34
  /** The customer the balance is for. */
35
  @SerializedName("customer")
36
  @Getter(lombok.AccessLevel.NONE)
37
  @Setter(lombok.AccessLevel.NONE)
38
  ExpandableField<Customer> customer;
39

40
  /**
41
   * Has the value {@code true} if the object exists in live mode or the value {@code false} if the
42
   * object exists in test mode.
43
   */
44
  @SerializedName("livemode")
45
  Boolean livemode;
46

47
  /**
48
   * String representing the object's type. Objects of the same type share the same value.
49
   *
50
   * <p>Equal to {@code billing.credit_balance_summary}.
51
   */
52
  @SerializedName("object")
53
  String object;
54

55
  /** Get ID of expandable {@code customer} object. */
56
  public String getCustomer() {
NEW
57
    return (this.customer != null) ? this.customer.getId() : null;
×
58
  }
59

60
  public void setCustomer(String id) {
NEW
61
    this.customer = ApiResource.setExpandableFieldId(id, this.customer);
×
NEW
62
  }
×
63

64
  /** Get expanded {@code customer}. */
65
  public Customer getCustomerObject() {
NEW
66
    return (this.customer != null) ? this.customer.getExpanded() : null;
×
67
  }
68

69
  public void setCustomerObject(Customer expandableObject) {
NEW
70
    this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
×
NEW
71
  }
×
72

73
  /** Retrieves the credit balance summary for a customer. */
74
  public static CreditBalanceSummary retrieve() throws StripeException {
NEW
75
    return retrieve((Map<String, Object>) null, (RequestOptions) null);
×
76
  }
77

78
  /** Retrieves the credit balance summary for a customer. */
79
  public static CreditBalanceSummary retrieve(RequestOptions options) throws StripeException {
NEW
80
    return retrieve((Map<String, Object>) null, options);
×
81
  }
82

83
  /** Retrieves the credit balance summary for a customer. */
84
  public static CreditBalanceSummary retrieve(Map<String, Object> params, RequestOptions options)
85
      throws StripeException {
NEW
86
    String path = "/v1/billing/credit_balance_summary";
×
NEW
87
    ApiRequest request =
×
88
        new ApiRequest(BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options);
NEW
89
    return getGlobalResponseGetter().request(request, CreditBalanceSummary.class);
×
90
  }
91

92
  /** Retrieves the credit balance summary for a customer. */
93
  public static CreditBalanceSummary retrieve(
94
      CreditBalanceSummaryRetrieveParams params, RequestOptions options) throws StripeException {
NEW
95
    String path = "/v1/billing/credit_balance_summary";
×
NEW
96
    ApiResource.checkNullTypedParams(path, params);
×
NEW
97
    ApiRequest request =
×
98
        new ApiRequest(
99
            BaseAddress.API,
100
            ApiResource.RequestMethod.GET,
101
            path,
NEW
102
            ApiRequestParams.paramsToMap(params),
×
103
            options);
NEW
104
    return getGlobalResponseGetter().request(request, CreditBalanceSummary.class);
×
105
  }
106

107
  @Getter
108
  @Setter
109
  @EqualsAndHashCode(callSuper = false)
NEW
110
  public static class Balance extends StripeObject {
×
111
    @SerializedName("available_balance")
112
    AvailableBalance availableBalance;
113

114
    @SerializedName("ledger_balance")
115
    LedgerBalance ledgerBalance;
116

117
    @Getter
118
    @Setter
119
    @EqualsAndHashCode(callSuper = false)
NEW
120
    public static class AvailableBalance extends StripeObject {
×
121
      /** The monetary amount. */
122
      @SerializedName("monetary")
123
      Monetary monetary;
124

125
      /**
126
       * The type of this amount. We currently only support {@code monetary} credits.
127
       *
128
       * <p>Equal to {@code monetary}.
129
       */
130
      @SerializedName("type")
131
      String type;
132

133
      @Getter
134
      @Setter
135
      @EqualsAndHashCode(callSuper = false)
NEW
136
      public static class Monetary extends StripeObject {
×
137
        /**
138
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
139
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
140
         * currency</a>.
141
         */
142
        @SerializedName("currency")
143
        String currency;
144

145
        /** A positive integer representing the amount. */
146
        @SerializedName("value")
147
        Long value;
148
      }
149
    }
150

151
    @Getter
152
    @Setter
153
    @EqualsAndHashCode(callSuper = false)
NEW
154
    public static class LedgerBalance extends StripeObject {
×
155
      /** The monetary amount. */
156
      @SerializedName("monetary")
157
      Monetary monetary;
158

159
      /**
160
       * The type of this amount. We currently only support {@code monetary} credits.
161
       *
162
       * <p>Equal to {@code monetary}.
163
       */
164
      @SerializedName("type")
165
      String type;
166

167
      @Getter
168
      @Setter
169
      @EqualsAndHashCode(callSuper = false)
NEW
170
      public static class Monetary extends StripeObject {
×
171
        /**
172
         * Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
173
         * code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
174
         * currency</a>.
175
         */
176
        @SerializedName("currency")
177
        String currency;
178

179
        /** A positive integer representing the amount. */
180
        @SerializedName("value")
181
        Long value;
182
      }
183
    }
184
  }
185

186
  @Override
187
  public void setResponseGetter(StripeResponseGetter responseGetter) {
NEW
188
    super.setResponseGetter(responseGetter);
×
NEW
189
    trySetResponseGetter(customer, responseGetter);
×
NEW
190
  }
×
191
}
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