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 PaymentService {

  public interface Iface {

    public long createPayment(long user_id, long cart_id, double amount, long gateway_id) throws PaymentException, TException;

    public void createPaymentRequest(long cart_id, long application_id, long merchant_tx_id, List<Param> params) throws PaymentException, TException;

    public void addCallbackUrl(long application_id, String callback_url, boolean updateIfExisting) throws PaymentException, TException;

    public void getCallbackUrl(long application_id) throws PaymentException, TException;

    public List<Payment> getPaymentsForUser(long userId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException;

    public List<Payment> getPaymentsForCart(long cartId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException;

    public List<Payment> getPayments(long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException;

    public List<Payment> getPaymentForMerchantId(long merchant_tx_id) throws PaymentException, TException;

    public void changePaymentStatus(long id, PaymentStatus newStatus) throws PaymentException, TException;

    public void changePaymentRequestStatus(long request_id, RequestStatus requestStatus) throws PaymentException, TException;

    public List<PaymentGateway> getPaymentGateways(PaymentGatewayStatus status) throws PaymentException, TException;

    public PaymentGateway getPaymentGateway(long id) throws PaymentException, TException;

    public void changeGatewayStatus(long id, PaymentGatewayStatus status) throws PaymentException, TException;

    public Payment getPayment(long id) throws PaymentException, TException;

    public void addBankDetails(long id, String bid, String btxid, String error_code, String session_id, String postdate, String auth_code, String ref_code) throws PaymentException, TException;

  }

  public static class Client implements Iface {
    public Client(TProtocol prot)
    {
      this(prot, prot);
    }

    public Client(TProtocol iprot, TProtocol oprot)
    {
      iprot_ = iprot;
      oprot_ = oprot;
    }

    protected TProtocol iprot_;
    protected TProtocol oprot_;

    protected int seqid_;

    public TProtocol getInputProtocol()
    {
      return this.iprot_;
    }

    public TProtocol getOutputProtocol()
    {
      return this.oprot_;
    }

    public long createPayment(long user_id, long cart_id, double amount, long gateway_id) throws PaymentException, TException
    {
      send_createPayment(user_id, cart_id, amount, gateway_id);
      return recv_createPayment();
    }

    public void send_createPayment(long user_id, long cart_id, double amount, long gateway_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("createPayment", TMessageType.CALL, seqid_));
      createPayment_args args = new createPayment_args();
      args.user_id = user_id;
      args.cart_id = cart_id;
      args.amount = amount;
      args.gateway_id = gateway_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public long recv_createPayment() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      createPayment_result result = new createPayment_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "createPayment failed: unknown result");
    }

    public void createPaymentRequest(long cart_id, long application_id, long merchant_tx_id, List<Param> params) throws PaymentException, TException
    {
      send_createPaymentRequest(cart_id, application_id, merchant_tx_id, params);
      recv_createPaymentRequest();
    }

    public void send_createPaymentRequest(long cart_id, long application_id, long merchant_tx_id, List<Param> params) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("createPaymentRequest", TMessageType.CALL, seqid_));
      createPaymentRequest_args args = new createPaymentRequest_args();
      args.cart_id = cart_id;
      args.application_id = application_id;
      args.merchant_tx_id = merchant_tx_id;
      args.params = params;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_createPaymentRequest() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      createPaymentRequest_result result = new createPaymentRequest_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public void addCallbackUrl(long application_id, String callback_url, boolean updateIfExisting) throws PaymentException, TException
    {
      send_addCallbackUrl(application_id, callback_url, updateIfExisting);
      recv_addCallbackUrl();
    }

    public void send_addCallbackUrl(long application_id, String callback_url, boolean updateIfExisting) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("addCallbackUrl", TMessageType.CALL, seqid_));
      addCallbackUrl_args args = new addCallbackUrl_args();
      args.application_id = application_id;
      args.callback_url = callback_url;
      args.updateIfExisting = updateIfExisting;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_addCallbackUrl() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      addCallbackUrl_result result = new addCallbackUrl_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public void getCallbackUrl(long application_id) throws PaymentException, TException
    {
      send_getCallbackUrl(application_id);
      recv_getCallbackUrl();
    }

    public void send_getCallbackUrl(long application_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getCallbackUrl", TMessageType.CALL, seqid_));
      getCallbackUrl_args args = new getCallbackUrl_args();
      args.application_id = application_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_getCallbackUrl() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getCallbackUrl_result result = new getCallbackUrl_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public List<Payment> getPaymentsForUser(long userId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException
    {
      send_getPaymentsForUser(userId, from_time, to_time, status, gateway_id);
      return recv_getPaymentsForUser();
    }

    public void send_getPaymentsForUser(long userId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPaymentsForUser", TMessageType.CALL, seqid_));
      getPaymentsForUser_args args = new getPaymentsForUser_args();
      args.userId = userId;
      args.from_time = from_time;
      args.to_time = to_time;
      args.status = status;
      args.gateway_id = gateway_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Payment> recv_getPaymentsForUser() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPaymentsForUser_result result = new getPaymentsForUser_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentsForUser failed: unknown result");
    }

    public List<Payment> getPaymentsForCart(long cartId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException
    {
      send_getPaymentsForCart(cartId, from_time, to_time, status, gateway_id);
      return recv_getPaymentsForCart();
    }

    public void send_getPaymentsForCart(long cartId, long from_time, long to_time, PaymentStatus status, long gateway_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPaymentsForCart", TMessageType.CALL, seqid_));
      getPaymentsForCart_args args = new getPaymentsForCart_args();
      args.cartId = cartId;
      args.from_time = from_time;
      args.to_time = to_time;
      args.status = status;
      args.gateway_id = gateway_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Payment> recv_getPaymentsForCart() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPaymentsForCart_result result = new getPaymentsForCart_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentsForCart failed: unknown result");
    }

    public List<Payment> getPayments(long from_time, long to_time, PaymentStatus status, long gateway_id) throws PaymentException, TException
    {
      send_getPayments(from_time, to_time, status, gateway_id);
      return recv_getPayments();
    }

    public void send_getPayments(long from_time, long to_time, PaymentStatus status, long gateway_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPayments", TMessageType.CALL, seqid_));
      getPayments_args args = new getPayments_args();
      args.from_time = from_time;
      args.to_time = to_time;
      args.status = status;
      args.gateway_id = gateway_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Payment> recv_getPayments() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPayments_result result = new getPayments_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPayments failed: unknown result");
    }

    public List<Payment> getPaymentForMerchantId(long merchant_tx_id) throws PaymentException, TException
    {
      send_getPaymentForMerchantId(merchant_tx_id);
      return recv_getPaymentForMerchantId();
    }

    public void send_getPaymentForMerchantId(long merchant_tx_id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPaymentForMerchantId", TMessageType.CALL, seqid_));
      getPaymentForMerchantId_args args = new getPaymentForMerchantId_args();
      args.merchant_tx_id = merchant_tx_id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<Payment> recv_getPaymentForMerchantId() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPaymentForMerchantId_result result = new getPaymentForMerchantId_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentForMerchantId failed: unknown result");
    }

    public void changePaymentStatus(long id, PaymentStatus newStatus) throws PaymentException, TException
    {
      send_changePaymentStatus(id, newStatus);
      recv_changePaymentStatus();
    }

    public void send_changePaymentStatus(long id, PaymentStatus newStatus) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("changePaymentStatus", TMessageType.CALL, seqid_));
      changePaymentStatus_args args = new changePaymentStatus_args();
      args.id = id;
      args.newStatus = newStatus;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_changePaymentStatus() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      changePaymentStatus_result result = new changePaymentStatus_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public void changePaymentRequestStatus(long request_id, RequestStatus requestStatus) throws PaymentException, TException
    {
      send_changePaymentRequestStatus(request_id, requestStatus);
      recv_changePaymentRequestStatus();
    }

    public void send_changePaymentRequestStatus(long request_id, RequestStatus requestStatus) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("changePaymentRequestStatus", TMessageType.CALL, seqid_));
      changePaymentRequestStatus_args args = new changePaymentRequestStatus_args();
      args.request_id = request_id;
      args.requestStatus = requestStatus;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_changePaymentRequestStatus() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      changePaymentRequestStatus_result result = new changePaymentRequestStatus_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public List<PaymentGateway> getPaymentGateways(PaymentGatewayStatus status) throws PaymentException, TException
    {
      send_getPaymentGateways(status);
      return recv_getPaymentGateways();
    }

    public void send_getPaymentGateways(PaymentGatewayStatus status) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPaymentGateways", TMessageType.CALL, seqid_));
      getPaymentGateways_args args = new getPaymentGateways_args();
      args.status = status;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public List<PaymentGateway> recv_getPaymentGateways() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPaymentGateways_result result = new getPaymentGateways_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentGateways failed: unknown result");
    }

    public PaymentGateway getPaymentGateway(long id) throws PaymentException, TException
    {
      send_getPaymentGateway(id);
      return recv_getPaymentGateway();
    }

    public void send_getPaymentGateway(long id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPaymentGateway", TMessageType.CALL, seqid_));
      getPaymentGateway_args args = new getPaymentGateway_args();
      args.id = id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public PaymentGateway recv_getPaymentGateway() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPaymentGateway_result result = new getPaymentGateway_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentGateway failed: unknown result");
    }

    public void changeGatewayStatus(long id, PaymentGatewayStatus status) throws PaymentException, TException
    {
      send_changeGatewayStatus(id, status);
      recv_changeGatewayStatus();
    }

    public void send_changeGatewayStatus(long id, PaymentGatewayStatus status) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("changeGatewayStatus", TMessageType.CALL, seqid_));
      changeGatewayStatus_args args = new changeGatewayStatus_args();
      args.id = id;
      args.status = status;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_changeGatewayStatus() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      changeGatewayStatus_result result = new changeGatewayStatus_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

    public Payment getPayment(long id) throws PaymentException, TException
    {
      send_getPayment(id);
      return recv_getPayment();
    }

    public void send_getPayment(long id) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("getPayment", TMessageType.CALL, seqid_));
      getPayment_args args = new getPayment_args();
      args.id = id;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public Payment recv_getPayment() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      getPayment_result result = new getPayment_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.isSetSuccess()) {
        return result.success;
      }
      if (result.pe != null) {
        throw result.pe;
      }
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getPayment failed: unknown result");
    }

    public void addBankDetails(long id, String bid, String btxid, String error_code, String session_id, String postdate, String auth_code, String ref_code) throws PaymentException, TException
    {
      send_addBankDetails(id, bid, btxid, error_code, session_id, postdate, auth_code, ref_code);
      recv_addBankDetails();
    }

    public void send_addBankDetails(long id, String bid, String btxid, String error_code, String session_id, String postdate, String auth_code, String ref_code) throws TException
    {
      oprot_.writeMessageBegin(new TMessage("addBankDetails", TMessageType.CALL, seqid_));
      addBankDetails_args args = new addBankDetails_args();
      args.id = id;
      args.bid = bid;
      args.btxid = btxid;
      args.error_code = error_code;
      args.session_id = session_id;
      args.postdate = postdate;
      args.auth_code = auth_code;
      args.ref_code = ref_code;
      args.write(oprot_);
      oprot_.writeMessageEnd();
      oprot_.getTransport().flush();
    }

    public void recv_addBankDetails() throws PaymentException, TException
    {
      TMessage msg = iprot_.readMessageBegin();
      if (msg.type == TMessageType.EXCEPTION) {
        TApplicationException x = TApplicationException.read(iprot_);
        iprot_.readMessageEnd();
        throw x;
      }
      addBankDetails_result result = new addBankDetails_result();
      result.read(iprot_);
      iprot_.readMessageEnd();
      if (result.pe != null) {
        throw result.pe;
      }
      return;
    }

  }
  public static class Processor implements TProcessor {
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
    public Processor(Iface iface)
    {
      iface_ = iface;
      processMap_.put("createPayment", new createPayment());
      processMap_.put("createPaymentRequest", new createPaymentRequest());
      processMap_.put("addCallbackUrl", new addCallbackUrl());
      processMap_.put("getCallbackUrl", new getCallbackUrl());
      processMap_.put("getPaymentsForUser", new getPaymentsForUser());
      processMap_.put("getPaymentsForCart", new getPaymentsForCart());
      processMap_.put("getPayments", new getPayments());
      processMap_.put("getPaymentForMerchantId", new getPaymentForMerchantId());
      processMap_.put("changePaymentStatus", new changePaymentStatus());
      processMap_.put("changePaymentRequestStatus", new changePaymentRequestStatus());
      processMap_.put("getPaymentGateways", new getPaymentGateways());
      processMap_.put("getPaymentGateway", new getPaymentGateway());
      processMap_.put("changeGatewayStatus", new changeGatewayStatus());
      processMap_.put("getPayment", new getPayment());
      processMap_.put("addBankDetails", new addBankDetails());
    }

    protected static interface ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException;
    }

    private Iface iface_;
    protected final HashMap<String,ProcessFunction> processMap_ = new HashMap<String,ProcessFunction>();

    public boolean process(TProtocol iprot, TProtocol oprot) throws TException
    {
      TMessage msg = iprot.readMessageBegin();
      ProcessFunction fn = processMap_.get(msg.name);
      if (fn == null) {
        TProtocolUtil.skip(iprot, TType.STRUCT);
        iprot.readMessageEnd();
        TApplicationException x = new TApplicationException(TApplicationException.UNKNOWN_METHOD, "Invalid method name: '"+msg.name+"'");
        oprot.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid));
        x.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
        return true;
      }
      fn.process(msg.seqid, iprot, oprot);
      return true;
    }

    private class createPayment implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        createPayment_args args = new createPayment_args();
        args.read(iprot);
        iprot.readMessageEnd();
        createPayment_result result = new createPayment_result();
        try {
          result.success = iface_.createPayment(args.user_id, args.cart_id, args.amount, args.gateway_id);
          result.setSuccessIsSet(true);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing createPayment", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing createPayment");
          oprot.writeMessageBegin(new TMessage("createPayment", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("createPayment", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class createPaymentRequest implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        createPaymentRequest_args args = new createPaymentRequest_args();
        args.read(iprot);
        iprot.readMessageEnd();
        createPaymentRequest_result result = new createPaymentRequest_result();
        try {
          iface_.createPaymentRequest(args.cart_id, args.application_id, args.merchant_tx_id, args.params);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing createPaymentRequest", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing createPaymentRequest");
          oprot.writeMessageBegin(new TMessage("createPaymentRequest", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("createPaymentRequest", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class addCallbackUrl implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        addCallbackUrl_args args = new addCallbackUrl_args();
        args.read(iprot);
        iprot.readMessageEnd();
        addCallbackUrl_result result = new addCallbackUrl_result();
        try {
          iface_.addCallbackUrl(args.application_id, args.callback_url, args.updateIfExisting);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing addCallbackUrl", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing addCallbackUrl");
          oprot.writeMessageBegin(new TMessage("addCallbackUrl", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("addCallbackUrl", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getCallbackUrl implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getCallbackUrl_args args = new getCallbackUrl_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getCallbackUrl_result result = new getCallbackUrl_result();
        try {
          iface_.getCallbackUrl(args.application_id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getCallbackUrl", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getCallbackUrl");
          oprot.writeMessageBegin(new TMessage("getCallbackUrl", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getCallbackUrl", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPaymentsForUser implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPaymentsForUser_args args = new getPaymentsForUser_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPaymentsForUser_result result = new getPaymentsForUser_result();
        try {
          result.success = iface_.getPaymentsForUser(args.userId, args.from_time, args.to_time, args.status, args.gateway_id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPaymentsForUser", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPaymentsForUser");
          oprot.writeMessageBegin(new TMessage("getPaymentsForUser", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPaymentsForUser", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPaymentsForCart implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPaymentsForCart_args args = new getPaymentsForCart_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPaymentsForCart_result result = new getPaymentsForCart_result();
        try {
          result.success = iface_.getPaymentsForCart(args.cartId, args.from_time, args.to_time, args.status, args.gateway_id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPaymentsForCart", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPaymentsForCart");
          oprot.writeMessageBegin(new TMessage("getPaymentsForCart", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPaymentsForCart", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPayments implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPayments_args args = new getPayments_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPayments_result result = new getPayments_result();
        try {
          result.success = iface_.getPayments(args.from_time, args.to_time, args.status, args.gateway_id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPayments", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPayments");
          oprot.writeMessageBegin(new TMessage("getPayments", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPayments", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPaymentForMerchantId implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPaymentForMerchantId_args args = new getPaymentForMerchantId_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPaymentForMerchantId_result result = new getPaymentForMerchantId_result();
        try {
          result.success = iface_.getPaymentForMerchantId(args.merchant_tx_id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPaymentForMerchantId", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPaymentForMerchantId");
          oprot.writeMessageBegin(new TMessage("getPaymentForMerchantId", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPaymentForMerchantId", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class changePaymentStatus implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        changePaymentStatus_args args = new changePaymentStatus_args();
        args.read(iprot);
        iprot.readMessageEnd();
        changePaymentStatus_result result = new changePaymentStatus_result();
        try {
          iface_.changePaymentStatus(args.id, args.newStatus);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing changePaymentStatus", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing changePaymentStatus");
          oprot.writeMessageBegin(new TMessage("changePaymentStatus", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("changePaymentStatus", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class changePaymentRequestStatus implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        changePaymentRequestStatus_args args = new changePaymentRequestStatus_args();
        args.read(iprot);
        iprot.readMessageEnd();
        changePaymentRequestStatus_result result = new changePaymentRequestStatus_result();
        try {
          iface_.changePaymentRequestStatus(args.request_id, args.requestStatus);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing changePaymentRequestStatus", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing changePaymentRequestStatus");
          oprot.writeMessageBegin(new TMessage("changePaymentRequestStatus", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("changePaymentRequestStatus", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPaymentGateways implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPaymentGateways_args args = new getPaymentGateways_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPaymentGateways_result result = new getPaymentGateways_result();
        try {
          result.success = iface_.getPaymentGateways(args.status);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPaymentGateways", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPaymentGateways");
          oprot.writeMessageBegin(new TMessage("getPaymentGateways", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPaymentGateways", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPaymentGateway implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPaymentGateway_args args = new getPaymentGateway_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPaymentGateway_result result = new getPaymentGateway_result();
        try {
          result.success = iface_.getPaymentGateway(args.id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPaymentGateway", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPaymentGateway");
          oprot.writeMessageBegin(new TMessage("getPaymentGateway", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPaymentGateway", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class changeGatewayStatus implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        changeGatewayStatus_args args = new changeGatewayStatus_args();
        args.read(iprot);
        iprot.readMessageEnd();
        changeGatewayStatus_result result = new changeGatewayStatus_result();
        try {
          iface_.changeGatewayStatus(args.id, args.status);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing changeGatewayStatus", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing changeGatewayStatus");
          oprot.writeMessageBegin(new TMessage("changeGatewayStatus", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("changeGatewayStatus", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class getPayment implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        getPayment_args args = new getPayment_args();
        args.read(iprot);
        iprot.readMessageEnd();
        getPayment_result result = new getPayment_result();
        try {
          result.success = iface_.getPayment(args.id);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing getPayment", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing getPayment");
          oprot.writeMessageBegin(new TMessage("getPayment", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("getPayment", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

    private class addBankDetails implements ProcessFunction {
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
      {
        addBankDetails_args args = new addBankDetails_args();
        args.read(iprot);
        iprot.readMessageEnd();
        addBankDetails_result result = new addBankDetails_result();
        try {
          iface_.addBankDetails(args.id, args.bid, args.btxid, args.error_code, args.session_id, args.postdate, args.auth_code, args.ref_code);
        } catch (PaymentException pe) {
          result.pe = pe;
        } catch (Throwable th) {
          LOGGER.error("Internal error processing addBankDetails", th);
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing addBankDetails");
          oprot.writeMessageBegin(new TMessage("addBankDetails", TMessageType.EXCEPTION, seqid));
          x.write(oprot);
          oprot.writeMessageEnd();
          oprot.getTransport().flush();
          return;
        }
        oprot.writeMessageBegin(new TMessage("addBankDetails", TMessageType.REPLY, seqid));
        result.write(oprot);
        oprot.writeMessageEnd();
        oprot.getTransport().flush();
      }

    }

  }

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

    private static final TField USER_ID_FIELD_DESC = new TField("user_id", TType.I64, (short)1);
    private static final TField CART_ID_FIELD_DESC = new TField("cart_id", TType.I64, (short)2);
    private static final TField AMOUNT_FIELD_DESC = new TField("amount", TType.DOUBLE, (short)3);
    private static final TField GATEWAY_ID_FIELD_DESC = new TField("gateway_id", TType.I64, (short)4);

    private long user_id;
    private long cart_id;
    private double amount;
    private long gateway_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      USER_ID((short)1, "user_id"),
      CART_ID((short)2, "cart_id"),
      AMOUNT((short)3, "amount"),
      GATEWAY_ID((short)4, "gateway_id");

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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      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.AMOUNT, new FieldMetaData("amount", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.DOUBLE)));
      put(_Fields.GATEWAY_ID, new FieldMetaData("gateway_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public createPayment_args() {
    }

    public createPayment_args(
      long user_id,
      long cart_id,
      double amount,
      long gateway_id)
    {
      this();
      this.user_id = user_id;
      setUser_idIsSet(true);
      this.cart_id = cart_id;
      setCart_idIsSet(true);
      this.amount = amount;
      setAmountIsSet(true);
      this.gateway_id = gateway_id;
      setGateway_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPayment_args(createPayment_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.user_id = other.user_id;
      this.cart_id = other.cart_id;
      this.amount = other.amount;
      this.gateway_id = other.gateway_id;
    }

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

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

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

    public createPayment_args 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 createPayment_args 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 double getAmount() {
      return this.amount;
    }

    public createPayment_args 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 getGateway_id() {
      return this.gateway_id;
    }

    public createPayment_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      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 AMOUNT:
        if (value == null) {
          unsetAmount();
        } else {
          setAmount((Double)value);
        }
        break;

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return new Long(getUser_id());

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

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

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

      }
      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 USER_ID:
        return isSetUser_id();
      case CART_ID:
        return isSetCart_id();
      case AMOUNT:
        return isSetAmount();
      case GATEWAY_ID:
        return isSetGateway_id();
      }
      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 createPayment_args)
        return this.equals((createPayment_args)that);
      return false;
    }

    public boolean equals(createPayment_args that) {
      if (that == null)
        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_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_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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetUser_id()).compareTo(isSetUser_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(user_id, typedOther.user_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCart_id()).compareTo(isSetCart_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cart_id, typedOther.cart_id);
      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(isSetGateway_id()).compareTo(isSetGateway_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(gateway_id, typedOther.gateway_id);
      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 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 AMOUNT:
              if (field.type == TType.DOUBLE) {
                this.amount = iprot.readDouble();
                setAmountIsSet(true);
              } 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;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

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

      oprot.writeStructBegin(STRUCT_DESC);
      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();
      oprot.writeFieldBegin(AMOUNT_FIELD_DESC);
      oprot.writeDouble(this.amount);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
      oprot.writeI64(this.gateway_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      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("amount:");
      sb.append(this.amount);
      first = false;
      if (!first) sb.append(", ");
      sb.append("gateway_id:");
      sb.append(this.gateway_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private long success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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 __SUCCESS_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public createPayment_result() {
    }

    public createPayment_result(
      long success,
      PaymentException pe)
    {
      this();
      this.success = success;
      setSuccessIsSet(true);
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPayment_result(createPayment_result other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.success = other.success;
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public long getSuccess() {
      return this.success;
    }

    public createPayment_result setSuccess(long success) {
      this.success = success;
      setSuccessIsSet(true);
      return this;
    }

    public void unsetSuccess() {
      __isset_bit_vector.clear(__SUCCESS_ISSET_ID);
    }

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

    public void setSuccessIsSet(boolean value) {
      __isset_bit_vector.set(__SUCCESS_ISSET_ID, value);
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public createPayment_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Long)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return new Long(getSuccess());

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 createPayment_result)
        return this.equals((createPayment_result)that);
      return false;
    }

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

      boolean this_present_success = true;
      boolean that_present_success = true;
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (this.success != that.success)
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(isSetSuccess());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(success, typedOther.success);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 SUCCESS:
              if (field.type == TType.I64) {
                this.success = iprot.readI64();
                setSuccessIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        oprot.writeI64(this.success);
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      sb.append(this.success);
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CART_ID_FIELD_DESC = new TField("cart_id", TType.I64, (short)1);
    private static final TField APPLICATION_ID_FIELD_DESC = new TField("application_id", TType.I64, (short)2);
    private static final TField MERCHANT_TX_ID_FIELD_DESC = new TField("merchant_tx_id", TType.I64, (short)3);
    private static final TField PARAMS_FIELD_DESC = new TField("params", TType.LIST, (short)5);

    private long cart_id;
    private long application_id;
    private long merchant_tx_id;
    private List<Param> params;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CART_ID((short)1, "cart_id"),
      APPLICATION_ID((short)2, "application_id"),
      MERCHANT_TX_ID((short)3, "merchant_tx_id"),
      PARAMS((short)5, "params");

      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 __CART_ID_ISSET_ID = 0;
    private static final int __APPLICATION_ID_ISSET_ID = 1;
    private static final int __MERCHANT_TX_ID_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CART_ID, new FieldMetaData("cart_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.APPLICATION_ID, new FieldMetaData("application_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.MERCHANT_TX_ID, new FieldMetaData("merchant_tx_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.PARAMS, new FieldMetaData("params", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Param.class))));
    }});

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

    public createPaymentRequest_args() {
    }

    public createPaymentRequest_args(
      long cart_id,
      long application_id,
      long merchant_tx_id,
      List<Param> params)
    {
      this();
      this.cart_id = cart_id;
      setCart_idIsSet(true);
      this.application_id = application_id;
      setApplication_idIsSet(true);
      this.merchant_tx_id = merchant_tx_id;
      setMerchant_tx_idIsSet(true);
      this.params = params;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPaymentRequest_args(createPaymentRequest_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.cart_id = other.cart_id;
      this.application_id = other.application_id;
      this.merchant_tx_id = other.merchant_tx_id;
      if (other.isSetParams()) {
        List<Param> __this__params = new ArrayList<Param>();
        for (Param other_element : other.params) {
          __this__params.add(new Param(other_element));
        }
        this.params = __this__params;
      }
    }

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

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

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

    public createPaymentRequest_args 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 long getApplication_id() {
      return this.application_id;
    }

    public createPaymentRequest_args setApplication_id(long application_id) {
      this.application_id = application_id;
      setApplication_idIsSet(true);
      return this;
    }

    public void unsetApplication_id() {
      __isset_bit_vector.clear(__APPLICATION_ID_ISSET_ID);
    }

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

    public void setApplication_idIsSet(boolean value) {
      __isset_bit_vector.set(__APPLICATION_ID_ISSET_ID, value);
    }

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

    public createPaymentRequest_args setMerchant_tx_id(long merchant_tx_id) {
      this.merchant_tx_id = merchant_tx_id;
      setMerchant_tx_idIsSet(true);
      return this;
    }

    public void unsetMerchant_tx_id() {
      __isset_bit_vector.clear(__MERCHANT_TX_ID_ISSET_ID);
    }

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

    public void setMerchant_tx_idIsSet(boolean value) {
      __isset_bit_vector.set(__MERCHANT_TX_ID_ISSET_ID, value);
    }

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

    public java.util.Iterator<Param> getParamsIterator() {
      return (this.params == null) ? null : this.params.iterator();
    }

    public void addToParams(Param elem) {
      if (this.params == null) {
        this.params = new ArrayList<Param>();
      }
      this.params.add(elem);
    }

    public List<Param> getParams() {
      return this.params;
    }

    public createPaymentRequest_args setParams(List<Param> params) {
      this.params = params;
      return this;
    }

    public void unsetParams() {
      this.params = null;
    }

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

    public void setParamsIsSet(boolean value) {
      if (!value) {
        this.params = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CART_ID:
        if (value == null) {
          unsetCart_id();
        } else {
          setCart_id((Long)value);
        }
        break;

      case APPLICATION_ID:
        if (value == null) {
          unsetApplication_id();
        } else {
          setApplication_id((Long)value);
        }
        break;

      case MERCHANT_TX_ID:
        if (value == null) {
          unsetMerchant_tx_id();
        } else {
          setMerchant_tx_id((Long)value);
        }
        break;

      case PARAMS:
        if (value == null) {
          unsetParams();
        } else {
          setParams((List<Param>)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CART_ID:
        return new Long(getCart_id());

      case APPLICATION_ID:
        return new Long(getApplication_id());

      case MERCHANT_TX_ID:
        return new Long(getMerchant_tx_id());

      case PARAMS:
        return getParams();

      }
      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 CART_ID:
        return isSetCart_id();
      case APPLICATION_ID:
        return isSetApplication_id();
      case MERCHANT_TX_ID:
        return isSetMerchant_tx_id();
      case PARAMS:
        return isSetParams();
      }
      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 createPaymentRequest_args)
        return this.equals((createPaymentRequest_args)that);
      return false;
    }

    public boolean equals(createPaymentRequest_args that) {
      if (that == null)
        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_application_id = true;
      boolean that_present_application_id = true;
      if (this_present_application_id || that_present_application_id) {
        if (!(this_present_application_id && that_present_application_id))
          return false;
        if (this.application_id != that.application_id)
          return false;
      }

      boolean this_present_merchant_tx_id = true;
      boolean that_present_merchant_tx_id = true;
      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 != that.merchant_tx_id)
          return false;
      }

      boolean this_present_params = true && this.isSetParams();
      boolean that_present_params = true && that.isSetParams();
      if (this_present_params || that_present_params) {
        if (!(this_present_params && that_present_params))
          return false;
        if (!this.params.equals(that.params))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCart_id()).compareTo(isSetCart_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cart_id, typedOther.cart_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetApplication_id()).compareTo(isSetApplication_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(application_id, typedOther.application_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetMerchant_tx_id()).compareTo(isSetMerchant_tx_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(merchant_tx_id, typedOther.merchant_tx_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetParams()).compareTo(isSetParams());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(params, typedOther.params);
      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 CART_ID:
              if (field.type == TType.I64) {
                this.cart_id = iprot.readI64();
                setCart_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case APPLICATION_ID:
              if (field.type == TType.I64) {
                this.application_id = iprot.readI64();
                setApplication_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case MERCHANT_TX_ID:
              if (field.type == TType.I64) {
                this.merchant_tx_id = iprot.readI64();
                setMerchant_tx_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PARAMS:
              if (field.type == TType.LIST) {
                {
                  TList _list14 = iprot.readListBegin();
                  this.params = new ArrayList<Param>(_list14.size);
                  for (int _i15 = 0; _i15 < _list14.size; ++_i15)
                  {
                    Param _elem16;
                    _elem16 = new Param();
                    _elem16.read(iprot);
                    this.params.add(_elem16);
                  }
                  iprot.readListEnd();
                }
              } 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(CART_ID_FIELD_DESC);
      oprot.writeI64(this.cart_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(APPLICATION_ID_FIELD_DESC);
      oprot.writeI64(this.application_id);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(MERCHANT_TX_ID_FIELD_DESC);
      oprot.writeI64(this.merchant_tx_id);
      oprot.writeFieldEnd();
      if (this.params != null) {
        oprot.writeFieldBegin(PARAMS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.params.size()));
          for (Param _iter17 : this.params)
          {
            _iter17.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cart_id:");
      sb.append(this.cart_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("application_id:");
      sb.append(this.application_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("merchant_tx_id:");
      sb.append(this.merchant_tx_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("params:");
      if (this.params == null) {
        sb.append("null");
      } else {
        sb.append(this.params);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public createPaymentRequest_result() {
    }

    public createPaymentRequest_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public createPaymentRequest_result(createPaymentRequest_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public createPaymentRequest_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 createPaymentRequest_result)
        return this.equals((createPaymentRequest_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField APPLICATION_ID_FIELD_DESC = new TField("application_id", TType.I64, (short)1);
    private static final TField CALLBACK_URL_FIELD_DESC = new TField("callback_url", TType.STRING, (short)2);
    private static final TField UPDATE_IF_EXISTING_FIELD_DESC = new TField("updateIfExisting", TType.BOOL, (short)3);

    private long application_id;
    private String callback_url;
    private boolean updateIfExisting;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      APPLICATION_ID((short)1, "application_id"),
      CALLBACK_URL((short)2, "callback_url"),
      UPDATE_IF_EXISTING((short)3, "updateIfExisting");

      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 __APPLICATION_ID_ISSET_ID = 0;
    private static final int __UPDATEIFEXISTING_ISSET_ID = 1;
    private BitSet __isset_bit_vector = new BitSet(2);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.APPLICATION_ID, new FieldMetaData("application_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.CALLBACK_URL, new FieldMetaData("callback_url", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
      put(_Fields.UPDATE_IF_EXISTING, new FieldMetaData("updateIfExisting", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.BOOL)));
    }});

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

    public addCallbackUrl_args() {
    }

    public addCallbackUrl_args(
      long application_id,
      String callback_url,
      boolean updateIfExisting)
    {
      this();
      this.application_id = application_id;
      setApplication_idIsSet(true);
      this.callback_url = callback_url;
      this.updateIfExisting = updateIfExisting;
      setUpdateIfExistingIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addCallbackUrl_args(addCallbackUrl_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.application_id = other.application_id;
      if (other.isSetCallback_url()) {
        this.callback_url = other.callback_url;
      }
      this.updateIfExisting = other.updateIfExisting;
    }

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

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

    public long getApplication_id() {
      return this.application_id;
    }

    public addCallbackUrl_args setApplication_id(long application_id) {
      this.application_id = application_id;
      setApplication_idIsSet(true);
      return this;
    }

    public void unsetApplication_id() {
      __isset_bit_vector.clear(__APPLICATION_ID_ISSET_ID);
    }

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

    public void setApplication_idIsSet(boolean value) {
      __isset_bit_vector.set(__APPLICATION_ID_ISSET_ID, value);
    }

    public String getCallback_url() {
      return this.callback_url;
    }

    public addCallbackUrl_args setCallback_url(String callback_url) {
      this.callback_url = callback_url;
      return this;
    }

    public void unsetCallback_url() {
      this.callback_url = null;
    }

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

    public void setCallback_urlIsSet(boolean value) {
      if (!value) {
        this.callback_url = null;
      }
    }

    public boolean isUpdateIfExisting() {
      return this.updateIfExisting;
    }

    public addCallbackUrl_args setUpdateIfExisting(boolean updateIfExisting) {
      this.updateIfExisting = updateIfExisting;
      setUpdateIfExistingIsSet(true);
      return this;
    }

    public void unsetUpdateIfExisting() {
      __isset_bit_vector.clear(__UPDATEIFEXISTING_ISSET_ID);
    }

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

    public void setUpdateIfExistingIsSet(boolean value) {
      __isset_bit_vector.set(__UPDATEIFEXISTING_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case APPLICATION_ID:
        if (value == null) {
          unsetApplication_id();
        } else {
          setApplication_id((Long)value);
        }
        break;

      case CALLBACK_URL:
        if (value == null) {
          unsetCallback_url();
        } else {
          setCallback_url((String)value);
        }
        break;

      case UPDATE_IF_EXISTING:
        if (value == null) {
          unsetUpdateIfExisting();
        } else {
          setUpdateIfExisting((Boolean)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case APPLICATION_ID:
        return new Long(getApplication_id());

      case CALLBACK_URL:
        return getCallback_url();

      case UPDATE_IF_EXISTING:
        return new Boolean(isUpdateIfExisting());

      }
      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 APPLICATION_ID:
        return isSetApplication_id();
      case CALLBACK_URL:
        return isSetCallback_url();
      case UPDATE_IF_EXISTING:
        return isSetUpdateIfExisting();
      }
      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 addCallbackUrl_args)
        return this.equals((addCallbackUrl_args)that);
      return false;
    }

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

      boolean this_present_application_id = true;
      boolean that_present_application_id = true;
      if (this_present_application_id || that_present_application_id) {
        if (!(this_present_application_id && that_present_application_id))
          return false;
        if (this.application_id != that.application_id)
          return false;
      }

      boolean this_present_callback_url = true && this.isSetCallback_url();
      boolean that_present_callback_url = true && that.isSetCallback_url();
      if (this_present_callback_url || that_present_callback_url) {
        if (!(this_present_callback_url && that_present_callback_url))
          return false;
        if (!this.callback_url.equals(that.callback_url))
          return false;
      }

      boolean this_present_updateIfExisting = true;
      boolean that_present_updateIfExisting = true;
      if (this_present_updateIfExisting || that_present_updateIfExisting) {
        if (!(this_present_updateIfExisting && that_present_updateIfExisting))
          return false;
        if (this.updateIfExisting != that.updateIfExisting)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetApplication_id()).compareTo(isSetApplication_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(application_id, typedOther.application_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetCallback_url()).compareTo(isSetCallback_url());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(callback_url, typedOther.callback_url);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetUpdateIfExisting()).compareTo(isSetUpdateIfExisting());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(updateIfExisting, typedOther.updateIfExisting);
      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 APPLICATION_ID:
              if (field.type == TType.I64) {
                this.application_id = iprot.readI64();
                setApplication_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case CALLBACK_URL:
              if (field.type == TType.STRING) {
                this.callback_url = iprot.readString();
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case UPDATE_IF_EXISTING:
              if (field.type == TType.BOOL) {
                this.updateIfExisting = iprot.readBool();
                setUpdateIfExistingIsSet(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(APPLICATION_ID_FIELD_DESC);
      oprot.writeI64(this.application_id);
      oprot.writeFieldEnd();
      if (this.callback_url != null) {
        oprot.writeFieldBegin(CALLBACK_URL_FIELD_DESC);
        oprot.writeString(this.callback_url);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(UPDATE_IF_EXISTING_FIELD_DESC);
      oprot.writeBool(this.updateIfExisting);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("application_id:");
      sb.append(this.application_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("callback_url:");
      if (this.callback_url == null) {
        sb.append("null");
      } else {
        sb.append(this.callback_url);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("updateIfExisting:");
      sb.append(this.updateIfExisting);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public addCallbackUrl_result() {
    }

    public addCallbackUrl_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addCallbackUrl_result(addCallbackUrl_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public addCallbackUrl_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 addCallbackUrl_result)
        return this.equals((addCallbackUrl_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField APPLICATION_ID_FIELD_DESC = new TField("application_id", TType.I64, (short)1);

    private long application_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      APPLICATION_ID((short)1, "application_id");

      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 __APPLICATION_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.APPLICATION_ID, new FieldMetaData("application_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getCallbackUrl_args() {
    }

    public getCallbackUrl_args(
      long application_id)
    {
      this();
      this.application_id = application_id;
      setApplication_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCallbackUrl_args(getCallbackUrl_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.application_id = other.application_id;
    }

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

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

    public long getApplication_id() {
      return this.application_id;
    }

    public getCallbackUrl_args setApplication_id(long application_id) {
      this.application_id = application_id;
      setApplication_idIsSet(true);
      return this;
    }

    public void unsetApplication_id() {
      __isset_bit_vector.clear(__APPLICATION_ID_ISSET_ID);
    }

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

    public void setApplication_idIsSet(boolean value) {
      __isset_bit_vector.set(__APPLICATION_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case APPLICATION_ID:
        if (value == null) {
          unsetApplication_id();
        } else {
          setApplication_id((Long)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case APPLICATION_ID:
        return new Long(getApplication_id());

      }
      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 APPLICATION_ID:
        return isSetApplication_id();
      }
      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 getCallbackUrl_args)
        return this.equals((getCallbackUrl_args)that);
      return false;
    }

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

      boolean this_present_application_id = true;
      boolean that_present_application_id = true;
      if (this_present_application_id || that_present_application_id) {
        if (!(this_present_application_id && that_present_application_id))
          return false;
        if (this.application_id != that.application_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetApplication_id()).compareTo(isSetApplication_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(application_id, typedOther.application_id);
      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 APPLICATION_ID:
              if (field.type == TType.I64) {
                this.application_id = iprot.readI64();
                setApplication_idIsSet(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(APPLICATION_ID_FIELD_DESC);
      oprot.writeI64(this.application_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("application_id:");
      sb.append(this.application_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getCallbackUrl_result() {
    }

    public getCallbackUrl_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getCallbackUrl_result(getCallbackUrl_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public getCallbackUrl_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 getCallbackUrl_result)
        return this.equals((getCallbackUrl_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField USER_ID_FIELD_DESC = new TField("userId", TType.I64, (short)1);
    private static final TField FROM_TIME_FIELD_DESC = new TField("from_time", TType.I64, (short)2);
    private static final TField TO_TIME_FIELD_DESC = new TField("to_time", TType.I64, (short)3);
    private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)4);
    private static final TField GATEWAY_ID_FIELD_DESC = new TField("gateway_id", TType.I64, (short)5);

    private long userId;
    private long from_time;
    private long to_time;
    private PaymentStatus status;
    private long gateway_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      USER_ID((short)1, "userId"),
      FROM_TIME((short)2, "from_time"),
      TO_TIME((short)3, "to_time"),
      /**
       * 
       * @see PaymentStatus
       */
      STATUS((short)4, "status"),
      GATEWAY_ID((short)5, "gateway_id");

      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 __USERID_ISSET_ID = 0;
    private static final int __FROM_TIME_ISSET_ID = 1;
    private static final int __TO_TIME_ISSET_ID = 2;
    private static final int __GATEWAY_ID_ISSET_ID = 3;
    private BitSet __isset_bit_vector = new BitSet(4);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.USER_ID, new FieldMetaData("userId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.FROM_TIME, new FieldMetaData("from_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TO_TIME, new FieldMetaData("to_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentStatus.class)));
      put(_Fields.GATEWAY_ID, new FieldMetaData("gateway_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getPaymentsForUser_args() {
    }

    public getPaymentsForUser_args(
      long userId,
      long from_time,
      long to_time,
      PaymentStatus status,
      long gateway_id)
    {
      this();
      this.userId = userId;
      setUserIdIsSet(true);
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      this.to_time = to_time;
      setTo_timeIsSet(true);
      this.status = status;
      this.gateway_id = gateway_id;
      setGateway_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentsForUser_args(getPaymentsForUser_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.userId = other.userId;
      this.from_time = other.from_time;
      this.to_time = other.to_time;
      if (other.isSetStatus()) {
        this.status = other.status;
      }
      this.gateway_id = other.gateway_id;
    }

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

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

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

    public getPaymentsForUser_args 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 long getFrom_time() {
      return this.from_time;
    }

    public getPaymentsForUser_args setFrom_time(long from_time) {
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      return this;
    }

    public void unsetFrom_time() {
      __isset_bit_vector.clear(__FROM_TIME_ISSET_ID);
    }

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

    public void setFrom_timeIsSet(boolean value) {
      __isset_bit_vector.set(__FROM_TIME_ISSET_ID, value);
    }

    public long getTo_time() {
      return this.to_time;
    }

    public getPaymentsForUser_args setTo_time(long to_time) {
      this.to_time = to_time;
      setTo_timeIsSet(true);
      return this;
    }

    public void unsetTo_time() {
      __isset_bit_vector.clear(__TO_TIME_ISSET_ID);
    }

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

    public void setTo_timeIsSet(boolean value) {
      __isset_bit_vector.set(__TO_TIME_ISSET_ID, value);
    }

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

    /**
     * 
     * @see PaymentStatus
     */
    public getPaymentsForUser_args 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 getGateway_id() {
      return this.gateway_id;
    }

    public getPaymentsForUser_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case USER_ID:
        if (value == null) {
          unsetUserId();
        } else {
          setUserId((Long)value);
        }
        break;

      case FROM_TIME:
        if (value == null) {
          unsetFrom_time();
        } else {
          setFrom_time((Long)value);
        }
        break;

      case TO_TIME:
        if (value == null) {
          unsetTo_time();
        } else {
          setTo_time((Long)value);
        }
        break;

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

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case USER_ID:
        return new Long(getUserId());

      case FROM_TIME:
        return new Long(getFrom_time());

      case TO_TIME:
        return new Long(getTo_time());

      case STATUS:
        return getStatus();

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

      }
      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 USER_ID:
        return isSetUserId();
      case FROM_TIME:
        return isSetFrom_time();
      case TO_TIME:
        return isSetTo_time();
      case STATUS:
        return isSetStatus();
      case GATEWAY_ID:
        return isSetGateway_id();
      }
      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 getPaymentsForUser_args)
        return this.equals((getPaymentsForUser_args)that);
      return false;
    }

    public boolean equals(getPaymentsForUser_args that) {
      if (that == null)
        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_from_time = true;
      boolean that_present_from_time = true;
      if (this_present_from_time || that_present_from_time) {
        if (!(this_present_from_time && that_present_from_time))
          return false;
        if (this.from_time != that.from_time)
          return false;
      }

      boolean this_present_to_time = true;
      boolean that_present_to_time = true;
      if (this_present_to_time || that_present_to_time) {
        if (!(this_present_to_time && that_present_to_time))
          return false;
        if (this.to_time != that.to_time)
          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_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;
      }

      return true;
    }

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

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

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

      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(isSetFrom_time()).compareTo(isSetFrom_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(from_time, typedOther.from_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTo_time()).compareTo(isSetTo_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(to_time, typedOther.to_time);
      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(isSetGateway_id()).compareTo(isSetGateway_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(gateway_id, typedOther.gateway_id);
      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 USER_ID:
              if (field.type == TType.I64) {
                this.userId = iprot.readI64();
                setUserIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case FROM_TIME:
              if (field.type == TType.I64) {
                this.from_time = iprot.readI64();
                setFrom_timeIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TO_TIME:
              if (field.type == TType.I64) {
                this.to_time = iprot.readI64();
                setTo_timeIsSet(true);
              } 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 GATEWAY_ID:
              if (field.type == TType.I64) {
                this.gateway_id = iprot.readI64();
                setGateway_idIsSet(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(USER_ID_FIELD_DESC);
      oprot.writeI64(this.userId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(FROM_TIME_FIELD_DESC);
      oprot.writeI64(this.from_time);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TO_TIME_FIELD_DESC);
      oprot.writeI64(this.to_time);
      oprot.writeFieldEnd();
      if (this.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(this.status.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
      oprot.writeI64(this.gateway_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("userId:");
      sb.append(this.userId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("from_time:");
      sb.append(this.from_time);
      first = false;
      if (!first) sb.append(", ");
      sb.append("to_time:");
      sb.append(this.to_time);
      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("gateway_id:");
      sb.append(this.gateway_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private List<Payment> success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Payment.class))));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPaymentsForUser_result() {
    }

    public getPaymentsForUser_result(
      List<Payment> success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentsForUser_result(getPaymentsForUser_result other) {
      if (other.isSetSuccess()) {
        List<Payment> __this__success = new ArrayList<Payment>();
        for (Payment other_element : other.success) {
          __this__success.add(new Payment(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

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

    public java.util.Iterator<Payment> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Payment elem) {
      if (this.success == null) {
        this.success = new ArrayList<Payment>();
      }
      this.success.add(elem);
    }

    public List<Payment> getSuccess() {
      return this.success;
    }

    public getPaymentsForUser_result setSuccess(List<Payment> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPaymentsForUser_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Payment>)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPaymentsForUser_result)
        return this.equals((getPaymentsForUser_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list18 = iprot.readListBegin();
                  this.success = new ArrayList<Payment>(_list18.size);
                  for (int _i19 = 0; _i19 < _list18.size; ++_i19)
                  {
                    Payment _elem20;
                    _elem20 = new Payment();
                    _elem20.read(iprot);
                    this.success.add(_elem20);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Payment _iter21 : this.success)
          {
            _iter21.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField CART_ID_FIELD_DESC = new TField("cartId", TType.I64, (short)1);
    private static final TField FROM_TIME_FIELD_DESC = new TField("from_time", TType.I64, (short)2);
    private static final TField TO_TIME_FIELD_DESC = new TField("to_time", TType.I64, (short)3);
    private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)4);
    private static final TField GATEWAY_ID_FIELD_DESC = new TField("gateway_id", TType.I64, (short)5);

    private long cartId;
    private long from_time;
    private long to_time;
    private PaymentStatus status;
    private long gateway_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      CART_ID((short)1, "cartId"),
      FROM_TIME((short)2, "from_time"),
      TO_TIME((short)3, "to_time"),
      /**
       * 
       * @see PaymentStatus
       */
      STATUS((short)4, "status"),
      GATEWAY_ID((short)5, "gateway_id");

      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 __CARTID_ISSET_ID = 0;
    private static final int __FROM_TIME_ISSET_ID = 1;
    private static final int __TO_TIME_ISSET_ID = 2;
    private static final int __GATEWAY_ID_ISSET_ID = 3;
    private BitSet __isset_bit_vector = new BitSet(4);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.CART_ID, new FieldMetaData("cartId", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.FROM_TIME, new FieldMetaData("from_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TO_TIME, new FieldMetaData("to_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentStatus.class)));
      put(_Fields.GATEWAY_ID, new FieldMetaData("gateway_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getPaymentsForCart_args() {
    }

    public getPaymentsForCart_args(
      long cartId,
      long from_time,
      long to_time,
      PaymentStatus status,
      long gateway_id)
    {
      this();
      this.cartId = cartId;
      setCartIdIsSet(true);
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      this.to_time = to_time;
      setTo_timeIsSet(true);
      this.status = status;
      this.gateway_id = gateway_id;
      setGateway_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentsForCart_args(getPaymentsForCart_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.cartId = other.cartId;
      this.from_time = other.from_time;
      this.to_time = other.to_time;
      if (other.isSetStatus()) {
        this.status = other.status;
      }
      this.gateway_id = other.gateway_id;
    }

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

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

    public long getCartId() {
      return this.cartId;
    }

    public getPaymentsForCart_args setCartId(long cartId) {
      this.cartId = cartId;
      setCartIdIsSet(true);
      return this;
    }

    public void unsetCartId() {
      __isset_bit_vector.clear(__CARTID_ISSET_ID);
    }

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

    public void setCartIdIsSet(boolean value) {
      __isset_bit_vector.set(__CARTID_ISSET_ID, value);
    }

    public long getFrom_time() {
      return this.from_time;
    }

    public getPaymentsForCart_args setFrom_time(long from_time) {
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      return this;
    }

    public void unsetFrom_time() {
      __isset_bit_vector.clear(__FROM_TIME_ISSET_ID);
    }

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

    public void setFrom_timeIsSet(boolean value) {
      __isset_bit_vector.set(__FROM_TIME_ISSET_ID, value);
    }

    public long getTo_time() {
      return this.to_time;
    }

    public getPaymentsForCart_args setTo_time(long to_time) {
      this.to_time = to_time;
      setTo_timeIsSet(true);
      return this;
    }

    public void unsetTo_time() {
      __isset_bit_vector.clear(__TO_TIME_ISSET_ID);
    }

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

    public void setTo_timeIsSet(boolean value) {
      __isset_bit_vector.set(__TO_TIME_ISSET_ID, value);
    }

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

    /**
     * 
     * @see PaymentStatus
     */
    public getPaymentsForCart_args 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 getGateway_id() {
      return this.gateway_id;
    }

    public getPaymentsForCart_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case CART_ID:
        if (value == null) {
          unsetCartId();
        } else {
          setCartId((Long)value);
        }
        break;

      case FROM_TIME:
        if (value == null) {
          unsetFrom_time();
        } else {
          setFrom_time((Long)value);
        }
        break;

      case TO_TIME:
        if (value == null) {
          unsetTo_time();
        } else {
          setTo_time((Long)value);
        }
        break;

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

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case CART_ID:
        return new Long(getCartId());

      case FROM_TIME:
        return new Long(getFrom_time());

      case TO_TIME:
        return new Long(getTo_time());

      case STATUS:
        return getStatus();

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

      }
      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 CART_ID:
        return isSetCartId();
      case FROM_TIME:
        return isSetFrom_time();
      case TO_TIME:
        return isSetTo_time();
      case STATUS:
        return isSetStatus();
      case GATEWAY_ID:
        return isSetGateway_id();
      }
      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 getPaymentsForCart_args)
        return this.equals((getPaymentsForCart_args)that);
      return false;
    }

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

      boolean this_present_cartId = true;
      boolean that_present_cartId = true;
      if (this_present_cartId || that_present_cartId) {
        if (!(this_present_cartId && that_present_cartId))
          return false;
        if (this.cartId != that.cartId)
          return false;
      }

      boolean this_present_from_time = true;
      boolean that_present_from_time = true;
      if (this_present_from_time || that_present_from_time) {
        if (!(this_present_from_time && that_present_from_time))
          return false;
        if (this.from_time != that.from_time)
          return false;
      }

      boolean this_present_to_time = true;
      boolean that_present_to_time = true;
      if (this_present_to_time || that_present_to_time) {
        if (!(this_present_to_time && that_present_to_time))
          return false;
        if (this.to_time != that.to_time)
          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_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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetCartId()).compareTo(isSetCartId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(cartId, typedOther.cartId);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetFrom_time()).compareTo(isSetFrom_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(from_time, typedOther.from_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTo_time()).compareTo(isSetTo_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(to_time, typedOther.to_time);
      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(isSetGateway_id()).compareTo(isSetGateway_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(gateway_id, typedOther.gateway_id);
      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 CART_ID:
              if (field.type == TType.I64) {
                this.cartId = iprot.readI64();
                setCartIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case FROM_TIME:
              if (field.type == TType.I64) {
                this.from_time = iprot.readI64();
                setFrom_timeIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TO_TIME:
              if (field.type == TType.I64) {
                this.to_time = iprot.readI64();
                setTo_timeIsSet(true);
              } 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 GATEWAY_ID:
              if (field.type == TType.I64) {
                this.gateway_id = iprot.readI64();
                setGateway_idIsSet(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(CART_ID_FIELD_DESC);
      oprot.writeI64(this.cartId);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(FROM_TIME_FIELD_DESC);
      oprot.writeI64(this.from_time);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TO_TIME_FIELD_DESC);
      oprot.writeI64(this.to_time);
      oprot.writeFieldEnd();
      if (this.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(this.status.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
      oprot.writeI64(this.gateway_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("cartId:");
      sb.append(this.cartId);
      first = false;
      if (!first) sb.append(", ");
      sb.append("from_time:");
      sb.append(this.from_time);
      first = false;
      if (!first) sb.append(", ");
      sb.append("to_time:");
      sb.append(this.to_time);
      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("gateway_id:");
      sb.append(this.gateway_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private List<Payment> success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Payment.class))));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPaymentsForCart_result() {
    }

    public getPaymentsForCart_result(
      List<Payment> success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentsForCart_result(getPaymentsForCart_result other) {
      if (other.isSetSuccess()) {
        List<Payment> __this__success = new ArrayList<Payment>();
        for (Payment other_element : other.success) {
          __this__success.add(new Payment(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

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

    public java.util.Iterator<Payment> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Payment elem) {
      if (this.success == null) {
        this.success = new ArrayList<Payment>();
      }
      this.success.add(elem);
    }

    public List<Payment> getSuccess() {
      return this.success;
    }

    public getPaymentsForCart_result setSuccess(List<Payment> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPaymentsForCart_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Payment>)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPaymentsForCart_result)
        return this.equals((getPaymentsForCart_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list22 = iprot.readListBegin();
                  this.success = new ArrayList<Payment>(_list22.size);
                  for (int _i23 = 0; _i23 < _list22.size; ++_i23)
                  {
                    Payment _elem24;
                    _elem24 = new Payment();
                    _elem24.read(iprot);
                    this.success.add(_elem24);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Payment _iter25 : this.success)
          {
            _iter25.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField FROM_TIME_FIELD_DESC = new TField("from_time", TType.I64, (short)1);
    private static final TField TO_TIME_FIELD_DESC = new TField("to_time", TType.I64, (short)2);
    private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)3);
    private static final TField GATEWAY_ID_FIELD_DESC = new TField("gateway_id", TType.I64, (short)4);

    private long from_time;
    private long to_time;
    private PaymentStatus status;
    private long gateway_id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      FROM_TIME((short)1, "from_time"),
      TO_TIME((short)2, "to_time"),
      /**
       * 
       * @see PaymentStatus
       */
      STATUS((short)3, "status"),
      GATEWAY_ID((short)4, "gateway_id");

      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 __FROM_TIME_ISSET_ID = 0;
    private static final int __TO_TIME_ISSET_ID = 1;
    private static final int __GATEWAY_ID_ISSET_ID = 2;
    private BitSet __isset_bit_vector = new BitSet(3);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.FROM_TIME, new FieldMetaData("from_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.TO_TIME, new FieldMetaData("to_time", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentStatus.class)));
      put(_Fields.GATEWAY_ID, new FieldMetaData("gateway_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getPayments_args() {
    }

    public getPayments_args(
      long from_time,
      long to_time,
      PaymentStatus status,
      long gateway_id)
    {
      this();
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      this.to_time = to_time;
      setTo_timeIsSet(true);
      this.status = status;
      this.gateway_id = gateway_id;
      setGateway_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPayments_args(getPayments_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.from_time = other.from_time;
      this.to_time = other.to_time;
      if (other.isSetStatus()) {
        this.status = other.status;
      }
      this.gateway_id = other.gateway_id;
    }

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

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

    public long getFrom_time() {
      return this.from_time;
    }

    public getPayments_args setFrom_time(long from_time) {
      this.from_time = from_time;
      setFrom_timeIsSet(true);
      return this;
    }

    public void unsetFrom_time() {
      __isset_bit_vector.clear(__FROM_TIME_ISSET_ID);
    }

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

    public void setFrom_timeIsSet(boolean value) {
      __isset_bit_vector.set(__FROM_TIME_ISSET_ID, value);
    }

    public long getTo_time() {
      return this.to_time;
    }

    public getPayments_args setTo_time(long to_time) {
      this.to_time = to_time;
      setTo_timeIsSet(true);
      return this;
    }

    public void unsetTo_time() {
      __isset_bit_vector.clear(__TO_TIME_ISSET_ID);
    }

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

    public void setTo_timeIsSet(boolean value) {
      __isset_bit_vector.set(__TO_TIME_ISSET_ID, value);
    }

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

    /**
     * 
     * @see PaymentStatus
     */
    public getPayments_args 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 getGateway_id() {
      return this.gateway_id;
    }

    public getPayments_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case FROM_TIME:
        if (value == null) {
          unsetFrom_time();
        } else {
          setFrom_time((Long)value);
        }
        break;

      case TO_TIME:
        if (value == null) {
          unsetTo_time();
        } else {
          setTo_time((Long)value);
        }
        break;

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

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

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case FROM_TIME:
        return new Long(getFrom_time());

      case TO_TIME:
        return new Long(getTo_time());

      case STATUS:
        return getStatus();

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

      }
      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 FROM_TIME:
        return isSetFrom_time();
      case TO_TIME:
        return isSetTo_time();
      case STATUS:
        return isSetStatus();
      case GATEWAY_ID:
        return isSetGateway_id();
      }
      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 getPayments_args)
        return this.equals((getPayments_args)that);
      return false;
    }

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

      boolean this_present_from_time = true;
      boolean that_present_from_time = true;
      if (this_present_from_time || that_present_from_time) {
        if (!(this_present_from_time && that_present_from_time))
          return false;
        if (this.from_time != that.from_time)
          return false;
      }

      boolean this_present_to_time = true;
      boolean that_present_to_time = true;
      if (this_present_to_time || that_present_to_time) {
        if (!(this_present_to_time && that_present_to_time))
          return false;
        if (this.to_time != that.to_time)
          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_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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetFrom_time()).compareTo(isSetFrom_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(from_time, typedOther.from_time);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetTo_time()).compareTo(isSetTo_time());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(to_time, typedOther.to_time);
      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(isSetGateway_id()).compareTo(isSetGateway_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(gateway_id, typedOther.gateway_id);
      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 FROM_TIME:
              if (field.type == TType.I64) {
                this.from_time = iprot.readI64();
                setFrom_timeIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case TO_TIME:
              if (field.type == TType.I64) {
                this.to_time = iprot.readI64();
                setTo_timeIsSet(true);
              } 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 GATEWAY_ID:
              if (field.type == TType.I64) {
                this.gateway_id = iprot.readI64();
                setGateway_idIsSet(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(FROM_TIME_FIELD_DESC);
      oprot.writeI64(this.from_time);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(TO_TIME_FIELD_DESC);
      oprot.writeI64(this.to_time);
      oprot.writeFieldEnd();
      if (this.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(this.status.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
      oprot.writeI64(this.gateway_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("from_time:");
      sb.append(this.from_time);
      first = false;
      if (!first) sb.append(", ");
      sb.append("to_time:");
      sb.append(this.to_time);
      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("gateway_id:");
      sb.append(this.gateway_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private List<Payment> success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Payment.class))));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPayments_result() {
    }

    public getPayments_result(
      List<Payment> success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPayments_result(getPayments_result other) {
      if (other.isSetSuccess()) {
        List<Payment> __this__success = new ArrayList<Payment>();
        for (Payment other_element : other.success) {
          __this__success.add(new Payment(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

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

    public java.util.Iterator<Payment> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Payment elem) {
      if (this.success == null) {
        this.success = new ArrayList<Payment>();
      }
      this.success.add(elem);
    }

    public List<Payment> getSuccess() {
      return this.success;
    }

    public getPayments_result setSuccess(List<Payment> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPayments_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Payment>)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPayments_result)
        return this.equals((getPayments_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list26 = iprot.readListBegin();
                  this.success = new ArrayList<Payment>(_list26.size);
                  for (int _i27 = 0; _i27 < _list26.size; ++_i27)
                  {
                    Payment _elem28;
                    _elem28 = new Payment();
                    _elem28.read(iprot);
                    this.success.add(_elem28);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Payment _iter29 : this.success)
          {
            _iter29.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField MERCHANT_TX_ID_FIELD_DESC = new TField("merchant_tx_id", TType.I64, (short)1);

    private long merchant_tx_id;

    /** 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");

      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 __MERCHANT_TX_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    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.I64)));
    }});

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

    public getPaymentForMerchantId_args() {
    }

    public getPaymentForMerchantId_args(
      long merchant_tx_id)
    {
      this();
      this.merchant_tx_id = merchant_tx_id;
      setMerchant_tx_idIsSet(true);
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentForMerchantId_args(getPaymentForMerchantId_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.merchant_tx_id = other.merchant_tx_id;
    }

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

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

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

    public getPaymentForMerchantId_args setMerchant_tx_id(long merchant_tx_id) {
      this.merchant_tx_id = merchant_tx_id;
      setMerchant_tx_idIsSet(true);
      return this;
    }

    public void unsetMerchant_tx_id() {
      __isset_bit_vector.clear(__MERCHANT_TX_ID_ISSET_ID);
    }

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

    public void setMerchant_tx_idIsSet(boolean value) {
      __isset_bit_vector.set(__MERCHANT_TX_ID_ISSET_ID, value);
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case MERCHANT_TX_ID:
        if (value == null) {
          unsetMerchant_tx_id();
        } else {
          setMerchant_tx_id((Long)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 new Long(getMerchant_tx_id());

      }
      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();
      }
      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 getPaymentForMerchantId_args)
        return this.equals((getPaymentForMerchantId_args)that);
      return false;
    }

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

      boolean this_present_merchant_tx_id = true;
      boolean that_present_merchant_tx_id = true;
      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 != that.merchant_tx_id)
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetMerchant_tx_id()).compareTo(isSetMerchant_tx_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(merchant_tx_id, typedOther.merchant_tx_id);
      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 MERCHANT_TX_ID:
              if (field.type == TType.I64) {
                this.merchant_tx_id = iprot.readI64();
                setMerchant_tx_idIsSet(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(MERCHANT_TX_ID_FIELD_DESC);
      oprot.writeI64(this.merchant_tx_id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("merchant_tx_id:");
      sb.append(this.merchant_tx_id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private List<Payment> success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, Payment.class))));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPaymentForMerchantId_result() {
    }

    public getPaymentForMerchantId_result(
      List<Payment> success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentForMerchantId_result(getPaymentForMerchantId_result other) {
      if (other.isSetSuccess()) {
        List<Payment> __this__success = new ArrayList<Payment>();
        for (Payment other_element : other.success) {
          __this__success.add(new Payment(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

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

    public java.util.Iterator<Payment> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(Payment elem) {
      if (this.success == null) {
        this.success = new ArrayList<Payment>();
      }
      this.success.add(elem);
    }

    public List<Payment> getSuccess() {
      return this.success;
    }

    public getPaymentForMerchantId_result setSuccess(List<Payment> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPaymentForMerchantId_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<Payment>)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPaymentForMerchantId_result)
        return this.equals((getPaymentForMerchantId_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list30 = iprot.readListBegin();
                  this.success = new ArrayList<Payment>(_list30.size);
                  for (int _i31 = 0; _i31 < _list30.size; ++_i31)
                  {
                    Payment _elem32;
                    _elem32 = new Payment();
                    _elem32.read(iprot);
                    this.success.add(_elem32);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (Payment _iter33 : this.success)
          {
            _iter33.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
    private static final TField NEW_STATUS_FIELD_DESC = new TField("newStatus", TType.I32, (short)2);

    private long id;
    private PaymentStatus newStatus;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ID((short)1, "id"),
      /**
       * 
       * @see PaymentStatus
       */
      NEW_STATUS((short)2, "newStatus");

      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 __ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.NEW_STATUS, new FieldMetaData("newStatus", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentStatus.class)));
    }});

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

    public changePaymentStatus_args() {
    }

    public changePaymentStatus_args(
      long id,
      PaymentStatus newStatus)
    {
      this();
      this.id = id;
      setIdIsSet(true);
      this.newStatus = newStatus;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changePaymentStatus_args(changePaymentStatus_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.id = other.id;
      if (other.isSetNewStatus()) {
        this.newStatus = other.newStatus;
      }
    }

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

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

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

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

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

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

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

    /**
     * 
     * @see PaymentStatus
     */
    public PaymentStatus getNewStatus() {
      return this.newStatus;
    }

    /**
     * 
     * @see PaymentStatus
     */
    public changePaymentStatus_args setNewStatus(PaymentStatus newStatus) {
      this.newStatus = newStatus;
      return this;
    }

    public void unsetNewStatus() {
      this.newStatus = null;
    }

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

    public void setNewStatusIsSet(boolean value) {
      if (!value) {
        this.newStatus = null;
      }
    }

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

      case NEW_STATUS:
        if (value == null) {
          unsetNewStatus();
        } else {
          setNewStatus((PaymentStatus)value);
        }
        break;

      }
    }

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

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

      case NEW_STATUS:
        return getNewStatus();

      }
      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 ID:
        return isSetId();
      case NEW_STATUS:
        return isSetNewStatus();
      }
      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 changePaymentStatus_args)
        return this.equals((changePaymentStatus_args)that);
      return false;
    }

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

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

      boolean this_present_newStatus = true && this.isSetNewStatus();
      boolean that_present_newStatus = true && that.isSetNewStatus();
      if (this_present_newStatus || that_present_newStatus) {
        if (!(this_present_newStatus && that_present_newStatus))
          return false;
        if (!this.newStatus.equals(that.newStatus))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetNewStatus()).compareTo(isSetNewStatus());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(newStatus, typedOther.newStatus);
      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 ID:
              if (field.type == TType.I64) {
                this.id = iprot.readI64();
                setIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case NEW_STATUS:
              if (field.type == TType.I32) {
                this.newStatus = PaymentStatus.findByValue(iprot.readI32());
              } 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(ID_FIELD_DESC);
      oprot.writeI64(this.id);
      oprot.writeFieldEnd();
      if (this.newStatus != null) {
        oprot.writeFieldBegin(NEW_STATUS_FIELD_DESC);
        oprot.writeI32(this.newStatus.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("id:");
      sb.append(this.id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("newStatus:");
      if (this.newStatus == null) {
        sb.append("null");
      } else {
        String newStatus_name = newStatus.name();
        if (newStatus_name != null) {
          sb.append(newStatus_name);
          sb.append(" (");
        }
        sb.append(this.newStatus);
        if (newStatus_name != null) {
          sb.append(")");
        }
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public changePaymentStatus_result() {
    }

    public changePaymentStatus_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changePaymentStatus_result(changePaymentStatus_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public changePaymentStatus_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 changePaymentStatus_result)
        return this.equals((changePaymentStatus_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField REQUEST_ID_FIELD_DESC = new TField("request_id", TType.I64, (short)1);
    private static final TField REQUEST_STATUS_FIELD_DESC = new TField("requestStatus", TType.I32, (short)2);

    private long request_id;
    private RequestStatus requestStatus;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      REQUEST_ID((short)1, "request_id"),
      /**
       * 
       * @see RequestStatus
       */
      REQUEST_STATUS((short)2, "requestStatus");

      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 __REQUEST_ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.REQUEST_ID, new FieldMetaData("request_id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.REQUEST_STATUS, new FieldMetaData("requestStatus", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, RequestStatus.class)));
    }});

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

    public changePaymentRequestStatus_args() {
    }

    public changePaymentRequestStatus_args(
      long request_id,
      RequestStatus requestStatus)
    {
      this();
      this.request_id = request_id;
      setRequest_idIsSet(true);
      this.requestStatus = requestStatus;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changePaymentRequestStatus_args(changePaymentRequestStatus_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.request_id = other.request_id;
      if (other.isSetRequestStatus()) {
        this.requestStatus = other.requestStatus;
      }
    }

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

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

    public long getRequest_id() {
      return this.request_id;
    }

    public changePaymentRequestStatus_args setRequest_id(long request_id) {
      this.request_id = request_id;
      setRequest_idIsSet(true);
      return this;
    }

    public void unsetRequest_id() {
      __isset_bit_vector.clear(__REQUEST_ID_ISSET_ID);
    }

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

    public void setRequest_idIsSet(boolean value) {
      __isset_bit_vector.set(__REQUEST_ID_ISSET_ID, value);
    }

    /**
     * 
     * @see RequestStatus
     */
    public RequestStatus getRequestStatus() {
      return this.requestStatus;
    }

    /**
     * 
     * @see RequestStatus
     */
    public changePaymentRequestStatus_args setRequestStatus(RequestStatus requestStatus) {
      this.requestStatus = requestStatus;
      return this;
    }

    public void unsetRequestStatus() {
      this.requestStatus = null;
    }

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

    public void setRequestStatusIsSet(boolean value) {
      if (!value) {
        this.requestStatus = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case REQUEST_ID:
        if (value == null) {
          unsetRequest_id();
        } else {
          setRequest_id((Long)value);
        }
        break;

      case REQUEST_STATUS:
        if (value == null) {
          unsetRequestStatus();
        } else {
          setRequestStatus((RequestStatus)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case REQUEST_ID:
        return new Long(getRequest_id());

      case REQUEST_STATUS:
        return getRequestStatus();

      }
      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 REQUEST_ID:
        return isSetRequest_id();
      case REQUEST_STATUS:
        return isSetRequestStatus();
      }
      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 changePaymentRequestStatus_args)
        return this.equals((changePaymentRequestStatus_args)that);
      return false;
    }

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

      boolean this_present_request_id = true;
      boolean that_present_request_id = true;
      if (this_present_request_id || that_present_request_id) {
        if (!(this_present_request_id && that_present_request_id))
          return false;
        if (this.request_id != that.request_id)
          return false;
      }

      boolean this_present_requestStatus = true && this.isSetRequestStatus();
      boolean that_present_requestStatus = true && that.isSetRequestStatus();
      if (this_present_requestStatus || that_present_requestStatus) {
        if (!(this_present_requestStatus && that_present_requestStatus))
          return false;
        if (!this.requestStatus.equals(that.requestStatus))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetRequest_id()).compareTo(isSetRequest_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(request_id, typedOther.request_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetRequestStatus()).compareTo(isSetRequestStatus());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(requestStatus, typedOther.requestStatus);
      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 REQUEST_ID:
              if (field.type == TType.I64) {
                this.request_id = iprot.readI64();
                setRequest_idIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case REQUEST_STATUS:
              if (field.type == TType.I32) {
                this.requestStatus = RequestStatus.findByValue(iprot.readI32());
              } 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(REQUEST_ID_FIELD_DESC);
      oprot.writeI64(this.request_id);
      oprot.writeFieldEnd();
      if (this.requestStatus != null) {
        oprot.writeFieldBegin(REQUEST_STATUS_FIELD_DESC);
        oprot.writeI32(this.requestStatus.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("request_id:");
      sb.append(this.request_id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("requestStatus:");
      if (this.requestStatus == null) {
        sb.append("null");
      } else {
        String requestStatus_name = requestStatus.name();
        if (requestStatus_name != null) {
          sb.append(requestStatus_name);
          sb.append(" (");
        }
        sb.append(this.requestStatus);
        if (requestStatus_name != null) {
          sb.append(")");
        }
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public changePaymentRequestStatus_result() {
    }

    public changePaymentRequestStatus_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changePaymentRequestStatus_result(changePaymentRequestStatus_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public changePaymentRequestStatus_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 changePaymentRequestStatus_result)
        return this.equals((changePaymentRequestStatus_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)1);

    private PaymentGatewayStatus status;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      /**
       * 
       * @see PaymentGatewayStatus
       */
      STATUS((short)1, "status");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentGatewayStatus.class)));
    }});

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

    public getPaymentGateways_args() {
    }

    public getPaymentGateways_args(
      PaymentGatewayStatus status)
    {
      this();
      this.status = status;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentGateways_args(getPaymentGateways_args other) {
      if (other.isSetStatus()) {
        this.status = other.status;
      }
    }

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

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

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

    /**
     * 
     * @see PaymentGatewayStatus
     */
    public getPaymentGateways_args setStatus(PaymentGatewayStatus 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case STATUS:
        if (value == null) {
          unsetStatus();
        } else {
          setStatus((PaymentGatewayStatus)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case STATUS:
        return getStatus();

      }
      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 STATUS:
        return isSetStatus();
      }
      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 getPaymentGateways_args)
        return this.equals((getPaymentGateways_args)that);
      return false;
    }

    public boolean equals(getPaymentGateways_args that) {
      if (that == null)
        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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetStatus()).compareTo(isSetStatus());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(status, typedOther.status);
      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 STATUS:
              if (field.type == TType.I32) {
                this.status = PaymentGatewayStatus.findByValue(iprot.readI32());
              } 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.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(this.status.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      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;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.LIST, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private List<PaymentGateway> success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new ListMetaData(TType.LIST, 
              new StructMetaData(TType.STRUCT, PaymentGateway.class))));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPaymentGateways_result() {
    }

    public getPaymentGateways_result(
      List<PaymentGateway> success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentGateways_result(getPaymentGateways_result other) {
      if (other.isSetSuccess()) {
        List<PaymentGateway> __this__success = new ArrayList<PaymentGateway>();
        for (PaymentGateway other_element : other.success) {
          __this__success.add(new PaymentGateway(other_element));
        }
        this.success = __this__success;
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

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

    public java.util.Iterator<PaymentGateway> getSuccessIterator() {
      return (this.success == null) ? null : this.success.iterator();
    }

    public void addToSuccess(PaymentGateway elem) {
      if (this.success == null) {
        this.success = new ArrayList<PaymentGateway>();
      }
      this.success.add(elem);
    }

    public List<PaymentGateway> getSuccess() {
      return this.success;
    }

    public getPaymentGateways_result setSuccess(List<PaymentGateway> success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPaymentGateways_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((List<PaymentGateway>)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPaymentGateways_result)
        return this.equals((getPaymentGateways_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.LIST) {
                {
                  TList _list34 = iprot.readListBegin();
                  this.success = new ArrayList<PaymentGateway>(_list34.size);
                  for (int _i35 = 0; _i35 < _list34.size; ++_i35)
                  {
                    PaymentGateway _elem36;
                    _elem36 = new PaymentGateway();
                    _elem36.read(iprot);
                    this.success.add(_elem36);
                  }
                  iprot.readListEnd();
                }
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        {
          oprot.writeListBegin(new TList(TType.STRUCT, this.success.size()));
          for (PaymentGateway _iter37 : this.success)
          {
            _iter37.write(oprot);
          }
          oprot.writeListEnd();
        }
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);

    private long id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ID((short)1, "id");

      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 __ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getPaymentGateway_args() {
    }

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

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentGateway_args(getPaymentGateway_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.id = other.id;
    }

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

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

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

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

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

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

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

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

      }
    }

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

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

      }
      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 ID:
        return isSetId();
      }
      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 getPaymentGateway_args)
        return this.equals((getPaymentGateway_args)that);
      return false;
    }

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

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

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(id, typedOther.id);
      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 ID:
              if (field.type == TType.I64) {
                this.id = iprot.readI64();
                setIdIsSet(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(ID_FIELD_DESC);
      oprot.writeI64(this.id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("id:");
      sb.append(this.id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentGateway success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, PaymentGateway.class)));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPaymentGateway_result() {
    }

    public getPaymentGateway_result(
      PaymentGateway success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPaymentGateway_result(getPaymentGateway_result other) {
      if (other.isSetSuccess()) {
        this.success = new PaymentGateway(other.success);
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentGateway getSuccess() {
      return this.success;
    }

    public getPaymentGateway_result setSuccess(PaymentGateway success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPaymentGateway_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((PaymentGateway)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPaymentGateway_result)
        return this.equals((getPaymentGateway_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new PaymentGateway();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
    private static final TField STATUS_FIELD_DESC = new TField("status", TType.I32, (short)2);

    private long id;
    private PaymentGatewayStatus status;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ID((short)1, "id"),
      /**
       * 
       * @see PaymentGatewayStatus
       */
      STATUS((short)2, "status");

      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 __ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.STATUS, new FieldMetaData("status", TFieldRequirementType.DEFAULT, 
          new EnumMetaData(TType.ENUM, PaymentGatewayStatus.class)));
    }});

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

    public changeGatewayStatus_args() {
    }

    public changeGatewayStatus_args(
      long id,
      PaymentGatewayStatus status)
    {
      this();
      this.id = id;
      setIdIsSet(true);
      this.status = status;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changeGatewayStatus_args(changeGatewayStatus_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.id = other.id;
      if (other.isSetStatus()) {
        this.status = other.status;
      }
    }

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

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

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

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

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

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

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

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

    /**
     * 
     * @see PaymentGatewayStatus
     */
    public changeGatewayStatus_args setStatus(PaymentGatewayStatus 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ID:
        if (value == null) {
          unsetId();
        } else {
          setId((Long)value);
        }
        break;

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

      }
    }

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

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

      case STATUS:
        return getStatus();

      }
      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 ID:
        return isSetId();
      case STATUS:
        return isSetStatus();
      }
      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 changeGatewayStatus_args)
        return this.equals((changeGatewayStatus_args)that);
      return false;
    }

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

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

      boolean this_present_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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(id, typedOther.id);
      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;
      }
      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 ID:
              if (field.type == TType.I64) {
                this.id = iprot.readI64();
                setIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case STATUS:
              if (field.type == TType.I32) {
                this.status = PaymentGatewayStatus.findByValue(iprot.readI32());
              } 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(ID_FIELD_DESC);
      oprot.writeI64(this.id);
      oprot.writeFieldEnd();
      if (this.status != null) {
        oprot.writeFieldBegin(STATUS_FIELD_DESC);
        oprot.writeI32(this.status.getValue());
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("id:");
      sb.append(this.id);
      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;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public changeGatewayStatus_result() {
    }

    public changeGatewayStatus_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public changeGatewayStatus_result(changeGatewayStatus_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public changeGatewayStatus_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 changeGatewayStatus_result)
        return this.equals((changeGatewayStatus_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);

    private long id;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ID((short)1, "id");

      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 __ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
    }});

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

    public getPayment_args() {
    }

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

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPayment_args(getPayment_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.id = other.id;
    }

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

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

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

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

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

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

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

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

      }
    }

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

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

      }
      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 ID:
        return isSetId();
      }
      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 getPayment_args)
        return this.equals((getPayment_args)that);
      return false;
    }

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

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

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(id, typedOther.id);
      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 ID:
              if (field.type == TType.I64) {
                this.id = iprot.readI64();
                setIdIsSet(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(ID_FIELD_DESC);
      oprot.writeI64(this.id);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("id:");
      sb.append(this.id);
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRUCT, (short)0);
    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private Payment success;
    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      SUCCESS((short)0, "success"),
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, 
          new StructMetaData(TType.STRUCT, Payment.class)));
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public getPayment_result() {
    }

    public getPayment_result(
      Payment success,
      PaymentException pe)
    {
      this();
      this.success = success;
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public getPayment_result(getPayment_result other) {
      if (other.isSetSuccess()) {
        this.success = new Payment(other.success);
      }
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public Payment getSuccess() {
      return this.success;
    }

    public getPayment_result setSuccess(Payment success) {
      this.success = success;
      return this;
    }

    public void unsetSuccess() {
      this.success = null;
    }

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

    public void setSuccessIsSet(boolean value) {
      if (!value) {
        this.success = null;
      }
    }

    public PaymentException getPe() {
      return this.pe;
    }

    public getPayment_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case SUCCESS:
        if (value == null) {
          unsetSuccess();
        } else {
          setSuccess((Payment)value);
        }
        break;

      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case SUCCESS:
        return getSuccess();

      case PE:
        return getPe();

      }
      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 SUCCESS:
        return isSetSuccess();
      case PE:
        return isSetPe();
      }
      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 getPayment_result)
        return this.equals((getPayment_result)that);
      return false;
    }

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

      boolean this_present_success = true && this.isSetSuccess();
      boolean that_present_success = true && that.isSetSuccess();
      if (this_present_success || that_present_success) {
        if (!(this_present_success && that_present_success))
          return false;
        if (!this.success.equals(that.success))
          return false;
      }

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          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 SUCCESS:
              if (field.type == TType.STRUCT) {
                this.success = new Payment();
                this.success.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetSuccess()) {
        oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
        this.success.write(oprot);
        oprot.writeFieldEnd();
      } else if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("success:");
      if (this.success == null) {
        sb.append("null");
      } else {
        sb.append(this.success);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField ID_FIELD_DESC = new TField("id", TType.I64, (short)1);
    private static final TField BID_FIELD_DESC = new TField("bid", TType.STRING, (short)2);
    private static final TField BTXID_FIELD_DESC = new TField("btxid", TType.STRING, (short)3);
    private static final TField ERROR_CODE_FIELD_DESC = new TField("error_code", TType.STRING, (short)4);
    private static final TField SESSION_ID_FIELD_DESC = new TField("session_id", TType.STRING, (short)5);
    private static final TField POSTDATE_FIELD_DESC = new TField("postdate", TType.STRING, (short)6);
    private static final TField AUTH_CODE_FIELD_DESC = new TField("auth_code", TType.STRING, (short)7);
    private static final TField REF_CODE_FIELD_DESC = new TField("ref_code", TType.STRING, (short)8);

    private long id;
    private String bid;
    private String btxid;
    private String error_code;
    private String session_id;
    private String postdate;
    private String auth_code;
    private String ref_code;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      ID((short)1, "id"),
      BID((short)2, "bid"),
      BTXID((short)3, "btxid"),
      ERROR_CODE((short)4, "error_code"),
      SESSION_ID((short)5, "session_id"),
      POSTDATE((short)6, "postdate"),
      AUTH_CODE((short)7, "auth_code"),
      REF_CODE((short)8, "ref_code");

      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 __ID_ISSET_ID = 0;
    private BitSet __isset_bit_vector = new BitSet(1);

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.ID, new FieldMetaData("id", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.I64)));
      put(_Fields.BID, new FieldMetaData("bid", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
      put(_Fields.BTXID, new FieldMetaData("btxid", 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.POSTDATE, new FieldMetaData("postdate", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
      put(_Fields.AUTH_CODE, new FieldMetaData("auth_code", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
      put(_Fields.REF_CODE, new FieldMetaData("ref_code", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRING)));
    }});

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

    public addBankDetails_args() {
    }

    public addBankDetails_args(
      long id,
      String bid,
      String btxid,
      String error_code,
      String session_id,
      String postdate,
      String auth_code,
      String ref_code)
    {
      this();
      this.id = id;
      setIdIsSet(true);
      this.bid = bid;
      this.btxid = btxid;
      this.error_code = error_code;
      this.session_id = session_id;
      this.postdate = postdate;
      this.auth_code = auth_code;
      this.ref_code = ref_code;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addBankDetails_args(addBankDetails_args other) {
      __isset_bit_vector.clear();
      __isset_bit_vector.or(other.__isset_bit_vector);
      this.id = other.id;
      if (other.isSetBid()) {
        this.bid = other.bid;
      }
      if (other.isSetBtxid()) {
        this.btxid = other.btxid;
      }
      if (other.isSetError_code()) {
        this.error_code = other.error_code;
      }
      if (other.isSetSession_id()) {
        this.session_id = other.session_id;
      }
      if (other.isSetPostdate()) {
        this.postdate = other.postdate;
      }
      if (other.isSetAuth_code()) {
        this.auth_code = other.auth_code;
      }
      if (other.isSetRef_code()) {
        this.ref_code = other.ref_code;
      }
    }

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

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

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

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

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

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

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

    public String getBid() {
      return this.bid;
    }

    public addBankDetails_args setBid(String bid) {
      this.bid = bid;
      return this;
    }

    public void unsetBid() {
      this.bid = null;
    }

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

    public void setBidIsSet(boolean value) {
      if (!value) {
        this.bid = null;
      }
    }

    public String getBtxid() {
      return this.btxid;
    }

    public addBankDetails_args setBtxid(String btxid) {
      this.btxid = btxid;
      return this;
    }

    public void unsetBtxid() {
      this.btxid = null;
    }

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

    public void setBtxidIsSet(boolean value) {
      if (!value) {
        this.btxid = null;
      }
    }

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

    public addBankDetails_args 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 addBankDetails_args 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 getPostdate() {
      return this.postdate;
    }

    public addBankDetails_args setPostdate(String postdate) {
      this.postdate = postdate;
      return this;
    }

    public void unsetPostdate() {
      this.postdate = null;
    }

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

    public void setPostdateIsSet(boolean value) {
      if (!value) {
        this.postdate = null;
      }
    }

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

    public addBankDetails_args 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 getRef_code() {
      return this.ref_code;
    }

    public addBankDetails_args 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 void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case ID:
        if (value == null) {
          unsetId();
        } else {
          setId((Long)value);
        }
        break;

      case BID:
        if (value == null) {
          unsetBid();
        } else {
          setBid((String)value);
        }
        break;

      case BTXID:
        if (value == null) {
          unsetBtxid();
        } else {
          setBtxid((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 POSTDATE:
        if (value == null) {
          unsetPostdate();
        } else {
          setPostdate((String)value);
        }
        break;

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

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

      }
    }

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

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

      case BID:
        return getBid();

      case BTXID:
        return getBtxid();

      case ERROR_CODE:
        return getError_code();

      case SESSION_ID:
        return getSession_id();

      case POSTDATE:
        return getPostdate();

      case AUTH_CODE:
        return getAuth_code();

      case REF_CODE:
        return getRef_code();

      }
      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 ID:
        return isSetId();
      case BID:
        return isSetBid();
      case BTXID:
        return isSetBtxid();
      case ERROR_CODE:
        return isSetError_code();
      case SESSION_ID:
        return isSetSession_id();
      case POSTDATE:
        return isSetPostdate();
      case AUTH_CODE:
        return isSetAuth_code();
      case REF_CODE:
        return isSetRef_code();
      }
      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 addBankDetails_args)
        return this.equals((addBankDetails_args)that);
      return false;
    }

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

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

      boolean this_present_bid = true && this.isSetBid();
      boolean that_present_bid = true && that.isSetBid();
      if (this_present_bid || that_present_bid) {
        if (!(this_present_bid && that_present_bid))
          return false;
        if (!this.bid.equals(that.bid))
          return false;
      }

      boolean this_present_btxid = true && this.isSetBtxid();
      boolean that_present_btxid = true && that.isSetBtxid();
      if (this_present_btxid || that_present_btxid) {
        if (!(this_present_btxid && that_present_btxid))
          return false;
        if (!this.btxid.equals(that.btxid))
          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_postdate = true && this.isSetPostdate();
      boolean that_present_postdate = true && that.isSetPostdate();
      if (this_present_postdate || that_present_postdate) {
        if (!(this_present_postdate && that_present_postdate))
          return false;
        if (!this.postdate.equals(that.postdate))
          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_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;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetId()).compareTo(isSetId());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(id, typedOther.id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetBid()).compareTo(isSetBid());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(bid, typedOther.bid);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetBtxid()).compareTo(isSetBtxid());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(btxid, typedOther.btxid);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetError_code()).compareTo(isSetError_code());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(error_code, typedOther.error_code);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetSession_id()).compareTo(isSetSession_id());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(session_id, typedOther.session_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetPostdate()).compareTo(isSetPostdate());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(postdate, typedOther.postdate);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetAuth_code()).compareTo(isSetAuth_code());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(auth_code, typedOther.auth_code);
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = Boolean.valueOf(isSetRef_code()).compareTo(isSetRef_code());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(ref_code, typedOther.ref_code);
      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 ID:
              if (field.type == TType.I64) {
                this.id = iprot.readI64();
                setIdIsSet(true);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case BID:
              if (field.type == TType.STRING) {
                this.bid = iprot.readString();
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
            case BTXID:
              if (field.type == TType.STRING) {
                this.btxid = 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 POSTDATE:
              if (field.type == TType.STRING) {
                this.postdate = 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 REF_CODE:
              if (field.type == TType.STRING) {
                this.ref_code = 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);
      oprot.writeFieldBegin(ID_FIELD_DESC);
      oprot.writeI64(this.id);
      oprot.writeFieldEnd();
      if (this.bid != null) {
        oprot.writeFieldBegin(BID_FIELD_DESC);
        oprot.writeString(this.bid);
        oprot.writeFieldEnd();
      }
      if (this.btxid != null) {
        oprot.writeFieldBegin(BTXID_FIELD_DESC);
        oprot.writeString(this.btxid);
        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.postdate != null) {
        oprot.writeFieldBegin(POSTDATE_FIELD_DESC);
        oprot.writeString(this.postdate);
        oprot.writeFieldEnd();
      }
      if (this.auth_code != null) {
        oprot.writeFieldBegin(AUTH_CODE_FIELD_DESC);
        oprot.writeString(this.auth_code);
        oprot.writeFieldEnd();
      }
      if (this.ref_code != null) {
        oprot.writeFieldBegin(REF_CODE_FIELD_DESC);
        oprot.writeString(this.ref_code);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("id:");
      sb.append(this.id);
      first = false;
      if (!first) sb.append(", ");
      sb.append("bid:");
      if (this.bid == null) {
        sb.append("null");
      } else {
        sb.append(this.bid);
      }
      first = false;
      if (!first) sb.append(", ");
      sb.append("btxid:");
      if (this.btxid == null) {
        sb.append("null");
      } else {
        sb.append(this.btxid);
      }
      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("postdate:");
      if (this.postdate == null) {
        sb.append("null");
      } else {
        sb.append(this.postdate);
      }
      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("ref_code:");
      if (this.ref_code == null) {
        sb.append("null");
      } else {
        sb.append(this.ref_code);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

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

    private static final TField PE_FIELD_DESC = new TField("pe", TType.STRUCT, (short)1);

    private PaymentException pe;

    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
    public enum _Fields implements TFieldIdEnum {
      PE((short)1, "pe");

      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

    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
      put(_Fields.PE, new FieldMetaData("pe", TFieldRequirementType.DEFAULT, 
          new FieldValueMetaData(TType.STRUCT)));
    }});

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

    public addBankDetails_result() {
    }

    public addBankDetails_result(
      PaymentException pe)
    {
      this();
      this.pe = pe;
    }

    /**
     * Performs a deep copy on <i>other</i>.
     */
    public addBankDetails_result(addBankDetails_result other) {
      if (other.isSetPe()) {
        this.pe = new PaymentException(other.pe);
      }
    }

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

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

    public PaymentException getPe() {
      return this.pe;
    }

    public addBankDetails_result setPe(PaymentException pe) {
      this.pe = pe;
      return this;
    }

    public void unsetPe() {
      this.pe = null;
    }

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

    public void setPeIsSet(boolean value) {
      if (!value) {
        this.pe = null;
      }
    }

    public void setFieldValue(_Fields field, Object value) {
      switch (field) {
      case PE:
        if (value == null) {
          unsetPe();
        } else {
          setPe((PaymentException)value);
        }
        break;

      }
    }

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

    public Object getFieldValue(_Fields field) {
      switch (field) {
      case PE:
        return getPe();

      }
      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 PE:
        return isSetPe();
      }
      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 addBankDetails_result)
        return this.equals((addBankDetails_result)that);
      return false;
    }

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

      boolean this_present_pe = true && this.isSetPe();
      boolean that_present_pe = true && that.isSetPe();
      if (this_present_pe || that_present_pe) {
        if (!(this_present_pe && that_present_pe))
          return false;
        if (!this.pe.equals(that.pe))
          return false;
      }

      return true;
    }

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

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

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

      lastComparison = Boolean.valueOf(isSetPe()).compareTo(isSetPe());
      if (lastComparison != 0) {
        return lastComparison;
      }
      lastComparison = TBaseHelper.compareTo(pe, typedOther.pe);
      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 PE:
              if (field.type == TType.STRUCT) {
                this.pe = new PaymentException();
                this.pe.read(iprot);
              } else { 
                TProtocolUtil.skip(iprot, field.type);
              }
              break;
          }
          iprot.readFieldEnd();
        }
      }
      iprot.readStructEnd();
      validate();
    }

    public void write(TProtocol oprot) throws TException {
      oprot.writeStructBegin(STRUCT_DESC);

      if (this.isSetPe()) {
        oprot.writeFieldBegin(PE_FIELD_DESC);
        this.pe.write(oprot);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

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

      sb.append("pe:");
      if (this.pe == null) {
        sb.append("null");
      } else {
        sb.append(this.pe);
      }
      first = false;
      sb.append(")");
      return sb.toString();
    }

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

  }

}