-
Notifications
You must be signed in to change notification settings - Fork 356
/
BalanceTransaction.java
292 lines (259 loc) · 11.6 KB
/
BalanceTransaction.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// File generated from our OpenAPI spec
package com.stripe.model;
import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.BalanceTransactionListParams;
import com.stripe.param.BalanceTransactionRetrieveParams;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
/**
* Balance transactions represent funds moving through your Stripe account. They're created for
* every type of transaction that comes into or flows out of your Stripe account balance.
*
* <p>Related guide: <a href="https://stripe.com/docs/reports/balance-transaction-types">Balance
* Transaction Types</a>.
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public class BalanceTransaction extends ApiResource implements HasId {
/** Gross amount of the transaction, in %s. */
@SerializedName("amount")
Long amount;
/** The date the transaction's net funds will become available in the Stripe balance. */
@SerializedName("available_on")
Long availableOn;
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
@SerializedName("created")
Long created;
/**
* Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>,
* in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
*/
@SerializedName("currency")
String currency;
/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;
/**
* The exchange rate used, if applicable, for this transaction. Specifically, if money was
* converted from currency A to currency B, then the {@code amount} in currency A, times {@code
* exchange_rate}, would be the {@code amount} in currency B. For example, suppose you charged a
* customer 10.00 EUR. Then the PaymentIntent's {@code amount} would be {@code 1000} and {@code
* currency} would be {@code eur}. Suppose this was converted into 12.34 USD in your Stripe
* account. Then the BalanceTransaction's {@code amount} would be {@code 1234}, {@code currency}
* would be {@code usd}, and {@code exchange_rate} would be {@code 1.234}.
*/
@SerializedName("exchange_rate")
BigDecimal exchangeRate;
/** Fees (in %s) paid for this transaction. */
@SerializedName("fee")
Long fee;
/** Detailed breakdown of fees (in %s) paid for this transaction. */
@SerializedName("fee_details")
List<BalanceTransaction.Fee> feeDetails;
/** Unique identifier for the object. */
@Getter(onMethod_ = {@Override})
@SerializedName("id")
String id;
/** Net amount of the transaction, in %s. */
@SerializedName("net")
Long net;
/**
* String representing the object's type. Objects of the same type share the same value.
*
* <p>Equal to {@code balance_transaction}.
*/
@SerializedName("object")
String object;
/**
* <a href="https://stripe.com/docs/reports/reporting-categories">Learn more</a> about how
* reporting categories can help you understand balance transactions from an accounting
* perspective.
*/
@SerializedName("reporting_category")
String reportingCategory;
/** The Stripe object to which this transaction is related. */
@SerializedName("source")
@Getter(lombok.AccessLevel.NONE)
@Setter(lombok.AccessLevel.NONE)
ExpandableField<BalanceTransactionSource> source;
/**
* If the transaction's net funds are available in the Stripe balance yet. Either {@code
* available} or {@code pending}.
*/
@SerializedName("status")
String status;
/**
* Transaction type: {@code adjustment}, {@code advance}, {@code advance_funding}, {@code
* anticipation_repayment}, {@code application_fee}, {@code application_fee_refund}, {@code
* charge}, {@code connect_collection_transfer}, {@code contribution}, {@code
* issuing_authorization_hold}, {@code issuing_authorization_release}, {@code issuing_dispute},
* {@code issuing_transaction}, {@code payment}, {@code payment_failure_refund}, {@code
* payment_refund}, {@code payout}, {@code payout_cancel}, {@code payout_failure}, {@code refund},
* {@code refund_failure}, {@code reserve_transaction}, {@code reserved_funds}, {@code
* stripe_fee}, {@code stripe_fx_fee}, {@code tax_fee}, {@code topup}, {@code topup_reversal},
* {@code transfer}, {@code transfer_cancel}, {@code transfer_failure}, or {@code
* transfer_refund}. <a href="https://stripe.com/docs/reports/balance-transaction-types">Learn
* more</a> about balance transaction types and what they represent. If you are looking to
* classify transactions for accounting purposes, you might want to consider {@code
* reporting_category} instead.
*
* <p>One of {@code adjustment}, {@code advance}, {@code advance_funding}, {@code
* anticipation_repayment}, {@code application_fee}, {@code application_fee_refund}, {@code
* charge}, {@code connect_collection_transfer}, {@code contribution}, {@code
* issuing_authorization_hold}, {@code issuing_authorization_release}, {@code issuing_dispute},
* {@code issuing_transaction}, {@code payment}, {@code payment_failure_refund}, {@code
* payment_refund}, {@code payout}, {@code payout_cancel}, {@code payout_failure}, {@code refund},
* {@code refund_failure}, {@code reserve_transaction}, {@code reserved_funds}, {@code
* stripe_fee}, {@code stripe_fx_fee}, {@code tax_fee}, {@code topup}, {@code topup_reversal},
* {@code transfer}, {@code transfer_cancel}, {@code transfer_failure}, or {@code
* transfer_refund}.
*/
@SerializedName("type")
String type;
/** Get ID of expandable {@code source} object. */
public String getSource() {
return (this.source != null) ? this.source.getId() : null;
}
public void setSource(String id) {
this.source = ApiResource.setExpandableFieldId(id, this.source);
}
/** Get expanded {@code source}. */
public BalanceTransactionSource getSourceObject() {
return (this.source != null) ? this.source.getExpanded() : null;
}
public void setSourceObject(BalanceTransactionSource expandableObject) {
this.source =
new ExpandableField<BalanceTransactionSource>(expandableObject.getId(), expandableObject);
}
/**
* Returns a list of transactions that have contributed to the Stripe account balance (e.g.,
* charges, transfers, and so forth). The transactions are returned in sorted order, with the most
* recent transactions appearing first.
*
* <p>Note that this endpoint was previously called “Balance history” and used the path <code>
* /v1/balance/history</code>.
*/
public static BalanceTransactionCollection list(Map<String, Object> params)
throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of transactions that have contributed to the Stripe account balance (e.g.,
* charges, transfers, and so forth). The transactions are returned in sorted order, with the most
* recent transactions appearing first.
*
* <p>Note that this endpoint was previously called “Balance history” and used the path <code>
* /v1/balance/history</code>.
*/
public static BalanceTransactionCollection list(
Map<String, Object> params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/balance_transactions");
return ApiResource.requestCollection(url, params, BalanceTransactionCollection.class, options);
}
/**
* Returns a list of transactions that have contributed to the Stripe account balance (e.g.,
* charges, transfers, and so forth). The transactions are returned in sorted order, with the most
* recent transactions appearing first.
*
* <p>Note that this endpoint was previously called “Balance history” and used the path <code>
* /v1/balance/history</code>.
*/
public static BalanceTransactionCollection list(BalanceTransactionListParams params)
throws StripeException {
return list(params, (RequestOptions) null);
}
/**
* Returns a list of transactions that have contributed to the Stripe account balance (e.g.,
* charges, transfers, and so forth). The transactions are returned in sorted order, with the most
* recent transactions appearing first.
*
* <p>Note that this endpoint was previously called “Balance history” and used the path <code>
* /v1/balance/history</code>.
*/
public static BalanceTransactionCollection list(
BalanceTransactionListParams params, RequestOptions options) throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/balance_transactions");
return ApiResource.requestCollection(url, params, BalanceTransactionCollection.class, options);
}
/**
* Retrieves the balance transaction with the given ID.
*
* <p>Note that this endpoint previously used the path <code>/v1/balance/history/:id</code>.
*/
public static BalanceTransaction retrieve(String id) throws StripeException {
return retrieve(id, (Map<String, Object>) null, (RequestOptions) null);
}
/**
* Retrieves the balance transaction with the given ID.
*
* <p>Note that this endpoint previously used the path <code>/v1/balance/history/:id</code>.
*/
public static BalanceTransaction retrieve(String id, RequestOptions options)
throws StripeException {
return retrieve(id, (Map<String, Object>) null, options);
}
/**
* Retrieves the balance transaction with the given ID.
*
* <p>Note that this endpoint previously used the path <code>/v1/balance/history/:id</code>.
*/
public static BalanceTransaction retrieve(
String id, Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/balance_transactions/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(
ApiResource.RequestMethod.GET, url, params, BalanceTransaction.class, options);
}
/**
* Retrieves the balance transaction with the given ID.
*
* <p>Note that this endpoint previously used the path <code>/v1/balance/history/:id</code>.
*/
public static BalanceTransaction retrieve(
String id, BalanceTransactionRetrieveParams params, RequestOptions options)
throws StripeException {
String url =
String.format(
"%s%s",
Stripe.getApiBase(),
String.format("/v1/balance_transactions/%s", ApiResource.urlEncodeId(id)));
return ApiResource.request(
ApiResource.RequestMethod.GET, url, params, BalanceTransaction.class, options);
}
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class Fee extends StripeObject {
/** Amount of the fee, in cents. */
@SerializedName("amount")
Long amount;
/** ID of the Connect application that earned the fee. */
@SerializedName("application")
String application;
/**
* Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency
* code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported
* currency</a>.
*/
@SerializedName("currency")
String currency;
/** An arbitrary string attached to the object. Often useful for displaying to users. */
@SerializedName("description")
String description;
/** Type of the fee, one of: {@code application_fee}, {@code stripe_fee} or {@code tax}. */
@SerializedName("type")
String type;
}
}