Subversion Repositories SmartDukaan

Rev

Rev 1731 | Rev 2062 | 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
#

from thrift.Thrift import *
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface:
  def closeSession(self, ):
    """
    For closing the open session in sqlalchemy
    """
    pass

  def createPayment(self, userId, amount, gatewayId, txnId):
    """
    create a new payment and return payment id, throws an exception if gateway is not active
    
    
    Parameters:
     - userId
     - amount
     - gatewayId
     - txnId
    """
    pass

  def getPaymentsForUser(self, userId, fromTime, toTime, status, gatewayId):
    """
    get payment for user. If status and gateway are null, it is ignored. Same for times as well.
    
    
    Parameters:
     - userId
     - fromTime
     - toTime
     - status
     - gatewayId
    """
    pass

  def getPayments(self, fromTime, toTime, status, gatewayId):
    """
    get all payments for user. Gateway is mandatory.
    
    
    Parameters:
     - fromTime
     - toTime
     - status
     - gatewayId
    """
    pass

  def getPaymentGateway(self, id):
    """
    Get a particular gateway
    
    
    Parameters:
     - id
    """
    pass

  def getPayment(self, id):
    """
    Get a particular payment info
    
    
    Parameters:
     - id
    """
    pass

  def getPaymentForTxnId(self, txnId):
    """
    Get a particular payment for a transaction. Will raise exception.
    
    
    Parameters:
     - txnId
    """
    pass

  def updatePaymentDetails(self, id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, gatewayTxnDate, attributes):
    """
    mark payment successful and store parameters
    
    
    Parameters:
     - id
     - gatewayPaymentId
     - sessionId
     - gatewayTxnStatus
     - description
     - gatewayTxnId
     - authCode
     - referenceCode
     - errorCode
     - status
     - gatewayTxnDate
     - attributes
    """
    pass

  def getSuccessfulPaymentsAmountRange(self, ):
    """
    Returns the minimum and maximum amounts among successful payments.
    List contains two double values, first minimum and second maximum amount.
    """
    pass


