Subversion Repositories SmartDukaan

Rev

Rev 420 | Rev 705 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * Autogenerated by Thrift
 *
 * 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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;

public class Payment implements TBase<Payment._Fields>, java.io.Serializable, Cloneable, Comparable<Payment> {
  private static final TStruct STRUCT_DESC = new TStruct("Payment");

  private static final TField PAYMENT_ID_FIELD_DESC = new TField("paymentId", TType.I64, (short)1);
  private static final TField GATEWAY_ID_FIELD_DESC = new TField("gatewayId", TType.I64, (short)2);
  private static final TField GATEWAY_PAYMENT_ID_FIELD_DESC = new TField("gatewayPaymentId", TType.STRING, (short)3);
  private static final TField MERCHANT_TXN_ID_FIELD_DESC = new TField("merchantTxnId", TType.STRING, (short)4);
  private static final TField GATEWAY_TXN_ID_FIELD_DESC = new TField("gatewayTxnId", TType.STRING, (short)5);
  private static final TField AMOUNT_FIELD_DESC = new TField("amount", TType.DOUBLE, (short)6);
  private static final TField GATEWAY_TXN_STATUS_FIELD_DESC = new TField("gatewayTxnStatus", TType.STRING, (short)7);
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)8);
  private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)9);
  private static final TField ERROR_CODE_FIELD_DESC = new TField("errorCode", TType.STRING, (short)10);
  private static final TField DESCRIPTION_FIELD_DESC = new TField("description", TType.STRING, (short)11);
  private static final TField AUTH_CODE_FIELD_DESC = new TField("authCode", TType.STRING, (short)12);
  private static final TField REFERENCE_CODE_FIELD_DESC = new TField("referenceCode", TType.STRING, (short)13);
  private static final TField SESSION_ID_FIELD_DESC = new TField("sessionId", TType.STRING, (short)14);
  private static final TField GATEWAY_TXN_DATE_FIELD_DESC = new TField("gatewayTxnDate", TType.STRING, (short)15);
  private static final TField ATTRIBUTES_FIELD_DESC = new TField("attributes", TType.LIST, (short)16);
  private static final TField INIT_TIMESTAMP_FIELD_DESC = new TField("initTimestamp", TType.I64, (short)17);
  private static final TField SUCCESS_TIMESTAMP_FIELD_DESC = new TField("successTimestamp", TType.I64, (short)18);
  private static final TField ERROR_TIMESTAMP_FIELD_DESC = new TField("errorTimestamp", TType.I64, (short)19);

  private long paymentId;
  private long gatewayId;
  private String gatewayPaymentId;
  private String merchantTxnId;
  private String gatewayTxnId;
  private double amount;
  private String gatewayTxnStatus;
  private PaymentStatus status;
  private long userId;
  private String errorCode;
  private String description;
  private String authCode;
  private String referenceCode;
  private String sessionId;
  private String gatewayTxnDate;
  private List<Attribute> attributes;
  private long initTimestamp;
  private long successTimestamp;
  private long errorTimestamp;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    PAYMENT_ID((short)1, "paymentId"),
    GATEWAY_ID((short)2, "gatewayId"),
    GATEWAY_PAYMENT_ID((short)3, "gatewayPaymentId"),
    MERCHANT_TXN_ID((short)4, "merchantTxnId"),
    GATEWAY_TXN_ID((short)5, "gatewayTxnId"),
    AMOUNT((short)6, "amount"),
    GATEWAY_TXN_STATUS((short)7, "gatewayTxnStatus"),
    /**
     * 
     * @see PaymentStatus
     */
    STATUS((short)8, "status"),
    USER_ID((short)9, "userId"),
    ERROR_CODE((short)10, "errorCode"),
    DESCRIPTION((short)11, "description"),
    AUTH_CODE((short)12, "authCode"),
    REFERENCE_CODE((short)13, "referenceCode"),
    SESSION_ID((short)14, "sessionId"),
    GATEWAY_TXN_DATE((short)15, "gatewayTxnDate"),
    ATTRIBUTES((short)16, "attributes"),
    INIT_TIMESTAMP((short)17, "initTimestamp"),
    SUCCESS_TIMESTAMP((short)18, "successTimestamp"),
    ERROR_TIMESTAMP((short)19, "errorTimestamp");

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

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

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    public static _Fields findByThriftId(int fieldId) {
      return byId.get(fieldId);
    }

    /**
     * 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 __PAYMENTID_ISSET_ID = 0;
  private static final int __GATEWAYID_ISSET_ID = 1;
  private static final int __AMOUNT_ISSET_ID = 2;
  private static final int __USERID_ISSET_ID = 3;
  private static final int __INITTIMESTAMP_ISSET_ID = 4;
  private static final int __SUCCESSTIMESTAMP_ISSET_ID = 5;
  private static final int __ERRORTIMESTAMP_ISSET_ID = 6;
  private BitSet __isset_bit_vector = new BitSet(7);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.PAYMENT_ID, new FieldMetaData("paymentId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.GATEWAY_ID, new FieldMetaData("gatewayId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.GATEWAY_PAYMENT_ID, new FieldMetaData("gatewayPaymentId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.MERCHANT_TXN_ID, new FieldMetaData("merchantTxnId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.GATEWAY_TXN_ID, new FieldMetaData("gatewayTxnId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.AMOUNT, new FieldMetaData("amount", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.GATEWAY_TXN_STATUS, new FieldMetaData("gatewayTxnStatus", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, PaymentStatus.class)));
    put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ERROR_CODE, new FieldMetaData("errorCode", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.DESCRIPTION, new FieldMetaData("description", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.AUTH_CODE, new FieldMetaData("authCode", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.REFERENCE_CODE, new FieldMetaData("referenceCode", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SESSION_ID, new FieldMetaData("sessionId", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.GATEWAY_TXN_DATE, new FieldMetaData("gatewayTxnDate", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ATTRIBUTES, new FieldMetaData("attributes", TFieldRequirementType.DEFAULT, 
        new ListMetaData(TType.LIST, 
            new StructMetaData(TType.STRUCT, Attribute.class))));
    put(_Fields.INIT_TIMESTAMP, new FieldMetaData("initTimestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.SUCCESS_TIMESTAMP, new FieldMetaData("successTimestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.ERROR_TIMESTAMP, new FieldMetaData("errorTimestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
  }});

  static {
    FieldMetaData.addStructMetaDataMap(Payment.class, metaDataMap);
  }

  public Payment() {
  }

  public Payment(
    long paymentId,
    long gatewayId,
    String gatewayPaymentId,
    String merchantTxnId,
    String gatewayTxnId,
    double amount,
    String gatewayTxnStatus,
    PaymentStatus status,
    long userId,
    String errorCode,
    String description,
    String authCode,
    String referenceCode,
    String sessionId,
    String gatewayTxnDate,
    List<Attribute> attributes,
    long initTimestamp,
    long successTimestamp,
    long errorTimestamp)
  {
    this();
    this.paymentId = paymentId;
    setPaymentIdIsSet(true);
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
    this.gatewayPaymentId = gatewayPaymentId;
    this.merchantTxnId = merchantTxnId;
    this.gatewayTxnId = gatewayTxnId;
    this.amount = amount;
    setAmountIsSet(true);
    this.gatewayTxnStatus = gatewayTxnStatus;
    this.status = status;
    this.userId = userId;
    setUserIdIsSet(true);
    this.errorCode = errorCode;
    this.description = description;
    this.authCode = authCode;
    this.referenceCode = referenceCode;
    this.sessionId = sessionId;
    this.gatewayTxnDate = gatewayTxnDate;
    this.attributes = attributes;
    this.initTimestamp = initTimestamp;
    setInitTimestampIsSet(true);
    this.successTimestamp = successTimestamp;
    setSuccessTimestampIsSet(true);
    this.errorTimestamp = errorTimestamp;
    setErrorTimestampIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Payment(Payment other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    this.paymentId = other.paymentId;
    this.gatewayId = other.gatewayId;
    if (other.isSetGatewayPaymentId()) {
      this.gatewayPaymentId = other.gatewayPaymentId;
    }
    if (other.isSetMerchantTxnId()) {
      this.merchantTxnId = other.merchantTxnId;
    }
    if (other.isSetGatewayTxnId()) {
      this.gatewayTxnId = other.gatewayTxnId;
    }
    this.amount = other.amount;
    if (other.isSetGatewayTxnStatus()) {
      this.gatewayTxnStatus = other.gatewayTxnStatus;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    this.userId = other.userId;
    if (other.isSetErrorCode()) {
      this.errorCode = other.errorCode;
    }
    if (other.isSetDescription()) {
      this.description = other.description;
    }
    if (other.isSetAuthCode()) {
      this.authCode = other.authCode;
    }
    if (other.isSetReferenceCode()) {
      this.referenceCode = other.referenceCode;
    }
    if (other.isSetSessionId()) {
      this.sessionId = other.sessionId;
    }
    if (other.isSetGatewayTxnDate()) {
      this.gatewayTxnDate = other.gatewayTxnDate;
    }
    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;
    }
    this.initTimestamp = other.initTimestamp;
    this.successTimestamp = other.successTimestamp;
    this.errorTimestamp = other.errorTimestamp;
  }

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

  @Deprecated
  public Payment clone() {
    return new Payment(this);
  }

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

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

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

  /** Returns true if field paymentId is set (has been asigned 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 Payment setGatewayId(long gatewayId) {
    this.gatewayId = gatewayId;
    setGatewayIdIsSet(true);
    return this;
  }

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

  /** Returns true if field gatewayId is set (has been asigned 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 String getGatewayPaymentId() {
    return this.gatewayPaymentId;
  }

  public Payment setGatewayPaymentId(String gatewayPaymentId) {
    this.gatewayPaymentId = gatewayPaymentId;
    return this;
  }

  public void unsetGatewayPaymentId() {
    this.gatewayPaymentId = null;
  }

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

  public void setGatewayPaymentIdIsSet(boolean value) {
    if (!value) {
      this.gatewayPaymentId = null;
    }
  }

  public String getMerchantTxnId() {
    return this.merchantTxnId;
  }

  public Payment setMerchantTxnId(String merchantTxnId) {
    this.merchantTxnId = merchantTxnId;
    return this;
  }

  public void unsetMerchantTxnId() {
    this.merchantTxnId = null;
  }

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

  public void setMerchantTxnIdIsSet(boolean value) {
    if (!value) {
      this.merchantTxnId = null;
    }
  }

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

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

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

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

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

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

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

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

  /** Returns true if field amount is set (has been asigned 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 getGatewayTxnStatus() {
    return this.gatewayTxnStatus;
  }

  public Payment setGatewayTxnStatus(String gatewayTxnStatus) {
    this.gatewayTxnStatus = gatewayTxnStatus;
    return this;
  }

  public void unsetGatewayTxnStatus() {
    this.gatewayTxnStatus = null;
  }

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

  public void setGatewayTxnStatusIsSet(boolean value) {
    if (!value) {
      this.gatewayTxnStatus = null;
    }
  }

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

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

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

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

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

  public long getUserId() {
    return this.userId;
  }

  public Payment setUserId(long userId) {
    this.userId = userId;
    setUserIdIsSet(true);
    return this;
  }

  public void unsetUserId() {
    __isset_bit_vector.clear(__USERID_ISSET_ID);
  }

  /** Returns true if field userId is set (has been asigned a value) and false otherwise */
  public boolean isSetUserId() {
    return __isset_bit_vector.get(__USERID_ISSET_ID);
  }

  public void setUserIdIsSet(boolean value) {
    __isset_bit_vector.set(__USERID_ISSET_ID, value);
  }

  public String getErrorCode() {
    return this.errorCode;
  }

  public Payment setErrorCode(String errorCode) {
    this.errorCode = errorCode;
    return this;
  }

  public void unsetErrorCode() {
    this.errorCode = null;
  }

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

  public void setErrorCodeIsSet(boolean value) {
    if (!value) {
      this.errorCode = null;
    }
  }

  public String getDescription() {
    return this.description;
  }

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

  public void unsetDescription() {
    this.description = null;
  }

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

  public void setDescriptionIsSet(boolean value) {
    if (!value) {
      this.description = null;
    }
  }

  public String getAuthCode() {
    return this.authCode;
  }

  public Payment setAuthCode(String authCode) {
    this.authCode = authCode;
    return this;
  }

  public void unsetAuthCode() {
    this.authCode = null;
  }

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

  public void setAuthCodeIsSet(boolean value) {
    if (!value) {
      this.authCode = null;
    }
  }

  public String getReferenceCode() {
    return this.referenceCode;
  }

  public Payment setReferenceCode(String referenceCode) {
    this.referenceCode = referenceCode;
    return this;
  }

  public void unsetReferenceCode() {
    this.referenceCode = null;
  }

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

  public void setReferenceCodeIsSet(boolean value) {
    if (!value) {
      this.referenceCode = null;
    }
  }

  public String getSessionId() {
    return this.sessionId;
  }

  public Payment setSessionId(String sessionId) {
    this.sessionId = sessionId;
    return this;
  }

  public void unsetSessionId() {
    this.sessionId = null;
  }

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

  public void setSessionIdIsSet(boolean value) {
    if (!value) {
      this.sessionId = null;
    }
  }

  public String getGatewayTxnDate() {
    return this.gatewayTxnDate;
  }

  public Payment setGatewayTxnDate(String gatewayTxnDate) {
    this.gatewayTxnDate = gatewayTxnDate;
    return this;
  }

  public void unsetGatewayTxnDate() {
    this.gatewayTxnDate = null;
  }

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

  public void setGatewayTxnDateIsSet(boolean value) {
    if (!value) {
      this.gatewayTxnDate = null;
    }
  }

  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 Payment setAttributes(List<Attribute> attributes) {
    this.attributes = attributes;
    return this;
  }

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

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

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

  public long getInitTimestamp() {
    return this.initTimestamp;
  }

  public Payment setInitTimestamp(long initTimestamp) {
    this.initTimestamp = initTimestamp;
    setInitTimestampIsSet(true);
    return this;
  }

  public void unsetInitTimestamp() {
    __isset_bit_vector.clear(__INITTIMESTAMP_ISSET_ID);
  }

  /** Returns true if field initTimestamp is set (has been asigned a value) and false otherwise */
  public boolean isSetInitTimestamp() {
    return __isset_bit_vector.get(__INITTIMESTAMP_ISSET_ID);
  }

  public void setInitTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__INITTIMESTAMP_ISSET_ID, value);
  }

  public long getSuccessTimestamp() {
    return this.successTimestamp;
  }

  public Payment setSuccessTimestamp(long successTimestamp) {
    this.successTimestamp = successTimestamp;
    setSuccessTimestampIsSet(true);
    return this;
  }

  public void unsetSuccessTimestamp() {
    __isset_bit_vector.clear(__SUCCESSTIMESTAMP_ISSET_ID);
  }

  /** Returns true if field successTimestamp is set (has been asigned a value) and false otherwise */
  public boolean isSetSuccessTimestamp() {
    return __isset_bit_vector.get(__SUCCESSTIMESTAMP_ISSET_ID);
  }

  public void setSuccessTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__SUCCESSTIMESTAMP_ISSET_ID, value);
  }

  public long getErrorTimestamp() {
    return this.errorTimestamp;
  }

  public Payment setErrorTimestamp(long errorTimestamp) {
    this.errorTimestamp = errorTimestamp;
    setErrorTimestampIsSet(true);
    return this;
  }

  public void unsetErrorTimestamp() {
    __isset_bit_vector.clear(__ERRORTIMESTAMP_ISSET_ID);
  }

  /** Returns true if field errorTimestamp is set (has been asigned a value) and false otherwise */
  public boolean isSetErrorTimestamp() {
    return __isset_bit_vector.get(__ERRORTIMESTAMP_ISSET_ID);
  }

  public void setErrorTimestampIsSet(boolean value) {
    __isset_bit_vector.set(__ERRORTIMESTAMP_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    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 GATEWAY_PAYMENT_ID:
      if (value == null) {
        unsetGatewayPaymentId();
      } else {
        setGatewayPaymentId((String)value);
      }
      break;

    case MERCHANT_TXN_ID:
      if (value == null) {
        unsetMerchantTxnId();
      } else {
        setMerchantTxnId((String)value);
      }
      break;

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

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

    case GATEWAY_TXN_STATUS:
      if (value == null) {
        unsetGatewayTxnStatus();
      } else {
        setGatewayTxnStatus((String)value);
      }
      break;

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

    case USER_ID:
      if (value == null) {
        unsetUserId();
      } else {
        setUserId((Long)value);
      }
      break;

    case ERROR_CODE:
      if (value == null) {
        unsetErrorCode();
      } else {
        setErrorCode((String)value);
      }
      break;

    case DESCRIPTION:
      if (value == null) {
        unsetDescription();
      } else {
        setDescription((String)value);
      }
      break;

    case AUTH_CODE:
      if (value == null) {
        unsetAuthCode();
      } else {
        setAuthCode((String)value);
      }
      break;

    case REFERENCE_CODE:
      if (value == null) {
        unsetReferenceCode();
      } else {
        setReferenceCode((String)value);
      }
      break;

    case SESSION_ID:
      if (value == null) {
        unsetSessionId();
      } else {
        setSessionId((String)value);
      }
      break;

    case GATEWAY_TXN_DATE:
      if (value == null) {
        unsetGatewayTxnDate();
      } else {
        setGatewayTxnDate((String)value);
      }
      break;

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

    case INIT_TIMESTAMP:
      if (value == null) {
        unsetInitTimestamp();
      } else {
        setInitTimestamp((Long)value);
      }
      break;

    case SUCCESS_TIMESTAMP:
      if (value == null) {
        unsetSuccessTimestamp();
      } else {
        setSuccessTimestamp((Long)value);
      }
      break;

    case ERROR_TIMESTAMP:
      if (value == null) {
        unsetErrorTimestamp();
      } else {
        setErrorTimestamp((Long)value);
      }
      break;

    }
  }

  public void setFieldValue(int fieldID, Object value) {
    setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
  }

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case PAYMENT_ID:
      return new Long(getPaymentId());

    case GATEWAY_ID:
      return new Long(getGatewayId());

    case GATEWAY_PAYMENT_ID:
      return getGatewayPaymentId();

    case MERCHANT_TXN_ID:
      return getMerchantTxnId();

    case GATEWAY_TXN_ID:
      return getGatewayTxnId();

    case AMOUNT:
      return new Double(getAmount());

    case GATEWAY_TXN_STATUS:
      return getGatewayTxnStatus();

    case STATUS:
      return getStatus();

    case USER_ID:
      return new Long(getUserId());

    case ERROR_CODE:
      return getErrorCode();

    case DESCRIPTION:
      return getDescription();

    case AUTH_CODE:
      return getAuthCode();

    case REFERENCE_CODE:
      return getReferenceCode();

    case SESSION_ID:
      return getSessionId();

    case GATEWAY_TXN_DATE:
      return getGatewayTxnDate();

    case ATTRIBUTES:
      return getAttributes();

    case INIT_TIMESTAMP:
      return new Long(getInitTimestamp());

    case SUCCESS_TIMESTAMP:
      return new Long(getSuccessTimestamp());

    case ERROR_TIMESTAMP:
      return new Long(getErrorTimestamp());

    }
    throw new IllegalStateException();
  }

  public Object getFieldValue(int fieldId) {
    return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
  }

  /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    switch (field) {
    case PAYMENT_ID:
      return isSetPaymentId();
    case GATEWAY_ID:
      return isSetGatewayId();
    case GATEWAY_PAYMENT_ID:
      return isSetGatewayPaymentId();
    case MERCHANT_TXN_ID:
      return isSetMerchantTxnId();
    case GATEWAY_TXN_ID:
      return isSetGatewayTxnId();
    case AMOUNT:
      return isSetAmount();
    case GATEWAY_TXN_STATUS:
      return isSetGatewayTxnStatus();
    case STATUS:
      return isSetStatus();
    case USER_ID:
      return isSetUserId();
    case ERROR_CODE:
      return isSetErrorCode();
    case DESCRIPTION:
      return isSetDescription();
    case AUTH_CODE:
      return isSetAuthCode();
    case REFERENCE_CODE:
      return isSetReferenceCode();
    case SESSION_ID:
      return isSetSessionId();
    case GATEWAY_TXN_DATE:
      return isSetGatewayTxnDate();
    case ATTRIBUTES:
      return isSetAttributes();
    case INIT_TIMESTAMP:
      return isSetInitTimestamp();
    case SUCCESS_TIMESTAMP:
      return isSetSuccessTimestamp();
    case ERROR_TIMESTAMP:
      return isSetErrorTimestamp();
    }
    throw new IllegalStateException();
  }

  public boolean isSet(int fieldID) {
    return isSet(_Fields.findByThriftIdOrThrow(fieldID));
  }

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

  public boolean equals(Payment that) {
    if (that == null)
      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_gatewayPaymentId = true && this.isSetGatewayPaymentId();
    boolean that_present_gatewayPaymentId = true && that.isSetGatewayPaymentId();
    if (this_present_gatewayPaymentId || that_present_gatewayPaymentId) {
      if (!(this_present_gatewayPaymentId && that_present_gatewayPaymentId))
        return false;
      if (!this.gatewayPaymentId.equals(that.gatewayPaymentId))
        return false;
    }

    boolean this_present_merchantTxnId = true && this.isSetMerchantTxnId();
    boolean that_present_merchantTxnId = true && that.isSetMerchantTxnId();
    if (this_present_merchantTxnId || that_present_merchantTxnId) {
      if (!(this_present_merchantTxnId && that_present_merchantTxnId))
        return false;
      if (!this.merchantTxnId.equals(that.merchantTxnId))
        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_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_gatewayTxnStatus = true && this.isSetGatewayTxnStatus();
    boolean that_present_gatewayTxnStatus = true && that.isSetGatewayTxnStatus();
    if (this_present_gatewayTxnStatus || that_present_gatewayTxnStatus) {
      if (!(this_present_gatewayTxnStatus && that_present_gatewayTxnStatus))
        return false;
      if (!this.gatewayTxnStatus.equals(that.gatewayTxnStatus))
        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_userId = true;
    boolean that_present_userId = true;
    if (this_present_userId || that_present_userId) {
      if (!(this_present_userId && that_present_userId))
        return false;
      if (this.userId != that.userId)
        return false;
    }

    boolean this_present_errorCode = true && this.isSetErrorCode();
    boolean that_present_errorCode = true && that.isSetErrorCode();
    if (this_present_errorCode || that_present_errorCode) {
      if (!(this_present_errorCode && that_present_errorCode))
        return false;
      if (!this.errorCode.equals(that.errorCode))
        return false;
    }

    boolean this_present_description = true && this.isSetDescription();
    boolean that_present_description = true && that.isSetDescription();
    if (this_present_description || that_present_description) {
      if (!(this_present_description && that_present_description))
        return false;
      if (!this.description.equals(that.description))
        return false;
    }

    boolean this_present_authCode = true && this.isSetAuthCode();
    boolean that_present_authCode = true && that.isSetAuthCode();
    if (this_present_authCode || that_present_authCode) {
      if (!(this_present_authCode && that_present_authCode))
        return false;
      if (!this.authCode.equals(that.authCode))
        return false;
    }

    boolean this_present_referenceCode = true && this.isSetReferenceCode();
    boolean that_present_referenceCode = true && that.isSetReferenceCode();
    if (this_present_referenceCode || that_present_referenceCode) {
      if (!(this_present_referenceCode && that_present_referenceCode))
        return false;
      if (!this.referenceCode.equals(that.referenceCode))
        return false;
    }

    boolean this_present_sessionId = true && this.isSetSessionId();
    boolean that_present_sessionId = true && that.isSetSessionId();
    if (this_present_sessionId || that_present_sessionId) {
      if (!(this_present_sessionId && that_present_sessionId))
        return false;
      if (!this.sessionId.equals(that.sessionId))
        return false;
    }

    boolean this_present_gatewayTxnDate = true && this.isSetGatewayTxnDate();
    boolean that_present_gatewayTxnDate = true && that.isSetGatewayTxnDate();
    if (this_present_gatewayTxnDate || that_present_gatewayTxnDate) {
      if (!(this_present_gatewayTxnDate && that_present_gatewayTxnDate))
        return false;
      if (!this.gatewayTxnDate.equals(that.gatewayTxnDate))
        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;
    }

    boolean this_present_initTimestamp = true;
    boolean that_present_initTimestamp = true;
    if (this_present_initTimestamp || that_present_initTimestamp) {
      if (!(this_present_initTimestamp && that_present_initTimestamp))
        return false;
      if (this.initTimestamp != that.initTimestamp)
        return false;
    }

    boolean this_present_successTimestamp = true;
    boolean that_present_successTimestamp = true;
    if (this_present_successTimestamp || that_present_successTimestamp) {
      if (!(this_present_successTimestamp && that_present_successTimestamp))
        return false;
      if (this.successTimestamp != that.successTimestamp)
        return false;
    }

    boolean this_present_errorTimestamp = true;
    boolean that_present_errorTimestamp = true;
    if (this_present_errorTimestamp || that_present_errorTimestamp) {
      if (!(this_present_errorTimestamp && that_present_errorTimestamp))
        return false;
      if (this.errorTimestamp != that.errorTimestamp)
        return false;
    }

    return true;
  }

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

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

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

    lastComparison = Boolean.valueOf(isSetPaymentId()).compareTo(isSetPaymentId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(paymentId, typedOther.paymentId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGatewayId()).compareTo(isSetGatewayId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(gatewayId, typedOther.gatewayId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGatewayPaymentId()).compareTo(isSetGatewayPaymentId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(gatewayPaymentId, typedOther.gatewayPaymentId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetMerchantTxnId()).compareTo(isSetMerchantTxnId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(merchantTxnId, typedOther.merchantTxnId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGatewayTxnId()).compareTo(isSetGatewayTxnId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(gatewayTxnId, typedOther.gatewayTxnId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAmount()).compareTo(isSetAmount());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(amount, typedOther.amount);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGatewayTxnStatus()).compareTo(isSetGatewayTxnStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(gatewayTxnStatus, typedOther.gatewayTxnStatus);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(status, typedOther.status);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetUserId()).compareTo(isSetUserId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(userId, typedOther.userId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetErrorCode()).compareTo(isSetErrorCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(errorCode, typedOther.errorCode);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetDescription()).compareTo(isSetDescription());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(description, typedOther.description);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAuthCode()).compareTo(isSetAuthCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(authCode, typedOther.authCode);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetReferenceCode()).compareTo(isSetReferenceCode());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(referenceCode, typedOther.referenceCode);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSessionId()).compareTo(isSetSessionId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(sessionId, typedOther.sessionId);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetGatewayTxnDate()).compareTo(isSetGatewayTxnDate());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(gatewayTxnDate, typedOther.gatewayTxnDate);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(isSetAttributes());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(attributes, typedOther.attributes);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetInitTimestamp()).compareTo(isSetInitTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(initTimestamp, typedOther.initTimestamp);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetSuccessTimestamp()).compareTo(isSetSuccessTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(successTimestamp, typedOther.successTimestamp);
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = Boolean.valueOf(isSetErrorTimestamp()).compareTo(isSetErrorTimestamp());
    if (lastComparison != 0) {
      return lastComparison;
    }
    lastComparison = TBaseHelper.compareTo(errorTimestamp, typedOther.errorTimestamp);
    if (lastComparison != 0) {
      return lastComparison;
    }
    return 0;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      _Fields fieldId = _Fields.findByThriftId(field.id);
      if (fieldId == null) {
        TProtocolUtil.skip(iprot, field.type);
      } else {
        switch (fieldId) {
          case PAYMENT_ID:
            if (field.type == TType.I64) {
              this.paymentId = iprot.readI64();
              setPaymentIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_ID:
            if (field.type == TType.I64) {
              this.gatewayId = iprot.readI64();
              setGatewayIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_PAYMENT_ID:
            if (field.type == TType.STRING) {
              this.gatewayPaymentId = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case MERCHANT_TXN_ID:
            if (field.type == TType.STRING) {
              this.merchantTxnId = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_TXN_ID:
            if (field.type == TType.STRING) {
              this.gatewayTxnId = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AMOUNT:
            if (field.type == TType.DOUBLE) {
              this.amount = iprot.readDouble();
              setAmountIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_TXN_STATUS:
            if (field.type == TType.STRING) {
              this.gatewayTxnStatus = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case STATUS:
            if (field.type == TType.I32) {
              this.status = PaymentStatus.findByValue(iprot.readI32());
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_ID:
            if (field.type == TType.I64) {
              this.userId = iprot.readI64();
              setUserIdIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ERROR_CODE:
            if (field.type == TType.STRING) {
              this.errorCode = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case DESCRIPTION:
            if (field.type == TType.STRING) {
              this.description = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AUTH_CODE:
            if (field.type == TType.STRING) {
              this.authCode = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case REFERENCE_CODE:
            if (field.type == TType.STRING) {
              this.referenceCode = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SESSION_ID:
            if (field.type == TType.STRING) {
              this.sessionId = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_TXN_DATE:
            if (field.type == TType.STRING) {
              this.gatewayTxnDate = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ATTRIBUTES:
            if (field.type == TType.LIST) {
              {
                TList _list4 = iprot.readListBegin();
                this.attributes = new ArrayList<Attribute>(_list4.size);
                for (int _i5 = 0; _i5 < _list4.size; ++_i5)
                {
                  Attribute _elem6;
                  _elem6 = new Attribute();
                  _elem6.read(iprot);
                  this.attributes.add(_elem6);
                }
                iprot.readListEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case INIT_TIMESTAMP:
            if (field.type == TType.I64) {
              this.initTimestamp = iprot.readI64();
              setInitTimestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SUCCESS_TIMESTAMP:
            if (field.type == TType.I64) {
              this.successTimestamp = iprot.readI64();
              setSuccessTimestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ERROR_TIMESTAMP:
            if (field.type == TType.I64) {
              this.errorTimestamp = iprot.readI64();
              setErrorTimestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

  public void write(TProtocol oprot) throws TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    oprot.writeFieldBegin(PAYMENT_ID_FIELD_DESC);
    oprot.writeI64(this.paymentId);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
    oprot.writeI64(this.gatewayId);
    oprot.writeFieldEnd();
    if (this.gatewayPaymentId != null) {
      oprot.writeFieldBegin(GATEWAY_PAYMENT_ID_FIELD_DESC);
      oprot.writeString(this.gatewayPaymentId);
      oprot.writeFieldEnd();
    }
    if (this.merchantTxnId != null) {
      oprot.writeFieldBegin(MERCHANT_TXN_ID_FIELD_DESC);
      oprot.writeString(this.merchantTxnId);
      oprot.writeFieldEnd();
    }
    if (this.gatewayTxnId != null) {
      oprot.writeFieldBegin(GATEWAY_TXN_ID_FIELD_DESC);
      oprot.writeString(this.gatewayTxnId);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.amount);
    oprot.writeFieldEnd();
    if (this.gatewayTxnStatus != null) {
      oprot.writeFieldBegin(GATEWAY_TXN_STATUS_FIELD_DESC);
      oprot.writeString(this.gatewayTxnStatus);
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.userId);
    oprot.writeFieldEnd();
    if (this.errorCode != null) {
      oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC);
      oprot.writeString(this.errorCode);
      oprot.writeFieldEnd();
    }
    if (this.description != null) {
      oprot.writeFieldBegin(DESCRIPTION_FIELD_DESC);
      oprot.writeString(this.description);
      oprot.writeFieldEnd();
    }
    if (this.authCode != null) {
      oprot.writeFieldBegin(AUTH_CODE_FIELD_DESC);
      oprot.writeString(this.authCode);
      oprot.writeFieldEnd();
    }
    if (this.referenceCode != null) {
      oprot.writeFieldBegin(REFERENCE_CODE_FIELD_DESC);
      oprot.writeString(this.referenceCode);
      oprot.writeFieldEnd();
    }
    if (this.sessionId != null) {
      oprot.writeFieldBegin(SESSION_ID_FIELD_DESC);
      oprot.writeString(this.sessionId);
      oprot.writeFieldEnd();
    }
    if (this.gatewayTxnDate != null) {
      oprot.writeFieldBegin(GATEWAY_TXN_DATE_FIELD_DESC);
      oprot.writeString(this.gatewayTxnDate);
      oprot.writeFieldEnd();
    }
    if (this.attributes != null) {
      oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
      {
        oprot.writeListBegin(new TList(TType.STRUCT, this.attributes.size()));
        for (Attribute _iter7 : this.attributes)
        {
          _iter7.write(oprot);
        }
        oprot.writeListEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(INIT_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.initTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SUCCESS_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.successTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(ERROR_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.errorTimestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    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("gatewayPaymentId:");
    if (this.gatewayPaymentId == null) {
      sb.append("null");
    } else {
      sb.append(this.gatewayPaymentId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("merchantTxnId:");
    if (this.merchantTxnId == null) {
      sb.append("null");
    } else {
      sb.append(this.merchantTxnId);
    }
    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("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("gatewayTxnStatus:");
    if (this.gatewayTxnStatus == null) {
      sb.append("null");
    } else {
      sb.append(this.gatewayTxnStatus);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("status:");
    if (this.status == null) {
      sb.append("null");
    } else {
      String status_name = status.name();
      if (status_name != null) {
        sb.append(status_name);
        sb.append(" (");
      }
      sb.append(this.status);
      if (status_name != null) {
        sb.append(")");
      }
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("userId:");
    sb.append(this.userId);
    first = false;
    if (!first) sb.append(", ");
    sb.append("errorCode:");
    if (this.errorCode == null) {
      sb.append("null");
    } else {
      sb.append(this.errorCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("description:");
    if (this.description == null) {
      sb.append("null");
    } else {
      sb.append(this.description);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("authCode:");
    if (this.authCode == null) {
      sb.append("null");
    } else {
      sb.append(this.authCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("referenceCode:");
    if (this.referenceCode == null) {
      sb.append("null");
    } else {
      sb.append(this.referenceCode);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("sessionId:");
    if (this.sessionId == null) {
      sb.append("null");
    } else {
      sb.append(this.sessionId);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("gatewayTxnDate:");
    if (this.gatewayTxnDate == null) {
      sb.append("null");
    } else {
      sb.append(this.gatewayTxnDate);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("attributes:");
    if (this.attributes == null) {
      sb.append("null");
    } else {
      sb.append(this.attributes);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("initTimestamp:");
    sb.append(this.initTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("successTimestamp:");
    sb.append(this.successTimestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("errorTimestamp:");
    sb.append(this.errorTimestamp);
    first = false;
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws TException {
    // check for required fields
  }

}