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

com.cardpay.sdk.model.PlanRetry 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.util.ArrayList;
import java.util.List;
import lombok.Data;

@Data

public class PlanRetry {
  @SerializedName("duration")
  private Integer duration = null;
  @SerializedName("frequency")
  private List frequency = null;
  /**
   * Retry mode
   */
  @JsonAdapter(ModeEnum.Adapter.class)
  public enum ModeEnum {
    DEFAULT("DEFAULT"),
    
    INTERVAL("INTERVAL"),
    
    CALENDAR("CALENDAR"),
    
    NO_RETRY("NO_RETRY");

    private String value;

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

    public String getValue() {
      return value;
    }

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

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

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

  @SerializedName("mode")
  private ModeEnum mode = null;
  @SerializedName("retry_advice")
  private Boolean retryAdvice = null;
  @SerializedName("schedule")
  private List schedule = null;
  
  public void setDuration(Integer duration) {
      this.duration = duration;
  }

  /**
   * minimum: 1
   * maximum: 30
   * @param duration Value of period time which is retry available for subscription in days. Mandatory, if mode = DEFAULT Possible values: min: 1 max: 30
   * @return bean instance
   **/
  public PlanRetry duration(Integer duration) {
      this.duration = duration;
      return this;
  }

  
  public void setFrequency(List frequency) {
      this.frequency = frequency;
  }

  /**
   * @param frequency Intervals for initiating reties. Mandatory, if mode = INTERVAL Possible element values in array: min: 1 max: 30
   * @return bean instance
   **/
  public PlanRetry frequency(List frequency) {
      this.frequency = frequency;
      return this;
  }

  public PlanRetry addFrequencyItem(Integer frequencyItem) {
    if (this.frequency == null) {
      this.frequency = new ArrayList<>();
    }
    this.frequency.add(frequencyItem);
    return this;
  }

  
  public void setMode(ModeEnum mode) {
      this.mode = mode;
  }

  /**
   * @param mode Retry mode
   * @return bean instance
   **/
  public PlanRetry mode(ModeEnum mode) {
      this.mode = mode;
      return this;
  }

  
  public void setRetryAdvice(Boolean retryAdvice) {
      this.retryAdvice = retryAdvice;
  }

  /**
   * @param retryAdvice If value is true MAC recommendation will be applied, if false retry will be strictly according setting for retry Can be only for mode = INTERVAL (if not specified then default value is 'true')
   * @return bean instance
   **/
  public PlanRetry retryAdvice(Boolean retryAdvice) {
      this.retryAdvice = retryAdvice;
      return this;
  }

  
  public void setSchedule(List schedule) {
      this.schedule = schedule;
  }

  /**
   * @param schedule Intervals for initiating reties. Mandatory, if mode = CALENDAR Possible element values in array: min: 1 max: 30
   * @return bean instance
   **/
  public PlanRetry schedule(List schedule) {
      this.schedule = schedule;
      return this;
  }

  public PlanRetry addScheduleItem(Integer scheduleItem) {
    if (this.schedule == null) {
      this.schedule = new ArrayList<>();
    }
    this.schedule.add(scheduleItem);
    return this;
  }


  @Override
  public String toString() {
     StringBuilder sb = new StringBuilder();
     sb.append("PlanRetry( ");
     
     if (duration != null) sb.append("duration=").append(duration.toString()).append("; ");
     if (frequency != null) sb.append("frequency=").append(frequency.toString()).append("; ");
     if (mode != null) sb.append("mode=").append(mode.toString()).append("; ");
     if (retryAdvice != null) sb.append("retryAdvice=").append(retryAdvice.toString()).append("; ");
     if (schedule != null) sb.append("schedule=").append(schedule.toString()).append("; ");
     sb.append(")");
     return sb.toString();
  }

}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy