Skip to content

Commit 173675c

Browse files
authored
Merge pull request #876 from stripe/remi/codegen-1d1c646
Add support for `invoice_customer_balance_settings` on `Invoice`
2 parents 2d727b8 + 0065b3d commit 173675c

File tree

3 files changed

+173
-0
lines changed

3 files changed

+173
-0
lines changed

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

+15
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ public class Subscription extends ApiResource implements HasId, MetadataStore<Su
145145
@SerializedName("id")
146146
String id;
147147

148+
@SerializedName("invoice_customer_balance_settings")
149+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings;
150+
148151
/** List of subscription items, each with an attached plan. */
149152
@SerializedName("items")
150153
SubscriptionItemCollection items;
@@ -700,6 +703,18 @@ public static class BillingThresholds extends StripeObject {
700703
Boolean resetBillingCycleAnchor;
701704
}
702705

706+
@Getter
707+
@Setter
708+
@EqualsAndHashCode(callSuper = false)
709+
public static class InvoiceCustomerBalanceSettings extends StripeObject {
710+
/**
711+
* Controls whether a customer balance applied to this invoice should be consumed and not
712+
* credited or debited back to the customer if voided.
713+
*/
714+
@SerializedName("consume_applied_balance_on_void")
715+
Boolean consumeAppliedBalanceOnVoid;
716+
}
717+
703718
@Getter
704719
@Setter
705720
@EqualsAndHashCode(callSuper = false)

src/main/java/com/stripe/param/SubscriptionCreateParams.java

+79
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ public class SubscriptionCreateParams extends ApiRequestParams {
122122
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
123123
Map<String, Object> extraParams;
124124

125+
/**
126+
* All voided invoices now return the customer balance, independent of
127+
* `consume_applied_balance_on_void`.
128+
*/
129+
@SerializedName("invoice_customer_balance_settings")
130+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings;
131+
125132
/** List of subscription items, each with an attached plan. */
126133
@SerializedName("items")
127134
List<Item> items;
@@ -234,6 +241,7 @@ private SubscriptionCreateParams(
234241
Object defaultTaxRates,
235242
List<String> expand,
236243
Map<String, Object> extraParams,
244+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings,
237245
List<Item> items,
238246
Map<String, String> metadata,
239247
Boolean offSession,
@@ -260,6 +268,7 @@ private SubscriptionCreateParams(
260268
this.defaultTaxRates = defaultTaxRates;
261269
this.expand = expand;
262270
this.extraParams = extraParams;
271+
this.invoiceCustomerBalanceSettings = invoiceCustomerBalanceSettings;
263272
this.items = items;
264273
this.metadata = metadata;
265274
this.offSession = offSession;
@@ -308,6 +317,8 @@ public static class Builder {
308317

309318
private Map<String, Object> extraParams;
310319

320+
private InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings;
321+
311322
private List<Item> items;
312323

313324
private Map<String, String> metadata;
@@ -348,6 +359,7 @@ public SubscriptionCreateParams build() {
348359
this.defaultTaxRates,
349360
this.expand,
350361
this.extraParams,
362+
this.invoiceCustomerBalanceSettings,
351363
this.items,
352364
this.metadata,
353365
this.offSession,
@@ -583,6 +595,16 @@ public Builder putAllExtraParam(Map<String, Object> map) {
583595
return this;
584596
}
585597

598+
/**
599+
* All voided invoices now return the customer balance, independent of
600+
* `consume_applied_balance_on_void`.
601+
*/
602+
public Builder setInvoiceCustomerBalanceSettings(
603+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings) {
604+
this.invoiceCustomerBalanceSettings = invoiceCustomerBalanceSettings;
605+
return this;
606+
}
607+
586608
/**
587609
* Add an element to `items` list. A list is initialized for the first `add/addAll` call, and
588610
* subsequent calls adds additional elements to the original list. See {@link
@@ -868,6 +890,63 @@ public Builder setResetBillingCycleAnchor(Boolean resetBillingCycleAnchor) {
868890
}
869891
}
870892

893+
@Getter
894+
public static class InvoiceCustomerBalanceSettings {
895+
/**
896+
* Map of extra parameters for custom features not available in this client library. The content
897+
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
898+
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
899+
* param object. Effectively, this map is flattened to its parent instance.
900+
*/
901+
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
902+
Map<String, Object> extraParams;
903+
904+
private InvoiceCustomerBalanceSettings(Map<String, Object> extraParams) {
905+
this.extraParams = extraParams;
906+
}
907+
908+
public static Builder builder() {
909+
return new Builder();
910+
}
911+
912+
public static class Builder {
913+
private Map<String, Object> extraParams;
914+
915+
/** Finalize and obtain parameter instance from this builder. */
916+
public InvoiceCustomerBalanceSettings build() {
917+
return new InvoiceCustomerBalanceSettings(this.extraParams);
918+
}
919+
920+
/**
921+
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
922+
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
923+
* SubscriptionCreateParams.InvoiceCustomerBalanceSettings#extraParams} for the field
924+
* documentation.
925+
*/
926+
public Builder putExtraParam(String key, Object value) {
927+
if (this.extraParams == null) {
928+
this.extraParams = new HashMap<>();
929+
}
930+
this.extraParams.put(key, value);
931+
return this;
932+
}
933+
934+
/**
935+
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
936+
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
937+
* See {@link SubscriptionCreateParams.InvoiceCustomerBalanceSettings#extraParams} for the
938+
* field documentation.
939+
*/
940+
public Builder putAllExtraParam(Map<String, Object> map) {
941+
if (this.extraParams == null) {
942+
this.extraParams = new HashMap<>();
943+
}
944+
this.extraParams.putAll(map);
945+
return this;
946+
}
947+
}
948+
}
949+
871950
@Getter
872951
public static class Item {
873952
/**

src/main/java/com/stripe/param/SubscriptionUpdateParams.java

+79
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@ public class SubscriptionUpdateParams extends ApiRequestParams {
109109
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
110110
Map<String, Object> extraParams;
111111

112+
/**
113+
* All voided invoices now return the customer balance, independent of
114+
* `consume_applied_balance_on_void`.
115+
*/
116+
@SerializedName("invoice_customer_balance_settings")
117+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings;
118+
112119
/** List of subscription items, each with an attached plan. */
113120
@SerializedName("items")
114121
List<Item> items;
@@ -222,6 +229,7 @@ private SubscriptionUpdateParams(
222229
Object defaultTaxRates,
223230
List<String> expand,
224231
Map<String, Object> extraParams,
232+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings,
225233
List<Item> items,
226234
Map<String, String> metadata,
227235
Boolean offSession,
@@ -246,6 +254,7 @@ private SubscriptionUpdateParams(
246254
this.defaultTaxRates = defaultTaxRates;
247255
this.expand = expand;
248256
this.extraParams = extraParams;
257+
this.invoiceCustomerBalanceSettings = invoiceCustomerBalanceSettings;
249258
this.items = items;
250259
this.metadata = metadata;
251260
this.offSession = offSession;
@@ -290,6 +299,8 @@ public static class Builder {
290299

291300
private Map<String, Object> extraParams;
292301

302+
private InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings;
303+
293304
private List<Item> items;
294305

295306
private Map<String, String> metadata;
@@ -328,6 +339,7 @@ public SubscriptionUpdateParams build() {
328339
this.defaultTaxRates,
329340
this.expand,
330341
this.extraParams,
342+
this.invoiceCustomerBalanceSettings,
331343
this.items,
332344
this.metadata,
333345
this.offSession,
@@ -584,6 +596,16 @@ public Builder putAllExtraParam(Map<String, Object> map) {
584596
return this;
585597
}
586598

599+
/**
600+
* All voided invoices now return the customer balance, independent of
601+
* `consume_applied_balance_on_void`.
602+
*/
603+
public Builder setInvoiceCustomerBalanceSettings(
604+
InvoiceCustomerBalanceSettings invoiceCustomerBalanceSettings) {
605+
this.invoiceCustomerBalanceSettings = invoiceCustomerBalanceSettings;
606+
return this;
607+
}
608+
587609
/**
588610
* Add an element to `items` list. A list is initialized for the first `add/addAll` call, and
589611
* subsequent calls adds additional elements to the original list. See {@link
@@ -882,6 +904,63 @@ public Builder setResetBillingCycleAnchor(Boolean resetBillingCycleAnchor) {
882904
}
883905
}
884906

907+
@Getter
908+
public static class InvoiceCustomerBalanceSettings {
909+
/**
910+
* Map of extra parameters for custom features not available in this client library. The content
911+
* in this map is not serialized under this field's {@code @SerializedName} value. Instead, each
912+
* key/value pair is serialized as if the key is a root-level field (serialized) name in this
913+
* param object. Effectively, this map is flattened to its parent instance.
914+
*/
915+
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
916+
Map<String, Object> extraParams;
917+
918+
private InvoiceCustomerBalanceSettings(Map<String, Object> extraParams) {
919+
this.extraParams = extraParams;
920+
}
921+
922+
public static Builder builder() {
923+
return new Builder();
924+
}
925+
926+
public static class Builder {
927+
private Map<String, Object> extraParams;
928+
929+
/** Finalize and obtain parameter instance from this builder. */
930+
public InvoiceCustomerBalanceSettings build() {
931+
return new InvoiceCustomerBalanceSettings(this.extraParams);
932+
}
933+
934+
/**
935+
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
936+
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
937+
* SubscriptionUpdateParams.InvoiceCustomerBalanceSettings#extraParams} for the field
938+
* documentation.
939+
*/
940+
public Builder putExtraParam(String key, Object value) {
941+
if (this.extraParams == null) {
942+
this.extraParams = new HashMap<>();
943+
}
944+
this.extraParams.put(key, value);
945+
return this;
946+
}
947+
948+
/**
949+
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
950+
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
951+
* See {@link SubscriptionUpdateParams.InvoiceCustomerBalanceSettings#extraParams} for the
952+
* field documentation.
953+
*/
954+
public Builder putAllExtraParam(Map<String, Object> map) {
955+
if (this.extraParams == null) {
956+
this.extraParams = new HashMap<>();
957+
}
958+
this.extraParams.putAll(map);
959+
return this;
960+
}
961+
}
962+
}
963+
885964
@Getter
886965
public static class Item {
887966
/**

0 commit comments

Comments
 (0)