Subversion Repositories SmartDukaan

Rev

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

#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

from thrift.Thrift import *
import shop2020.thriftpy.generic.ttypes


from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class PaymentGatewayStatus:
  """
  Various structures
  *
  """
  AVAILABLE = 0
  BLOCKED = 1

  _VALUES_TO_NAMES = {
    0: "AVAILABLE",
    1: "BLOCKED",
  }

  _NAMES_TO_VALUES = {
    "AVAILABLE": 0,
    "BLOCKED": 1,
  }

class PaymentStatus:
  INIT = 0
  PENDING = 1
  SUCCESS = 2
  FAILED = 3
  AUTHORIZED = 4
  PARTIALLY_CAPTURED = 5
  CAPTURE_IN_PROCESS = 6
  PROVISIONALLY_CAPTURED = 7
  REFUNDED = 8
  PENDING_APPROVAL = 9

  _VALUES_TO_NAMES = {
    0: "INIT",
    1: "PENDING",
    2: "SUCCESS",
    3: "FAILED",
    4: "AUTHORIZED",
    5: "PARTIALLY_CAPTURED",
    6: "CAPTURE_IN_PROCESS",
    7: "PROVISIONALLY_CAPTURED",
    8: "REFUNDED",
    9: "PENDING_APPROVAL",
  }

  _NAMES_TO_VALUES = {
    "INIT": 0,
    "PENDING": 1,
    "SUCCESS": 2,
    "FAILED": 3,
    "AUTHORIZED": 4,
    "PARTIALLY_CAPTURED": 5,
    "CAPTURE_IN_PROCESS": 6,
    "PROVISIONALLY_CAPTURED": 7,
    "REFUNDED": 8,
    "PENDING_APPROVAL": 9,
  }

class ExtraPaymentProcessingType:
  FAILED_PAYMENTS = 0
  PENDING_CAPTURE = 1

  _VALUES_TO_NAMES = {
    0: "FAILED_PAYMENTS",
    1: "PENDING_CAPTURE",
  }

  _NAMES_TO_VALUES = {
    "FAILED_PAYMENTS": 0,
    "PENDING_CAPTURE": 1,
  }


