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

com.cardpay.sdk.model.ResponsePlanData Maven / Gradle / Ivy

There is a newer version: 3.82.1
Show newest version
/*
 * CardPay REST API
 * Welcome to the CardPay REST API. The CardPay API uses HTTP verbs and a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) resources endpoint structure (see more info about REST). Request and response payloads are formatted as JSON. Merchant uses API to create payments, refunds, payouts or recurrings, check or update transaction status and get information about created transactions. In API authentication process based on [OAuth 2.0](https://oauth.net/2/) standard. For recent changes see changelog section.
 *
 * OpenAPI spec version: 3.0
 * 
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */


package com.cardpay.sdk.model;

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 java.io.IOException;
import java.math.BigDecimal;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;

@Data

public class ResponsePlanData {
  @SerializedName("id")
  private String id = null;
  @SerializedName("name")
  private String name = null;
  @SerializedName("created")
  private OffsetDateTime created = null;
  /**
   * Status of created plan: 'ACTIVE' or 'INACTIVE'
   */
  @JsonAdapter(StatusEnum.Adapter.class)
  public enum StatusEnum {
    ACTIVE("ACTIVE"),
    
    INACTIVE("INACTIVE");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static StatusEnum fromValue(String text) {
      for (StatusEnum b : StatusEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }

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

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

  @SerializedName("status")
  private StatusEnum status = null;
  /**
   * Period of created plan
   */
  @JsonAdapter(PeriodEnum.Adapter.class)
  public enum PeriodEnum {
    MINUTE("minute"),
    
    DAY("day"),
    
    WEEK("week"),
    
    MONTH("month"),
    
    YEAR("year");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static PeriodEnum fromValue(String text) {
      for (PeriodEnum b : PeriodEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }

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

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

  @SerializedName("period")
  private PeriodEnum period = null;
  @SerializedName("interval")
  private Integer interval = null;
  @SerializedName("currency")
  private String currency = null;
  @SerializedName("amount")
  private BigDecimal amount = null;
  @SerializedName("retries")
  private Integer retries = null;
  @SerializedName("pricing_model")
  private String pricingModel = null;
  @SerializedName("quantity")
  private List quantity = null;
  @SerializedName("retry")
  private PlanRetryResponse retry = null;
  @SerializedName("subscription_decline_logic")
  private PlanSubscriptionDeclineLogic subscriptionDeclineLogic = null;
  
  public void setId(String id) {
      this.id = id;
  }

  /**
   * @param id ID of created plan
   * @return bean instance
   **/
  public ResponsePlanData id(String id) {
      this.id = id;
      return this;
  }

  
  public void setName(String name) {
      this.name = name;
  }

  /**
   * @param name Name of created plan
   * @return bean instance
   **/
  public ResponsePlanData name(String name) {
      this.name = name;
      return this;
  }

  
  public void setCreated(OffsetDateTime created) {
      this.created = created;
  }

  /**
   * @param created Creation time, [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format
   * @return bean instance
   **/
  public ResponsePlanData created(OffsetDateTime created) {
      this.created = created;
      return this;
  }

  
  public void setStatus(StatusEnum status) {
      this.status = status;
  }

  /**
   * @param status Status of created plan: 'ACTIVE' or 'INACTIVE'
   * @return bean instance
   **/
  public ResponsePlanData status(StatusEnum status) {
      this.status = status;
      return this;
  }

  
  public void setPeriod(PeriodEnum period) {
      this.period = period;
  }

  /**
   * @param period Period of created plan
   * @return bean instance
   **/
  public ResponsePlanData period(PeriodEnum period) {
      this.period = period;
      return this;
  }

  
  public void setInterval(Integer interval) {
      this.interval = interval;
  }

  /**
   * @param interval Interval of plan
   * @return bean instance
   **/
  public ResponsePlanData interval(Integer interval) {
      this.interval = interval;
      return this;
  }

  
  public void setCurrency(String currency) {
      this.currency = currency;
  }

  /**
   * @param currency [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of created plan
   * @return bean instance
   **/
  public ResponsePlanData currency(String currency) {
      this.currency = currency;
      return this;
  }

  
  public void setAmount(BigDecimal amount) {
      this.amount = amount;
  }

  /**
   * @param amount The total amount of created plan
   * @return bean instance
   **/
  public ResponsePlanData amount(BigDecimal amount) {
      this.amount = amount;
      return this;
  }

  
  public void setRetries(Integer retries) {
      this.retries = retries;
  }

  /**
   * @param retries Number of daily basis retry attempts in case of payment has not been captured successfully, from 1 to 15 attempts
   * @return bean instance
   **/
  public ResponsePlanData retries(Integer retries) {
      this.retries = retries;
      return this;
  }

  
  public void setPricingModel(String pricingModel) {
      this.pricingModel = pricingModel;
  }

  /**
   * @param pricingModel Parameter regulates the price calculation pricing_model depending on the number of units. Possible values: `FIXED` `TIERED` `VOLUME`
   * @return bean instance
   **/
  public ResponsePlanData pricingModel(String pricingModel) {
      this.pricingModel = pricingModel;
      return this;
  }

  
  public void setQuantity(List quantity) {
      this.quantity = quantity;
  }

  /**
   * @param quantity Array with units params
   * @return bean instance
   **/
  public ResponsePlanData quantity(List quantity) {
      this.quantity = quantity;
      return this;
  }

  public ResponsePlanData addQuantityItem(PlanQuantity quantityItem) {
    if (this.quantity == null) {
      this.quantity = new ArrayList<>();
    }
    this.quantity.add(quantityItem);
    return this;
  }

  
  public void setRetry(PlanRetryResponse retry) {
      this.retry = retry;
  }

  /**
   * @param retry Retry
   * @return bean instance
   **/
  public ResponsePlanData retry(PlanRetryResponse retry) {
      this.retry = retry;
      return this;
  }

  
  public void setSubscriptionDeclineLogic(PlanSubscriptionDeclineLogic subscriptionDeclineLogic) {
      this.subscriptionDeclineLogic = subscriptionDeclineLogic;
  }

  /**
   * @param subscriptionDeclineLogic Subscription decline logic
   * @return bean instance
   **/
  public ResponsePlanData subscriptionDeclineLogic(PlanSubscriptionDeclineLogic subscriptionDeclineLogic) {
      this.subscriptionDeclineLogic = subscriptionDeclineLogic;
      return this;
  }


  @Override
  public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("ResponsePlanData( ");
     
     if (id != null) sb.append("id=").append(id.toString()).append("; ");
     if (name != null) sb.append("name=").append(name.toString()).append("; ");
     if (created != null) sb.append("created=").append(created.toString()).append("; ");
     if (status != null) sb.append("status=").append(status.toString()).append("; ");
     if (period != null) sb.append("period=").append(period.toString()).append("; ");
     if (interval != null) sb.append("interval=").append(interval.toString()).append("; ");
     if (currency != null) sb.append("currency=").append(currency.toString()).append("; ");
     if (amount != null) sb.append("amount=").append(amount.toString()).append("; ");
     if (retries != null) sb.append("retries=").append(retries.toString()).append("; ");
     if (pricingModel != null) sb.append("pricingModel=").append(pricingModel.toString()).append("; ");
     if (quantity != null) sb.append("quantity=").append(quantity.toString()).append("; ");
     if (retry != null) sb.append("retry=").append(retry.toString()).append("; ");
     if (subscriptionDeclineLogic != null) sb.append("subscriptionDeclineLogic=").append(subscriptionDeclineLogic.toString()).append("; ");
     sb.append(")");
     return sb.toString();
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy