Skip to content

Commit 5cf739d

Browse files
authored
API Updates (#1346)
1 parent 25f17e0 commit 5cf739d

16 files changed

+696
-58
lines changed

src/main/java/com/stripe/model/Application.java

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
@Setter
1111
@EqualsAndHashCode(callSuper = false)
1212
public class Application extends StripeObject implements HasId {
13+
/** Always true for a deleted object. */
14+
@SerializedName("deleted")
15+
Boolean deleted;
16+
1317
/** Unique identifier for the object. */
1418
@Getter(onMethod_ = {@Override})
1519
@SerializedName("id")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
// File generated from our OpenAPI spec
2+
package com.stripe.model;
3+
4+
import com.google.gson.annotations.SerializedName;
5+
import com.stripe.Stripe;
6+
import com.stripe.exception.StripeException;
7+
import com.stripe.net.ApiResource;
8+
import com.stripe.net.RequestOptions;
9+
import com.stripe.param.CashBalanceRetrieveParams;
10+
import com.stripe.param.CashBalanceUpdateParams;
11+
import java.util.Map;
12+
import lombok.EqualsAndHashCode;
13+
import lombok.Getter;
14+
import lombok.Setter;
15+
16+
@Getter
17+
@Setter
18+
@EqualsAndHashCode(callSuper = false)
19+
public class CashBalance extends ApiResource {
20+
/**
21+
* A hash of all cash balances available to this customer. You cannot delete a customer with any
22+
* cash balances, even if the balance is 0.
23+
*/
24+
@SerializedName("available")
25+
Map<String, Long> available;
26+
27+
/** The ID of the customer whose cash balance this object represents. */
28+
@SerializedName("customer")
29+
String customer;
30+
31+
/**
32+
* Has the value {@code true} if the object exists in live mode or the value {@code false} if the
33+
* object exists in test mode.
34+
*/
35+
@SerializedName("livemode")
36+
Boolean livemode;
37+
38+
/**
39+
* String representing the object's type. Objects of the same type share the same value.
40+
*
41+
* <p>Equal to {@code cash_balance}.
42+
*/
43+
@SerializedName("object")
44+
String object;
45+
46+
@SerializedName("settings")
47+
BalanceSettings settings;
48+
49+
/** Retrieves a customer’s cash balance. */
50+
public CashBalance retrieve(String customer) throws StripeException {
51+
return retrieve(customer, (Map<String, Object>) null, (RequestOptions) null);
52+
}
53+
54+
/** Retrieves a customer’s cash balance. */
55+
public CashBalance retrieve(String customer, RequestOptions options) throws StripeException {
56+
return retrieve(customer, (Map<String, Object>) null, options);
57+
}
58+
59+
/** Retrieves a customer’s cash balance. */
60+
public CashBalance retrieve(String customer, Map<String, Object> params, RequestOptions options)
61+
throws StripeException {
62+
String url =
63+
String.format(
64+
"%s%s",
65+
Stripe.getApiBase(),
66+
String.format("/v1/customers/%s/cash_balance", ApiResource.urlEncodeId(customer)));
67+
return ApiResource.request(
68+
ApiResource.RequestMethod.GET, url, params, CashBalance.class, options);
69+
}
70+
71+
/** Retrieves a customer’s cash balance. */
72+
public CashBalance retrieve(
73+
String customer, CashBalanceRetrieveParams params, RequestOptions options)
74+
throws StripeException {
75+
String url =
76+
String.format(
77+
"%s%s",
78+
Stripe.getApiBase(),
79+
String.format("/v1/customers/%s/cash_balance", ApiResource.urlEncodeId(customer)));
80+
return ApiResource.request(
81+
ApiResource.RequestMethod.GET, url, params, CashBalance.class, options);
82+
}
83+
84+
/** Updates a customer’s cash balance. */
85+
public CashBalance update(Map<String, Object> params) throws StripeException {
86+
return update(params, (RequestOptions) null);
87+
}
88+
89+
/** Updates a customer’s cash balance. */
90+
public CashBalance update(Map<String, Object> params, RequestOptions options)
91+
throws StripeException {
92+
String url =
93+
String.format(
94+
"%s%s",
95+
Stripe.getApiBase(),
96+
String.format(
97+
"/v1/customers/%s/cash_balance", ApiResource.urlEncodeId(this.getCustomer())));
98+
return ApiResource.request(
99+
ApiResource.RequestMethod.POST, url, params, CashBalance.class, options);
100+
}
101+
102+
/** Updates a customer’s cash balance. */
103+
public CashBalance update(CashBalanceUpdateParams params) throws StripeException {
104+
return update(params, (RequestOptions) null);
105+
}
106+
107+
/** Updates a customer’s cash balance. */
108+
public CashBalance update(CashBalanceUpdateParams params, RequestOptions options)
109+
throws StripeException {
110+
String url =
111+
String.format(
112+
"%s%s",
113+
Stripe.getApiBase(),
114+
String.format(
115+
"/v1/customers/%s/cash_balance", ApiResource.urlEncodeId(this.getCustomer())));
116+
return ApiResource.request(
117+
ApiResource.RequestMethod.POST, url, params, CashBalance.class, options);
118+
}
119+
120+
@Getter
121+
@Setter
122+
@EqualsAndHashCode(callSuper = false)
123+
public static class BalanceSettings extends StripeObject {
124+
/**
125+
* The configuration for how funds that land in the customer cash balance are reconciled.
126+
*
127+
* <p>One of {@code automatic}, or {@code manual}.
128+
*/
129+
@SerializedName("reconciliation_mode")
130+
String reconciliationMode;
131+
}
132+
}

src/main/java/com/stripe/model/Customer.java

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public class Customer extends ApiResource implements HasId, MetadataStore<Custom
3939
@SerializedName("balance")
4040
Long balance;
4141

42+
/**
43+
* The current funds being held by Stripe on behalf of the customer. These funds can be applied
44+
* towards payment intents with source &quot;cash_balance&quot;.The settings[reconciliation_mode]
45+
* field describes whether these funds are applied to such payment intents manually or
46+
* automatically.
47+
*/
48+
@SerializedName("cash_balance")
49+
CashBalance cashBalance;
50+
4251
/** Time at which the object was created. Measured in seconds since the Unix epoch. */
4352
@SerializedName("created")
4453
Long created;

src/main/java/com/stripe/model/EventDataClassLookup.java

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ final class EventDataClassLookup {
2525
classLookup.put("bitcoin_transaction", BitcoinTransaction.class);
2626
classLookup.put("capability", Capability.class);
2727
classLookup.put("card", Card.class);
28+
classLookup.put("cash_balance", CashBalance.class);
2829
classLookup.put("charge", Charge.class);
2930
classLookup.put("connect_collection_transfer", ConnectCollectionTransfer.class);
3031
classLookup.put("country_spec", CountrySpec.class);

src/main/java/com/stripe/model/Invoice.java

+32-8
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice
6666
@SerializedName("amount_remaining")
6767
Long amountRemaining;
6868

69+
/** ID of the Connect Application that created the invoice. */
70+
@SerializedName("application")
71+
@Getter(lombok.AccessLevel.NONE)
72+
@Setter(lombok.AccessLevel.NONE)
73+
ExpandableField<Application> application;
74+
6975
/**
7076
* The fee in %s that will be applied to the invoice and transferred to the application owner's
7177
* Stripe account when the invoice is paid.
@@ -495,6 +501,24 @@ public class Invoice extends ApiResource implements HasId, MetadataStore<Invoice
495501
@SerializedName("webhooks_delivered_at")
496502
Long webhooksDeliveredAt;
497503

504+
/** Get ID of expandable {@code application} object. */
505+
public String getApplication() {
506+
return (this.application != null) ? this.application.getId() : null;
507+
}
508+
509+
public void setApplication(String id) {
510+
this.application = ApiResource.setExpandableFieldId(id, this.application);
511+
}
512+
513+
/** Get expanded {@code application}. */
514+
public Application getApplicationObject() {
515+
return (this.application != null) ? this.application.getExpanded() : null;
516+
}
517+
518+
public void setApplicationObject(Application expandableObject) {
519+
this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
520+
}
521+
498522
/** Get ID of expandable {@code charge} object. */
499523
public String getCharge() {
500524
return (this.charge != null) ? this.charge.getId() : null;
@@ -1548,14 +1572,14 @@ public static class CustomField extends StripeObject {
15481572
public static class CustomerTaxId extends StripeObject {
15491573
/**
15501574
* The type of the tax ID, one of {@code eu_vat}, {@code br_cnpj}, {@code br_cpf}, {@code
1551-
* gb_vat}, {@code nz_gst}, {@code au_abn}, {@code au_arn}, {@code in_gst}, {@code no_vat},
1552-
* {@code za_vat}, {@code ch_vat}, {@code mx_rfc}, {@code sg_uen}, {@code ru_inn}, {@code
1553-
* ru_kpp}, {@code ca_bn}, {@code hk_br}, {@code es_cif}, {@code tw_vat}, {@code th_vat}, {@code
1554-
* jp_cn}, {@code jp_rn}, {@code li_uid}, {@code my_itn}, {@code us_ein}, {@code kr_brn}, {@code
1555-
* ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code ca_pst_sk}, {@code
1556-
* my_sst}, {@code sg_gst}, {@code ae_trn}, {@code cl_tin}, {@code sa_vat}, {@code id_npwp},
1557-
* {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, {@code is_vat}, {@code
1558-
* bg_uic}, {@code hu_tin}, {@code si_tin}, or {@code unknown}.
1575+
* eu_oss_vat}, {@code gb_vat}, {@code nz_gst}, {@code au_abn}, {@code au_arn}, {@code in_gst},
1576+
* {@code no_vat}, {@code za_vat}, {@code ch_vat}, {@code mx_rfc}, {@code sg_uen}, {@code
1577+
* ru_inn}, {@code ru_kpp}, {@code ca_bn}, {@code hk_br}, {@code es_cif}, {@code tw_vat}, {@code
1578+
* th_vat}, {@code jp_cn}, {@code jp_rn}, {@code li_uid}, {@code my_itn}, {@code us_ein}, {@code
1579+
* kr_brn}, {@code ca_qst}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code ca_pst_mb}, {@code
1580+
* ca_pst_sk}, {@code my_sst}, {@code sg_gst}, {@code ae_trn}, {@code cl_tin}, {@code sa_vat},
1581+
* {@code id_npwp}, {@code my_frp}, {@code il_vat}, {@code ge_vat}, {@code ua_vat}, {@code
1582+
* is_vat}, {@code bg_uic}, {@code hu_tin}, {@code si_tin}, or {@code unknown}.
15591583
*/
15601584
@SerializedName("type")
15611585
String type;

src/main/java/com/stripe/model/Quote.java

+24
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ public class Quote extends ApiResource implements HasId, MetadataStore<Quote> {
3838
@SerializedName("amount_total")
3939
Long amountTotal;
4040

41+
/** ID of the Connect Application that created the quote. */
42+
@SerializedName("application")
43+
@Getter(lombok.AccessLevel.NONE)
44+
@Setter(lombok.AccessLevel.NONE)
45+
ExpandableField<Application> application;
46+
4147
/**
4248
* The amount of the application fee (if any) that will be requested to be applied to the payment
4349
* and transferred to the application owner's Stripe account. Only applicable if there are no line
@@ -229,6 +235,24 @@ public class Quote extends ApiResource implements HasId, MetadataStore<Quote> {
229235
@SerializedName("transfer_data")
230236
TransferData transferData;
231237

238+
/** Get ID of expandable {@code application} object. */
239+
public String getApplication() {
240+
return (this.application != null) ? this.application.getId() : null;
241+
}
242+
243+
public void setApplication(String id) {
244+
this.application = ApiResource.setExpandableFieldId(id, this.application);
245+
}
246+
247+
/** Get expanded {@code application}. */
248+
public Application getApplicationObject() {
249+
return (this.application != null) ? this.application.getExpanded() : null;
250+
}
251+
252+
public void setApplicationObject(Application expandableObject) {
253+
this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
254+
}
255+
232256
/** Get ID of expandable {@code customer} object. */
233257
public String getCustomer() {
234258
return (this.customer != null) ? this.customer.getId() : null;

src/main/java/com/stripe/model/Subscription.java

+24
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
@Setter
2525
@EqualsAndHashCode(callSuper = false)
2626
public class Subscription extends ApiResource implements HasId, MetadataStore<Subscription> {
27+
/** ID of the Connect Application that created the subscription. */
28+
@SerializedName("application")
29+
@Getter(lombok.AccessLevel.NONE)
30+
@Setter(lombok.AccessLevel.NONE)
31+
ExpandableField<Application> application;
32+
2733
/**
2834
* A non-negative decimal between 0 and 100, with at most two decimal places. This represents the
2935
* percentage of the subscription invoice subtotal that will be transferred to the application
@@ -304,6 +310,24 @@ public class Subscription extends ApiResource implements HasId, MetadataStore<Su
304310
@SerializedName("trial_start")
305311
Long trialStart;
306312

313+
/** Get ID of expandable {@code application} object. */
314+
public String getApplication() {
315+
return (this.application != null) ? this.application.getId() : null;
316+
}
317+
318+
public void setApplication(String id) {
319+
this.application = ApiResource.setExpandableFieldId(id, this.application);
320+
}
321+
322+
/** Get expanded {@code application}. */
323+
public Application getApplicationObject() {
324+
return (this.application != null) ? this.application.getExpanded() : null;
325+
}
326+
327+
public void setApplicationObject(Application expandableObject) {
328+
this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
329+
}
330+
307331
/** Get ID of expandable {@code customer} object. */
308332
public String getCustomer() {
309333
return (this.customer != null) ? this.customer.getId() : null;

src/main/java/com/stripe/model/SubscriptionSchedule.java

+24
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
@EqualsAndHashCode(callSuper = false)
2626
public class SubscriptionSchedule extends ApiResource
2727
implements HasId, MetadataStore<SubscriptionSchedule> {
28+
/** ID of the Connect Application that created the schedule. */
29+
@SerializedName("application")
30+
@Getter(lombok.AccessLevel.NONE)
31+
@Setter(lombok.AccessLevel.NONE)
32+
ExpandableField<Application> application;
33+
2834
/**
2935
* Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
3036
*/
@@ -134,6 +140,24 @@ public class SubscriptionSchedule extends ApiResource
134140
@Setter(lombok.AccessLevel.NONE)
135141
ExpandableField<TestClock> testClock;
136142

143+
/** Get ID of expandable {@code application} object. */
144+
public String getApplication() {
145+
return (this.application != null) ? this.application.getId() : null;
146+
}
147+
148+
public void setApplication(String id) {
149+
this.application = ApiResource.setExpandableFieldId(id, this.application);
150+
}
151+
152+
/** Get expanded {@code application}. */
153+
public Application getApplicationObject() {
154+
return (this.application != null) ? this.application.getExpanded() : null;
155+
}
156+
157+
public void setApplicationObject(Application expandableObject) {
158+
this.application = new ExpandableField<Application>(expandableObject.getId(), expandableObject);
159+
}
160+
137161
/** Get ID of expandable {@code customer} object. */
138162
public String getCustomer() {
139163
return (this.customer != null) ? this.customer.getId() : null;

src/main/java/com/stripe/model/TaxId.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ public class TaxId extends ApiResource implements HasId {
5757
* Type of the tax ID, one of {@code ae_trn}, {@code au_abn}, {@code au_arn}, {@code bg_uic},
5858
* {@code br_cnpj}, {@code br_cpf}, {@code ca_bn}, {@code ca_gst_hst}, {@code ca_pst_bc}, {@code
5959
* ca_pst_mb}, {@code ca_pst_sk}, {@code ca_qst}, {@code ch_vat}, {@code cl_tin}, {@code es_cif},
60-
* {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code hu_tin}, {@code id_npwp},
61-
* {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code jp_rn}, {@code kr_brn},
62-
* {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code my_sst}, {@code no_vat},
63-
* {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code sg_gst}, {@code sg_uen},
64-
* {@code si_tin}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code us_ein}, or {@code
65-
* za_vat}. Note that some legacy tax IDs have type {@code unknown}
60+
* {@code eu_oss_vat}, {@code eu_vat}, {@code gb_vat}, {@code ge_vat}, {@code hk_br}, {@code
61+
* hu_tin}, {@code id_npwp}, {@code il_vat}, {@code in_gst}, {@code is_vat}, {@code jp_cn}, {@code
62+
* jp_rn}, {@code kr_brn}, {@code li_uid}, {@code mx_rfc}, {@code my_frp}, {@code my_itn}, {@code
63+
* my_sst}, {@code no_vat}, {@code nz_gst}, {@code ru_inn}, {@code ru_kpp}, {@code sa_vat}, {@code
64+
* sg_gst}, {@code sg_uen}, {@code si_tin}, {@code th_vat}, {@code tw_vat}, {@code ua_vat}, {@code
65+
* us_ein}, or {@code za_vat}. Note that some legacy tax IDs have type {@code unknown}
6666
*/
6767
@SerializedName("type")
6868
String type;

0 commit comments

Comments
 (0)