class Client(Iface):
  def __init__(self, iprot, oprot=None):
    self._iprot = self._oprot = iprot
    if oprot != None:
      self._oprot = oprot
    self._seqid = 0

  def closeSession(self, ):
    """
    For closing the open session in sqlalchemy
    """
    self.send_closeSession()
    self.recv_closeSession()

  def send_closeSession(self, ):
    self._oprot.writeMessageBegin('closeSession', TMessageType.CALL, self._seqid)
    args = closeSession_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_closeSession(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = closeSession_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    return

  def createPayment(self, userId, amount, gatewayId, txnId):
    """
    create a new payment and return payment id, throws an exception if gateway is not active
    
    
    Parameters:
     - userId
     - amount
     - gatewayId
     - txnId
    """
    self.send_createPayment(userId, amount, gatewayId, txnId)
    return self.recv_createPayment()

  def send_createPayment(self, userId, amount, gatewayId, txnId):
    self._oprot.writeMessageBegin('createPayment', TMessageType.CALL, self._seqid)
    args = createPayment_args()
    args.userId = userId
    args.amount = amount
    args.gatewayId = gatewayId
    args.txnId = txnId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_createPayment(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = createPayment_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createPayment failed: unknown result");

  def getPaymentsForUser(self, userId, fromTime, toTime, status, gatewayId):
    """
    get payment for user. If status and gateway are null, it is ignored. Same for times as well.
    
    
    Parameters:
     - userId
     - fromTime
     - toTime
     - status
     - gatewayId
    """
    self.send_getPaymentsForUser(userId, fromTime, toTime, status, gatewayId)
    return self.recv_getPaymentsForUser()

  def send_getPaymentsForUser(self, userId, fromTime, toTime, status, gatewayId):
    self._oprot.writeMessageBegin('getPaymentsForUser', TMessageType.CALL, self._seqid)
    args = getPaymentsForUser_args()
    args.userId = userId
    args.fromTime = fromTime
    args.toTime = toTime
    args.status = status
    args.gatewayId = gatewayId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPaymentsForUser(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPaymentsForUser_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentsForUser failed: unknown result");

  def getPayments(self, fromTime, toTime, status, gatewayId):
    """
    get all payments for user. Gateway is mandatory.
    
    
    Parameters:
     - fromTime
     - toTime
     - status
     - gatewayId
    """
    self.send_getPayments(fromTime, toTime, status, gatewayId)
    return self.recv_getPayments()

  def send_getPayments(self, fromTime, toTime, status, gatewayId):
    self._oprot.writeMessageBegin('getPayments', TMessageType.CALL, self._seqid)
    args = getPayments_args()
    args.fromTime = fromTime
    args.toTime = toTime
    args.status = status
    args.gatewayId = gatewayId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPayments(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPayments_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPayments failed: unknown result");

  def getPaymentGateway(self, id):
    """
    Get a particular gateway
    
    
    Parameters:
     - id
    """
    self.send_getPaymentGateway(id)
    return self.recv_getPaymentGateway()

  def send_getPaymentGateway(self, id):
    self._oprot.writeMessageBegin('getPaymentGateway', TMessageType.CALL, self._seqid)
    args = getPaymentGateway_args()
    args.id = id
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPaymentGateway(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPaymentGateway_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentGateway failed: unknown result");

  def getPayment(self, id):
    """
    Get a particular payment info
    
    
    Parameters:
     - id
    """
    self.send_getPayment(id)
    return self.recv_getPayment()

  def send_getPayment(self, id):
    self._oprot.writeMessageBegin('getPayment', TMessageType.CALL, self._seqid)
    args = getPayment_args()
    args.id = id
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPayment(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPayment_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPayment failed: unknown result");

  def getPaymentForTxnId(self, txnId):
    """
    Get a particular payment for a transaction. Will raise exception.
    
    
    Parameters:
     - txnId
    """
    self.send_getPaymentForTxnId(txnId)
    return self.recv_getPaymentForTxnId()

  def send_getPaymentForTxnId(self, txnId):
    self._oprot.writeMessageBegin('getPaymentForTxnId', TMessageType.CALL, self._seqid)
    args = getPaymentForTxnId_args()
    args.txnId = txnId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPaymentForTxnId(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPaymentForTxnId_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPaymentForTxnId failed: unknown result");

  def updatePaymentDetails(self, id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, gatewayTxnDate, attributes):
    """
    mark payment successful and store parameters
    
    
    Parameters:
     - id
     - gatewayPaymentId
     - sessionId
     - gatewayTxnStatus
     - description
     - gatewayTxnId
     - authCode
     - referenceCode
     - errorCode
     - status
     - gatewayTxnDate
     - attributes
    """
    self.send_updatePaymentDetails(id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, gatewayTxnDate, attributes)
    return self.recv_updatePaymentDetails()

  def send_updatePaymentDetails(self, id, gatewayPaymentId, sessionId, gatewayTxnStatus, description, gatewayTxnId, authCode, referenceCode, errorCode, status, gatewayTxnDate, attributes):
    self._oprot.writeMessageBegin('updatePaymentDetails', TMessageType.CALL, self._seqid)
    args = updatePaymentDetails_args()
    args.id = id
    args.gatewayPaymentId = gatewayPaymentId
    args.sessionId = sessionId
    args.gatewayTxnStatus = gatewayTxnStatus
    args.description = description
    args.gatewayTxnId = gatewayTxnId
    args.authCode = authCode
    args.referenceCode = referenceCode
    args.errorCode = errorCode
    args.status = status
    args.gatewayTxnDate = gatewayTxnDate
    args.attributes = attributes
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_updatePaymentDetails(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = updatePaymentDetails_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    if result.pe != None:
      raise result.pe
    raise TApplicationException(TApplicationException.MISSING_RESULT, "updatePaymentDetails failed: unknown result");

  def getSuccessfulPaymentsAmountRange(self, ):
    """
    Returns the minimum and maximum amounts among successful payments.
    List contains two double values, first minimum and second maximum amount.
    """
    self.send_getSuccessfulPaymentsAmountRange()
    return self.recv_getSuccessfulPaymentsAmountRange()

  def send_getSuccessfulPaymentsAmountRange(self, ):
    self._oprot.writeMessageBegin('getSuccessfulPaymentsAmountRange', TMessageType.CALL, self._seqid)
    args = getSuccessfulPaymentsAmountRange_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getSuccessfulPaymentsAmountRange(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getSuccessfulPaymentsAmountRange_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success != None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getSuccessfulPaymentsAmountRange failed: unknown result");


class Processor(Iface, TProcessor):
  def __init__(self, handler):
    self._handler = handler
    self._processMap = {}
    self._processMap["closeSession"] = Processor.process_closeSession
    self._processMap["createPayment"] = Processor.process_createPayment
    self._processMap["getPaymentsForUser"] = Processor.process_getPaymentsForUser
    self._processMap["getPayments"] = Processor.process_getPayments
    self._processMap["getPaymentGateway"] = Processor.process_getPaymentGateway
    self._processMap["getPayment"] = Processor.process_getPayment
    self._processMap["getPaymentForTxnId"] = Processor.process_getPaymentForTxnId
    self._processMap["updatePaymentDetails"] = Processor.process_updatePaymentDetails
    self._processMap["getSuccessfulPaymentsAmountRange"] = Processor.process_getSuccessfulPaymentsAmountRange

  def process(self, iprot, oprot):
    (name, type, seqid) = iprot.readMessageBegin()
    if name not in self._processMap:
      iprot.skip(TType.STRUCT)
      iprot.readMessageEnd()
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
      x.write(oprot)
      oprot.writeMessageEnd()
      oprot.trans.flush()
      return
    else:
      self._processMap[name](self, seqid, iprot, oprot)
    return True

  def process_closeSession(self, seqid, iprot, oprot):
    args = closeSession_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = closeSession_result()
    self._handler.closeSession()
    oprot.writeMessageBegin("closeSession", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_createPayment(self, seqid, iprot, oprot):
    args = createPayment_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = createPayment_result()
    try:
      result.success = self._handler.createPayment(args.userId, args.amount, args.gatewayId, args.txnId)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("createPayment", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPaymentsForUser(self, seqid, iprot, oprot):
    args = getPaymentsForUser_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPaymentsForUser_result()
    try:
      result.success = self._handler.getPaymentsForUser(args.userId, args.fromTime, args.toTime, args.status, args.gatewayId)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("getPaymentsForUser", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPayments(self, seqid, iprot, oprot):
    args = getPayments_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPayments_result()
    try:
      result.success = self._handler.getPayments(args.fromTime, args.toTime, args.status, args.gatewayId)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("getPayments", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPaymentGateway(self, seqid, iprot, oprot):
    args = getPaymentGateway_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPaymentGateway_result()
    try:
      result.success = self._handler.getPaymentGateway(args.id)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("getPaymentGateway", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPayment(self, seqid, iprot, oprot):
    args = getPayment_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPayment_result()
    try:
      result.success = self._handler.getPayment(args.id)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("getPayment", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPaymentForTxnId(self, seqid, iprot, oprot):
    args = getPaymentForTxnId_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPaymentForTxnId_result()
    try:
      result.success = self._handler.getPaymentForTxnId(args.txnId)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("getPaymentForTxnId", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_updatePaymentDetails(self, seqid, iprot, oprot):
    args = updatePaymentDetails_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = updatePaymentDetails_result()
    try:
      result.success = self._handler.updatePaymentDetails(args.id, args.gatewayPaymentId, args.sessionId, args.gatewayTxnStatus, args.description, args.gatewayTxnId, args.authCode, args.referenceCode, args.errorCode, args.status, args.gatewayTxnDate, args.attributes)
    except PaymentException, pe:
      result.pe = pe
    oprot.writeMessageBegin("updatePaymentDetails", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getSuccessfulPaymentsAmountRange(self, seqid, iprot, oprot):
    args = getSuccessfulPaymentsAmountRange_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getSuccessfulPaymentsAmountRange_result()
    result.success = self._handler.getSuccessfulPaymentsAmountRange()
    oprot.writeMessageBegin("getSuccessfulPaymentsAmountRange", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class closeSession_args:

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('closeSession_args')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class closeSession_result:

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('closeSession_result')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class createPayment_args:
  """
  Attributes:
   - userId
   - amount
   - gatewayId
   - txnId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'userId', None, None, ), # 1
    (2, TType.DOUBLE, 'amount', None, None, ), # 2
    (3, TType.I64, 'gatewayId', None, None, ), # 3
    (4, TType.I64, 'txnId', None, None, ), # 4
  )

  def __init__(self, userId=None, amount=None, gatewayId=None, txnId=None,):
    self.userId = userId
    self.amount = amount
    self.gatewayId = gatewayId
    self.txnId = txnId

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.userId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.DOUBLE:
          self.amount = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.gatewayId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.txnId = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('createPayment_args')
    if self.userId != None:
      oprot.writeFieldBegin('userId', TType.I64, 1)
      oprot.writeI64(self.userId)
      oprot.writeFieldEnd()
    if self.amount != None:
      oprot.writeFieldBegin('amount', TType.DOUBLE, 2)
      oprot.writeDouble(self.amount)
      oprot.writeFieldEnd()
    if self.gatewayId != None:
      oprot.writeFieldBegin('gatewayId', TType.I64, 3)
      oprot.writeI64(self.gatewayId)
      oprot.writeFieldEnd()
    if self.txnId != None:
      oprot.writeFieldBegin('txnId', TType.I64, 4)
      oprot.writeI64(self.txnId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class createPayment_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.I64, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.I64:
          self.success = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('createPayment_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.I64, 0)
      oprot.writeI64(self.success)
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentsForUser_args:
  """
  Attributes:
   - userId
   - fromTime
   - toTime
   - status
   - gatewayId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'userId', None, None, ), # 1
    (2, TType.I64, 'fromTime', None, None, ), # 2
    (3, TType.I64, 'toTime', None, None, ), # 3
    (4, TType.I32, 'status', None, None, ), # 4
    (5, TType.I64, 'gatewayId', None, None, ), # 5
  )

  def __init__(self, userId=None, fromTime=None, toTime=None, status=None, gatewayId=None,):
    self.userId = userId
    self.fromTime = fromTime
    self.toTime = toTime
    self.status = status
    self.gatewayId = gatewayId

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.userId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.fromTime = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.toTime = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.I64:
          self.gatewayId = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentsForUser_args')
    if self.userId != None:
      oprot.writeFieldBegin('userId', TType.I64, 1)
      oprot.writeI64(self.userId)
      oprot.writeFieldEnd()
    if self.fromTime != None:
      oprot.writeFieldBegin('fromTime', TType.I64, 2)
      oprot.writeI64(self.fromTime)
      oprot.writeFieldEnd()
    if self.toTime != None:
      oprot.writeFieldBegin('toTime', TType.I64, 3)
      oprot.writeI64(self.toTime)
      oprot.writeFieldEnd()
    if self.status != None:
      oprot.writeFieldBegin('status', TType.I32, 4)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.gatewayId != None:
      oprot.writeFieldBegin('gatewayId', TType.I64, 5)
      oprot.writeI64(self.gatewayId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentsForUser_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Payment, Payment.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype17, _size14) = iprot.readListBegin()
          for _i18 in xrange(_size14):
            _elem19 = Payment()
            _elem19.read(iprot)
            self.success.append(_elem19)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentsForUser_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter20 in self.success:
        iter20.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPayments_args:
  """
  Attributes:
   - fromTime
   - toTime
   - status
   - gatewayId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'fromTime', None, None, ), # 1
    (2, TType.I64, 'toTime', None, None, ), # 2
    (3, TType.I32, 'status', None, None, ), # 3
    (4, TType.I64, 'gatewayId', None, None, ), # 4
  )

  def __init__(self, fromTime=None, toTime=None, status=None, gatewayId=None,):
    self.fromTime = fromTime
    self.toTime = toTime
    self.status = status
    self.gatewayId = gatewayId

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.fromTime = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.toTime = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.gatewayId = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPayments_args')
    if self.fromTime != None:
      oprot.writeFieldBegin('fromTime', TType.I64, 1)
      oprot.writeI64(self.fromTime)
      oprot.writeFieldEnd()
    if self.toTime != None:
      oprot.writeFieldBegin('toTime', TType.I64, 2)
      oprot.writeI64(self.toTime)
      oprot.writeFieldEnd()
    if self.status != None:
      oprot.writeFieldBegin('status', TType.I32, 3)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.gatewayId != None:
      oprot.writeFieldBegin('gatewayId', TType.I64, 4)
      oprot.writeI64(self.gatewayId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPayments_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Payment, Payment.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype24, _size21) = iprot.readListBegin()
          for _i25 in xrange(_size21):
            _elem26 = Payment()
            _elem26.read(iprot)
            self.success.append(_elem26)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPayments_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter27 in self.success:
        iter27.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentGateway_args:
  """
  Attributes:
   - id
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
  )

  def __init__(self, id=None,):
    self.id = id

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentGateway_args')
    if self.id != None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentGateway_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (PaymentGateway, PaymentGateway.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = PaymentGateway()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentGateway_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPayment_args:
  """
  Attributes:
   - id
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
  )

  def __init__(self, id=None,):
    self.id = id

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPayment_args')
    if self.id != None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPayment_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (Payment, Payment.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.STRUCT:
          self.success = Payment()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPayment_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentForTxnId_args:
  """
  Attributes:
   - txnId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'txnId', None, None, ), # 1
  )

  def __init__(self, txnId=None,):
    self.txnId = txnId

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.txnId = iprot.readI64();
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentForTxnId_args')
    if self.txnId != None:
      oprot.writeFieldBegin('txnId', TType.I64, 1)
      oprot.writeI64(self.txnId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getPaymentForTxnId_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Payment, Payment.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype31, _size28) = iprot.readListBegin()
          for _i32 in xrange(_size28):
            _elem33 = Payment()
            _elem33.read(iprot)
            self.success.append(_elem33)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getPaymentForTxnId_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter34 in self.success:
        iter34.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class updatePaymentDetails_args:
  """
  Attributes:
   - id
   - gatewayPaymentId
   - sessionId
   - gatewayTxnStatus
   - description
   - gatewayTxnId
   - authCode
   - referenceCode
   - errorCode
   - status
   - gatewayTxnDate
   - attributes
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'gatewayPaymentId', None, None, ), # 2
    (3, TType.STRING, 'sessionId', None, None, ), # 3
    (4, TType.STRING, 'gatewayTxnStatus', None, None, ), # 4
    (5, TType.STRING, 'description', None, None, ), # 5
    (6, TType.STRING, 'gatewayTxnId', None, None, ), # 6
    (7, TType.STRING, 'authCode', None, None, ), # 7
    (8, TType.STRING, 'referenceCode', None, None, ), # 8
    (9, TType.STRING, 'errorCode', None, None, ), # 9
    (10, TType.I32, 'status', None, None, ), # 10
    (11, TType.STRING, 'gatewayTxnDate', None, None, ), # 11
    (12, TType.LIST, 'attributes', (TType.STRUCT,(Attribute, Attribute.thrift_spec)), None, ), # 12
  )

  def __init__(self, id=None, gatewayPaymentId=None, sessionId=None, gatewayTxnStatus=None, description=None, gatewayTxnId=None, authCode=None, referenceCode=None, errorCode=None, status=None, gatewayTxnDate=None, attributes=None,):
    self.id = id
    self.gatewayPaymentId = gatewayPaymentId
    self.sessionId = sessionId
    self.gatewayTxnStatus = gatewayTxnStatus
    self.description = description
    self.gatewayTxnId = gatewayTxnId
    self.authCode = authCode
    self.referenceCode = referenceCode
    self.errorCode = errorCode
    self.status = status
    self.gatewayTxnDate = gatewayTxnDate
    self.attributes = attributes

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.id = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.gatewayPaymentId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.sessionId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.gatewayTxnStatus = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.description = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.gatewayTxnId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.authCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.STRING:
          self.referenceCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.STRING:
          self.errorCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRING:
          self.gatewayTxnDate = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.LIST:
          self.attributes = []
          (_etype38, _size35) = iprot.readListBegin()
          for _i39 in xrange(_size35):
            _elem40 = Attribute()
            _elem40.read(iprot)
            self.attributes.append(_elem40)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('updatePaymentDetails_args')
    if self.id != None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.gatewayPaymentId != None:
      oprot.writeFieldBegin('gatewayPaymentId', TType.STRING, 2)
      oprot.writeString(self.gatewayPaymentId)
      oprot.writeFieldEnd()
    if self.sessionId != None:
      oprot.writeFieldBegin('sessionId', TType.STRING, 3)
      oprot.writeString(self.sessionId)
      oprot.writeFieldEnd()
    if self.gatewayTxnStatus != None:
      oprot.writeFieldBegin('gatewayTxnStatus', TType.STRING, 4)
      oprot.writeString(self.gatewayTxnStatus)
      oprot.writeFieldEnd()
    if self.description != None:
      oprot.writeFieldBegin('description', TType.STRING, 5)
      oprot.writeString(self.description)
      oprot.writeFieldEnd()
    if self.gatewayTxnId != None:
      oprot.writeFieldBegin('gatewayTxnId', TType.STRING, 6)
      oprot.writeString(self.gatewayTxnId)
      oprot.writeFieldEnd()
    if self.authCode != None:
      oprot.writeFieldBegin('authCode', TType.STRING, 7)
      oprot.writeString(self.authCode)
      oprot.writeFieldEnd()
    if self.referenceCode != None:
      oprot.writeFieldBegin('referenceCode', TType.STRING, 8)
      oprot.writeString(self.referenceCode)
      oprot.writeFieldEnd()
    if self.errorCode != None:
      oprot.writeFieldBegin('errorCode', TType.STRING, 9)
      oprot.writeString(self.errorCode)
      oprot.writeFieldEnd()
    if self.status != None:
      oprot.writeFieldBegin('status', TType.I32, 10)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.gatewayTxnDate != None:
      oprot.writeFieldBegin('gatewayTxnDate', TType.STRING, 11)
      oprot.writeString(self.gatewayTxnDate)
      oprot.writeFieldEnd()
    if self.attributes != None:
      oprot.writeFieldBegin('attributes', TType.LIST, 12)
      oprot.writeListBegin(TType.STRUCT, len(self.attributes))
      for iter41 in self.attributes:
        iter41.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class updatePaymentDetails_result:
  """
  Attributes:
   - success
   - pe
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pe', (PaymentException, PaymentException.thrift_spec), None, ), # 1
  )

  def __init__(self, success=None, pe=None,):
    self.success = success
    self.pe = pe

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.BOOL:
          self.success = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pe = PaymentException()
          self.pe.read(iprot)
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('updatePaymentDetails_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    if self.pe != None:
      oprot.writeFieldBegin('pe', TType.STRUCT, 1)
      self.pe.write(oprot)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getSuccessfulPaymentsAmountRange_args:

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getSuccessfulPaymentsAmountRange_args')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class getSuccessfulPaymentsAmountRange_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.DOUBLE,None), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype45, _size42) = iprot.readListBegin()
          for _i46 in xrange(_size42):
            _elem47 = iprot.readDouble();
            self.success.append(_elem47)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('getSuccessfulPaymentsAmountRange_result')
    if self.success != None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.DOUBLE, len(self.success))
      for iter48 in self.success:
        oprot.writeDouble(iter48)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)