Skip to content

Commit

Permalink
Rename 'virtual' child services and remove backcompat methods (#1754)
Browse files Browse the repository at this point in the history
* Rename 'virtual' child services

* Remove backcompat methods
  • Loading branch information
anniel-stripe committed Mar 1, 2024
1 parent d163152 commit dda232b
Show file tree
Hide file tree
Showing 55 changed files with 5,942 additions and 2,108 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/stripe/StripeClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ public com.stripe.service.BalanceTransactionService balanceTransactions() {
return new com.stripe.service.BalanceTransactionService(this.getResponseGetter());
}

public com.stripe.service.BankAccountService bankAccounts() {
return new com.stripe.service.BankAccountService(this.getResponseGetter());
}

public com.stripe.service.BillingPortalService billingPortal() {
return new com.stripe.service.BillingPortalService(this.getResponseGetter());
}
Expand Down Expand Up @@ -297,6 +293,10 @@ public com.stripe.service.TaxCodeService taxCodes() {
return new com.stripe.service.TaxCodeService(this.getResponseGetter());
}

public com.stripe.service.TaxIdService taxIds() {
return new com.stripe.service.TaxIdService(this.getResponseGetter());
}

public com.stripe.service.TaxRateService taxRates() {
return new com.stripe.service.TaxRateService(this.getResponseGetter());
}
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/stripe/model/PaymentSource.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
// File generated from our OpenAPI spec
package com.stripe.model;

public interface PaymentSource extends StripeObjectInterface, HasId {}
import com.stripe.exception.StripeException;
import com.stripe.net.RequestOptions;
import java.util.Map;

public interface PaymentSource extends StripeObjectInterface, HasId {
PaymentSource update(Map<String, Object> params, RequestOptions options) throws StripeException;

PaymentSource update(Map<String, Object> params) throws StripeException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import com.stripe.exception.StripeException;
import com.stripe.net.RequestOptions;
import java.io.IOException;
import java.util.Map;
import lombok.Getter;

/**
Expand Down Expand Up @@ -86,5 +89,26 @@ private UnknownSubType(String id, String object, String rawJson) {
public String getId() {
return this.id;
}
/** Unsupported operation for unknown subtype. */
@Override
public PaymentSource update(Map<String, Object> params, RequestOptions options)
throws StripeException {
throw new UnsupportedOperationException(
String.format(
"Unknown subtype of PaymentSource with id: %s, object: %s, "
+ "does not implement method: update. "
+ "Please contact support@stripe.com for assistance.",
this.id, this.object));
}
/** Unsupported operation for unknown subtype. */
@Override
public PaymentSource update(Map<String, Object> params) throws StripeException {
throw new UnsupportedOperationException(
String.format(
"Unknown subtype of PaymentSource with id: %s, object: %s, "
+ "does not implement method: update. "
+ "Please contact support@stripe.com for assistance.",
this.id, this.object));
}
}
}
152 changes: 146 additions & 6 deletions src/main/java/com/stripe/model/TaxId.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@
import com.stripe.exception.StripeException;
import com.stripe.net.ApiMode;
import com.stripe.net.ApiRequest;
import com.stripe.net.ApiRequestParams;
import com.stripe.net.ApiResource;
import com.stripe.net.BaseAddress;
import com.stripe.net.RequestOptions;
import com.stripe.net.StripeResponseGetter;
import com.stripe.param.TaxIdCreateParams;
import com.stripe.param.TaxIdListParams;
import com.stripe.param.TaxIdRetrieveParams;
import java.util.Map;
import lombok.EqualsAndHashCode;
import lombok.Getter;
Expand Down Expand Up @@ -113,31 +117,167 @@ public void setCustomerObject(Customer expandableObject) {
this.customer = new ExpandableField<Customer>(expandableObject.getId(), expandableObject);
}

/** Deletes an existing {@code tax_id} object. */
/** Creates a new account or customer {@code tax_id} object. */
public static TaxId create(Map<String, Object> params) throws StripeException {
return create(params, (RequestOptions) null);
}

/** Creates a new account or customer {@code tax_id} object. */
public static TaxId create(Map<String, Object> params, RequestOptions options)
throws StripeException {
String path = "/v1/tax_ids";
ApiRequest request =
new ApiRequest(
BaseAddress.API, ApiResource.RequestMethod.POST, path, params, options, ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxId.class);
}

/** Creates a new account or customer {@code tax_id} object. */
public static TaxId create(TaxIdCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}

/** Creates a new account or customer {@code tax_id} object. */
public static TaxId create(TaxIdCreateParams params, RequestOptions options)
throws StripeException {
String path = "/v1/tax_ids";
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.POST,
path,
ApiRequestParams.paramsToMap(params),
options,
ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxId.class);
}

/** Deletes an existing account or customer {@code tax_id} object. */
public TaxId delete() throws StripeException {
return delete((Map<String, Object>) null, (RequestOptions) null);
}

/** Deletes an existing {@code tax_id} object. */
/** Deletes an existing account or customer {@code tax_id} object. */
public TaxId delete(RequestOptions options) throws StripeException {
return delete((Map<String, Object>) null, options);
}

/** Deletes an existing {@code tax_id} object. */
/** Deletes an existing account or customer {@code tax_id} object. */
public TaxId delete(Map<String, Object> params) throws StripeException {
return delete(params, (RequestOptions) null);
}

/** Deletes an existing {@code tax_id} object. */
/** Deletes an existing account or customer {@code tax_id} object. */
public TaxId delete(Map<String, Object> params, RequestOptions options) throws StripeException {
String path = String.format("/v1/tax_ids/%s", ApiResource.urlEncodeId(this.getId()));
ApiRequest request =
new ApiRequest(
BaseAddress.API, ApiResource.RequestMethod.DELETE, path, params, options, ApiMode.V1);
return getResponseGetter().request(request, TaxId.class);
}

/** Deletes an existing {@code tax_id} object. */
public static TaxId delete(String customer, String id) throws StripeException {
return delete(customer, id, (Map<String, Object>) null, (RequestOptions) null);
}

/** Deletes an existing {@code tax_id} object. */
public static TaxId delete(String customer, String id, RequestOptions options)
throws StripeException {
return delete(customer, id, (Map<String, Object>) null, options);
}

/** Deletes an existing {@code tax_id} object. */
public static TaxId delete(String customer, String id, Map<String, Object> params)
throws StripeException {
return delete(customer, id, params, (RequestOptions) null);
}

/** Deletes an existing {@code tax_id} object. */
public static TaxId delete(
String customer, String id, Map<String, Object> params, RequestOptions options)
throws StripeException {
String path =
String.format(
"/v1/customers/%s/tax_ids/%s",
ApiResource.urlEncodeId(this.getCustomer()), ApiResource.urlEncodeId(this.getId()));
ApiResource.urlEncodeId(customer), ApiResource.urlEncodeId(id));
ApiRequest request =
new ApiRequest(
BaseAddress.API, ApiResource.RequestMethod.DELETE, path, params, options, ApiMode.V1);
return getResponseGetter().request(request, TaxId.class);
return getGlobalResponseGetter().request(request, TaxId.class);
}

/** Returns a list of tax IDs. */
public static TaxIdCollection list(Map<String, Object> params) throws StripeException {
return list(params, (RequestOptions) null);
}

/** Returns a list of tax IDs. */
public static TaxIdCollection list(Map<String, Object> params, RequestOptions options)
throws StripeException {
String path = "/v1/tax_ids";
ApiRequest request =
new ApiRequest(
BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxIdCollection.class);
}

/** Returns a list of tax IDs. */
public static TaxIdCollection list(TaxIdListParams params) throws StripeException {
return list(params, (RequestOptions) null);
}

/** Returns a list of tax IDs. */
public static TaxIdCollection list(TaxIdListParams params, RequestOptions options)
throws StripeException {
String path = "/v1/tax_ids";
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options,
ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxIdCollection.class);
}

/** Retrieves an account or customer {@code tax_id} object. */
public static TaxId retrieve(String id) throws StripeException {
return retrieve(id, (Map<String, Object>) null, (RequestOptions) null);
}

/** Retrieves an account or customer {@code tax_id} object. */
public static TaxId retrieve(String id, RequestOptions options) throws StripeException {
return retrieve(id, (Map<String, Object>) null, options);
}

/** Retrieves an account or customer {@code tax_id} object. */
public static TaxId retrieve(String id, Map<String, Object> params, RequestOptions options)
throws StripeException {
String path = String.format("/v1/tax_ids/%s", ApiResource.urlEncodeId(id));
ApiRequest request =
new ApiRequest(
BaseAddress.API, ApiResource.RequestMethod.GET, path, params, options, ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxId.class);
}

/** Retrieves an account or customer {@code tax_id} object. */
public static TaxId retrieve(String id, TaxIdRetrieveParams params, RequestOptions options)
throws StripeException {
String path = String.format("/v1/tax_ids/%s", ApiResource.urlEncodeId(id));
ApiResource.checkNullTypedParams(path, params);
ApiRequest request =
new ApiRequest(
BaseAddress.API,
ApiResource.RequestMethod.GET,
path,
ApiRequestParams.paramsToMap(params),
options,
ApiMode.V1);
return getGlobalResponseGetter().request(request, TaxId.class);
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import lombok.Getter;

@Getter
public class PaymentSourceRetrieveParams extends ApiRequestParams {
public class AccountCapabilityListParams extends ApiRequestParams {
/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List<String> expand;
Expand All @@ -24,7 +24,7 @@ public class PaymentSourceRetrieveParams extends ApiRequestParams {
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

private PaymentSourceRetrieveParams(List<String> expand, Map<String, Object> extraParams) {
private AccountCapabilityListParams(List<String> expand, Map<String, Object> extraParams) {
this.expand = expand;
this.extraParams = extraParams;
}
Expand All @@ -39,14 +39,14 @@ public static class Builder {
private Map<String, Object> extraParams;

/** Finalize and obtain parameter instance from this builder. */
public PaymentSourceRetrieveParams build() {
return new PaymentSourceRetrieveParams(this.expand, this.extraParams);
public AccountCapabilityListParams build() {
return new AccountCapabilityListParams(this.expand, this.extraParams);
}

/**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* PaymentSourceRetrieveParams#expand} for the field documentation.
* AccountCapabilityListParams#expand} for the field documentation.
*/
public Builder addExpand(String element) {
if (this.expand == null) {
Expand All @@ -59,7 +59,7 @@ public Builder addExpand(String element) {
/**
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* PaymentSourceRetrieveParams#expand} for the field documentation.
* AccountCapabilityListParams#expand} for the field documentation.
*/
public Builder addAllExpand(List<String> elements) {
if (this.expand == null) {
Expand All @@ -72,7 +72,7 @@ public Builder addAllExpand(List<String> elements) {
/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
* PaymentSourceRetrieveParams#extraParams} for the field documentation.
* AccountCapabilityListParams#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
Expand All @@ -85,7 +85,7 @@ public Builder putExtraParam(String key, Object value) {
/**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
* See {@link PaymentSourceRetrieveParams#extraParams} for the field documentation.
* See {@link AccountCapabilityListParams#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import lombok.Getter;

@Getter
public class CapabilityListParams extends ApiRequestParams {
public class AccountCapabilityRetrieveParams extends ApiRequestParams {
/** Specifies which fields in the response should be expanded. */
@SerializedName("expand")
List<String> expand;
Expand All @@ -24,7 +24,7 @@ public class CapabilityListParams extends ApiRequestParams {
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

private CapabilityListParams(List<String> expand, Map<String, Object> extraParams) {
private AccountCapabilityRetrieveParams(List<String> expand, Map<String, Object> extraParams) {
this.expand = expand;
this.extraParams = extraParams;
}
Expand All @@ -39,14 +39,14 @@ public static class Builder {
private Map<String, Object> extraParams;

/** Finalize and obtain parameter instance from this builder. */
public CapabilityListParams build() {
return new CapabilityListParams(this.expand, this.extraParams);
public AccountCapabilityRetrieveParams build() {
return new AccountCapabilityRetrieveParams(this.expand, this.extraParams);
}

/**
* Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* CapabilityListParams#expand} for the field documentation.
* AccountCapabilityRetrieveParams#expand} for the field documentation.
*/
public Builder addExpand(String element) {
if (this.expand == null) {
Expand All @@ -59,7 +59,7 @@ public Builder addExpand(String element) {
/**
* Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and
* subsequent calls adds additional elements to the original list. See {@link
* CapabilityListParams#expand} for the field documentation.
* AccountCapabilityRetrieveParams#expand} for the field documentation.
*/
public Builder addAllExpand(List<String> elements) {
if (this.expand == null) {
Expand All @@ -72,7 +72,7 @@ public Builder addAllExpand(List<String> elements) {
/**
* Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll`
* call, and subsequent calls add additional key/value pairs to the original map. See {@link
* CapabilityListParams#extraParams} for the field documentation.
* AccountCapabilityRetrieveParams#extraParams} for the field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
Expand All @@ -85,7 +85,7 @@ public Builder putExtraParam(String key, Object value) {
/**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original map.
* See {@link CapabilityListParams#extraParams} for the field documentation.
* See {@link AccountCapabilityRetrieveParams#extraParams} for the field documentation.
*/
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
Expand Down

0 comments on commit dda232b

Please sign in to comment.