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

org.openapitools.client.model.CancelSubscriptionRequest Maven / Gradle / Ivy

There is a newer version: 3.2.1
Show newest version
/*
* Quickstart API Reference
* Zuora Quickstart API is the API that helps you achieve fundamental use cases.
* It provides a much simplified object model and improved performance, enabling developers to easily learn and use.
*/

package org.openapitools.client.model;

import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.client.model.ProcessingOptions;
import org.openapitools.client.model.WriteOffSuscriptionRequest;
import org.openapitools.jackson.nullable.JsonNullable;

import org.openapitools.client.JSON.CustomFieldAdapter;
import org.openapitools.client.JSON.NullableFieldAdapter;
/**
 * CancelSubscriptionRequest
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class CancelSubscriptionRequest {
  public static final String SERIALIZED_NAME_CANCEL_DATE = "cancel_date";
  @SerializedName(SERIALIZED_NAME_CANCEL_DATE)
  private String cancelDate;

  /**
   * The date on which the subscription is canceled. Can be either the end of the subscription term or the end of the billing period.
   */
  @JsonAdapter(CancelAtEnum.Adapter.class)
  public enum CancelAtEnum {
    INVOICE_PERIOD_END("invoice_period_end"),
    
    SUBSCRIPTION_TERM_END("subscription_term_end"),
    
    UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api");

    private String value;

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

    public String getValue() {
      return value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    public static CancelAtEnum fromValue(String value) {
      for (CancelAtEnum b : CancelAtEnum.values()) {
        if (b.value.equals(value)) {
          return b;
        }
      }
      throw new IllegalArgumentException("Unexpected value '" + value + "'");
    }

    public static class Adapter extends TypeAdapter {
      @Override
      public void write(final JsonWriter jsonWriter, final CancelAtEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

      @Override
      public CancelAtEnum read(final JsonReader jsonReader) throws IOException {
        String value =  jsonReader.nextString();
        return CancelAtEnum.fromValue(value);
      }
    }
  }

  public static final String SERIALIZED_NAME_CANCEL_AT = "cancel_at";
  @SerializedName(SERIALIZED_NAME_CANCEL_AT)
  private CancelAtEnum cancelAt;

  public static final String SERIALIZED_NAME_PROCESSING_OPTIONS = "processing_options";
  @SerializedName(SERIALIZED_NAME_PROCESSING_OPTIONS)
  private ProcessingOptions processingOptions;

  public static final String SERIALIZED_NAME_REFUND_AMOUNT = "refund_amount";
  @SerializedName(SERIALIZED_NAME_REFUND_AMOUNT)
  private BigDecimal refundAmount;

  public static final String SERIALIZED_NAME_WRITE_OFF = "write_off";
  @SerializedName(SERIALIZED_NAME_WRITE_OFF)
  private Boolean writeOff = false;

  public static final String SERIALIZED_NAME_WRITE_OFF_BEHAVIOR = "write_off_behavior";
  @SerializedName(SERIALIZED_NAME_WRITE_OFF_BEHAVIOR)
  private WriteOffSuscriptionRequest writeOffBehavior;

  public static final String SERIALIZED_NAME_CUSTOM_FIELDS = "custom_fields";
  @SerializedName(SERIALIZED_NAME_CUSTOM_FIELDS)
  @JsonAdapter(CustomFieldAdapter.class)
  private Map customFields = null;

  public static final String SERIALIZED_NAME_CHANGE_REASON = "change_reason";
  @SerializedName(SERIALIZED_NAME_CHANGE_REASON)
  private String changeReason;

  public CancelSubscriptionRequest() { 
  }

  public CancelSubscriptionRequest cancelDate(String cancelDate) {
    
    this.cancelDate = cancelDate;
    return this;
  }

   /**
   * Date on which the subscription is canceled.
   * @return cancelDate
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Date on which the subscription is canceled.")

  public String getCancelDate() {
    return cancelDate;
  }


  public void setCancelDate(String cancelDate) {
    this.cancelDate = cancelDate;
  }


  public CancelSubscriptionRequest cancelAt(CancelAtEnum cancelAt) {
    
    this.cancelAt = cancelAt;
    return this;
  }

   /**
   * The date on which the subscription is canceled. Can be either the end of the subscription term or the end of the billing period.
   * @return cancelAt
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "The date on which the subscription is canceled. Can be either the end of the subscription term or the end of the billing period.")

  public CancelAtEnum getCancelAt() {
    return cancelAt;
  }


  public void setCancelAt(CancelAtEnum cancelAt) {
    this.cancelAt = cancelAt;
  }


  public CancelSubscriptionRequest processingOptions(ProcessingOptions processingOptions) {
    
    this.processingOptions = processingOptions;
    return this;
  }

   /**
   * Processing options for the invoice or payment.
   * @return processingOptions
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Processing options for the invoice or payment.")

  public ProcessingOptions getProcessingOptions() {
    return processingOptions;
  }


  public void setProcessingOptions(ProcessingOptions processingOptions) {
    this.processingOptions = processingOptions;
  }


  public CancelSubscriptionRequest refundAmount(BigDecimal refundAmount) {
    
    this.refundAmount = refundAmount;
    return this;
  }

   /**
   * Amount to be refunded
   * @return refundAmount
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Amount to be refunded")

  public BigDecimal getRefundAmount() {
    return refundAmount;
  }


  public void setRefundAmount(BigDecimal refundAmount) {
    this.refundAmount = refundAmount;
  }


  public CancelSubscriptionRequest writeOff(Boolean writeOff) {
    
    this.writeOff = writeOff;
    return this;
  }

   /**
   * Indicates whether to write off the outstanding balance on the invoice after canceling the subscription.
   * @return writeOff
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Indicates whether to write off the outstanding balance on the invoice after canceling the subscription.")

  public Boolean getWriteOff() {
    return writeOff;
  }


  public void setWriteOff(Boolean writeOff) {
    this.writeOff = writeOff;
  }


  public CancelSubscriptionRequest writeOffBehavior(WriteOffSuscriptionRequest writeOffBehavior) {
    
    this.writeOffBehavior = writeOffBehavior;
    return this;
  }

   /**
   * Get writeOffBehavior
   * @return writeOffBehavior
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "")

  public WriteOffSuscriptionRequest getWriteOffBehavior() {
    return writeOffBehavior;
  }


  public void setWriteOffBehavior(WriteOffSuscriptionRequest writeOffBehavior) {
    this.writeOffBehavior = writeOffBehavior;
  }


  public CancelSubscriptionRequest customFields(Map customFields) {
    
    this.customFields = customFields;
    return this;
  }

  public CancelSubscriptionRequest putCustomFieldsItem(String key, String customFieldsItem) {
    if (this.customFields == null) {
      this.customFields = new HashMap();
    }
    this.customFields.put(key, customFieldsItem);
    return this;
  }

   /**
   * Set of user-defined fields associated with this object. Useful for storing additional information about the object in a structured format.
   * @return customFields
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "Set of user-defined fields associated with this object. Useful for storing additional information about the object in a structured format.")

  public Map getCustomFields() {
    return customFields;
  }


  public void setCustomFields(Map customFields) {
    this.customFields = customFields;
  }


  public CancelSubscriptionRequest changeReason(String changeReason) {
    
    this.changeReason = changeReason;
    return this;
  }

   /**
   * A brief description of the reason for this change.
   * @return changeReason
  **/
  @javax.annotation.Nullable
  @ApiModelProperty(value = "A brief description of the reason for this change.")

  public String getChangeReason() {
    return changeReason;
  }


  public void setChangeReason(String changeReason) {
    this.changeReason = changeReason;
  }


  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    CancelSubscriptionRequest cancelSubscriptionRequest = (CancelSubscriptionRequest) o;
    return Objects.equals(this.cancelDate, cancelSubscriptionRequest.cancelDate) &&
        Objects.equals(this.cancelAt, cancelSubscriptionRequest.cancelAt) &&
        Objects.equals(this.processingOptions, cancelSubscriptionRequest.processingOptions) &&
        Objects.equals(this.refundAmount, cancelSubscriptionRequest.refundAmount) &&
        Objects.equals(this.writeOff, cancelSubscriptionRequest.writeOff) &&
        Objects.equals(this.writeOffBehavior, cancelSubscriptionRequest.writeOffBehavior) &&
        Objects.equals(this.customFields, cancelSubscriptionRequest.customFields) &&
        Objects.equals(this.changeReason, cancelSubscriptionRequest.changeReason);
  }

  private static  boolean equalsNullable(JsonNullable a, JsonNullable b) {
    return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
  }

  @Override
  public int hashCode() {
    return Objects.hash(cancelDate, cancelAt, processingOptions, refundAmount, writeOff, writeOffBehavior, customFields, changeReason);
  }

  private static  int hashCodeNullable(JsonNullable a) {
    if (a == null) {
      return 1;
    }
    return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class CancelSubscriptionRequest {\n");
    sb.append("    cancelDate: ").append(toIndentedString(cancelDate)).append("\n");
    sb.append("    cancelAt: ").append(toIndentedString(cancelAt)).append("\n");
    sb.append("    processingOptions: ").append(toIndentedString(processingOptions)).append("\n");
    sb.append("    refundAmount: ").append(toIndentedString(refundAmount)).append("\n");
    sb.append("    writeOff: ").append(toIndentedString(writeOff)).append("\n");
    sb.append("    writeOffBehavior: ").append(toIndentedString(writeOffBehavior)).append("\n");
    sb.append("    customFields: ").append(toIndentedString(customFields)).append("\n");
    sb.append("    changeReason: ").append(toIndentedString(changeReason)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy