|
| 1 | +// File generated from our OpenAPI spec |
| 2 | +package com.stripe.param; |
| 3 | + |
| 4 | +import com.google.gson.annotations.SerializedName; |
| 5 | +import com.stripe.net.ApiRequestParams; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.HashMap; |
| 8 | +import java.util.List; |
| 9 | +import java.util.Map; |
| 10 | +import lombok.EqualsAndHashCode; |
| 11 | +import lombok.Getter; |
| 12 | + |
| 13 | +@Getter |
| 14 | +@EqualsAndHashCode(callSuper = false) |
| 15 | +public class SubscriptionPauseParams extends ApiRequestParams { |
| 16 | + /** Controls what to bill for when pausing the subscription. */ |
| 17 | + @SerializedName("bill_for") |
| 18 | + BillFor billFor; |
| 19 | + |
| 20 | + /** Specifies which fields in the response should be expanded. */ |
| 21 | + @SerializedName("expand") |
| 22 | + List<String> expand; |
| 23 | + |
| 24 | + /** |
| 25 | + * Map of extra parameters for custom features not available in this client library. The content |
| 26 | + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each |
| 27 | + * key/value pair is serialized as if the key is a root-level field (serialized) name in this |
| 28 | + * param object. Effectively, this map is flattened to its parent instance. |
| 29 | + */ |
| 30 | + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) |
| 31 | + Map<String, Object> extraParams; |
| 32 | + |
| 33 | + /** |
| 34 | + * Determines how to handle debits and credits when pausing. The default is {@code |
| 35 | + * pending_invoice_item}. |
| 36 | + */ |
| 37 | + @SerializedName("invoicing_behavior") |
| 38 | + InvoicingBehavior invoicingBehavior; |
| 39 | + |
| 40 | + /** <strong>Required.</strong> The type of pause to apply. */ |
| 41 | + @SerializedName("type") |
| 42 | + Type type; |
| 43 | + |
| 44 | + private SubscriptionPauseParams( |
| 45 | + BillFor billFor, |
| 46 | + List<String> expand, |
| 47 | + Map<String, Object> extraParams, |
| 48 | + InvoicingBehavior invoicingBehavior, |
| 49 | + Type type) { |
| 50 | + this.billFor = billFor; |
| 51 | + this.expand = expand; |
| 52 | + this.extraParams = extraParams; |
| 53 | + this.invoicingBehavior = invoicingBehavior; |
| 54 | + this.type = type; |
| 55 | + } |
| 56 | + |
| 57 | + public static Builder builder() { |
| 58 | + return new Builder(); |
| 59 | + } |
| 60 | + |
| 61 | + public static class Builder { |
| 62 | + private BillFor billFor; |
| 63 | + |
| 64 | + private List<String> expand; |
| 65 | + |
| 66 | + private Map<String, Object> extraParams; |
| 67 | + |
| 68 | + private InvoicingBehavior invoicingBehavior; |
| 69 | + |
| 70 | + private Type type; |
| 71 | + |
| 72 | + /** Finalize and obtain parameter instance from this builder. */ |
| 73 | + public SubscriptionPauseParams build() { |
| 74 | + return new SubscriptionPauseParams( |
| 75 | + this.billFor, this.expand, this.extraParams, this.invoicingBehavior, this.type); |
| 76 | + } |
| 77 | + |
| 78 | + /** Controls what to bill for when pausing the subscription. */ |
| 79 | + public Builder setBillFor(SubscriptionPauseParams.BillFor billFor) { |
| 80 | + this.billFor = billFor; |
| 81 | + return this; |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and |
| 86 | + * subsequent calls adds additional elements to the original list. See {@link |
| 87 | + * SubscriptionPauseParams#expand} for the field documentation. |
| 88 | + */ |
| 89 | + public Builder addExpand(String element) { |
| 90 | + if (this.expand == null) { |
| 91 | + this.expand = new ArrayList<>(); |
| 92 | + } |
| 93 | + this.expand.add(element); |
| 94 | + return this; |
| 95 | + } |
| 96 | + |
| 97 | + /** |
| 98 | + * Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and |
| 99 | + * subsequent calls adds additional elements to the original list. See {@link |
| 100 | + * SubscriptionPauseParams#expand} for the field documentation. |
| 101 | + */ |
| 102 | + public Builder addAllExpand(List<String> elements) { |
| 103 | + if (this.expand == null) { |
| 104 | + this.expand = new ArrayList<>(); |
| 105 | + } |
| 106 | + this.expand.addAll(elements); |
| 107 | + return this; |
| 108 | + } |
| 109 | + |
| 110 | + /** |
| 111 | + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` |
| 112 | + * call, and subsequent calls add additional key/value pairs to the original map. See {@link |
| 113 | + * SubscriptionPauseParams#extraParams} for the field documentation. |
| 114 | + */ |
| 115 | + public Builder putExtraParam(String key, Object value) { |
| 116 | + if (this.extraParams == null) { |
| 117 | + this.extraParams = new HashMap<>(); |
| 118 | + } |
| 119 | + this.extraParams.put(key, value); |
| 120 | + return this; |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first |
| 125 | + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. |
| 126 | + * See {@link SubscriptionPauseParams#extraParams} for the field documentation. |
| 127 | + */ |
| 128 | + public Builder putAllExtraParam(Map<String, Object> map) { |
| 129 | + if (this.extraParams == null) { |
| 130 | + this.extraParams = new HashMap<>(); |
| 131 | + } |
| 132 | + this.extraParams.putAll(map); |
| 133 | + return this; |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * Determines how to handle debits and credits when pausing. The default is {@code |
| 138 | + * pending_invoice_item}. |
| 139 | + */ |
| 140 | + public Builder setInvoicingBehavior( |
| 141 | + SubscriptionPauseParams.InvoicingBehavior invoicingBehavior) { |
| 142 | + this.invoicingBehavior = invoicingBehavior; |
| 143 | + return this; |
| 144 | + } |
| 145 | + |
| 146 | + /** <strong>Required.</strong> The type of pause to apply. */ |
| 147 | + public Builder setType(SubscriptionPauseParams.Type type) { |
| 148 | + this.type = type; |
| 149 | + return this; |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + @Getter |
| 154 | + @EqualsAndHashCode(callSuper = false) |
| 155 | + public static class BillFor { |
| 156 | + /** |
| 157 | + * Map of extra parameters for custom features not available in this client library. The content |
| 158 | + * in this map is not serialized under this field's {@code @SerializedName} value. Instead, each |
| 159 | + * key/value pair is serialized as if the key is a root-level field (serialized) name in this |
| 160 | + * param object. Effectively, this map is flattened to its parent instance. |
| 161 | + */ |
| 162 | + @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) |
| 163 | + Map<String, Object> extraParams; |
| 164 | + |
| 165 | + /** |
| 166 | + * Controls whether to debit for accrued metered usage in the current billing period. The |
| 167 | + * default is {@code false}. |
| 168 | + */ |
| 169 | + @SerializedName("outstanding_usage") |
| 170 | + Boolean outstandingUsage; |
| 171 | + |
| 172 | + /** |
| 173 | + * Controls whether to credit for licensed items in the current billing period. The default is |
| 174 | + * {@code false}. |
| 175 | + */ |
| 176 | + @SerializedName("unused_time") |
| 177 | + Boolean unusedTime; |
| 178 | + |
| 179 | + private BillFor(Map<String, Object> extraParams, Boolean outstandingUsage, Boolean unusedTime) { |
| 180 | + this.extraParams = extraParams; |
| 181 | + this.outstandingUsage = outstandingUsage; |
| 182 | + this.unusedTime = unusedTime; |
| 183 | + } |
| 184 | + |
| 185 | + public static Builder builder() { |
| 186 | + return new Builder(); |
| 187 | + } |
| 188 | + |
| 189 | + public static class Builder { |
| 190 | + private Map<String, Object> extraParams; |
| 191 | + |
| 192 | + private Boolean outstandingUsage; |
| 193 | + |
| 194 | + private Boolean unusedTime; |
| 195 | + |
| 196 | + /** Finalize and obtain parameter instance from this builder. */ |
| 197 | + public SubscriptionPauseParams.BillFor build() { |
| 198 | + return new SubscriptionPauseParams.BillFor( |
| 199 | + this.extraParams, this.outstandingUsage, this.unusedTime); |
| 200 | + } |
| 201 | + |
| 202 | + /** |
| 203 | + * Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` |
| 204 | + * call, and subsequent calls add additional key/value pairs to the original map. See {@link |
| 205 | + * SubscriptionPauseParams.BillFor#extraParams} for the field documentation. |
| 206 | + */ |
| 207 | + public Builder putExtraParam(String key, Object value) { |
| 208 | + if (this.extraParams == null) { |
| 209 | + this.extraParams = new HashMap<>(); |
| 210 | + } |
| 211 | + this.extraParams.put(key, value); |
| 212 | + return this; |
| 213 | + } |
| 214 | + |
| 215 | + /** |
| 216 | + * Add all map key/value pairs to `extraParams` map. A map is initialized for the first |
| 217 | + * `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. |
| 218 | + * See {@link SubscriptionPauseParams.BillFor#extraParams} for the field documentation. |
| 219 | + */ |
| 220 | + public Builder putAllExtraParam(Map<String, Object> map) { |
| 221 | + if (this.extraParams == null) { |
| 222 | + this.extraParams = new HashMap<>(); |
| 223 | + } |
| 224 | + this.extraParams.putAll(map); |
| 225 | + return this; |
| 226 | + } |
| 227 | + |
| 228 | + /** |
| 229 | + * Controls whether to debit for accrued metered usage in the current billing period. The |
| 230 | + * default is {@code false}. |
| 231 | + */ |
| 232 | + public Builder setOutstandingUsage(Boolean outstandingUsage) { |
| 233 | + this.outstandingUsage = outstandingUsage; |
| 234 | + return this; |
| 235 | + } |
| 236 | + |
| 237 | + /** |
| 238 | + * Controls whether to credit for licensed items in the current billing period. The default is |
| 239 | + * {@code false}. |
| 240 | + */ |
| 241 | + public Builder setUnusedTime(Boolean unusedTime) { |
| 242 | + this.unusedTime = unusedTime; |
| 243 | + return this; |
| 244 | + } |
| 245 | + } |
| 246 | + } |
| 247 | + |
| 248 | + public enum InvoicingBehavior implements ApiRequestParams.EnumParam { |
| 249 | + @SerializedName("invoice") |
| 250 | + INVOICE("invoice"), |
| 251 | + |
| 252 | + @SerializedName("pending_invoice_item") |
| 253 | + PENDING_INVOICE_ITEM("pending_invoice_item"); |
| 254 | + |
| 255 | + @Getter(onMethod_ = {@Override}) |
| 256 | + private final String value; |
| 257 | + |
| 258 | + InvoicingBehavior(String value) { |
| 259 | + this.value = value; |
| 260 | + } |
| 261 | + } |
| 262 | + |
| 263 | + public enum Type implements ApiRequestParams.EnumParam { |
| 264 | + @SerializedName("subscription") |
| 265 | + SUBSCRIPTION("subscription"); |
| 266 | + |
| 267 | + @Getter(onMethod_ = {@Override}) |
| 268 | + private final String value; |
| 269 | + |
| 270 | + Type(String value) { |
| 271 | + this.value = value; |
| 272 | + } |
| 273 | + } |
| 274 | +} |
0 commit comments