Skip to content

Commit

Permalink
Merge pull request #1015 from stripe/remi/codegen-6bc6b0c
Browse files Browse the repository at this point in the history
Add support for `Coupon` when for subscriptions on Checkout
  • Loading branch information
remi-stripe committed Apr 22, 2020
2 parents 42bb2d9 + 6aab484 commit 13055f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/stripe/model/billingportal/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,24 @@ public class Session extends ApiResource implements HasId {
@SerializedName("url")
String url;

/** Creates a session of the Self-service Portal. */
/** Creates a session of the self-serve Portal. */
public static Session create(Map<String, Object> params) throws StripeException {
return create(params, (RequestOptions) null);
}

/** Creates a session of the Self-service Portal. */
/** Creates a session of the self-serve Portal. */
public static Session create(Map<String, Object> params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/sessions");
return ApiResource.request(ApiResource.RequestMethod.POST, url, params, Session.class, options);
}

/** Creates a session of the Self-service Portal. */
/** Creates a session of the self-serve Portal. */
public static Session create(SessionCreateParams params) throws StripeException {
return create(params, (RequestOptions) null);
}

/** Creates a session of the Self-service Portal. */
/** Creates a session of the self-serve Portal. */
public static Session create(SessionCreateParams params, RequestOptions options)
throws StripeException {
String url = String.format("%s%s", Stripe.getApiBase(), "/v1/billing_portal/sessions");
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/stripe/param/checkout/SessionCreateParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -2402,6 +2402,13 @@ public static class SubscriptionData {
@SerializedName("application_fee_percent")
BigDecimal applicationFeePercent;

/**
* The code of the coupon to apply to this subscription. A coupon applied to a subscription will
* only affect invoices created for that particular subscription.
*/
@SerializedName("coupon")
String coupon;

/**
* The tax rates that will apply to any subscription item that does not have {@code tax_rates}
* set. Invoices created will have their {@code default_tax_rates} populated from the
Expand Down Expand Up @@ -2459,6 +2466,7 @@ public static class SubscriptionData {

private SubscriptionData(
BigDecimal applicationFeePercent,
String coupon,
List<String> defaultTaxRates,
Map<String, Object> extraParams,
List<Item> items,
Expand All @@ -2467,6 +2475,7 @@ private SubscriptionData(
Boolean trialFromPlan,
Long trialPeriodDays) {
this.applicationFeePercent = applicationFeePercent;
this.coupon = coupon;
this.defaultTaxRates = defaultTaxRates;
this.extraParams = extraParams;
this.items = items;
Expand All @@ -2483,6 +2492,8 @@ public static Builder builder() {
public static class Builder {
private BigDecimal applicationFeePercent;

private String coupon;

private List<String> defaultTaxRates;

private Map<String, Object> extraParams;
Expand All @@ -2501,6 +2512,7 @@ public static class Builder {
public SubscriptionData build() {
return new SubscriptionData(
this.applicationFeePercent,
this.coupon,
this.defaultTaxRates,
this.extraParams,
this.items,
Expand All @@ -2523,6 +2535,15 @@ public Builder setApplicationFeePercent(BigDecimal applicationFeePercent) {
return this;
}

/**
* The code of the coupon to apply to this subscription. A coupon applied to a subscription
* will only affect invoices created for that particular subscription.
*/
public Builder setCoupon(String coupon) {
this.coupon = coupon;
return this;
}

/**
* Add an element to `defaultTaxRates` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
Expand Down

0 comments on commit 13055f2

Please sign in to comment.