Subversion Repositories SmartDukaan

Rev

Rev 123 | Rev 695 | 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 {
  private static final TStruct STRUCT_DESC = new TStruct("Payment");

  private static final TField MERCHANT_TX_ID_FIELD_DESC = new TField("merchant_tx_id", TType.STRING, (short)1);
  private static final TField BANK_TX_ID_FIELD_DESC = new TField("bank_tx_id", TType.STRING, (short)2);
  private static final TField AMOUNT_FIELD_DESC = new TField("amount", TType.DOUBLE, (short)3);
  private static final TField INIT_TIMESTAMP_FIELD_DESC = new TField("init_timestamp", TType.I64, (short)4);
  private static final TField BANK_ACK_TIMESTAMP_FIELD_DESC = new TField("bank_ack_timestamp", TType.I64, (short)5);
  private static final TField BANK_STATUS_FIELD_DESC = new TField("bank_status", TType.STRING, (short)6);
  private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)7);
  private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)8);
  private static final TField USER_ID_FIELD_DESC = new TField("user_id", TType.I64, (short)9);
  private static final TField CART_ID_FIELD_DESC = new TField("cart_id", TType.I64, (short)10);
  private static final TField OTHER_INFO_FIELD_DESC = new TField("other_info", TType.MAP, (short)11);
  private static final TField GATEWAY_ID_FIELD_DESC = new TField("gateway_id", TType.I64, (short)12);
  private static final TField PAYMENT_ID_FIELD_DESC = new TField("payment_id", TType.STRING, (short)13);
  private static final TField ERROR_CODE_FIELD_DESC = new TField("error_code", TType.STRING, (short)14);
  private static final TField SESSION_ID_FIELD_DESC = new TField("session_id", TType.STRING, (short)15);
  private static final TField REF_CODE_FIELD_DESC = new TField("ref_code", TType.STRING, (short)16);
  private static final TField AUTH_CODE_FIELD_DESC = new TField("auth_code", TType.STRING, (short)17);
  private static final TField POST_DATE_FIELD_DESC = new TField("post_date", TType.STRING, (short)18);

  private String merchant_tx_id;
  private String bank_tx_id;
  private double amount;
  private long init_timestamp;
  private long bank_ack_timestamp;
  private String bank_status;
  private PaymentStatus status;
  private String message;
  private long user_id;
  private long cart_id;
  private Map<String,String> other_info;
  private long gateway_id;
  private String payment_id;
  private String error_code;
  private String session_id;
  private String ref_code;
  private String auth_code;
  private String post_date;

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements TFieldIdEnum {
    MERCHANT_TX_ID((short)1, "merchant_tx_id"),
    BANK_TX_ID((short)2, "bank_tx_id"),
    AMOUNT((short)3, "amount"),
    INIT_TIMESTAMP((short)4, "init_timestamp"),
    BANK_ACK_TIMESTAMP((short)5, "bank_ack_timestamp"),
    BANK_STATUS((short)6, "bank_status"),
    /**
     * 
     * @see PaymentStatus
     */
    STATUS((short)7, "status"),
    MESSAGE((short)8, "message"),
    USER_ID((short)9, "user_id"),
    CART_ID((short)10, "cart_id"),
    OTHER_INFO((short)11, "other_info"),
    GATEWAY_ID((short)12, "gateway_id"),
    PAYMENT_ID((short)13, "payment_id"),
    ERROR_CODE((short)14, "error_code"),
    SESSION_ID((short)15, "session_id"),
    REF_CODE((short)16, "ref_code"),
    AUTH_CODE((short)17, "auth_code"),
    POST_DATE((short)18, "post_date");

    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 __AMOUNT_ISSET_ID = 0;
  private static final int __INIT_TIMESTAMP_ISSET_ID = 1;
  private static final int __BANK_ACK_TIMESTAMP_ISSET_ID = 2;
  private static final int __USER_ID_ISSET_ID = 3;
  private static final int __CART_ID_ISSET_ID = 4;
  private static final int __GATEWAY_ID_ISSET_ID = 5;
  private BitSet __isset_bit_vector = new BitSet(6);

  public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
    put(_Fields.MERCHANT_TX_ID, new FieldMetaData("merchant_tx_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.BANK_TX_ID, new FieldMetaData("bank_tx_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.AMOUNT, new FieldMetaData("amount", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.DOUBLE)));
    put(_Fields.INIT_TIMESTAMP, new FieldMetaData("init_timestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.BANK_ACK_TIMESTAMP, new FieldMetaData("bank_ack_timestamp", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.BANK_STATUS, new FieldMetaData("bank_status", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
        new EnumMetaData(TType.ENUM, PaymentStatus.class)));
    put(_Fields.MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.USER_ID, new FieldMetaData("user_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.CART_ID, new FieldMetaData("cart_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.OTHER_INFO, new FieldMetaData("other_info", TFieldRequirementType.DEFAULT, 
        new MapMetaData(TType.MAP, 
            new FieldValueMetaData(TType.STRING), 
            new FieldValueMetaData(TType.STRING))));
    put(_Fields.GATEWAY_ID, new FieldMetaData("gateway_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.I64)));
    put(_Fields.PAYMENT_ID, new FieldMetaData("payment_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.ERROR_CODE, new FieldMetaData("error_code", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.SESSION_ID, new FieldMetaData("session_id", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.REF_CODE, new FieldMetaData("ref_code", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.AUTH_CODE, new FieldMetaData("auth_code", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
    put(_Fields.POST_DATE, new FieldMetaData("post_date", TFieldRequirementType.DEFAULT, 
        new FieldValueMetaData(TType.STRING)));
  }});

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

  public Payment() {
  }

  public Payment(
    String merchant_tx_id,
    String bank_tx_id,
    double amount,
    long init_timestamp,
    long bank_ack_timestamp,
    String bank_status,
    PaymentStatus status,
    String message,
    long user_id,
    long cart_id,
    Map<String,String> other_info,
    long gateway_id,
    String payment_id,
    String error_code,
    String session_id,
    String ref_code,
    String auth_code,
    String post_date)
  {
    this();
    this.merchant_tx_id = merchant_tx_id;
    this.bank_tx_id = bank_tx_id;
    this.amount = amount;
    setAmountIsSet(true);
    this.init_timestamp = init_timestamp;
    setInit_timestampIsSet(true);
    this.bank_ack_timestamp = bank_ack_timestamp;
    setBank_ack_timestampIsSet(true);
    this.bank_status = bank_status;
    this.status = status;
    this.message = message;
    this.user_id = user_id;
    setUser_idIsSet(true);
    this.cart_id = cart_id;
    setCart_idIsSet(true);
    this.other_info = other_info;
    this.gateway_id = gateway_id;
    setGateway_idIsSet(true);
    this.payment_id = payment_id;
    this.error_code = error_code;
    this.session_id = session_id;
    this.ref_code = ref_code;
    this.auth_code = auth_code;
    this.post_date = post_date;
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public Payment(Payment other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetMerchant_tx_id()) {
      this.merchant_tx_id = other.merchant_tx_id;
    }
    if (other.isSetBank_tx_id()) {
      this.bank_tx_id = other.bank_tx_id;
    }
    this.amount = other.amount;
    this.init_timestamp = other.init_timestamp;
    this.bank_ack_timestamp = other.bank_ack_timestamp;
    if (other.isSetBank_status()) {
      this.bank_status = other.bank_status;
    }
    if (other.isSetStatus()) {
      this.status = other.status;
    }
    if (other.isSetMessage()) {
      this.message = other.message;
    }
    this.user_id = other.user_id;
    this.cart_id = other.cart_id;
    if (other.isSetOther_info()) {
      Map<String,String> __this__other_info = new HashMap<String,String>();
      for (Map.Entry<String, String> other_element : other.other_info.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__other_info_copy_key = other_element_key;

        String __this__other_info_copy_value = other_element_value;

        __this__other_info.put(__this__other_info_copy_key, __this__other_info_copy_value);
      }
      this.other_info = __this__other_info;
    }
    this.gateway_id = other.gateway_id;
    if (other.isSetPayment_id()) {
      this.payment_id = other.payment_id;
    }
    if (other.isSetError_code()) {
      this.error_code = other.error_code;
    }
    if (other.isSetSession_id()) {
      this.session_id = other.session_id;
    }
    if (other.isSetRef_code()) {
      this.ref_code = other.ref_code;
    }
    if (other.isSetAuth_code()) {
      this.auth_code = other.auth_code;
    }
    if (other.isSetPost_date()) {
      this.post_date = other.post_date;
    }
  }

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

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

  public String getMerchant_tx_id() {
    return this.merchant_tx_id;
  }

  public Payment setMerchant_tx_id(String merchant_tx_id) {
    this.merchant_tx_id = merchant_tx_id;
    return this;
  }

  public void unsetMerchant_tx_id() {
    this.merchant_tx_id = null;
  }

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

  public void setMerchant_tx_idIsSet(boolean value) {
    if (!value) {
      this.merchant_tx_id = null;
    }
  }

  public String getBank_tx_id() {
    return this.bank_tx_id;
  }

  public Payment setBank_tx_id(String bank_tx_id) {
    this.bank_tx_id = bank_tx_id;
    return this;
  }

  public void unsetBank_tx_id() {
    this.bank_tx_id = null;
  }

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

  public void setBank_tx_idIsSet(boolean value) {
    if (!value) {
      this.bank_tx_id = 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 long getInit_timestamp() {
    return this.init_timestamp;
  }

  public Payment setInit_timestamp(long init_timestamp) {
    this.init_timestamp = init_timestamp;
    setInit_timestampIsSet(true);
    return this;
  }

  public void unsetInit_timestamp() {
    __isset_bit_vector.clear(__INIT_TIMESTAMP_ISSET_ID);
  }

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

  public void setInit_timestampIsSet(boolean value) {
    __isset_bit_vector.set(__INIT_TIMESTAMP_ISSET_ID, value);
  }

  public long getBank_ack_timestamp() {
    return this.bank_ack_timestamp;
  }

  public Payment setBank_ack_timestamp(long bank_ack_timestamp) {
    this.bank_ack_timestamp = bank_ack_timestamp;
    setBank_ack_timestampIsSet(true);
    return this;
  }

  public void unsetBank_ack_timestamp() {
    __isset_bit_vector.clear(__BANK_ACK_TIMESTAMP_ISSET_ID);
  }

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

  public void setBank_ack_timestampIsSet(boolean value) {
    __isset_bit_vector.set(__BANK_ACK_TIMESTAMP_ISSET_ID, value);
  }

  public String getBank_status() {
    return this.bank_status;
  }

  public Payment setBank_status(String bank_status) {
    this.bank_status = bank_status;
    return this;
  }

  public void unsetBank_status() {
    this.bank_status = null;
  }

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

  public void setBank_statusIsSet(boolean value) {
    if (!value) {
      this.bank_status = 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 String getMessage() {
    return this.message;
  }

  public Payment setMessage(String message) {
    this.message = message;
    return this;
  }

  public void unsetMessage() {
    this.message = null;
  }

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

  public void setMessageIsSet(boolean value) {
    if (!value) {
      this.message = null;
    }
  }

  public long getUser_id() {
    return this.user_id;
  }

  public Payment setUser_id(long user_id) {
    this.user_id = user_id;
    setUser_idIsSet(true);
    return this;
  }

  public void unsetUser_id() {
    __isset_bit_vector.clear(__USER_ID_ISSET_ID);
  }

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

  public void setUser_idIsSet(boolean value) {
    __isset_bit_vector.set(__USER_ID_ISSET_ID, value);
  }

  public long getCart_id() {
    return this.cart_id;
  }

  public Payment setCart_id(long cart_id) {
    this.cart_id = cart_id;
    setCart_idIsSet(true);
    return this;
  }

  public void unsetCart_id() {
    __isset_bit_vector.clear(__CART_ID_ISSET_ID);
  }

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

  public void setCart_idIsSet(boolean value) {
    __isset_bit_vector.set(__CART_ID_ISSET_ID, value);
  }

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

  public void putToOther_info(String key, String val) {
    if (this.other_info == null) {
      this.other_info = new HashMap<String,String>();
    }
    this.other_info.put(key, val);
  }

  public Map<String,String> getOther_info() {
    return this.other_info;
  }

  public Payment setOther_info(Map<String,String> other_info) {
    this.other_info = other_info;
    return this;
  }

  public void unsetOther_info() {
    this.other_info = null;
  }

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

  public void setOther_infoIsSet(boolean value) {
    if (!value) {
      this.other_info = null;
    }
  }

  public long getGateway_id() {
    return this.gateway_id;
  }

  public Payment setGateway_id(long gateway_id) {
    this.gateway_id = gateway_id;
    setGateway_idIsSet(true);
    return this;
  }

  public void unsetGateway_id() {
    __isset_bit_vector.clear(__GATEWAY_ID_ISSET_ID);
  }

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

  public void setGateway_idIsSet(boolean value) {
    __isset_bit_vector.set(__GATEWAY_ID_ISSET_ID, value);
  }

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

  public Payment setPayment_id(String payment_id) {
    this.payment_id = payment_id;
    return this;
  }

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

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

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

  public String getError_code() {
    return this.error_code;
  }

  public Payment setError_code(String error_code) {
    this.error_code = error_code;
    return this;
  }

  public void unsetError_code() {
    this.error_code = null;
  }

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

  public void setError_codeIsSet(boolean value) {
    if (!value) {
      this.error_code = null;
    }
  }

  public String getSession_id() {
    return this.session_id;
  }

  public Payment setSession_id(String session_id) {
    this.session_id = session_id;
    return this;
  }

  public void unsetSession_id() {
    this.session_id = null;
  }

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

  public void setSession_idIsSet(boolean value) {
    if (!value) {
      this.session_id = null;
    }
  }

  public String getRef_code() {
    return this.ref_code;
  }

  public Payment setRef_code(String ref_code) {
    this.ref_code = ref_code;
    return this;
  }

  public void unsetRef_code() {
    this.ref_code = null;
  }

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

  public void setRef_codeIsSet(boolean value) {
    if (!value) {
      this.ref_code = null;
    }
  }

  public String getAuth_code() {
    return this.auth_code;
  }

  public Payment setAuth_code(String auth_code) {
    this.auth_code = auth_code;
    return this;
  }

  public void unsetAuth_code() {
    this.auth_code = null;
  }

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

  public void setAuth_codeIsSet(boolean value) {
    if (!value) {
      this.auth_code = null;
    }
  }

  public String getPost_date() {
    return this.post_date;
  }

  public Payment setPost_date(String post_date) {
    this.post_date = post_date;
    return this;
  }

  public void unsetPost_date() {
    this.post_date = null;
  }

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

  public void setPost_dateIsSet(boolean value) {
    if (!value) {
      this.post_date = null;
    }
  }

  public void setFieldValue(_Fields field, Object value) {
    switch (field) {
    case MERCHANT_TX_ID:
      if (value == null) {
        unsetMerchant_tx_id();
      } else {
        setMerchant_tx_id((String)value);
      }
      break;

    case BANK_TX_ID:
      if (value == null) {
        unsetBank_tx_id();
      } else {
        setBank_tx_id((String)value);
      }
      break;

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

    case INIT_TIMESTAMP:
      if (value == null) {
        unsetInit_timestamp();
      } else {
        setInit_timestamp((Long)value);
      }
      break;

    case BANK_ACK_TIMESTAMP:
      if (value == null) {
        unsetBank_ack_timestamp();
      } else {
        setBank_ack_timestamp((Long)value);
      }
      break;

    case BANK_STATUS:
      if (value == null) {
        unsetBank_status();
      } else {
        setBank_status((String)value);
      }
      break;

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

    case MESSAGE:
      if (value == null) {
        unsetMessage();
      } else {
        setMessage((String)value);
      }
      break;

    case USER_ID:
      if (value == null) {
        unsetUser_id();
      } else {
        setUser_id((Long)value);
      }
      break;

    case CART_ID:
      if (value == null) {
        unsetCart_id();
      } else {
        setCart_id((Long)value);
      }
      break;

    case OTHER_INFO:
      if (value == null) {
        unsetOther_info();
      } else {
        setOther_info((Map<String,String>)value);
      }
      break;

    case GATEWAY_ID:
      if (value == null) {
        unsetGateway_id();
      } else {
        setGateway_id((Long)value);
      }
      break;

    case PAYMENT_ID:
      if (value == null) {
        unsetPayment_id();
      } else {
        setPayment_id((String)value);
      }
      break;

    case ERROR_CODE:
      if (value == null) {
        unsetError_code();
      } else {
        setError_code((String)value);
      }
      break;

    case SESSION_ID:
      if (value == null) {
        unsetSession_id();
      } else {
        setSession_id((String)value);
      }
      break;

    case REF_CODE:
      if (value == null) {
        unsetRef_code();
      } else {
        setRef_code((String)value);
      }
      break;

    case AUTH_CODE:
      if (value == null) {
        unsetAuth_code();
      } else {
        setAuth_code((String)value);
      }
      break;

    case POST_DATE:
      if (value == null) {
        unsetPost_date();
      } else {
        setPost_date((String)value);
      }
      break;

    }
  }

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

  public Object getFieldValue(_Fields field) {
    switch (field) {
    case MERCHANT_TX_ID:
      return getMerchant_tx_id();

    case BANK_TX_ID:
      return getBank_tx_id();

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

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

    case BANK_ACK_TIMESTAMP:
      return new Long(getBank_ack_timestamp());

    case BANK_STATUS:
      return getBank_status();

    case STATUS:
      return getStatus();

    case MESSAGE:
      return getMessage();

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

    case CART_ID:
      return new Long(getCart_id());

    case OTHER_INFO:
      return getOther_info();

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

    case PAYMENT_ID:
      return getPayment_id();

    case ERROR_CODE:
      return getError_code();

    case SESSION_ID:
      return getSession_id();

    case REF_CODE:
      return getRef_code();

    case AUTH_CODE:
      return getAuth_code();

    case POST_DATE:
      return getPost_date();

    }
    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 MERCHANT_TX_ID:
      return isSetMerchant_tx_id();
    case BANK_TX_ID:
      return isSetBank_tx_id();
    case AMOUNT:
      return isSetAmount();
    case INIT_TIMESTAMP:
      return isSetInit_timestamp();
    case BANK_ACK_TIMESTAMP:
      return isSetBank_ack_timestamp();
    case BANK_STATUS:
      return isSetBank_status();
    case STATUS:
      return isSetStatus();
    case MESSAGE:
      return isSetMessage();
    case USER_ID:
      return isSetUser_id();
    case CART_ID:
      return isSetCart_id();
    case OTHER_INFO:
      return isSetOther_info();
    case GATEWAY_ID:
      return isSetGateway_id();
    case PAYMENT_ID:
      return isSetPayment_id();
    case ERROR_CODE:
      return isSetError_code();
    case SESSION_ID:
      return isSetSession_id();
    case REF_CODE:
      return isSetRef_code();
    case AUTH_CODE:
      return isSetAuth_code();
    case POST_DATE:
      return isSetPost_date();
    }
    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_merchant_tx_id = true && this.isSetMerchant_tx_id();
    boolean that_present_merchant_tx_id = true && that.isSetMerchant_tx_id();
    if (this_present_merchant_tx_id || that_present_merchant_tx_id) {
      if (!(this_present_merchant_tx_id && that_present_merchant_tx_id))
        return false;
      if (!this.merchant_tx_id.equals(that.merchant_tx_id))
        return false;
    }

    boolean this_present_bank_tx_id = true && this.isSetBank_tx_id();
    boolean that_present_bank_tx_id = true && that.isSetBank_tx_id();
    if (this_present_bank_tx_id || that_present_bank_tx_id) {
      if (!(this_present_bank_tx_id && that_present_bank_tx_id))
        return false;
      if (!this.bank_tx_id.equals(that.bank_tx_id))
        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_init_timestamp = true;
    boolean that_present_init_timestamp = true;
    if (this_present_init_timestamp || that_present_init_timestamp) {
      if (!(this_present_init_timestamp && that_present_init_timestamp))
        return false;
      if (this.init_timestamp != that.init_timestamp)
        return false;
    }

    boolean this_present_bank_ack_timestamp = true;
    boolean that_present_bank_ack_timestamp = true;
    if (this_present_bank_ack_timestamp || that_present_bank_ack_timestamp) {
      if (!(this_present_bank_ack_timestamp && that_present_bank_ack_timestamp))
        return false;
      if (this.bank_ack_timestamp != that.bank_ack_timestamp)
        return false;
    }

    boolean this_present_bank_status = true && this.isSetBank_status();
    boolean that_present_bank_status = true && that.isSetBank_status();
    if (this_present_bank_status || that_present_bank_status) {
      if (!(this_present_bank_status && that_present_bank_status))
        return false;
      if (!this.bank_status.equals(that.bank_status))
        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_message = true && this.isSetMessage();
    boolean that_present_message = true && that.isSetMessage();
    if (this_present_message || that_present_message) {
      if (!(this_present_message && that_present_message))
        return false;
      if (!this.message.equals(that.message))
        return false;
    }

    boolean this_present_user_id = true;
    boolean that_present_user_id = true;
    if (this_present_user_id || that_present_user_id) {
      if (!(this_present_user_id && that_present_user_id))
        return false;
      if (this.user_id != that.user_id)
        return false;
    }

    boolean this_present_cart_id = true;
    boolean that_present_cart_id = true;
    if (this_present_cart_id || that_present_cart_id) {
      if (!(this_present_cart_id && that_present_cart_id))
        return false;
      if (this.cart_id != that.cart_id)
        return false;
    }

    boolean this_present_other_info = true && this.isSetOther_info();
    boolean that_present_other_info = true && that.isSetOther_info();
    if (this_present_other_info || that_present_other_info) {
      if (!(this_present_other_info && that_present_other_info))
        return false;
      if (!this.other_info.equals(that.other_info))
        return false;
    }

    boolean this_present_gateway_id = true;
    boolean that_present_gateway_id = true;
    if (this_present_gateway_id || that_present_gateway_id) {
      if (!(this_present_gateway_id && that_present_gateway_id))
        return false;
      if (this.gateway_id != that.gateway_id)
        return false;
    }

    boolean this_present_payment_id = true && this.isSetPayment_id();
    boolean that_present_payment_id = true && that.isSetPayment_id();
    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_error_code = true && this.isSetError_code();
    boolean that_present_error_code = true && that.isSetError_code();
    if (this_present_error_code || that_present_error_code) {
      if (!(this_present_error_code && that_present_error_code))
        return false;
      if (!this.error_code.equals(that.error_code))
        return false;
    }

    boolean this_present_session_id = true && this.isSetSession_id();
    boolean that_present_session_id = true && that.isSetSession_id();
    if (this_present_session_id || that_present_session_id) {
      if (!(this_present_session_id && that_present_session_id))
        return false;
      if (!this.session_id.equals(that.session_id))
        return false;
    }

    boolean this_present_ref_code = true && this.isSetRef_code();
    boolean that_present_ref_code = true && that.isSetRef_code();
    if (this_present_ref_code || that_present_ref_code) {
      if (!(this_present_ref_code && that_present_ref_code))
        return false;
      if (!this.ref_code.equals(that.ref_code))
        return false;
    }

    boolean this_present_auth_code = true && this.isSetAuth_code();
    boolean that_present_auth_code = true && that.isSetAuth_code();
    if (this_present_auth_code || that_present_auth_code) {
      if (!(this_present_auth_code && that_present_auth_code))
        return false;
      if (!this.auth_code.equals(that.auth_code))
        return false;
    }

    boolean this_present_post_date = true && this.isSetPost_date();
    boolean that_present_post_date = true && that.isSetPost_date();
    if (this_present_post_date || that_present_post_date) {
      if (!(this_present_post_date && that_present_post_date))
        return false;
      if (!this.post_date.equals(that.post_date))
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    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 MERCHANT_TX_ID:
            if (field.type == TType.STRING) {
              this.merchant_tx_id = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case BANK_TX_ID:
            if (field.type == TType.STRING) {
              this.bank_tx_id = 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 INIT_TIMESTAMP:
            if (field.type == TType.I64) {
              this.init_timestamp = iprot.readI64();
              setInit_timestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case BANK_ACK_TIMESTAMP:
            if (field.type == TType.I64) {
              this.bank_ack_timestamp = iprot.readI64();
              setBank_ack_timestampIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case BANK_STATUS:
            if (field.type == TType.STRING) {
              this.bank_status = 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 MESSAGE:
            if (field.type == TType.STRING) {
              this.message = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case USER_ID:
            if (field.type == TType.I64) {
              this.user_id = iprot.readI64();
              setUser_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case CART_ID:
            if (field.type == TType.I64) {
              this.cart_id = iprot.readI64();
              setCart_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case OTHER_INFO:
            if (field.type == TType.MAP) {
              {
                TMap _map5 = iprot.readMapBegin();
                this.other_info = new HashMap<String,String>(2*_map5.size);
                for (int _i6 = 0; _i6 < _map5.size; ++_i6)
                {
                  String _key7;
                  String _val8;
                  _key7 = iprot.readString();
                  _val8 = iprot.readString();
                  this.other_info.put(_key7, _val8);
                }
                iprot.readMapEnd();
              }
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case GATEWAY_ID:
            if (field.type == TType.I64) {
              this.gateway_id = iprot.readI64();
              setGateway_idIsSet(true);
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case PAYMENT_ID:
            if (field.type == TType.STRING) {
              this.payment_id = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case ERROR_CODE:
            if (field.type == TType.STRING) {
              this.error_code = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case SESSION_ID:
            if (field.type == TType.STRING) {
              this.session_id = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case REF_CODE:
            if (field.type == TType.STRING) {
              this.ref_code = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case AUTH_CODE:
            if (field.type == TType.STRING) {
              this.auth_code = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
          case POST_DATE:
            if (field.type == TType.STRING) {
              this.post_date = iprot.readString();
            } else { 
              TProtocolUtil.skip(iprot, field.type);
            }
            break;
        }
        iprot.readFieldEnd();
      }
    }
    iprot.readStructEnd();
    validate();
  }

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

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.merchant_tx_id != null) {
      oprot.writeFieldBegin(MERCHANT_TX_ID_FIELD_DESC);
      oprot.writeString(this.merchant_tx_id);
      oprot.writeFieldEnd();
    }
    if (this.bank_tx_id != null) {
      oprot.writeFieldBegin(BANK_TX_ID_FIELD_DESC);
      oprot.writeString(this.bank_tx_id);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
    oprot.writeDouble(this.amount);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(INIT_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.init_timestamp);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(BANK_ACK_TIMESTAMP_FIELD_DESC);
    oprot.writeI64(this.bank_ack_timestamp);
    oprot.writeFieldEnd();
    if (this.bank_status != null) {
      oprot.writeFieldBegin(BANK_STATUS_FIELD_DESC);
      oprot.writeString(this.bank_status);
      oprot.writeFieldEnd();
    }
    if (this.status != null) {
      oprot.writeFieldBegin(STATUS_FIELD_DESC);
      oprot.writeI32(this.status.getValue());
      oprot.writeFieldEnd();
    }
    if (this.message != null) {
      oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
      oprot.writeString(this.message);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(USER_ID_FIELD_DESC);
    oprot.writeI64(this.user_id);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CART_ID_FIELD_DESC);
    oprot.writeI64(this.cart_id);
    oprot.writeFieldEnd();
    if (this.other_info != null) {
      oprot.writeFieldBegin(OTHER_INFO_FIELD_DESC);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.other_info.size()));
        for (Map.Entry<String, String> _iter9 : this.other_info.entrySet())
        {
          oprot.writeString(_iter9.getKey());
          oprot.writeString(_iter9.getValue());
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
    oprot.writeI64(this.gateway_id);
    oprot.writeFieldEnd();
    if (this.payment_id != null) {
      oprot.writeFieldBegin(PAYMENT_ID_FIELD_DESC);
      oprot.writeString(this.payment_id);
      oprot.writeFieldEnd();
    }
    if (this.error_code != null) {
      oprot.writeFieldBegin(ERROR_CODE_FIELD_DESC);
      oprot.writeString(this.error_code);
      oprot.writeFieldEnd();
    }
    if (this.session_id != null) {
      oprot.writeFieldBegin(SESSION_ID_FIELD_DESC);
      oprot.writeString(this.session_id);
      oprot.writeFieldEnd();
    }
    if (this.ref_code != null) {
      oprot.writeFieldBegin(REF_CODE_FIELD_DESC);
      oprot.writeString(this.ref_code);
      oprot.writeFieldEnd();
    }
    if (this.auth_code != null) {
      oprot.writeFieldBegin(AUTH_CODE_FIELD_DESC);
      oprot.writeString(this.auth_code);
      oprot.writeFieldEnd();
    }
    if (this.post_date != null) {
      oprot.writeFieldBegin(POST_DATE_FIELD_DESC);
      oprot.writeString(this.post_date);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

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

    sb.append("merchant_tx_id:");
    if (this.merchant_tx_id == null) {
      sb.append("null");
    } else {
      sb.append(this.merchant_tx_id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("bank_tx_id:");
    if (this.bank_tx_id == null) {
      sb.append("null");
    } else {
      sb.append(this.bank_tx_id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("amount:");
    sb.append(this.amount);
    first = false;
    if (!first) sb.append(", ");
    sb.append("init_timestamp:");
    sb.append(this.init_timestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bank_ack_timestamp:");
    sb.append(this.bank_ack_timestamp);
    first = false;
    if (!first) sb.append(", ");
    sb.append("bank_status:");
    if (this.bank_status == null) {
      sb.append("null");
    } else {
      sb.append(this.bank_status);
    }
    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("message:");
    if (this.message == null) {
      sb.append("null");
    } else {
      sb.append(this.message);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("user_id:");
    sb.append(this.user_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("cart_id:");
    sb.append(this.cart_id);
    first = false;
    if (!first) sb.append(", ");
    sb.append("other_info:");
    if (this.other_info == null) {
      sb.append("null");
    } else {
      sb.append(this.other_info);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("gateway_id:");
    sb.append(this.gateway_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("error_code:");
    if (this.error_code == null) {
      sb.append("null");
    } else {
      sb.append(this.error_code);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("session_id:");
    if (this.session_id == null) {
      sb.append("null");
    } else {
      sb.append(this.session_id);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("ref_code:");
    if (this.ref_code == null) {
      sb.append("null");
    } else {
      sb.append(this.ref_code);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("auth_code:");
    if (this.auth_code == null) {
      sb.append("null");
    } else {
      sb.append(this.auth_code);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("post_date:");
    if (this.post_date == null) {
      sb.append("null");
    } else {
      sb.append(this.post_date);
    }
    first = false;
    sb.append(")");
    return sb.toString();
  }

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

}