class Attribute:
  """
  Attributes:
   - name
   - value
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'name', None, None, ), # 1
    (2, TType.STRING, 'value', None, None, ), # 2
  )

  def __init__(self, name=None, value=None,):
    self.name = name
    self.value = value

  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.STRING:
          self.name = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.value = iprot.readString();
        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('Attribute')
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 1)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.value is not None:
      oprot.writeFieldBegin('value', TType.STRING, 2)
      oprot.writeString(self.value)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 PaymentGateway:
  """
  Attributes:
   - id
   - name
   - url
   - addedOn
   - aliasName
   - responseUrl
   - errorUrl
   - status
   - attributes
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.STRING, 'name', None, None, ), # 2
    (3, TType.STRING, 'url', None, None, ), # 3
    (4, TType.I64, 'addedOn', None, None, ), # 4
    (5, TType.STRING, 'aliasName', None, None, ), # 5
    (6, TType.STRING, 'responseUrl', None, None, ), # 6
    (7, TType.STRING, 'errorUrl', None, None, ), # 7
    (8, TType.I32, 'status', None, None, ), # 8
    (9, TType.LIST, 'attributes', (TType.STRUCT,(Attribute, Attribute.thrift_spec)), None, ), # 9
  )

  def __init__(self, id=None, name=None, url=None, addedOn=None, aliasName=None, responseUrl=None, errorUrl=None, status=None, attributes=None,):
    self.id = id
    self.name = name
    self.url = url
    self.addedOn = addedOn
    self.aliasName = aliasName
    self.responseUrl = responseUrl
    self.errorUrl = errorUrl
    self.status = status
    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.name = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.url = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.addedOn = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.aliasName = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.responseUrl = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.errorUrl = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.LIST:
          self.attributes = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = Attribute()
            _elem5.read(iprot)
            self.attributes.append(_elem5)
          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('PaymentGateway')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 2)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.url is not None:
      oprot.writeFieldBegin('url', TType.STRING, 3)
      oprot.writeString(self.url)
      oprot.writeFieldEnd()
    if self.addedOn is not None:
      oprot.writeFieldBegin('addedOn', TType.I64, 4)
      oprot.writeI64(self.addedOn)
      oprot.writeFieldEnd()
    if self.aliasName is not None:
      oprot.writeFieldBegin('aliasName', TType.STRING, 5)
      oprot.writeString(self.aliasName)
      oprot.writeFieldEnd()
    if self.responseUrl is not None:
      oprot.writeFieldBegin('responseUrl', TType.STRING, 6)
      oprot.writeString(self.responseUrl)
      oprot.writeFieldEnd()
    if self.errorUrl is not None:
      oprot.writeFieldBegin('errorUrl', TType.STRING, 7)
      oprot.writeString(self.errorUrl)
      oprot.writeFieldEnd()
    if self.status is not None:
      oprot.writeFieldBegin('status', TType.I32, 8)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.attributes is not None:
      oprot.writeFieldBegin('attributes', TType.LIST, 9)
      oprot.writeListBegin(TType.STRUCT, len(self.attributes))
      for iter6 in self.attributes:
        iter6.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 Payment:
  """
  Attributes:
   - paymentId
   - gatewayId
   - gatewayPaymentId
   - merchantTxnId
   - gatewayTxnId
   - amount
   - gatewayTxnStatus
   - status
   - userId
   - errorCode
   - description
   - authCode
   - referenceCode
   - sessionId
   - gatewayTxnDate
   - attributes
   - initTimestamp
   - successTimestamp
   - errorTimestamp
   - provisionalCaptureTimestamp
   - isDigital
   - refundAmount
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'paymentId', None, None, ), # 1
    (2, TType.I64, 'gatewayId', None, None, ), # 2
    (3, TType.STRING, 'gatewayPaymentId', None, None, ), # 3
    (4, TType.I64, 'merchantTxnId', None, None, ), # 4
    (5, TType.STRING, 'gatewayTxnId', None, None, ), # 5
    (6, TType.DOUBLE, 'amount', None, None, ), # 6
    (7, TType.STRING, 'gatewayTxnStatus', None, None, ), # 7
    (8, TType.I32, 'status', None, None, ), # 8
    (9, TType.I64, 'userId', None, None, ), # 9
    (10, TType.STRING, 'errorCode', None, None, ), # 10
    (11, TType.STRING, 'description', None, None, ), # 11
    (12, TType.STRING, 'authCode', None, None, ), # 12
    (13, TType.STRING, 'referenceCode', None, None, ), # 13
    (14, TType.STRING, 'sessionId', None, None, ), # 14
    (15, TType.STRING, 'gatewayTxnDate', None, None, ), # 15
    (16, TType.LIST, 'attributes', (TType.STRUCT,(Attribute, Attribute.thrift_spec)), None, ), # 16
    (17, TType.I64, 'initTimestamp', None, None, ), # 17
    (18, TType.I64, 'successTimestamp', None, None, ), # 18
    (19, TType.I64, 'errorTimestamp', None, None, ), # 19
    (20, TType.I64, 'provisionalCaptureTimestamp', None, None, ), # 20
    (21, TType.BOOL, 'isDigital', None, None, ), # 21
    (22, TType.DOUBLE, 'refundAmount', None, None, ), # 22
  )

  def __init__(self, paymentId=None, gatewayId=None, gatewayPaymentId=None, merchantTxnId=None, gatewayTxnId=None, amount=None, gatewayTxnStatus=None, status=None, userId=None, errorCode=None, description=None, authCode=None, referenceCode=None, sessionId=None, gatewayTxnDate=None, attributes=None, initTimestamp=None, successTimestamp=None, errorTimestamp=None, provisionalCaptureTimestamp=None, isDigital=None, refundAmount=None,):
    self.paymentId = paymentId
    self.gatewayId = gatewayId
    self.gatewayPaymentId = gatewayPaymentId
    self.merchantTxnId = merchantTxnId
    self.gatewayTxnId = gatewayTxnId
    self.amount = amount
    self.gatewayTxnStatus = gatewayTxnStatus
    self.status = status
    self.userId = userId
    self.errorCode = errorCode
    self.description = description
    self.authCode = authCode
    self.referenceCode = referenceCode
    self.sessionId = sessionId
    self.gatewayTxnDate = gatewayTxnDate
    self.attributes = attributes
    self.initTimestamp = initTimestamp
    self.successTimestamp = successTimestamp
    self.errorTimestamp = errorTimestamp
    self.provisionalCaptureTimestamp = provisionalCaptureTimestamp
    self.isDigital = isDigital
    self.refundAmount = refundAmount

  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.paymentId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.gatewayId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.gatewayPaymentId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.merchantTxnId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.STRING:
          self.gatewayTxnId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.DOUBLE:
          self.amount = iprot.readDouble();
        else:
          iprot.skip(ftype)
      elif fid == 7:
        if ftype == TType.STRING:
          self.gatewayTxnStatus = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I32:
          self.status = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.I64:
          self.userId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.STRING:
          self.errorCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 11:
        if ftype == TType.STRING:
          self.description = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 12:
        if ftype == TType.STRING:
          self.authCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 13:
        if ftype == TType.STRING:
          self.referenceCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 14:
        if ftype == TType.STRING:
          self.sessionId = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 15:
        if ftype == TType.STRING:
          self.gatewayTxnDate = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 16:
        if ftype == TType.LIST:
          self.attributes = []
          (_etype10, _size7) = iprot.readListBegin()
          for _i11 in xrange(_size7):
            _elem12 = Attribute()
            _elem12.read(iprot)
            self.attributes.append(_elem12)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 17:
        if ftype == TType.I64:
          self.initTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 18:
        if ftype == TType.I64:
          self.successTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 19:
        if ftype == TType.I64:
          self.errorTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 20:
        if ftype == TType.I64:
          self.provisionalCaptureTimestamp = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 21:
        if ftype == TType.BOOL:
          self.isDigital = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 22:
        if ftype == TType.DOUBLE:
          self.refundAmount = iprot.readDouble();
        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('Payment')
    if self.paymentId is not None:
      oprot.writeFieldBegin('paymentId', TType.I64, 1)
      oprot.writeI64(self.paymentId)
      oprot.writeFieldEnd()
    if self.gatewayId is not None:
      oprot.writeFieldBegin('gatewayId', TType.I64, 2)
      oprot.writeI64(self.gatewayId)
      oprot.writeFieldEnd()
    if self.gatewayPaymentId is not None:
      oprot.writeFieldBegin('gatewayPaymentId', TType.STRING, 3)
      oprot.writeString(self.gatewayPaymentId)
      oprot.writeFieldEnd()
    if self.merchantTxnId is not None:
      oprot.writeFieldBegin('merchantTxnId', TType.I64, 4)
      oprot.writeI64(self.merchantTxnId)
      oprot.writeFieldEnd()
    if self.gatewayTxnId is not None:
      oprot.writeFieldBegin('gatewayTxnId', TType.STRING, 5)
      oprot.writeString(self.gatewayTxnId)
      oprot.writeFieldEnd()
    if self.amount is not None:
      oprot.writeFieldBegin('amount', TType.DOUBLE, 6)
      oprot.writeDouble(self.amount)
      oprot.writeFieldEnd()
    if self.gatewayTxnStatus is not None:
      oprot.writeFieldBegin('gatewayTxnStatus', TType.STRING, 7)
      oprot.writeString(self.gatewayTxnStatus)
      oprot.writeFieldEnd()
    if self.status is not None:
      oprot.writeFieldBegin('status', TType.I32, 8)
      oprot.writeI32(self.status)
      oprot.writeFieldEnd()
    if self.userId is not None:
      oprot.writeFieldBegin('userId', TType.I64, 9)
      oprot.writeI64(self.userId)
      oprot.writeFieldEnd()
    if self.errorCode is not None:
      oprot.writeFieldBegin('errorCode', TType.STRING, 10)
      oprot.writeString(self.errorCode)
      oprot.writeFieldEnd()
    if self.description is not None:
      oprot.writeFieldBegin('description', TType.STRING, 11)
      oprot.writeString(self.description)
      oprot.writeFieldEnd()
    if self.authCode is not None:
      oprot.writeFieldBegin('authCode', TType.STRING, 12)
      oprot.writeString(self.authCode)
      oprot.writeFieldEnd()
    if self.referenceCode is not None:
      oprot.writeFieldBegin('referenceCode', TType.STRING, 13)
      oprot.writeString(self.referenceCode)
      oprot.writeFieldEnd()
    if self.sessionId is not None:
      oprot.writeFieldBegin('sessionId', TType.STRING, 14)
      oprot.writeString(self.sessionId)
      oprot.writeFieldEnd()
    if self.gatewayTxnDate is not None:
      oprot.writeFieldBegin('gatewayTxnDate', TType.STRING, 15)
      oprot.writeString(self.gatewayTxnDate)
      oprot.writeFieldEnd()
    if self.attributes is not None:
      oprot.writeFieldBegin('attributes', TType.LIST, 16)
      oprot.writeListBegin(TType.STRUCT, len(self.attributes))
      for iter13 in self.attributes:
        iter13.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.initTimestamp is not None:
      oprot.writeFieldBegin('initTimestamp', TType.I64, 17)
      oprot.writeI64(self.initTimestamp)
      oprot.writeFieldEnd()
    if self.successTimestamp is not None:
      oprot.writeFieldBegin('successTimestamp', TType.I64, 18)
      oprot.writeI64(self.successTimestamp)
      oprot.writeFieldEnd()
    if self.errorTimestamp is not None:
      oprot.writeFieldBegin('errorTimestamp', TType.I64, 19)
      oprot.writeI64(self.errorTimestamp)
      oprot.writeFieldEnd()
    if self.provisionalCaptureTimestamp is not None:
      oprot.writeFieldBegin('provisionalCaptureTimestamp', TType.I64, 20)
      oprot.writeI64(self.provisionalCaptureTimestamp)
      oprot.writeFieldEnd()
    if self.isDigital is not None:
      oprot.writeFieldBegin('isDigital', TType.BOOL, 21)
      oprot.writeBool(self.isDigital)
      oprot.writeFieldEnd()
    if self.refundAmount is not None:
      oprot.writeFieldBegin('refundAmount', TType.DOUBLE, 22)
      oprot.writeDouble(self.refundAmount)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 Refund:
  """
  Attributes:
   - id
   - paymentId
   - gatewayId
   - orderId
   - amount
   - gatewayTxnId
   - attempts
   - createdAt
   - processedAt
   - attributes
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'id', None, None, ), # 1
    (2, TType.I64, 'paymentId', None, None, ), # 2
    (3, TType.I64, 'gatewayId', None, None, ), # 3
    (4, TType.I64, 'orderId', None, None, ), # 4
    (5, TType.DOUBLE, 'amount', None, None, ), # 5
    (6, TType.STRING, 'gatewayTxnId', None, None, ), # 6
    (7, TType.I32, 'attempts', None, None, ), # 7
    (8, TType.I64, 'createdAt', None, None, ), # 8
    (9, TType.I64, 'processedAt', None, None, ), # 9
    (10, TType.LIST, 'attributes', (TType.STRUCT,(Attribute, Attribute.thrift_spec)), None, ), # 10
  )

  def __init__(self, id=None, paymentId=None, gatewayId=None, orderId=None, amount=None, gatewayTxnId=None, attempts=None, createdAt=None, processedAt=None, attributes=None,):
    self.id = id
    self.paymentId = paymentId
    self.gatewayId = gatewayId
    self.orderId = orderId
    self.amount = amount
    self.gatewayTxnId = gatewayTxnId
    self.attempts = attempts
    self.createdAt = createdAt
    self.processedAt = processedAt
    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.I64:
          self.paymentId = iprot.readI64();
        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.orderId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.DOUBLE:
          self.amount = iprot.readDouble();
        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.I32:
          self.attempts = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 8:
        if ftype == TType.I64:
          self.createdAt = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 9:
        if ftype == TType.I64:
          self.processedAt = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 10:
        if ftype == TType.LIST:
          self.attributes = []
          (_etype17, _size14) = iprot.readListBegin()
          for _i18 in xrange(_size14):
            _elem19 = Attribute()
            _elem19.read(iprot)
            self.attributes.append(_elem19)
          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('Refund')
    if self.id is not None:
      oprot.writeFieldBegin('id', TType.I64, 1)
      oprot.writeI64(self.id)
      oprot.writeFieldEnd()
    if self.paymentId is not None:
      oprot.writeFieldBegin('paymentId', TType.I64, 2)
      oprot.writeI64(self.paymentId)
      oprot.writeFieldEnd()
    if self.gatewayId is not None:
      oprot.writeFieldBegin('gatewayId', TType.I64, 3)
      oprot.writeI64(self.gatewayId)
      oprot.writeFieldEnd()
    if self.orderId is not None:
      oprot.writeFieldBegin('orderId', TType.I64, 4)
      oprot.writeI64(self.orderId)
      oprot.writeFieldEnd()
    if self.amount is not None:
      oprot.writeFieldBegin('amount', TType.DOUBLE, 5)
      oprot.writeDouble(self.amount)
      oprot.writeFieldEnd()
    if self.gatewayTxnId is not None:
      oprot.writeFieldBegin('gatewayTxnId', TType.STRING, 6)
      oprot.writeString(self.gatewayTxnId)
      oprot.writeFieldEnd()
    if self.attempts is not None:
      oprot.writeFieldBegin('attempts', TType.I32, 7)
      oprot.writeI32(self.attempts)
      oprot.writeFieldEnd()
    if self.createdAt is not None:
      oprot.writeFieldBegin('createdAt', TType.I64, 8)
      oprot.writeI64(self.createdAt)
      oprot.writeFieldEnd()
    if self.processedAt is not None:
      oprot.writeFieldBegin('processedAt', TType.I64, 9)
      oprot.writeI64(self.processedAt)
      oprot.writeFieldEnd()
    if self.attributes is not None:
      oprot.writeFieldBegin('attributes', TType.LIST, 10)
      oprot.writeListBegin(TType.STRUCT, len(self.attributes))
      for iter20 in self.attributes:
        iter20.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 PaymentException(Exception):
  """
  Attributes:
   - error_code
   - message
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'error_code', None, None, ), # 1
    (2, TType.STRING, 'message', None, None, ), # 2
  )

  def __init__(self, error_code=None, message=None,):
    self.error_code = error_code
    self.message = message

  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.error_code = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.message = iprot.readString();
        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('PaymentException')
    if self.error_code is not None:
      oprot.writeFieldBegin('error_code', TType.I64, 1)
      oprot.writeI64(self.error_code)
      oprot.writeFieldEnd()
    if self.message is not None:
      oprot.writeFieldBegin('message', TType.STRING, 2)
      oprot.writeString(self.message)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __str__(self):
    return repr(self)

  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)