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

com.rbkmoney.damsel.fraudbusters.Refund Maven / Gradle / Ivy

/**
 * Autogenerated by Thrift Compiler (1.0.0-dev)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package com.rbkmoney.damsel.fraudbusters;

import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;

import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@Generated(value = "Autogenerated by Thrift Compiler (1.0.0-dev)", date = "2021-07-15")
public class Refund implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Refund");

  private static final org.apache.thrift.protocol.TField ID_FIELD_DESC = new org.apache.thrift.protocol.TField("id", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField PAYMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("payment_id", org.apache.thrift.protocol.TType.STRING, (short)2);
  private static final org.apache.thrift.protocol.TField EVENT_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("event_time", org.apache.thrift.protocol.TType.STRING, (short)3);
  private static final org.apache.thrift.protocol.TField REFERENCE_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("reference_info", org.apache.thrift.protocol.TType.STRUCT, (short)4);
  private static final org.apache.thrift.protocol.TField PAYMENT_TOOL_FIELD_DESC = new org.apache.thrift.protocol.TField("payment_tool", org.apache.thrift.protocol.TType.STRUCT, (short)5);
  private static final org.apache.thrift.protocol.TField COST_FIELD_DESC = new org.apache.thrift.protocol.TField("cost", org.apache.thrift.protocol.TType.STRUCT, (short)6);
  private static final org.apache.thrift.protocol.TField PROVIDER_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("provider_info", org.apache.thrift.protocol.TType.STRUCT, (short)7);
  private static final org.apache.thrift.protocol.TField STATUS_FIELD_DESC = new org.apache.thrift.protocol.TField("status", org.apache.thrift.protocol.TType.I32, (short)8);
  private static final org.apache.thrift.protocol.TField ERROR_FIELD_DESC = new org.apache.thrift.protocol.TField("error", org.apache.thrift.protocol.TType.STRUCT, (short)9);
  private static final org.apache.thrift.protocol.TField CLIENT_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("client_info", org.apache.thrift.protocol.TType.STRUCT, (short)10);
  private static final org.apache.thrift.protocol.TField PAYER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("payer_type", org.apache.thrift.protocol.TType.I32, (short)11);

  private static final SchemeFactory STANDARD_SCHEME_FACTORY = new RefundStandardSchemeFactory();
  private static final SchemeFactory TUPLE_SCHEME_FACTORY = new RefundTupleSchemeFactory();

  public String id; // required
  public String payment_id; // required
  public String event_time; // required
  public ReferenceInfo reference_info; // required
  public com.rbkmoney.damsel.domain.PaymentTool payment_tool; // required
  public com.rbkmoney.damsel.domain.Cash cost; // required
  public ProviderInfo provider_info; // required
  /**
   * 
   * @see RefundStatus
   */
  public RefundStatus status; // required
  public Error error; // optional
  public ClientInfo client_info; // required
  /**
   * 
   * @see PayerType
   */
  public PayerType payer_type; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    ID((short)1, "id"),
    PAYMENT_ID((short)2, "payment_id"),
    EVENT_TIME((short)3, "event_time"),
    REFERENCE_INFO((short)4, "reference_info"),
    PAYMENT_TOOL((short)5, "payment_tool"),
    COST((short)6, "cost"),
    PROVIDER_INFO((short)7, "provider_info"),
    /**
     * 
     * @see RefundStatus
     */
    STATUS((short)8, "status"),
    ERROR((short)9, "error"),
    CLIENT_INFO((short)10, "client_info"),
    /**
     * 
     * @see PayerType
     */
    PAYER_TYPE((short)11, "payer_type");

    private static final Map byName = new HashMap();

    static {
      for (_Fields field : EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // ID
          return ID;
        case 2: // PAYMENT_ID
          return PAYMENT_ID;
        case 3: // EVENT_TIME
          return EVENT_TIME;
        case 4: // REFERENCE_INFO
          return REFERENCE_INFO;
        case 5: // PAYMENT_TOOL
          return PAYMENT_TOOL;
        case 6: // COST
          return COST;
        case 7: // PROVIDER_INFO
          return PROVIDER_INFO;
        case 8: // STATUS
          return STATUS;
        case 9: // ERROR
          return ERROR;
        case 10: // CLIENT_INFO
          return CLIENT_INFO;
        case 11: // PAYER_TYPE
          return PAYER_TYPE;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    public static _Fields findByName(String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final String _fieldName;

    _Fields(short thriftId, String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final _Fields optionals[] = {_Fields.ERROR,_Fields.PAYER_TYPE};
  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.ID, new org.apache.thrift.meta_data.FieldMetaData("id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.PAYMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("payment_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.EVENT_TIME, new org.apache.thrift.meta_data.FieldMetaData("event_time", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.REFERENCE_INFO, new org.apache.thrift.meta_data.FieldMetaData("reference_info", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ReferenceInfo.class)));
    tmpMap.put(_Fields.PAYMENT_TOOL, new org.apache.thrift.meta_data.FieldMetaData("payment_tool", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.damsel.domain.PaymentTool.class)));
    tmpMap.put(_Fields.COST, new org.apache.thrift.meta_data.FieldMetaData("cost", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, com.rbkmoney.damsel.domain.Cash.class)));
    tmpMap.put(_Fields.PROVIDER_INFO, new org.apache.thrift.meta_data.FieldMetaData("provider_info", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ProviderInfo.class)));
    tmpMap.put(_Fields.STATUS, new org.apache.thrift.meta_data.FieldMetaData("status", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, RefundStatus.class)));
    tmpMap.put(_Fields.ERROR, new org.apache.thrift.meta_data.FieldMetaData("error", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Error.class)));
    tmpMap.put(_Fields.CLIENT_INFO, new org.apache.thrift.meta_data.FieldMetaData("client_info", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ClientInfo.class)));
    tmpMap.put(_Fields.PAYER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("payer_type", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PayerType.class)));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Refund.class, metaDataMap);
  }

  public Refund() {
  }

  public Refund(
    String id,
    String payment_id,
    String event_time,
    ReferenceInfo reference_info,
    com.rbkmoney.damsel.domain.PaymentTool payment_tool,
    com.rbkmoney.damsel.domain.Cash cost,
    ProviderInfo provider_info,
    RefundStatus status,
    ClientInfo client_info)
  {
    this();
    this.id = id;
    this.payment_id = payment_id;
    this.event_time = event_time;
    this.reference_info = reference_info;
    this.payment_tool = payment_tool;
    this.cost = cost;
    this.provider_info = provider_info;
    this.status = status;
    this.client_info = client_info;
  }

  /**
   * Performs a deep copy on other.
   */
  public Refund(Refund other) {
    if (other.isSetId()) {
      this.id = other.id;
    }
    if (other.isSetPaymentId()) {
      this.payment_id = other.payment_id;
    }
    if (other.isSetEventTime()) {
      this.event_time = other.event_time;
    }
    if (other.isSetReferenceInfo()) {
      this.reference_info = new ReferenceInfo(other.reference_info);
    }
    if (other.isSetPaymentTool()) {
      this.payment_tool = new com.rbkmoney.damsel.domain.PaymentTool(other.payment_tool);
    }
    if (other.isSetCost()) {
      this.cost = new com.rbkmoney.damsel.domain.Cash(other.cost);
    }
    if (other.isSetProviderInfo()) {
      this.provider_info = new ProviderInfo(other.provider_info);
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    if (other.isSetError()) {
      this.error = new Error(other.error);
    }
    if (other.isSetClientInfo()) {
      this.client_info = new ClientInfo(other.client_info);
    }
    if (other.isSetPayerType()) {
      this.payer_type = other.payer_type;
    }
  }

  public Refund deepCopy() {
    return new Refund(this);
  }

  @Override
  public void clear() {
    this.id = null;
    this.payment_id = null;
    this.event_time = null;
    this.reference_info = null;
    this.payment_tool = null;
    this.cost = null;
    this.provider_info = null;
    this.status = null;
    this.error = null;
    this.client_info = null;
    this.payer_type = null;
  }

  public String getId() {
    return this.id;
  }

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

  public void unsetId() {
    this.id = null;
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return this.id != null;
  }

  public void setIdIsSet(boolean value) {
    if (!value) {
      this.id = null;
    }
  }

  public String getPaymentId() {
    return this.payment_id;
  }

  public Refund setPaymentId(String payment_id) {
    this.payment_id = payment_id;
    return this;
  }

  public void unsetPaymentId() {
    this.payment_id = null;
  }

  /** Returns true if field payment_id is set (has been assigned a value) and false otherwise */
  public boolean isSetPaymentId() {
    return this.payment_id != null;
  }

  public void setPaymentIdIsSet(boolean value) {
    if (!value) {
      this.payment_id = null;
    }
  }

  public String getEventTime() {
    return this.event_time;
  }

  public Refund setEventTime(String event_time) {
    this.event_time = event_time;
    return this;
  }

  public void unsetEventTime() {
    this.event_time = null;
  }

  /** Returns true if field event_time is set (has been assigned a value) and false otherwise */
  public boolean isSetEventTime() {
    return this.event_time != null;
  }

  public void setEventTimeIsSet(boolean value) {
    if (!value) {
      this.event_time = null;
    }
  }

  public ReferenceInfo getReferenceInfo() {
    return this.reference_info;
  }

  public Refund setReferenceInfo(ReferenceInfo reference_info) {
    this.reference_info = reference_info;
    return this;
  }

  public void unsetReferenceInfo() {
    this.reference_info = null;
  }

  /** Returns true if field reference_info is set (has been assigned a value) and false otherwise */
  public boolean isSetReferenceInfo() {
    return this.reference_info != null;
  }

  public void setReferenceInfoIsSet(boolean value) {
    if (!value) {
      this.reference_info = null;
    }
  }

  public com.rbkmoney.damsel.domain.PaymentTool getPaymentTool() {
    return this.payment_tool;
  }

  public Refund setPaymentTool(com.rbkmoney.damsel.domain.PaymentTool payment_tool) {
    this.payment_tool = payment_tool;
    return this;
  }

  public void unsetPaymentTool() {
    this.payment_tool = null;
  }

  /** Returns true if field payment_tool is set (has been assigned a value) and false otherwise */
  public boolean isSetPaymentTool() {
    return this.payment_tool != null;
  }

  public void setPaymentToolIsSet(boolean value) {
    if (!value) {
      this.payment_tool = null;
    }
  }

  public com.rbkmoney.damsel.domain.Cash getCost() {
    return this.cost;
  }

  public Refund setCost(com.rbkmoney.damsel.domain.Cash cost) {
    this.cost = cost;
    return this;
  }

  public void unsetCost() {
    this.cost = null;
  }

  /** Returns true if field cost is set (has been assigned a value) and false otherwise */
  public boolean isSetCost() {
    return this.cost != null;
  }

  public void setCostIsSet(boolean value) {
    if (!value) {
      this.cost = null;
    }
  }

  public ProviderInfo getProviderInfo() {
    return this.provider_info;
  }

  public Refund setProviderInfo(ProviderInfo provider_info) {
    this.provider_info = provider_info;
    return this;
  }

  public void unsetProviderInfo() {
    this.provider_info = null;
  }

  /** Returns true if field provider_info is set (has been assigned a value) and false otherwise */
  public boolean isSetProviderInfo() {
    return this.provider_info != null;
  }

  public void setProviderInfoIsSet(boolean value) {
    if (!value) {
      this.provider_info = null;
    }
  }

  /**
   * 
   * @see RefundStatus
   */
  public RefundStatus getStatus() {
    return this.status;
  }

  /**
   * 
   * @see RefundStatus
   */
  public Refund setStatus(RefundStatus status) {
    this.status = status;
    return this;
  }

  public void unsetStatus() {
    this.status = null;
  }

  /** Returns true if field status is set (has been assigned a value) and false otherwise */
  public boolean isSetStatus() {
    return this.status != null;
  }

  public void setStatusIsSet(boolean value) {
    if (!value) {
      this.status = null;
    }
  }

  public Error getError() {
    return this.error;
  }

  public Refund setError(Error error) {
    this.error = error;
    return this;
  }

  public void unsetError() {
    this.error = null;
  }

  /** Returns true if field error is set (has been assigned a value) and false otherwise */
  public boolean isSetError() {
    return this.error != null;
  }

  public void setErrorIsSet(boolean value) {
    if (!value) {
      this.error = null;
    }
  }

  public ClientInfo getClientInfo() {
    return this.client_info;
  }

  public Refund setClientInfo(ClientInfo client_info) {
    this.client_info = client_info;
    return this;
  }

  public void unsetClientInfo() {
    this.client_info = null;
  }

  /** Returns true if field client_info is set (has been assigned a value) and false otherwise */
  public boolean isSetClientInfo() {
    return this.client_info != null;
  }

  public void setClientInfoIsSet(boolean value) {
    if (!value) {
      this.client_info = null;
    }
  }

  /**
   * 
   * @see PayerType
   */
  public PayerType getPayerType() {
    return this.payer_type;
  }

  /**
   * 
   * @see PayerType
   */
  public Refund setPayerType(PayerType payer_type) {
    this.payer_type = payer_type;
    return this;
  }

  public void unsetPayerType() {
    this.payer_type = null;
  }

  /** Returns true if field payer_type is set (has been assigned a value) and false otherwise */
  public boolean isSetPayerType() {
    return this.payer_type != null;
  }

  public void setPayerTypeIsSet(boolean value) {
    if (!value) {
      this.payer_type = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case ID:
      if (value == null) {
        unsetId();
      } else {
        setId((String)value);
      }
      break;

    case PAYMENT_ID:
      if (value == null) {
        unsetPaymentId();
      } else {
        setPaymentId((String)value);
      }
      break;

    case EVENT_TIME:
      if (value == null) {
        unsetEventTime();
      } else {
        setEventTime((String)value);
      }
      break;

    case REFERENCE_INFO:
      if (value == null) {
        unsetReferenceInfo();
      } else {
        setReferenceInfo((ReferenceInfo)value);
      }
      break;

    case PAYMENT_TOOL:
      if (value == null) {
        unsetPaymentTool();
      } else {
        setPaymentTool((com.rbkmoney.damsel.domain.PaymentTool)value);
      }
      break;

    case COST:
      if (value == null) {
        unsetCost();
      } else {
        setCost((com.rbkmoney.damsel.domain.Cash)value);
      }
      break;

    case PROVIDER_INFO:
      if (value == null) {
        unsetProviderInfo();
      } else {
        setProviderInfo((ProviderInfo)value);
      }
      break;

    case STATUS:
      if (value == null) {
        unsetStatus();
      } else {
        setStatus((RefundStatus)value);
      }
      break;

    case ERROR:
      if (value == null) {
        unsetError();
      } else {
        setError((Error)value);
      }
      break;

    case CLIENT_INFO:
      if (value == null) {
        unsetClientInfo();
      } else {
        setClientInfo((ClientInfo)value);
      }
      break;

    case PAYER_TYPE:
      if (value == null) {
        unsetPayerType();
      } else {
        setPayerType((PayerType)value);
      }
      break;

    }
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case ID:
      return getId();

    case PAYMENT_ID:
      return getPaymentId();

    case EVENT_TIME:
      return getEventTime();

    case REFERENCE_INFO:
      return getReferenceInfo();

    case PAYMENT_TOOL:
      return getPaymentTool();

    case COST:
      return getCost();

    case PROVIDER_INFO:
      return getProviderInfo();

    case STATUS:
      return getStatus();

    case ERROR:
      return getError();

    case CLIENT_INFO:
      return getClientInfo();

    case PAYER_TYPE:
      return getPayerType();

    }
    throw new IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new IllegalArgumentException();
    }

    switch (field) {
    case ID:
      return isSetId();
    case PAYMENT_ID:
      return isSetPaymentId();
    case EVENT_TIME:
      return isSetEventTime();
    case REFERENCE_INFO:
      return isSetReferenceInfo();
    case PAYMENT_TOOL:
      return isSetPaymentTool();
    case COST:
      return isSetCost();
    case PROVIDER_INFO:
      return isSetProviderInfo();
    case STATUS:
      return isSetStatus();
    case ERROR:
      return isSetError();
    case CLIENT_INFO:
      return isSetClientInfo();
    case PAYER_TYPE:
      return isSetPayerType();
    }
    throw new IllegalStateException();
  }

  @Override
  public boolean equals(Object that) {
    if (that == null)
      return false;
    if (that instanceof Refund)
      return this.equals((Refund)that);
    return false;
  }

  public boolean equals(Refund that) {
    if (that == null)
      return false;

    boolean this_present_id = true && this.isSetId();
    boolean that_present_id = true && that.isSetId();
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (!this.id.equals(that.id))
        return false;
    }

    boolean this_present_payment_id = true && this.isSetPaymentId();
    boolean that_present_payment_id = true && that.isSetPaymentId();
    if (this_present_payment_id || that_present_payment_id) {
      if (!(this_present_payment_id && that_present_payment_id))
        return false;
      if (!this.payment_id.equals(that.payment_id))
        return false;
    }

    boolean this_present_event_time = true && this.isSetEventTime();
    boolean that_present_event_time = true && that.isSetEventTime();
    if (this_present_event_time || that_present_event_time) {
      if (!(this_present_event_time && that_present_event_time))
        return false;
      if (!this.event_time.equals(that.event_time))
        return false;
    }

    boolean this_present_reference_info = true && this.isSetReferenceInfo();
    boolean that_present_reference_info = true && that.isSetReferenceInfo();
    if (this_present_reference_info || that_present_reference_info) {
      if (!(this_present_reference_info && that_present_reference_info))
        return false;
      if (!this.reference_info.equals(that.reference_info))
        return false;
    }

    boolean this_present_payment_tool = true && this.isSetPaymentTool();
    boolean that_present_payment_tool = true && that.isSetPaymentTool();
    if (this_present_payment_tool || that_present_payment_tool) {
      if (!(this_present_payment_tool && that_present_payment_tool))
        return false;
      if (!this.payment_tool.equals(that.payment_tool))
        return false;
    }

    boolean this_present_cost = true && this.isSetCost();
    boolean that_present_cost = true && that.isSetCost();
    if (this_present_cost || that_present_cost) {
      if (!(this_present_cost && that_present_cost))
        return false;
      if (!this.cost.equals(that.cost))
        return false;
    }

    boolean this_present_provider_info = true && this.isSetProviderInfo();
    boolean that_present_provider_info = true && that.isSetProviderInfo();
    if (this_present_provider_info || that_present_provider_info) {
      if (!(this_present_provider_info && that_present_provider_info))
        return false;
      if (!this.provider_info.equals(that.provider_info))
        return false;
    }

    boolean this_present_status = true && this.isSetStatus();
    boolean that_present_status = true && that.isSetStatus();
    if (this_present_status || that_present_status) {
      if (!(this_present_status && that_present_status))
        return false;
      if (!this.status.equals(that.status))
        return false;
    }

    boolean this_present_error = true && this.isSetError();
    boolean that_present_error = true && that.isSetError();
    if (this_present_error || that_present_error) {
      if (!(this_present_error && that_present_error))
        return false;
      if (!this.error.equals(that.error))
        return false;
    }

    boolean this_present_client_info = true && this.isSetClientInfo();
    boolean that_present_client_info = true && that.isSetClientInfo();
    if (this_present_client_info || that_present_client_info) {
      if (!(this_present_client_info && that_present_client_info))
        return false;
      if (!this.client_info.equals(that.client_info))
        return false;
    }

    boolean this_present_payer_type = true && this.isSetPayerType();
    boolean that_present_payer_type = true && that.isSetPayerType();
    if (this_present_payer_type || that_present_payer_type) {
      if (!(this_present_payer_type && that_present_payer_type))
        return false;
      if (!this.payer_type.equals(that.payer_type))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetId()) ? 131071 : 524287);
    if (isSetId())
      hashCode = hashCode * 8191 + id.hashCode();

    hashCode = hashCode * 8191 + ((isSetPaymentId()) ? 131071 : 524287);
    if (isSetPaymentId())
      hashCode = hashCode * 8191 + payment_id.hashCode();

    hashCode = hashCode * 8191 + ((isSetEventTime()) ? 131071 : 524287);
    if (isSetEventTime())
      hashCode = hashCode * 8191 + event_time.hashCode();

    hashCode = hashCode * 8191 + ((isSetReferenceInfo()) ? 131071 : 524287);
    if (isSetReferenceInfo())
      hashCode = hashCode * 8191 + reference_info.hashCode();

    hashCode = hashCode * 8191 + ((isSetPaymentTool()) ? 131071 : 524287);
    if (isSetPaymentTool())
      hashCode = hashCode * 8191 + payment_tool.hashCode();

    hashCode = hashCode * 8191 + ((isSetCost()) ? 131071 : 524287);
    if (isSetCost())
      hashCode = hashCode * 8191 + cost.hashCode();

    hashCode = hashCode * 8191 + ((isSetProviderInfo()) ? 131071 : 524287);
    if (isSetProviderInfo())
      hashCode = hashCode * 8191 + provider_info.hashCode();

    hashCode = hashCode * 8191 + ((isSetStatus()) ? 131071 : 524287);
    if (isSetStatus())
      hashCode = hashCode * 8191 + status.getValue();

    hashCode = hashCode * 8191 + ((isSetError()) ? 131071 : 524287);
    if (isSetError())
      hashCode = hashCode * 8191 + error.hashCode();

    hashCode = hashCode * 8191 + ((isSetClientInfo()) ? 131071 : 524287);
    if (isSetClientInfo())
      hashCode = hashCode * 8191 + client_info.hashCode();

    hashCode = hashCode * 8191 + ((isSetPayerType()) ? 131071 : 524287);
    if (isSetPayerType())
      hashCode = hashCode * 8191 + payer_type.getValue();

    return hashCode;
  }

  @Override
  public int compareTo(Refund other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(other.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, other.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPaymentId()).compareTo(other.isSetPaymentId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPaymentId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payment_id, other.payment_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetEventTime()).compareTo(other.isSetEventTime());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetEventTime()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.event_time, other.event_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetReferenceInfo()).compareTo(other.isSetReferenceInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReferenceInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.reference_info, other.reference_info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPaymentTool()).compareTo(other.isSetPaymentTool());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPaymentTool()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payment_tool, other.payment_tool);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCost()).compareTo(other.isSetCost());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCost()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cost, other.cost);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProviderInfo()).compareTo(other.isSetProviderInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProviderInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.provider_info, other.provider_info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(other.isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetStatus()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.status, other.status);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetError()).compareTo(other.isSetError());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetError()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.error, other.error);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetClientInfo()).compareTo(other.isSetClientInfo());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetClientInfo()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.client_info, other.client_info);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPayerType()).compareTo(other.isSetPayerType());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPayerType()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.payer_type, other.payer_type);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public _Fields[] getFields() {
    return _Fields.values();
  }

  public Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> getFieldMetaData() {
    return metaDataMap;
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder("Refund(");
    boolean first = true;

    sb.append("id:");
    if (this.id == null) {
      sb.append("null");
    } else {
      sb.append(this.id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("payment_id:");
    if (this.payment_id == null) {
      sb.append("null");
    } else {
      sb.append(this.payment_id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("event_time:");
    if (this.event_time == null) {
      sb.append("null");
    } else {
      sb.append(this.event_time);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("reference_info:");
    if (this.reference_info == null) {
      sb.append("null");
    } else {
      sb.append(this.reference_info);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("payment_tool:");
    if (this.payment_tool == null) {
      sb.append("null");
    } else {
      sb.append(this.payment_tool);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("cost:");
    if (this.cost == null) {
      sb.append("null");
    } else {
      sb.append(this.cost);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("provider_info:");
    if (this.provider_info == null) {
      sb.append("null");
    } else {
      sb.append(this.provider_info);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      sb.append(this.status);
    }
    first = false;
    if (isSetError()) {
      if (!first) sb.append(", ");
      sb.append("error:");
      if (this.error == null) {
        sb.append("null");
      } else {
        sb.append(this.error);
      }
      first = false;
    }
    if (!first) sb.append(", ");
    sb.append("client_info:");
    if (this.client_info == null) {
      sb.append("null");
    } else {
      sb.append(this.client_info);
    }
    first = false;
    if (isSetPayerType()) {
      if (!first) sb.append(", ");
      sb.append("payer_type:");
      if (this.payer_type == null) {
        sb.append("null");
      } else {
        sb.append(this.payer_type);
      }
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (id == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'id' was not present! Struct: " + toString());
    }
    if (payment_id == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'payment_id' was not present! Struct: " + toString());
    }
    if (event_time == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'event_time' was not present! Struct: " + toString());
    }
    if (reference_info == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'reference_info' was not present! Struct: " + toString());
    }
    if (payment_tool == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'payment_tool' was not present! Struct: " + toString());
    }
    if (cost == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'cost' was not present! Struct: " + toString());
    }
    if (provider_info == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'provider_info' was not present! Struct: " + toString());
    }
    if (status == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'status' was not present! Struct: " + toString());
    }
    if (client_info == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'client_info' was not present! Struct: " + toString());
    }
    // check for sub-struct validity
    if (cost != null) {
      cost.validate();
    }
    if (provider_info != null) {
      provider_info.validate();
    }
    if (error != null) {
      error.validate();
    }
    if (client_info != null) {
      client_info.validate();
    }
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
    try {
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class RefundStandardSchemeFactory implements SchemeFactory {
    public RefundStandardScheme getScheme() {
      return new RefundStandardScheme();
    }
  }

  private static class RefundStandardScheme extends StandardScheme {

    public void read(org.apache.thrift.protocol.TProtocol iprot, Refund struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.id = iprot.readString();
              struct.setIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // PAYMENT_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.payment_id = iprot.readString();
              struct.setPaymentIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // EVENT_TIME
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.event_time = iprot.readString();
              struct.setEventTimeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // REFERENCE_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.reference_info = new ReferenceInfo();
              struct.reference_info.read(iprot);
              struct.setReferenceInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // PAYMENT_TOOL
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.payment_tool = new com.rbkmoney.damsel.domain.PaymentTool();
              struct.payment_tool.read(iprot);
              struct.setPaymentToolIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // COST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.cost = new com.rbkmoney.damsel.domain.Cash();
              struct.cost.read(iprot);
              struct.setCostIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // PROVIDER_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.provider_info = new ProviderInfo();
              struct.provider_info.read(iprot);
              struct.setProviderInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 8: // STATUS
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.status = com.rbkmoney.damsel.fraudbusters.RefundStatus.findByValue(iprot.readI32());
              struct.setStatusIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 9: // ERROR
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.error = new Error();
              struct.error.read(iprot);
              struct.setErrorIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 10: // CLIENT_INFO
            if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
              struct.client_info = new ClientInfo();
              struct.client_info.read(iprot);
              struct.setClientInfoIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 11: // PAYER_TYPE
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.payer_type = com.rbkmoney.damsel.fraudbusters.PayerType.findByValue(iprot.readI32());
              struct.setPayerTypeIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, Refund struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.id != null) {
        oprot.writeFieldBegin(ID_FIELD_DESC);
        oprot.writeString(struct.id);
        oprot.writeFieldEnd();
      }
      if (struct.payment_id != null) {
        oprot.writeFieldBegin(PAYMENT_ID_FIELD_DESC);
        oprot.writeString(struct.payment_id);
        oprot.writeFieldEnd();
      }
      if (struct.event_time != null) {
        oprot.writeFieldBegin(EVENT_TIME_FIELD_DESC);
        oprot.writeString(struct.event_time);
        oprot.writeFieldEnd();
      }
      if (struct.reference_info != null) {
        oprot.writeFieldBegin(REFERENCE_INFO_FIELD_DESC);
        struct.reference_info.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.payment_tool != null) {
        oprot.writeFieldBegin(PAYMENT_TOOL_FIELD_DESC);
        struct.payment_tool.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.cost != null) {
        oprot.writeFieldBegin(COST_FIELD_DESC);
        struct.cost.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.provider_info != null) {
        oprot.writeFieldBegin(PROVIDER_INFO_FIELD_DESC);
        struct.provider_info.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(struct.status.getValue());
        oprot.writeFieldEnd();
      }
      if (struct.error != null) {
        if (struct.isSetError()) {
          oprot.writeFieldBegin(ERROR_FIELD_DESC);
          struct.error.write(oprot);
          oprot.writeFieldEnd();
        }
      }
      if (struct.client_info != null) {
        oprot.writeFieldBegin(CLIENT_INFO_FIELD_DESC);
        struct.client_info.write(oprot);
        oprot.writeFieldEnd();
      }
      if (struct.payer_type != null) {
        if (struct.isSetPayerType()) {
          oprot.writeFieldBegin(PAYER_TYPE_FIELD_DESC);
          oprot.writeI32(struct.payer_type.getValue());
          oprot.writeFieldEnd();
        }
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class RefundTupleSchemeFactory implements SchemeFactory {
    public RefundTupleScheme getScheme() {
      return new RefundTupleScheme();
    }
  }

  private static class RefundTupleScheme extends TupleScheme {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, Refund struct) throws org.apache.thrift.TException {
      TTupleProtocol oprot = (TTupleProtocol) prot;
      oprot.writeString(struct.id);
      oprot.writeString(struct.payment_id);
      oprot.writeString(struct.event_time);
      struct.reference_info.write(oprot);
      struct.payment_tool.write(oprot);
      struct.cost.write(oprot);
      struct.provider_info.write(oprot);
      oprot.writeI32(struct.status.getValue());
      struct.client_info.write(oprot);
      BitSet optionals = new BitSet();
      if (struct.isSetError()) {
        optionals.set(0);
      }
      if (struct.isSetPayerType()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetError()) {
        struct.error.write(oprot);
      }
      if (struct.isSetPayerType()) {
        oprot.writeI32(struct.payer_type.getValue());
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, Refund struct) throws org.apache.thrift.TException {
      TTupleProtocol iprot = (TTupleProtocol) prot;
      struct.id = iprot.readString();
      struct.setIdIsSet(true);
      struct.payment_id = iprot.readString();
      struct.setPaymentIdIsSet(true);
      struct.event_time = iprot.readString();
      struct.setEventTimeIsSet(true);
      struct.reference_info = new ReferenceInfo();
      struct.reference_info.read(iprot);
      struct.setReferenceInfoIsSet(true);
      struct.payment_tool = new com.rbkmoney.damsel.domain.PaymentTool();
      struct.payment_tool.read(iprot);
      struct.setPaymentToolIsSet(true);
      struct.cost = new com.rbkmoney.damsel.domain.Cash();
      struct.cost.read(iprot);
      struct.setCostIsSet(true);
      struct.provider_info = new ProviderInfo();
      struct.provider_info.read(iprot);
      struct.setProviderInfoIsSet(true);
      struct.status = com.rbkmoney.damsel.fraudbusters.RefundStatus.findByValue(iprot.readI32());
      struct.setStatusIsSet(true);
      struct.client_info = new ClientInfo();
      struct.client_info.read(iprot);
      struct.setClientInfoIsSet(true);
      BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.error = new Error();
        struct.error.read(iprot);
        struct.setErrorIsSet(true);
      }
      if (incoming.get(1)) {
        struct.payer_type = com.rbkmoney.damsel.fraudbusters.PayerType.findByValue(iprot.readI32());
        struct.setPayerTypeIsSet(true);
      }
    }
  }

  private static  S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy