Skip to content

Multiple API changes #1035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/main/java/com/stripe/model/Charge.java
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,15 @@ public static class ThreeDSecure extends StripeObject {
@SerializedName("authenticated")
Boolean authenticated;

/**
* For authenticated transactions: whether issuing bank authenticated the cardholder with a
* traditional challenge screen, or with device data via the 3DS2 frictionless flow.
*
* <p>One of {@code challenge}, or {@code frictionless}.
*/
@SerializedName("authentication_flow")
String authenticationFlow;

/**
* Indicates the outcome of 3D Secure authentication.
*
Expand Down Expand Up @@ -1690,7 +1699,8 @@ public static class Receipt extends StripeObject {
public static class Eps extends StripeObject {
/**
* Owner's verified full name. Values are verified or provided by EPS directly (if supported)
* at the time of authorization or settlement. They cannot be set or mutated.
* at the time of authorization or settlement. They cannot be set or mutated. EPS rarely
* provides this information so the attribute is usually empty.
*/
@SerializedName("verified_name")
String verifiedName;
Expand Down Expand Up @@ -1738,6 +1748,7 @@ public static class Giropay extends StripeObject {
/**
* Owner's verified full name. Values are verified or provided by Giropay directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
* Giropay rarely provides this information so the attribute is usually empty.
*/
@SerializedName("verified_name")
String verifiedName;
Expand Down Expand Up @@ -1935,6 +1946,7 @@ public static class P24 extends StripeObject {
/**
* Owner's verified full name. Values are verified or provided by Przelewy24 directly (if
* supported) at the time of authorization or settlement. They cannot be set or mutated.
* Przelewy24 rarely provides this information so the attribute is usually empty.
*/
@SerializedName("verified_name")
String verifiedName;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/stripe/model/SubscriptionItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,18 @@ public static SubscriptionItemCollection list(
return ApiResource.requestCollection(url, params, SubscriptionItemCollection.class, options);
}

/** Retrieves the invoice item with the given ID. */
/** Retrieves the subscription item with the given ID. */
public static SubscriptionItem retrieve(String item) throws StripeException {
return retrieve(item, (Map<String, Object>) null, (RequestOptions) null);
}

/** Retrieves the invoice item with the given ID. */
/** Retrieves the subscription item with the given ID. */
public static SubscriptionItem retrieve(String item, RequestOptions options)
throws StripeException {
return retrieve(item, (Map<String, Object>) null, options);
}

/** Retrieves the invoice item with the given ID. */
/** Retrieves the subscription item with the given ID. */
public static SubscriptionItem retrieve(
String item, Map<String, Object> params, RequestOptions options) throws StripeException {
String url =
Expand All @@ -166,7 +166,7 @@ public static SubscriptionItem retrieve(
ApiResource.RequestMethod.GET, url, params, SubscriptionItem.class, options);
}

/** Retrieves the invoice item with the given ID. */
/** Retrieves the subscription item with the given ID. */
public static SubscriptionItem retrieve(
String item, SubscriptionItemRetrieveParams params, RequestOptions options)
throws StripeException {
Expand Down
212 changes: 210 additions & 2 deletions src/main/java/com/stripe/param/checkout/SessionCreateParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,20 @@ public static class PriceData {
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

/** The ID of the product that this price will belong to. */
/**
* The ID of the product that this price will belong to. One of {@code product} or {@code
* product_data} is required.
*/
@SerializedName("product")
String product;

/**
* Data used to generate a new product object inline. One of {@code product} or {@code
* product_data} is required.
*/
@SerializedName("product_data")
ProductData productData;

/** The recurring components of a price such as {@code interval} and {@code usage_type}. */
@SerializedName("recurring")
Recurring recurring;
Expand All @@ -826,12 +836,14 @@ private PriceData(
String currency,
Map<String, Object> extraParams,
String product,
ProductData productData,
Recurring recurring,
Long unitAmount,
BigDecimal unitAmountDecimal) {
this.currency = currency;
this.extraParams = extraParams;
this.product = product;
this.productData = productData;
this.recurring = recurring;
this.unitAmount = unitAmount;
this.unitAmountDecimal = unitAmountDecimal;
Expand All @@ -848,6 +860,8 @@ public static class Builder {

private String product;

private ProductData productData;

private Recurring recurring;

private Long unitAmount;
Expand All @@ -860,6 +874,7 @@ public PriceData build() {
this.currency,
this.extraParams,
this.product,
this.productData,
this.recurring,
this.unitAmount,
this.unitAmountDecimal);
Expand Down Expand Up @@ -903,12 +918,24 @@ public Builder putAllExtraParam(Map<String, Object> map) {
return this;
}

/** The ID of the product that this price will belong to. */
/**
* The ID of the product that this price will belong to. One of {@code product} or {@code
* product_data} is required.
*/
public Builder setProduct(String product) {
this.product = product;
return this;
}

/**
* Data used to generate a new product object inline. One of {@code product} or {@code
* product_data} is required.
*/
public Builder setProductData(ProductData productData) {
this.productData = productData;
return this;
}

/** The recurring components of a price such as {@code interval} and {@code usage_type}. */
public Builder setRecurring(Recurring recurring) {
this.recurring = recurring;
Expand All @@ -931,6 +958,187 @@ public Builder setUnitAmountDecimal(BigDecimal unitAmountDecimal) {
}
}

@Getter
public static class ProductData {
/**
* The product's description, meant to be displayable to the customer. Use this field to
* optionally store a long form explanation of the product being sold for your own rendering
* purposes.
*/
@SerializedName("description")
String description;

/**
* Map of extra parameters for custom features not available in this client library. The
* content in this map is not serialized under this field's {@code @SerializedName} value.
* Instead, each key/value pair is serialized as if the key is a root-level field
* (serialized) name in this param object. Effectively, this map is flattened to its parent
* instance.
*/
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;

/**
* A list of up to 8 URLs of images for this product, meant to be displayable to the
* customer.
*/
@SerializedName("images")
List<String> images;

/**
* Set of key-value pairs that you can attach to an object. This can be useful for storing
* additional information about the object in a structured format. Individual keys can be
* unset by posting an empty value to them. All keys can be unset by posting an empty value
* to {@code metadata}.
*/
@SerializedName("metadata")
Map<String, String> metadata;

/**
* The product's name, meant to be displayable to the customer. Whenever this product is
* sold via a subscription, name will show up on associated invoice line item descriptions.
*/
@SerializedName("name")
String name;

private ProductData(
String description,
Map<String, Object> extraParams,
List<String> images,
Map<String, String> metadata,
String name) {
this.description = description;
this.extraParams = extraParams;
this.images = images;
this.metadata = metadata;
this.name = name;
}

public static Builder builder() {
return new Builder();
}

public static class Builder {
private String description;

private Map<String, Object> extraParams;

private List<String> images;

private Map<String, String> metadata;

private String name;

/** Finalize and obtain parameter instance from this builder. */
public ProductData build() {
return new ProductData(
this.description, this.extraParams, this.images, this.metadata, this.name);
}

/**
* The product's description, meant to be displayable to the customer. Use this field to
* optionally store a long form explanation of the product being sold for your own
* rendering purposes.
*/
public Builder setDescription(String description) {
this.description = description;
return this;
}

/**
* 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 SessionCreateParams.LineItem.PriceData.ProductData#extraParams} for the
* field documentation.
*/
public Builder putExtraParam(String key, Object value) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.put(key, value);
return this;
}

/**
* 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 SessionCreateParams.LineItem.PriceData.ProductData#extraParams} for the
* field documentation.
*/
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}

/**
* Add an element to `images` list. A list is initialized for the first `add/addAll` call,
* and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem.PriceData.ProductData#images} for the field documentation.
*/
public Builder addImage(String element) {
if (this.images == null) {
this.images = new ArrayList<>();
}
this.images.add(element);
return this;
}

/**
* Add all elements to `images` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* SessionCreateParams.LineItem.PriceData.ProductData#images} for the field documentation.
*/
public Builder addAllImage(List<String> elements) {
if (this.images == null) {
this.images = new ArrayList<>();
}
this.images.addAll(elements);
return this;
}

/**
* Add a key/value pair to `metadata` 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 SessionCreateParams.LineItem.PriceData.ProductData#metadata} for the field
* documentation.
*/
public Builder putMetadata(String key, String value) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.put(key, value);
return this;
}

/**
* Add all map key/value pairs to `metadata` 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 SessionCreateParams.LineItem.PriceData.ProductData#metadata} for the
* field documentation.
*/
public Builder putAllMetadata(Map<String, String> map) {
if (this.metadata == null) {
this.metadata = new HashMap<>();
}
this.metadata.putAll(map);
return this;
}

/**
* The product's name, meant to be displayable to the customer. Whenever this product is
* sold via a subscription, name will show up on associated invoice line item
* descriptions.
*/
public Builder setName(String name) {
this.name = name;
return this;
}
}
}

@Getter
public static class Recurring {
/**
Expand Down