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

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

The 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 lombok.Data;

@Data

public class SubscriptionGetResponse {
  @SerializedName("amount_due")
  private BigDecimal amountDue = null;
  @SerializedName("amount_total")
  private BigDecimal amountTotal = null;
  @SerializedName("created")
  private OffsetDateTime created = null;
  @SerializedName("currency")
  private String currency = null;
  @SerializedName("customer")
  private SubscriptionCustomer customer = null;
  @SerializedName("description")
  private String description = null;
  @SerializedName("id")
  private String id = null;
  @SerializedName("interval")
  private Integer interval = null;
  @SerializedName("is_payment_date_shifted")
  private Boolean isPaymentDateShifted = null;
  @SerializedName("next_payment")
  private NextSubscriptionPayment nextPayment = null;
  @SerializedName("payments_due")
  private Integer paymentsDue = null;
  @SerializedName("pending_plan_update")
  private SubscriptionPendingPlanUpdate pendingPlanUpdate = null;
  /**
   * Period of subscription
   */
  @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("plan")
  private SubscriptionGetResponsePlan plan = null;
  @SerializedName("retries")
  private Integer retries = null;
  /**
   * Status of subscription
   */
  @JsonAdapter(StatusEnum.Adapter.class)
  public enum StatusEnum {
    ACTIVE("ACTIVE"),
    
    INACTIVE("INACTIVE"),
    
    CANCELLED("CANCELLED"),
    
    PAST_DUE("PAST_DUE"),
    
    PENDING("PENDING"),
    
    COMPLETED("COMPLETED"),
    
    CARD_EXPIRED("CARD_EXPIRED"),
    
    ACTIVATION_FAILED("ACTIVATION_FAILED"),
    
    UNPAID("UNPAID"),
    
    WAITING("WAITING");

    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;
  @SerializedName("status_reason")
  private String statusReason = null;
  @SerializedName("subscription_start")
  private OffsetDateTime subscriptionStart = null;
  /**
   * Recurring payment type name; can be ONECLICK, SCHEDULED, INSTALLMENT
   */
  @JsonAdapter(TypeEnum.Adapter.class)
  public enum TypeEnum {
    ONECLICK("ONECLICK"),
    
    SCHEDULED("SCHEDULED"),
    
    INSTALLMENT("INSTALLMENT");

    private String value;

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

    public String getValue() {
      return value;
    }

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

