All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.Plan Maven / Gradle / Ivy

There is a newer version: 26.13.0-beta.1
Show newest version
// Generated by delombok at Tue Sep 03 10:42:51 PDT 2019
// Generated by com.stripe.generator.entity.SdkBuilder
package com.stripe.model;

import com.google.gson.annotations.SerializedName;
import com.stripe.Stripe;
import com.stripe.exception.StripeException;
import com.stripe.net.ApiResource;
import com.stripe.net.RequestOptions;
import com.stripe.param.PlanCreateParams;
import com.stripe.param.PlanListParams;
import com.stripe.param.PlanRetrieveParams;
import com.stripe.param.PlanUpdateParams;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public class Plan extends ApiResource implements HasId, MetadataStore {
  /**
   * Whether the plan is currently available for new subscriptions.
   */
  @SerializedName("active")
  Boolean active;
  /**
   * Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are
   * `sum` for summing up all usage during a period, `last_during_period` for picking the last usage
   * record reported within a period, `last_ever` for picking the last usage record ever (across
   * period bounds) or `max` which picks the usage record with the maximum reported usage during a
   * period. Defaults to `sum`.
   */
  @SerializedName("aggregate_usage")
  String aggregateUsage;
  /**
   * The amount in %s to be charged on the interval specified.
   */
  @SerializedName("amount")
  Long amount;
  /**
   * Same as `amount`, but contains a decimal value with at most 12 decimal places.
   */
  @SerializedName("amount_decimal")
  BigDecimal amountDecimal;
  /**
   * Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit`
   * indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity`
   * (for plans with `usage_type=licensed`), or per unit of total usage (for plans with
   * `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a
   * tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
   */
  @SerializedName("billing_scheme")
  String billingScheme;
  /**
   * Time at which the object was created. Measured in seconds since the Unix epoch.
   */
  @SerializedName("created")
  Long created;
  /**
   * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
   * lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
   */
  @SerializedName("currency")
  String currency;
  /**
   * Always true for a deleted object.
   */
  @SerializedName("deleted")
  Boolean deleted;
  /**
   * Unique identifier for the object.
   */
  @SerializedName("id")
  String id;
  /**
   * One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be
   * billed.
   */
  @SerializedName("interval")
  String interval;
  /**
   * The number of intervals (specified in the `interval` property) between subscription billings.
   * For example, `interval=month` and `interval_count=3` bills every 3 months.
   */
  @SerializedName("interval_count")
  Long intervalCount;
  /**
   * Has the value `true` if the object exists in live mode or the value `false` if the object
   * exists in test mode.
   */
  @SerializedName("livemode")
  Boolean livemode;
  /**
   * 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.
   */
  @SerializedName("metadata")
  Map metadata;
  /**
   * A brief description of the plan, hidden from customers.
   */
  @SerializedName("nickname")
  String nickname;
  /**
   * String representing the object's type. Objects of the same type share the same value.
   */
  @SerializedName("object")
  String object;
  /**
   * The product whose pricing this plan determines.
   */
  @SerializedName("product")
  ExpandableField product;
  /**
   * Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to
   * `tiered`. See also the documentation for `billing_scheme`.
   */
  @SerializedName("tiers")
  List tiers;
  /**
   * Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based
   * tiering, the maximum quantity within a period determines the per unit price, in `graduated`
   * tiering pricing can successively change as the quantity grows.
   */
  @SerializedName("tiers_mode")
  String tiersMode;
  /**
   * Apply a transformation to the reported usage or set quantity before computing the billed price.
   * Cannot be combined with `tiers`.
   */
  @SerializedName("transform_usage")
  TransformUsage transformUsage;
  /**
   * Default number of trial days when subscribing a customer to this plan using
   * [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).
   */
  @SerializedName("trial_period_days")
  Long trialPeriodDays;
  /**
   * Configures how the quantity per period should be determined, can be either `metered` or
   * `licensed`. `licensed` will automatically bill the `quantity` set for a plan when adding it to
   * a subscription, `metered` will aggregate the total usage based on usage records. Defaults to
   * `licensed`.
   */
  @SerializedName("usage_type")
  String usageType;

  /**
   * Get id of expandable `product` object.
   */
  public String getProduct() {
    return (this.product != null) ? this.product.getId() : null;
  }

  public void setProduct(String id) {
    this.product = ApiResource.setExpandableFieldId(id, this.product);
  }

  /**
   * Get expanded `product`.
   */
  public Product getProductObject() {
    return (this.product != null) ? this.product.getExpanded() : null;
  }

  public void setProductObject(Product expandableObject) {
    this.product = new ExpandableField(expandableObject.getId(), expandableObject);
  }

  /**
   * Returns a list of your plans.
   */
  public static PlanCollection list(Map params) throws StripeException {
    return list(params, (RequestOptions) null);
  }

  /**
   * Returns a list of your plans.
   */
  public static PlanCollection list(Map params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans");
    return requestCollection(url, params, PlanCollection.class, options);
  }

  /**
   * Returns a list of your plans.
   */
  public static PlanCollection list(PlanListParams params) throws StripeException {
    return list(params, (RequestOptions) null);
  }

  /**
   * Returns a list of your plans.
   */
  public static PlanCollection list(PlanListParams params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans");
    return requestCollection(url, params, PlanCollection.class, options);
  }

  /**
   * You can create plans using the API, or in the Stripe Dashboard.
   */
  public static Plan create(Map params) throws StripeException {
    return create(params, (RequestOptions) null);
  }

  /**
   * You can create plans using the API, or in the Stripe Dashboard.
   */
  public static Plan create(Map params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans");
    return request(ApiResource.RequestMethod.POST, url, params, Plan.class, options);
  }

  /**
   * You can create plans using the API, or in the Stripe Dashboard.
   */
  public static Plan create(PlanCreateParams params) throws StripeException {
    return create(params, (RequestOptions) null);
  }

  /**
   * You can create plans using the API, or in the Stripe Dashboard.
   */
  public static Plan create(PlanCreateParams params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), "/v1/plans");
    return request(ApiResource.RequestMethod.POST, url, params, Plan.class, options);
  }

  /**
   * Retrieves the plan with the given ID.
   */
  public static Plan retrieve(String plan) throws StripeException {
    return retrieve(plan, (Map) null, (RequestOptions) null);
  }

  /**
   * Retrieves the plan with the given ID.
   */
  public static Plan retrieve(String plan, RequestOptions options) throws StripeException {
    return retrieve(plan, (Map) null, options);
  }

  /**
   * Retrieves the plan with the given ID.
   */
  public static Plan retrieve(String plan, Map params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/plans/%s", ApiResource.urlEncodeId(plan)));
    return request(ApiResource.RequestMethod.GET, url, params, Plan.class, options);
  }

  /**
   * Retrieves the plan with the given ID.
   */
  public static Plan retrieve(String plan, PlanRetrieveParams params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/plans/%s", ApiResource.urlEncodeId(plan)));
    return request(ApiResource.RequestMethod.GET, url, params, Plan.class, options);
  }

  /**
   * Updates the specified plan by setting the values of the parameters passed. Any parameters not
   * provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or
   * billing cycle.
   */
  @Override
  public Plan update(Map params) throws StripeException {
    return update(params, (RequestOptions) null);
  }

  /**
   * Updates the specified plan by setting the values of the parameters passed. Any parameters not
   * provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or
   * billing cycle.
   */
  @Override
  public Plan update(Map params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/plans/%s", ApiResource.urlEncodeId(this.getId())));
    return request(ApiResource.RequestMethod.POST, url, params, Plan.class, options);
  }

  /**
   * Updates the specified plan by setting the values of the parameters passed. Any parameters not
   * provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or
   * billing cycle.
   */
  public Plan update(PlanUpdateParams params) throws StripeException {
    return update(params, (RequestOptions) null);
  }

  /**
   * Updates the specified plan by setting the values of the parameters passed. Any parameters not
   * provided are left unchanged. By design, you cannot change a plan’s ID, amount, currency, or
   * billing cycle.
   */
  public Plan update(PlanUpdateParams params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/plans/%s", ApiResource.urlEncodeId(this.getId())));
    return request(ApiResource.RequestMethod.POST, url, params, Plan.class, options);
  }

  /**
   * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
   */
  public Plan delete() throws StripeException {
    return delete((Map) null, (RequestOptions) null);
  }

  /**
   * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
   */
  public Plan delete(RequestOptions options) throws StripeException {
    return delete((Map) null, options);
  }

  /**
   * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
   */
  public Plan delete(Map params) throws StripeException {
    return delete(params, (RequestOptions) null);
  }

  /**
   * Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
   */
  public Plan delete(Map params, RequestOptions options) throws StripeException {
    String url = String.format("%s%s", Stripe.getApiBase(), String.format("/v1/plans/%s", ApiResource.urlEncodeId(this.getId())));
    return request(ApiResource.RequestMethod.DELETE, url, params, Plan.class, options);
  }


  public static class Tier extends StripeObject {
    /**
     * Price for the entire tier.
     */
    @SerializedName("flat_amount")
    Long flatAmount;
    /**
     * Same as `flat_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @SerializedName("flat_amount_decimal")
    BigDecimal flatAmountDecimal;
    /**
     * Per unit price for units relevant to the tier.
     */
    @SerializedName("unit_amount")
    Long unitAmount;
    /**
     * Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @SerializedName("unit_amount_decimal")
    BigDecimal unitAmountDecimal;
    /**
     * Up to and including to this quantity will be contained in the tier.
     */
    @SerializedName("up_to")
    Long upTo;

    /**
     * Price for the entire tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Long getFlatAmount() {
      return this.flatAmount;
    }

    /**
     * Same as `flat_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public BigDecimal getFlatAmountDecimal() {
      return this.flatAmountDecimal;
    }

    /**
     * Per unit price for units relevant to the tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Long getUnitAmount() {
      return this.unitAmount;
    }

    /**
     * Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public BigDecimal getUnitAmountDecimal() {
      return this.unitAmountDecimal;
    }

    /**
     * Up to and including to this quantity will be contained in the tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Long getUpTo() {
      return this.upTo;
    }

    /**
     * Price for the entire tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setFlatAmount(final Long flatAmount) {
      this.flatAmount = flatAmount;
    }

    /**
     * Same as `flat_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setFlatAmountDecimal(final BigDecimal flatAmountDecimal) {
      this.flatAmountDecimal = flatAmountDecimal;
    }

    /**
     * Per unit price for units relevant to the tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setUnitAmount(final Long unitAmount) {
      this.unitAmount = unitAmount;
    }

    /**
     * Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setUnitAmountDecimal(final BigDecimal unitAmountDecimal) {
      this.unitAmountDecimal = unitAmountDecimal;
    }

    /**
     * Up to and including to this quantity will be contained in the tier.
     */
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setUpTo(final Long upTo) {
      this.upTo = upTo;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
      if (o == this) return true;
      if (!(o instanceof Plan.Tier)) return false;
      final Plan.Tier other = (Plan.Tier) o;
      if (!other.canEqual((java.lang.Object) this)) return false;
      final java.lang.Object this$flatAmount = this.getFlatAmount();
      final java.lang.Object other$flatAmount = other.getFlatAmount();
      if (this$flatAmount == null ? other$flatAmount != null : !this$flatAmount.equals(other$flatAmount)) return false;
      final java.lang.Object this$flatAmountDecimal = this.getFlatAmountDecimal();
      final java.lang.Object other$flatAmountDecimal = other.getFlatAmountDecimal();
      if (this$flatAmountDecimal == null ? other$flatAmountDecimal != null : !this$flatAmountDecimal.equals(other$flatAmountDecimal)) return false;
      final java.lang.Object this$unitAmount = this.getUnitAmount();
      final java.lang.Object other$unitAmount = other.getUnitAmount();
      if (this$unitAmount == null ? other$unitAmount != null : !this$unitAmount.equals(other$unitAmount)) return false;
      final java.lang.Object this$unitAmountDecimal = this.getUnitAmountDecimal();
      final java.lang.Object other$unitAmountDecimal = other.getUnitAmountDecimal();
      if (this$unitAmountDecimal == null ? other$unitAmountDecimal != null : !this$unitAmountDecimal.equals(other$unitAmountDecimal)) return false;
      final java.lang.Object this$upTo = this.getUpTo();
      final java.lang.Object other$upTo = other.getUpTo();
      if (this$upTo == null ? other$upTo != null : !this$upTo.equals(other$upTo)) return false;
      return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
      return other instanceof Plan.Tier;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
      final int PRIME = 59;
      int result = 1;
      final java.lang.Object $flatAmount = this.getFlatAmount();
      result = result * PRIME + ($flatAmount == null ? 43 : $flatAmount.hashCode());
      final java.lang.Object $flatAmountDecimal = this.getFlatAmountDecimal();
      result = result * PRIME + ($flatAmountDecimal == null ? 43 : $flatAmountDecimal.hashCode());
      final java.lang.Object $unitAmount = this.getUnitAmount();
      result = result * PRIME + ($unitAmount == null ? 43 : $unitAmount.hashCode());
      final java.lang.Object $unitAmountDecimal = this.getUnitAmountDecimal();
      result = result * PRIME + ($unitAmountDecimal == null ? 43 : $unitAmountDecimal.hashCode());
      final java.lang.Object $upTo = this.getUpTo();
      result = result * PRIME + ($upTo == null ? 43 : $upTo.hashCode());
      return result;
    }
  }


  public static class TransformUsage extends StripeObject {
    /** Divide usage by this number. */
    @SerializedName("divide_by")
    Long divideBy;
    /** After division, either round the result `up` or `down`. */
    @SerializedName("round")
    String round;

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Long getDivideBy() {
      return this.divideBy;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getRound() {
      return this.round;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setDivideBy(final Long divideBy) {
      this.divideBy = divideBy;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setRound(final String round) {
      this.round = round;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
      if (o == this) return true;
      if (!(o instanceof Plan.TransformUsage)) return false;
      final Plan.TransformUsage other = (Plan.TransformUsage) o;
      if (!other.canEqual((java.lang.Object) this)) return false;
      final java.lang.Object this$divideBy = this.getDivideBy();
      final java.lang.Object other$divideBy = other.getDivideBy();
      if (this$divideBy == null ? other$divideBy != null : !this$divideBy.equals(other$divideBy)) return false;
      final java.lang.Object this$round = this.getRound();
      final java.lang.Object other$round = other.getRound();
      if (this$round == null ? other$round != null : !this$round.equals(other$round)) return false;
      return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
      return other instanceof Plan.TransformUsage;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
      final int PRIME = 59;
      int result = 1;
      final java.lang.Object $divideBy = this.getDivideBy();
      result = result * PRIME + ($divideBy == null ? 43 : $divideBy.hashCode());
      final java.lang.Object $round = this.getRound();
      result = result * PRIME + ($round == null ? 43 : $round.hashCode());
      return result;
    }
  }

  /**
   * Whether the plan is currently available for new subscriptions.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Boolean getActive() {
    return this.active;
  }

  /**
   * Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are
   * `sum` for summing up all usage during a period, `last_during_period` for picking the last usage
   * record reported within a period, `last_ever` for picking the last usage record ever (across
   * period bounds) or `max` which picks the usage record with the maximum reported usage during a
   * period. Defaults to `sum`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getAggregateUsage() {
    return this.aggregateUsage;
  }

  /**
   * The amount in %s to be charged on the interval specified.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Long getAmount() {
    return this.amount;
  }

  /**
   * Same as `amount`, but contains a decimal value with at most 12 decimal places.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public BigDecimal getAmountDecimal() {
    return this.amountDecimal;
  }

  /**
   * Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit`
   * indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity`
   * (for plans with `usage_type=licensed`), or per unit of total usage (for plans with
   * `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a
   * tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getBillingScheme() {
    return this.billingScheme;
  }

  /**
   * Time at which the object was created. Measured in seconds since the Unix epoch.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Long getCreated() {
    return this.created;
  }

  /**
   * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
   * lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getCurrency() {
    return this.currency;
  }

  /**
   * Always true for a deleted object.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Boolean getDeleted() {
    return this.deleted;
  }

  /**
   * One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be
   * billed.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getInterval() {
    return this.interval;
  }

  /**
   * The number of intervals (specified in the `interval` property) between subscription billings.
   * For example, `interval=month` and `interval_count=3` bills every 3 months.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Long getIntervalCount() {
    return this.intervalCount;
  }

  /**
   * Has the value `true` if the object exists in live mode or the value `false` if the object
   * exists in test mode.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Boolean getLivemode() {
    return this.livemode;
  }

  /**
   * A brief description of the plan, hidden from customers.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getNickname() {
    return this.nickname;
  }

  /**
   * String representing the object's type. Objects of the same type share the same value.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getObject() {
    return this.object;
  }

  /**
   * Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to
   * `tiered`. See also the documentation for `billing_scheme`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public List getTiers() {
    return this.tiers;
  }

  /**
   * Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based
   * tiering, the maximum quantity within a period determines the per unit price, in `graduated`
   * tiering pricing can successively change as the quantity grows.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getTiersMode() {
    return this.tiersMode;
  }

  /**
   * Apply a transformation to the reported usage or set quantity before computing the billed price.
   * Cannot be combined with `tiers`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public TransformUsage getTransformUsage() {
    return this.transformUsage;
  }

  /**
   * Default number of trial days when subscribing a customer to this plan using
   * [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Long getTrialPeriodDays() {
    return this.trialPeriodDays;
  }

  /**
   * Configures how the quantity per period should be determined, can be either `metered` or
   * `licensed`. `licensed` will automatically bill the `quantity` set for a plan when adding it to
   * a subscription, `metered` will aggregate the total usage based on usage records. Defaults to
   * `licensed`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getUsageType() {
    return this.usageType;
  }

  /**
   * Whether the plan is currently available for new subscriptions.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setActive(final Boolean active) {
    this.active = active;
  }

  /**
   * Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are
   * `sum` for summing up all usage during a period, `last_during_period` for picking the last usage
   * record reported within a period, `last_ever` for picking the last usage record ever (across
   * period bounds) or `max` which picks the usage record with the maximum reported usage during a
   * period. Defaults to `sum`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setAggregateUsage(final String aggregateUsage) {
    this.aggregateUsage = aggregateUsage;
  }

  /**
   * The amount in %s to be charged on the interval specified.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setAmount(final Long amount) {
    this.amount = amount;
  }

  /**
   * Same as `amount`, but contains a decimal value with at most 12 decimal places.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setAmountDecimal(final BigDecimal amountDecimal) {
    this.amountDecimal = amountDecimal;
  }

  /**
   * Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit`
   * indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity`
   * (for plans with `usage_type=licensed`), or per unit of total usage (for plans with
   * `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a
   * tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setBillingScheme(final String billingScheme) {
    this.billingScheme = billingScheme;
  }

  /**
   * Time at which the object was created. Measured in seconds since the Unix epoch.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setCreated(final Long created) {
    this.created = created;
  }

  /**
   * Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in
   * lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setCurrency(final String currency) {
    this.currency = currency;
  }

  /**
   * Always true for a deleted object.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setDeleted(final Boolean deleted) {
    this.deleted = deleted;
  }

  /**
   * Unique identifier for the object.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setId(final String id) {
    this.id = id;
  }

  /**
   * One of `day`, `week`, `month` or `year`. The frequency with which a subscription should be
   * billed.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setInterval(final String interval) {
    this.interval = interval;
  }

  /**
   * The number of intervals (specified in the `interval` property) between subscription billings.
   * For example, `interval=month` and `interval_count=3` bills every 3 months.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setIntervalCount(final Long intervalCount) {
    this.intervalCount = intervalCount;
  }

  /**
   * Has the value `true` if the object exists in live mode or the value `false` if the object
   * exists in test mode.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setLivemode(final Boolean livemode) {
    this.livemode = livemode;
  }

  /**
   * 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.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setMetadata(final Map metadata) {
    this.metadata = metadata;
  }

  /**
   * A brief description of the plan, hidden from customers.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setNickname(final String nickname) {
    this.nickname = nickname;
  }

  /**
   * String representing the object's type. Objects of the same type share the same value.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setObject(final String object) {
    this.object = object;
  }

  /**
   * Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to
   * `tiered`. See also the documentation for `billing_scheme`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setTiers(final List tiers) {
    this.tiers = tiers;
  }

  /**
   * Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based
   * tiering, the maximum quantity within a period determines the per unit price, in `graduated`
   * tiering pricing can successively change as the quantity grows.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setTiersMode(final String tiersMode) {
    this.tiersMode = tiersMode;
  }

  /**
   * Apply a transformation to the reported usage or set quantity before computing the billed price.
   * Cannot be combined with `tiers`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setTransformUsage(final TransformUsage transformUsage) {
    this.transformUsage = transformUsage;
  }

  /**
   * Default number of trial days when subscribing a customer to this plan using
   * [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setTrialPeriodDays(final Long trialPeriodDays) {
    this.trialPeriodDays = trialPeriodDays;
  }

  /**
   * Configures how the quantity per period should be determined, can be either `metered` or
   * `licensed`. `licensed` will automatically bill the `quantity` set for a plan when adding it to
   * a subscription, `metered` will aggregate the total usage based on usage records. Defaults to
   * `licensed`.
   */
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public void setUsageType(final String usageType) {
    this.usageType = usageType;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public boolean equals(final java.lang.Object o) {
    if (o == this) return true;
    if (!(o instanceof Plan)) return false;
    final Plan other = (Plan) o;
    if (!other.canEqual((java.lang.Object) this)) return false;
    final java.lang.Object this$active = this.getActive();
    final java.lang.Object other$active = other.getActive();
    if (this$active == null ? other$active != null : !this$active.equals(other$active)) return false;
    final java.lang.Object this$aggregateUsage = this.getAggregateUsage();
    final java.lang.Object other$aggregateUsage = other.getAggregateUsage();
    if (this$aggregateUsage == null ? other$aggregateUsage != null : !this$aggregateUsage.equals(other$aggregateUsage)) return false;
    final java.lang.Object this$amount = this.getAmount();
    final java.lang.Object other$amount = other.getAmount();
    if (this$amount == null ? other$amount != null : !this$amount.equals(other$amount)) return false;
    final java.lang.Object this$amountDecimal = this.getAmountDecimal();
    final java.lang.Object other$amountDecimal = other.getAmountDecimal();
    if (this$amountDecimal == null ? other$amountDecimal != null : !this$amountDecimal.equals(other$amountDecimal)) return false;
    final java.lang.Object this$billingScheme = this.getBillingScheme();
    final java.lang.Object other$billingScheme = other.getBillingScheme();
    if (this$billingScheme == null ? other$billingScheme != null : !this$billingScheme.equals(other$billingScheme)) return false;
    final java.lang.Object this$created = this.getCreated();
    final java.lang.Object other$created = other.getCreated();
    if (this$created == null ? other$created != null : !this$created.equals(other$created)) return false;
    final java.lang.Object this$currency = this.getCurrency();
    final java.lang.Object other$currency = other.getCurrency();
    if (this$currency == null ? other$currency != null : !this$currency.equals(other$currency)) return false;
    final java.lang.Object this$deleted = this.getDeleted();
    final java.lang.Object other$deleted = other.getDeleted();
    if (this$deleted == null ? other$deleted != null : !this$deleted.equals(other$deleted)) return false;
    final java.lang.Object this$id = this.getId();
    final java.lang.Object other$id = other.getId();
    if (this$id == null ? other$id != null : !this$id.equals(other$id)) return false;
    final java.lang.Object this$interval = this.getInterval();
    final java.lang.Object other$interval = other.getInterval();
    if (this$interval == null ? other$interval != null : !this$interval.equals(other$interval)) return false;
    final java.lang.Object this$intervalCount = this.getIntervalCount();
    final java.lang.Object other$intervalCount = other.getIntervalCount();
    if (this$intervalCount == null ? other$intervalCount != null : !this$intervalCount.equals(other$intervalCount)) return false;
    final java.lang.Object this$livemode = this.getLivemode();
    final java.lang.Object other$livemode = other.getLivemode();
    if (this$livemode == null ? other$livemode != null : !this$livemode.equals(other$livemode)) return false;
    final java.lang.Object this$metadata = this.getMetadata();
    final java.lang.Object other$metadata = other.getMetadata();
    if (this$metadata == null ? other$metadata != null : !this$metadata.equals(other$metadata)) return false;
    final java.lang.Object this$nickname = this.getNickname();
    final java.lang.Object other$nickname = other.getNickname();
    if (this$nickname == null ? other$nickname != null : !this$nickname.equals(other$nickname)) return false;
    final java.lang.Object this$object = this.getObject();
    final java.lang.Object other$object = other.getObject();
    if (this$object == null ? other$object != null : !this$object.equals(other$object)) return false;
    final java.lang.Object this$product = this.getProduct();
    final java.lang.Object other$product = other.getProduct();
    if (this$product == null ? other$product != null : !this$product.equals(other$product)) return false;
    final java.lang.Object this$tiers = this.getTiers();
    final java.lang.Object other$tiers = other.getTiers();
    if (this$tiers == null ? other$tiers != null : !this$tiers.equals(other$tiers)) return false;
    final java.lang.Object this$tiersMode = this.getTiersMode();
    final java.lang.Object other$tiersMode = other.getTiersMode();
    if (this$tiersMode == null ? other$tiersMode != null : !this$tiersMode.equals(other$tiersMode)) return false;
    final java.lang.Object this$transformUsage = this.getTransformUsage();
    final java.lang.Object other$transformUsage = other.getTransformUsage();
    if (this$transformUsage == null ? other$transformUsage != null : !this$transformUsage.equals(other$transformUsage)) return false;
    final java.lang.Object this$trialPeriodDays = this.getTrialPeriodDays();
    final java.lang.Object other$trialPeriodDays = other.getTrialPeriodDays();
    if (this$trialPeriodDays == null ? other$trialPeriodDays != null : !this$trialPeriodDays.equals(other$trialPeriodDays)) return false;
    final java.lang.Object this$usageType = this.getUsageType();
    final java.lang.Object other$usageType = other.getUsageType();
    if (this$usageType == null ? other$usageType != null : !this$usageType.equals(other$usageType)) return false;
    return true;
  }

  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  protected boolean canEqual(final java.lang.Object other) {
    return other instanceof Plan;
  }

  @java.lang.Override
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public int hashCode() {
    final int PRIME = 59;
    int result = 1;
    final java.lang.Object $active = this.getActive();
    result = result * PRIME + ($active == null ? 43 : $active.hashCode());
    final java.lang.Object $aggregateUsage = this.getAggregateUsage();
    result = result * PRIME + ($aggregateUsage == null ? 43 : $aggregateUsage.hashCode());
    final java.lang.Object $amount = this.getAmount();
    result = result * PRIME + ($amount == null ? 43 : $amount.hashCode());
    final java.lang.Object $amountDecimal = this.getAmountDecimal();
    result = result * PRIME + ($amountDecimal == null ? 43 : $amountDecimal.hashCode());
    final java.lang.Object $billingScheme = this.getBillingScheme();
    result = result * PRIME + ($billingScheme == null ? 43 : $billingScheme.hashCode());
    final java.lang.Object $created = this.getCreated();
    result = result * PRIME + ($created == null ? 43 : $created.hashCode());
    final java.lang.Object $currency = this.getCurrency();
    result = result * PRIME + ($currency == null ? 43 : $currency.hashCode());
    final java.lang.Object $deleted = this.getDeleted();
    result = result * PRIME + ($deleted == null ? 43 : $deleted.hashCode());
    final java.lang.Object $id = this.getId();
    result = result * PRIME + ($id == null ? 43 : $id.hashCode());
    final java.lang.Object $interval = this.getInterval();
    result = result * PRIME + ($interval == null ? 43 : $interval.hashCode());
    final java.lang.Object $intervalCount = this.getIntervalCount();
    result = result * PRIME + ($intervalCount == null ? 43 : $intervalCount.hashCode());
    final java.lang.Object $livemode = this.getLivemode();
    result = result * PRIME + ($livemode == null ? 43 : $livemode.hashCode());
    final java.lang.Object $metadata = this.getMetadata();
    result = result * PRIME + ($metadata == null ? 43 : $metadata.hashCode());
    final java.lang.Object $nickname = this.getNickname();
    result = result * PRIME + ($nickname == null ? 43 : $nickname.hashCode());
    final java.lang.Object $object = this.getObject();
    result = result * PRIME + ($object == null ? 43 : $object.hashCode());
    final java.lang.Object $product = this.getProduct();
    result = result * PRIME + ($product == null ? 43 : $product.hashCode());
    final java.lang.Object $tiers = this.getTiers();
    result = result * PRIME + ($tiers == null ? 43 : $tiers.hashCode());
    final java.lang.Object $tiersMode = this.getTiersMode();
    result = result * PRIME + ($tiersMode == null ? 43 : $tiersMode.hashCode());
    final java.lang.Object $transformUsage = this.getTransformUsage();
    result = result * PRIME + ($transformUsage == null ? 43 : $transformUsage.hashCode());
    final java.lang.Object $trialPeriodDays = this.getTrialPeriodDays();
    result = result * PRIME + ($trialPeriodDays == null ? 43 : $trialPeriodDays.hashCode());
    final java.lang.Object $usageType = this.getUsageType();
    result = result * PRIME + ($usageType == null ? 43 : $usageType.hashCode());
    return result;
  }

  /**
   * Unique identifier for the object.
   */
  @Override
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public String getId() {
    return this.id;
  }

  /**
   * 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.
   */
  @Override
  @java.lang.SuppressWarnings("all")
  @lombok.Generated
  public Map getMetadata() {
    return this.metadata;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy