Subversion Repositories SmartDukaan

Rev

Rev 2747 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift Compiler (0.7.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package in.shop2020.payments;

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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Refund implements org.apache.thrift.TBase<Refund, Refund._Fields>, java.io.Serializable, Cloneable {
  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.I64, (short)1);
  private static final org.apache.thrift.protocol.TField PAYMENT_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paymentId", org.apache.thrift.protocol.TType.I64, (short)2);
  private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.I64, (short)3);
  private static final org.apache.thrift.protocol.TField ORDER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("orderId", org.apache.thrift.protocol.TType.I64, (short)4);
  private static final org.apache.thrift.protocol.TField AMOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("amount", org.apache.thrift.protocol.TType.DOUBLE, (short)5);
  private static final org.apache.thrift.protocol.TField GATEWAY_TXN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayTxnId", org.apache.thrift.protocol.TType.STRING, (short)6);
  private static final org.apache.thrift.protocol.TField ATTEMPTS_FIELD_DESC = new org.apache.thrift.protocol.TField("attempts", org.apache.thrift.protocol.TType.I32, (short)7);
  private static final org.apache.thrift.protocol.TField CREATED_AT_FIELD_DESC = new org.apache.thrift.protocol.TField("createdAt", org.apache.thrift.protocol.TType.I64, (short)8);
  private static final org.apache.thrift.protocol.TField PROCESSED_AT_FIELD_DESC = new org.apache.thrift.protocol.TField("processedAt", org.apache.thrift.protocol.TType.I64, (short)9);
  private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.LIST, (short)10);

  private long id; // required
  private long paymentId; // required
  private long gatewayId; // required
  private long orderId; // required
  private double amount; // required
  private String gatewayTxnId; // required
  private int attempts; // required
  private long createdAt; // required
  private long processedAt; // required
  private List<Attribute> attributes; // required

  /** 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, "paymentId"),
    GATEWAY_ID((short)3, "gatewayId"),
    ORDER_ID((short)4, "orderId"),
    AMOUNT((short)5, "amount"),
    GATEWAY_TXN_ID((short)6, "gatewayTxnId"),
    ATTEMPTS((short)7, "attempts"),
    CREATED_AT((short)8, "createdAt"),
    PROCESSED_AT((short)9, "processedAt"),
    ATTRIBUTES((short)10, "attributes");

    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();

    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: // GATEWAY_ID
          return GATEWAY_ID;
        case 4: // ORDER_ID
          return ORDER_ID;
        case 5: // AMOUNT
          return AMOUNT;
        case 6: // GATEWAY_TXN_ID
          return GATEWAY_TXN_ID;
        case 7: // ATTEMPTS
          return ATTEMPTS;
        case 8: // CREATED_AT
          return CREATED_AT;
        case 9: // PROCESSED_AT
          return PROCESSED_AT;
        case 10: // ATTRIBUTES
          return ATTRIBUTES;
        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 int __ID_ISSET_ID = 0;
  private static final int __PAYMENTID_ISSET_ID = 1;
  private static final int __GATEWAYID_ISSET_ID = 2;
  private static final int __ORDERID_ISSET_ID = 3;
  private static final int __AMOUNT_ISSET_ID = 4;
  private static final int __ATTEMPTS_ISSET_ID = 5;
  private static final int __CREATEDAT_ISSET_ID = 6;
  private static final int __PROCESSEDAT_ISSET_ID = 7;
  private BitSet __isset_bit_vector = new BitSet(8);

  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.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PAYMENT_ID, new org.apache.thrift.meta_data.FieldMetaData("paymentId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ORDER_ID, new org.apache.thrift.meta_data.FieldMetaData("orderId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.AMOUNT, new org.apache.thrift.meta_data.FieldMetaData("amount", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
    tmpMap.put(_Fields.GATEWAY_TXN_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayTxnId", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.ATTEMPTS, new org.apache.thrift.meta_data.FieldMetaData("attempts", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
    tmpMap.put(_Fields.CREATED_AT, new org.apache.thrift.meta_data.FieldMetaData("createdAt", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.PROCESSED_AT, new org.apache.thrift.meta_data.FieldMetaData("processedAt", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.DEFAULT, 
        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Attribute.class))));
    metaDataMap = Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Refund.class, metaDataMap);
  }

  public Refund() {
  }

  public Refund(
    long id,
    long paymentId,
    long gatewayId,
    long orderId,
    double amount,
    String gatewayTxnId,
    int attempts,
    long createdAt,
    long processedAt,
    List<Attribute> attributes)
  {
    this();
    this.id = id;
    setIdIsSet(true);
    this.paymentId = paymentId;
    setPaymentIdIsSet(true);
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
    this.orderId = orderId;
    setOrderIdIsSet(true);
    this.amount = amount;
    setAmountIsSet(true);
    this.gatewayTxnId = gatewayTxnId;
    this.attempts = attempts;
    setAttemptsIsSet(true);
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
    this.processedAt = processedAt;
    setProcessedAtIsSet(true);
    this.attributes = attributes;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Refund(Refund other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.id = other.id;
    this.paymentId = other.paymentId;
    this.gatewayId = other.gatewayId;
    this.orderId = other.orderId;
    this.amount = other.amount;
    if (other.isSetGatewayTxnId()) {
      this.gatewayTxnId = other.gatewayTxnId;
    }
    this.attempts = other.attempts;
    this.createdAt = other.createdAt;
    this.processedAt = other.processedAt;
    if (other.isSetAttributes()) {
      List<Attribute> __this__attributes = new ArrayList<Attribute>();
      for (Attribute other_element : other.attributes) {
        __this__attributes.add(new Attribute(other_element));
      }
      this.attributes = __this__attributes;
    }
  }

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

  @Override
  public void clear() {
    setIdIsSet(false);
    this.id = 0;
    setPaymentIdIsSet(false);
    this.paymentId = 0;
    setGatewayIdIsSet(false);
    this.gatewayId = 0;
    setOrderIdIsSet(false);
    this.orderId = 0;
    setAmountIsSet(false);
    this.amount = 0.0;
    this.gatewayTxnId = null;
    setAttemptsIsSet(false);
    this.attempts = 0;
    setCreatedAtIsSet(false);
    this.createdAt = 0;
    setProcessedAtIsSet(false);
    this.processedAt = 0;
    this.attributes = null;
  }

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

  public void setId(long id) {
    this.id = id;
    setIdIsSet(true);
  }

  public void unsetId() {
    __isset_bit_vector.clear(__ID_ISSET_ID);
  }

  /** Returns true if field id is set (has been assigned a value) and false otherwise */
  public boolean isSetId() {
    return __isset_bit_vector.get(__ID_ISSET_ID);
  }

  public void setIdIsSet(boolean value) {
    __isset_bit_vector.set(__ID_ISSET_ID, value);
  }

  public long getPaymentId() {
    return this.paymentId;
  }

  public void setPaymentId(long paymentId) {
    this.paymentId = paymentId;
    setPaymentIdIsSet(true);
  }

  public void unsetPaymentId() {
    __isset_bit_vector.clear(__PAYMENTID_ISSET_ID);
  }

  /** Returns true if field paymentId is set (has been assigned a value) and false otherwise */
  public boolean isSetPaymentId() {
    return __isset_bit_vector.get(__PAYMENTID_ISSET_ID);
  }

  public void setPaymentIdIsSet(boolean value) {
    __isset_bit_vector.set(__PAYMENTID_ISSET_ID, value);
  }

  public long getGatewayId() {
    return this.gatewayId;
  }

  public void setGatewayId(long gatewayId) {
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
  }

  public void unsetGatewayId() {
    __isset_bit_vector.clear(__GATEWAYID_ISSET_ID);
  }

  /** Returns true if field gatewayId is set (has been assigned a value) and false otherwise */
  public boolean isSetGatewayId() {
    return __isset_bit_vector.get(__GATEWAYID_ISSET_ID);
  }

  public void setGatewayIdIsSet(boolean value) {
    __isset_bit_vector.set(__GATEWAYID_ISSET_ID, value);
  }

  public long getOrderId() {
    return this.orderId;
  }

  public void setOrderId(long orderId) {
    this.orderId = orderId;
    setOrderIdIsSet(true);
  }

  public void unsetOrderId() {
    __isset_bit_vector.clear(__ORDERID_ISSET_ID);
  }

  /** Returns true if field orderId is set (has been assigned a value) and false otherwise */
  public boolean isSetOrderId() {
    return __isset_bit_vector.get(__ORDERID_ISSET_ID);
  }

  public void setOrderIdIsSet(boolean value) {
    __isset_bit_vector.set(__ORDERID_ISSET_ID, value);
  }

  public double getAmount() {
    return this.amount;
  }

  public void setAmount(double amount) {
    this.amount = amount;
    setAmountIsSet(true);
  }

  public void unsetAmount() {
    __isset_bit_vector.clear(__AMOUNT_ISSET_ID);
  }

  /** Returns true if field amount is set (has been assigned a value) and false otherwise */
  public boolean isSetAmount() {
    return __isset_bit_vector.get(__AMOUNT_ISSET_ID);
  }

  public void setAmountIsSet(boolean value) {
    __isset_bit_vector.set(__AMOUNT_ISSET_ID, value);
  }

  public String getGatewayTxnId() {
    return this.gatewayTxnId;
  }

  public void setGatewayTxnId(String gatewayTxnId) {
    this.gatewayTxnId = gatewayTxnId;
  }

  public void unsetGatewayTxnId() {
    this.gatewayTxnId = null;
  }

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

  public void setGatewayTxnIdIsSet(boolean value) {
    if (!value) {
      this.gatewayTxnId = null;
    }
  }

  public int getAttempts() {
    return this.attempts;
  }

  public void setAttempts(int attempts) {
    this.attempts = attempts;
    setAttemptsIsSet(true);
  }

  public void unsetAttempts() {
    __isset_bit_vector.clear(__ATTEMPTS_ISSET_ID);
  }

  /** Returns true if field attempts is set (has been assigned a value) and false otherwise */
  public boolean isSetAttempts() {
    return __isset_bit_vector.get(__ATTEMPTS_ISSET_ID);
  }

  public void setAttemptsIsSet(boolean value) {
    __isset_bit_vector.set(__ATTEMPTS_ISSET_ID, value);
  }

  public long getCreatedAt() {
    return this.createdAt;
  }

  public void setCreatedAt(long createdAt) {
    this.createdAt = createdAt;
    setCreatedAtIsSet(true);
  }

  public void unsetCreatedAt() {
    __isset_bit_vector.clear(__CREATEDAT_ISSET_ID);
  }

  /** Returns true if field createdAt is set (has been assigned a value) and false otherwise */
  public boolean isSetCreatedAt() {
    return __isset_bit_vector.get(__CREATEDAT_ISSET_ID);
  }

  public void setCreatedAtIsSet(boolean value) {
    __isset_bit_vector.set(__CREATEDAT_ISSET_ID, value);
  }

  public long getProcessedAt() {
    return this.processedAt;
  }

  public void setProcessedAt(long processedAt) {
    this.processedAt = processedAt;
    setProcessedAtIsSet(true);
  }

  public void unsetProcessedAt() {
    __isset_bit_vector.clear(__PROCESSEDAT_ISSET_ID);
  }

  /** Returns true if field processedAt is set (has been assigned a value) and false otherwise */
  public boolean isSetProcessedAt() {
    return __isset_bit_vector.get(__PROCESSEDAT_ISSET_ID);
  }

  public void setProcessedAtIsSet(boolean value) {
    __isset_bit_vector.set(__PROCESSEDAT_ISSET_ID, value);
  }

  public int getAttributesSize() {
    return (this.attributes == null) ? 0 : this.attributes.size();
  }

  public java.util.Iterator<Attribute> getAttributesIterator() {
    return (this.attributes == null) ? null : this.attributes.iterator();
  }

  public void addToAttributes(Attribute elem) {
    if (this.attributes == null) {
      this.attributes = new ArrayList<Attribute>();
    }
    this.attributes.add(elem);
  }

  public List<Attribute> getAttributes() {
    return this.attributes;
  }

  public void setAttributes(List<Attribute> attributes) {
    this.attributes = attributes;
  }

  public void unsetAttributes() {
    this.attributes = null;
  }

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

  public void setAttributesIsSet(boolean value) {
    if (!value) {
      this.attributes = null;
    }
  }

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

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

    case GATEWAY_ID:
      if (value == null) {
        unsetGatewayId();
      } else {
        setGatewayId((Long)value);
      }
      break;

    case ORDER_ID:
      if (value == null) {
        unsetOrderId();
      } else {
        setOrderId((Long)value);
      }
      break;

    case AMOUNT:
      if (value == null) {
        unsetAmount();
      } else {
        setAmount((Double)value);
      }
      break;

    case GATEWAY_TXN_ID:
      if (value == null) {
        unsetGatewayTxnId();
      } else {
        setGatewayTxnId((String)value);
      }
      break;

    case ATTEMPTS:
      if (value == null) {
        unsetAttempts();
      } else {
        setAttempts((Integer)value);
      }
      break;

    case CREATED_AT:
      if (value == null) {
        unsetCreatedAt();
      } else {
        setCreatedAt((Long)value);
      }
      break;

    case PROCESSED_AT:
      if (value == null) {
        unsetProcessedAt();
      } else {
        setProcessedAt((Long)value);
      }
      break;

    case ATTRIBUTES:
      if (value == null) {
        unsetAttributes();
      } else {
        setAttributes((List<Attribute>)value);
      }
      break;

    }
  }

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

    case PAYMENT_ID:
      return Long.valueOf(getPaymentId());

    case GATEWAY_ID:
      return Long.valueOf(getGatewayId());

    case ORDER_ID:
      return Long.valueOf(getOrderId());

    case AMOUNT:
      return Double.valueOf(getAmount());

    case GATEWAY_TXN_ID:
      return getGatewayTxnId();

    case ATTEMPTS:
      return Integer.valueOf(getAttempts());

    case CREATED_AT:
      return Long.valueOf(getCreatedAt());

    case PROCESSED_AT:
      return Long.valueOf(getProcessedAt());

    case ATTRIBUTES:
      return getAttributes();

    }
    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 GATEWAY_ID:
      return isSetGatewayId();
    case ORDER_ID:
      return isSetOrderId();
    case AMOUNT:
      return isSetAmount();
    case GATEWAY_TXN_ID:
      return isSetGatewayTxnId();
    case ATTEMPTS:
      return isSetAttempts();
    case CREATED_AT:
      return isSetCreatedAt();
    case PROCESSED_AT:
      return isSetProcessedAt();
    case ATTRIBUTES:
      return isSetAttributes();
    }
    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;
    boolean that_present_id = true;
    if (this_present_id || that_present_id) {
      if (!(this_present_id && that_present_id))
        return false;
      if (this.id != that.id)
        return false;
    }

    boolean this_present_paymentId = true;
    boolean that_present_paymentId = true;
    if (this_present_paymentId || that_present_paymentId) {
      if (!(this_present_paymentId && that_present_paymentId))
        return false;
      if (this.paymentId != that.paymentId)
        return false;
    }

    boolean this_present_gatewayId = true;
    boolean that_present_gatewayId = true;
    if (this_present_gatewayId || that_present_gatewayId) {
      if (!(this_present_gatewayId && that_present_gatewayId))
        return false;
      if (this.gatewayId != that.gatewayId)
        return false;
    }

    boolean this_present_orderId = true;
    boolean that_present_orderId = true;
    if (this_present_orderId || that_present_orderId) {
      if (!(this_present_orderId && that_present_orderId))
        return false;
      if (this.orderId != that.orderId)
        return false;
    }

    boolean this_present_amount = true;
    boolean that_present_amount = true;
    if (this_present_amount || that_present_amount) {
      if (!(this_present_amount && that_present_amount))
        return false;
      if (this.amount != that.amount)
        return false;
    }

    boolean this_present_gatewayTxnId = true && this.isSetGatewayTxnId();
    boolean that_present_gatewayTxnId = true && that.isSetGatewayTxnId();
    if (this_present_gatewayTxnId || that_present_gatewayTxnId) {
      if (!(this_present_gatewayTxnId && that_present_gatewayTxnId))
        return false;
      if (!this.gatewayTxnId.equals(that.gatewayTxnId))
        return false;
    }

    boolean this_present_attempts = true;
    boolean that_present_attempts = true;
    if (this_present_attempts || that_present_attempts) {
      if (!(this_present_attempts && that_present_attempts))
        return false;
      if (this.attempts != that.attempts)
        return false;
    }

    boolean this_present_createdAt = true;
    boolean that_present_createdAt = true;
    if (this_present_createdAt || that_present_createdAt) {
      if (!(this_present_createdAt && that_present_createdAt))
        return false;
      if (this.createdAt != that.createdAt)
        return false;
    }

    boolean this_present_processedAt = true;
    boolean that_present_processedAt = true;
    if (this_present_processedAt || that_present_processedAt) {
      if (!(this_present_processedAt && that_present_processedAt))
        return false;
      if (this.processedAt != that.processedAt)
        return false;
    }

    boolean this_present_attributes = true && this.isSetAttributes();
    boolean that_present_attributes = true && that.isSetAttributes();
    if (this_present_attributes || that_present_attributes) {
      if (!(this_present_attributes && that_present_attributes))
        return false;
      if (!this.attributes.equals(that.attributes))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    return 0;
  }

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

    int lastComparison = 0;
    Refund typedOther = (Refund)other;

    lastComparison = Boolean.valueOf(isSetId()).compareTo(typedOther.isSetId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetPaymentId()).compareTo(typedOther.isSetPaymentId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetPaymentId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paymentId, typedOther.paymentId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(typedOther.isSetGatewayId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGatewayId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayId, typedOther.gatewayId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetOrderId()).compareTo(typedOther.isSetOrderId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetOrderId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.orderId, typedOther.orderId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(typedOther.isSetAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAmount()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.amount, typedOther.amount);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetGatewayTxnId()).compareTo(typedOther.isSetGatewayTxnId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetGatewayTxnId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayTxnId, typedOther.gatewayTxnId);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAttempts()).compareTo(typedOther.isSetAttempts());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAttempts()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attempts, typedOther.attempts);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetCreatedAt()).compareTo(typedOther.isSetCreatedAt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetCreatedAt()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createdAt, typedOther.createdAt);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetProcessedAt()).compareTo(typedOther.isSetProcessedAt());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetProcessedAt()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.processedAt, typedOther.processedAt);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetAttributes()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

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

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) { 
        break;
      }
      switch (field.id) {
        case 1: // ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.id = iprot.readI64();
            setIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // PAYMENT_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.paymentId = iprot.readI64();
            setPaymentIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // GATEWAY_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.gatewayId = iprot.readI64();
            setGatewayIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // ORDER_ID
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.orderId = iprot.readI64();
            setOrderIdIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // AMOUNT
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.amount = iprot.readDouble();
            setAmountIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // GATEWAY_TXN_ID
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.gatewayTxnId = iprot.readString();
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // ATTEMPTS
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.attempts = iprot.readI32();
            setAttemptsIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // CREATED_AT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.createdAt = iprot.readI64();
            setCreatedAtIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // PROCESSED_AT
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.processedAt = iprot.readI64();
            setProcessedAtIsSet(true);
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // ATTRIBUTES
          if (field.type == org.apache.thrift.protocol.TType.LIST) {
            {
              org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
              this.attributes = new ArrayList<Attribute>(_list8.size);
              for (int _i9 = 0; _i9 < _list8.size; ++_i9)
              {
                Attribute _elem10; // required
                _elem10 = new Attribute();
                _elem10.read(iprot);
                this.attributes.add(_elem10);
              }
              iprot.readListEnd();
            }
          } else { 
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(ID_FIELD_DESC);
    oprot.writeI64(this.id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PAYMENT_ID_FIELD_DESC);
    oprot.writeI64(this.paymentId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
    oprot.writeI64(this.gatewayId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ORDER_ID_FIELD_DESC);
    oprot.writeI64(this.orderId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.amount);
    oprot.writeFieldEnd();
    if (this.gatewayTxnId != null) {
      oprot.writeFieldBegin(GATEWAY_TXN_ID_FIELD_DESC);
      oprot.writeString(this.gatewayTxnId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(ATTEMPTS_FIELD_DESC);
    oprot.writeI32(this.attempts);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CREATED_AT_FIELD_DESC);
    oprot.writeI64(this.createdAt);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(PROCESSED_AT_FIELD_DESC);
    oprot.writeI64(this.processedAt);
    oprot.writeFieldEnd();
    if (this.attributes != null) {
      oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
      {
        oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, this.attributes.size()));
        for (Attribute _iter11 : this.attributes)
        {
          _iter11.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("id:");
    sb.append(this.id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("paymentId:");
    sb.append(this.paymentId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("gatewayId:");
    sb.append(this.gatewayId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("orderId:");
    sb.append(this.orderId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("gatewayTxnId:");
    if (this.gatewayTxnId == null) {
      sb.append("null");
    } else {
      sb.append(this.gatewayTxnId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("attempts:");
    sb.append(this.attempts);
    first = false;
    if (!first) sb.append(", ");
    sb.append("createdAt:");
    sb.append(this.createdAt);
    first = false;
    if (!first) sb.append(", ");
    sb.append("processedAt:");
    sb.append(this.processedAt);
    first = false;
    if (!first) sb.append(", ");
    sb.append("attributes:");
    if (this.attributes == null) {
      sb.append("null");
    } else {
      sb.append(this.attributes);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
  }

  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 {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bit_vector = new BitSet(1);
      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);
    }
  }

}