    public static TypeEnum fromValue(String text) {
      for (TypeEnum b : TypeEnum.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 TypeEnum enumeration) throws IOException {
        jsonWriter.value(enumeration.getValue());
      }

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

  @SerializedName("type")
  private TypeEnum type = null;
  @SerializedName("units")
  private Integer units = null;
  
  public void setAmountDue(BigDecimal amountDue) {
      this.amountDue = amountDue;
  }

  /**
   * @param amountDue Amount of payments left to be captured
   * @return bean instance
   **/
  public SubscriptionGetResponse amountDue(BigDecimal amountDue) {
      this.amountDue = amountDue;
      return this;
  }

  
  public void setAmountTotal(BigDecimal amountTotal) {
      this.amountTotal = amountTotal;
  }

  /**
   * @param amountTotal Total amount of subscription to be paid before completion
   * @return bean instance
   **/
  public SubscriptionGetResponse amountTotal(BigDecimal amountTotal) {
      this.amountTotal = amountTotal;
      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 SubscriptionGetResponse created(OffsetDateTime created) {
      this.created = created;
      return this;
  }

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

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

  
  public void setCustomer(SubscriptionCustomer customer) {
      this.customer = customer;
  }

  /**
   * @param customer Customer data
   * @return bean instance
   **/
  public SubscriptionGetResponse customer(SubscriptionCustomer customer) {
      this.customer = customer;
      return this;
  }

  
  public void setDescription(String description) {
      this.description = description;
  }

  /**
   * @param description Description of subscription
   * @return bean instance
   **/
  public SubscriptionGetResponse description(String description) {
      this.description = description;
      return this;
  }

  
  public void setId(String id) {
      this.id = id;
  }

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

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

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

  
  public void setIsPaymentDateShifted(Boolean isPaymentDateShifted) {
      this.isPaymentDateShifted = isPaymentDateShifted;
  }

  /**
   * @param isPaymentDateShifted A sign of whether it is possible to change the subscription payment date, because it has already been changed before `true` - can't change `false` - can change
   * @return bean instance
   **/
  public SubscriptionGetResponse isPaymentDateShifted(Boolean isPaymentDateShifted) {
      this.isPaymentDateShifted = isPaymentDateShifted;
      return this;
  }

  
  public void setNextPayment(NextSubscriptionPayment nextPayment) {
      this.nextPayment = nextPayment;
  }

  /**
   * @param nextPayment Next payment data
   * @return bean instance
   **/
  public SubscriptionGetResponse nextPayment(NextSubscriptionPayment nextPayment) {
      this.nextPayment = nextPayment;
      return this;
  }

  
  public void setPaymentsDue(Integer paymentsDue) {
      this.paymentsDue = paymentsDue;
  }

  /**
   * @param paymentsDue Number of payments left to be captured
   * @return bean instance
   **/
  public SubscriptionGetResponse paymentsDue(Integer paymentsDue) {
      this.paymentsDue = paymentsDue;
      return this;
  }

  
  public void setPendingPlanUpdate(SubscriptionPendingPlanUpdate pendingPlanUpdate) {
      this.pendingPlanUpdate = pendingPlanUpdate;
  }

  /**
   * @param pendingPlanUpdate Pending plan update data
   * @return bean instance
   **/
  public SubscriptionGetResponse pendingPlanUpdate(SubscriptionPendingPlanUpdate pendingPlanUpdate) {
      this.pendingPlanUpdate = pendingPlanUpdate;
      return this;
  }

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

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

  
  public void setPlan(SubscriptionGetResponsePlan plan) {
      this.plan = plan;
  }

  /**
   * @param plan Plan data
   * @return bean instance
   **/
  public SubscriptionGetResponse plan(SubscriptionGetResponsePlan plan) {
      this.plan = plan;
      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.
   * @return bean instance
   **/
  public SubscriptionGetResponse retries(Integer retries) {
      this.retries = retries;
      return this;
  }

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

  /**
   * @param status Status of subscription
   * @return bean instance
   **/
  public SubscriptionGetResponse status(StatusEnum status) {
      this.status = status;
      return this;
  }

  
  public void setStatusReason(String statusReason) {
      this.statusReason = statusReason;
  }

  /**
   * @param statusReason Reason of subscription cancellation that was made by CardPay
   * @return bean instance
   **/
  public SubscriptionGetResponse statusReason(String statusReason) {
      this.statusReason = statusReason;
      return this;
  }

  
  public void setSubscriptionStart(OffsetDateTime subscriptionStart) {
      this.subscriptionStart = subscriptionStart;
  }

  /**
   * @param subscriptionStart The time in 'yyyy-MM-dd' format when subscription actually becomes activated (grace period)
   * @return bean instance
   **/
  public SubscriptionGetResponse subscriptionStart(OffsetDateTime subscriptionStart) {
      this.subscriptionStart = subscriptionStart;
      return this;
  }

  
  public void setType(TypeEnum type) {
      this.type = type;
  }

  /**
   * @param type Recurring payment type name; can be ONECLICK, SCHEDULED, INSTALLMENT
   * @return bean instance
   **/
  public SubscriptionGetResponse type(TypeEnum type) {
      this.type = type;
      return this;
  }

  
  public void setUnits(Integer units) {
      this.units = units;
  }

  /**
   * @param units Units quantity of the subscription, who can consume their service.
   * @return bean instance
   **/
  public SubscriptionGetResponse units(Integer units) {
      this.units = units;
      return this;
  }


  @Override
  public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("SubscriptionGetResponse( ");
     
     if (amountDue != null) sb.append("amountDue=").append(amountDue.toString()).append("; ");
     if (amountTotal != null) sb.append("amountTotal=").append(amountTotal.toString()).append("; ");
     if (created != null) sb.append("created=").append(created.toString()).append("; ");
     if (currency != null) sb.append("currency=").append(currency.toString()).append("; ");
     if (customer != null) sb.append("customer=").append(customer.toString()).append("; ");
     if (description != null) sb.append("description=").append(description.toString()).append("; ");
     if (id != null) sb.append("id=").append(id.toString()).append("; ");
     if (interval != null) sb.append("interval=").append(interval.toString()).append("; ");
     if (isPaymentDateShifted != null) sb.append("isPaymentDateShifted=").append(isPaymentDateShifted.toString()).append("; ");
     if (nextPayment != null) sb.append("nextPayment=").append(nextPayment.toString()).append("; ");
     if (paymentsDue != null) sb.append("paymentsDue=").append(paymentsDue.toString()).append("; ");
     if (pendingPlanUpdate != null) sb.append("pendingPlanUpdate=").append(pendingPlanUpdate.toString()).append("; ");
     if (period != null) sb.append("period=").append(period.toString()).append("; ");
     if (plan != null) sb.append("plan=").append(plan.toString()).append("; ");
     if (retries != null) sb.append("retries=").append(retries.toString()).append("; ");
     if (status != null) sb.append("status=").append(status.toString()).append("; ");
     if (statusReason != null) sb.append("statusReason=").append(statusReason.toString()).append("; ");
     if (subscriptionStart != null) sb.append("subscriptionStart=").append(subscriptionStart.toString()).append("; ");
     if (type != null) sb.append("type=").append(type.toString()).append("; ");
     if (units != null) sb.append("units=").append(units.toString()).append("; ");
     sb.append(")");
     return sb.toString();
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy