Skip to content
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

API Updates #1250

Merged
merged 1 commit into from
Aug 27, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/com/stripe/model/billingportal/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ public static class PaymentMethodUpdate extends StripeObject {
@Setter
@EqualsAndHashCode(callSuper = false)
public static class SubscriptionCancel extends StripeObject {
@SerializedName("cancellation_reason")
CancellationReason cancellationReason;

/** Whether the feature is enabled. */
@SerializedName("enabled")
Boolean enabled;
Expand All @@ -303,6 +306,19 @@ public static class SubscriptionCancel extends StripeObject {
*/
@SerializedName("proration_behavior")
String prorationBehavior;

@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
public static class CancellationReason extends StripeObject {
/** Whether the feature is enabled. */
@SerializedName("enabled")
Boolean enabled;

/** Which cancellation reasons will be given as options to the customer. */
@SerializedName("options")
List<String> options;
}
}

@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,13 @@ public Builder putAllExtraParam(Map<String, Object> map) {

@Getter
public static class SubscriptionCancel {
/**
* Whether the cancellation reasons will be collected in the portal and which options are
* exposed to the customer.
*/
@SerializedName("cancellation_reason")
CancellationReason cancellationReason;

/** Whether the feature is enabled. */
@SerializedName("enabled")
Boolean enabled;
Expand Down Expand Up @@ -740,10 +747,12 @@ public static class SubscriptionCancel {
ProrationBehavior prorationBehavior;

private SubscriptionCancel(
CancellationReason cancellationReason,
Boolean enabled,
Map<String, Object> extraParams,
Mode mode,
ProrationBehavior prorationBehavior) {
this.cancellationReason = cancellationReason;
this.enabled = enabled;
this.extraParams = extraParams;
this.mode = mode;
Expand All @@ -755,6 +764,8 @@ public static Builder builder() {
}

public static class Builder {
private CancellationReason cancellationReason;

private Boolean enabled;

private Map<String, Object> extraParams;
Expand All @@ -766,7 +777,20 @@ public static class Builder {
/** Finalize and obtain parameter instance from this builder. */
public SubscriptionCancel build() {
return new SubscriptionCancel(
this.enabled, this.extraParams, this.mode, this.prorationBehavior);
this.cancellationReason,
this.enabled,
this.extraParams,
this.mode,
this.prorationBehavior);
}

/**
* Whether the cancellation reasons will be collected in the portal and which options are
* exposed to the customer.
*/
public Builder setCancellationReason(CancellationReason cancellationReason) {
this.cancellationReason = cancellationReason;
return this;
}

/** Whether the feature is enabled. */
Expand Down Expand Up @@ -821,6 +845,172 @@ public Builder setProrationBehavior(ProrationBehavior prorationBehavior) {
}
}

@Getter
public static class CancellationReason {
/** Whether the feature is enabled. */
@SerializedName("enabled")
Boolean enabled;

/**
* 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;

/** Which cancellation reasons will be given as options to the customer. */
@SerializedName("options")
Object options;

private CancellationReason(
Boolean enabled, Map<String, Object> extraParams, Object options) {
this.enabled = enabled;
this.extraParams = extraParams;
this.options = options;
}

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

public static class Builder {
private Boolean enabled;

private Map<String, Object> extraParams;

private Object options;

/** Finalize and obtain parameter instance from this builder. */
public CancellationReason build() {
return new CancellationReason(this.enabled, this.extraParams, this.options);
}

/** Whether the feature is enabled. */
public Builder setEnabled(Boolean enabled) {
this.enabled = enabled;
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
* ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason#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
* ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason#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 `options` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason#options} for
* the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addOption(Option element) {
if (this.options == null || this.options instanceof EmptyParam) {
this.options =
new ArrayList<
ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason
.Option>();
}
((List<ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason.Option>)
this.options)
.add(element);
return this;
}

/**
* Add all elements to `options` list. A list is initialized for the first `add/addAll`
* call, and subsequent calls adds additional elements to the original list. See {@link
* ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason#options} for
* the field documentation.
*/
@SuppressWarnings("unchecked")
public Builder addAllOption(List<Option> elements) {
if (this.options == null || this.options instanceof EmptyParam) {
this.options =
new ArrayList<
ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason
.Option>();
}
((List<ConfigurationCreateParams.Features.SubscriptionCancel.CancellationReason.Option>)
this.options)
.addAll(elements);
return this;
}

/** Which cancellation reasons will be given as options to the customer. */
public Builder setOptions(EmptyParam options) {
this.options = options;
return this;
}

/** Which cancellation reasons will be given as options to the customer. */
public Builder setOptions(List<Option> options) {
this.options = options;
return this;
}
}

public enum Option implements ApiRequestParams.EnumParam {
@SerializedName("customer_service")
CUSTOMER_SERVICE("customer_service"),

@SerializedName("low_quality")
LOW_QUALITY("low_quality"),

@SerializedName("missing_features")
MISSING_FEATURES("missing_features"),

@SerializedName("other")
OTHER("other"),

@SerializedName("switched_service")
SWITCHED_SERVICE("switched_service"),

@SerializedName("too_complex")
TOO_COMPLEX("too_complex"),

@SerializedName("too_expensive")
TOO_EXPENSIVE("too_expensive"),

@SerializedName("unused")
UNUSED("unused");

@Getter(onMethod_ = {@Override})
private final String value;

Option(String value) {
this.value = value;
}
}
}

public enum Mode implements ApiRequestParams.EnumParam {
@SerializedName("at_period_end")
AT_PERIOD_END("at_period_end"),
Expand Down