Subversion Repositories SmartDukaan

Rev

Rev 11819 | 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.GenericService
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface(shop2020.thriftpy.generic.GenericService.Iface):
  """
  Promotion Service
  """
  def createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
    """
    Parameters:
     - name
     - ruleExecutionSrc
     - startOn
     - endOn
    """
    pass

  def removeAllCouponsByPromotionId(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    pass

  def getCoupon(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    pass

  def isGiftVoucher(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    pass

  def isCodApplicable(self, cart):
    """
    Parameters:
     - cart
    """
    pass

  def getAllPromotions(self, ):
    pass

  def getPromotionById(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    pass

  def generateCouponsForPromotion(self, promotionId, couponCode):
    """
    Parameters:
     - promotionId
     - couponCode
    """
    pass

  def applyCoupon(self, couponCode, cartId):
    """
    Parameters:
     - couponCode
     - cartId
    """
    pass

  def getEmiDiscount(self, cartId):
    """
    Parameters:
     - cartId
    """
    pass

  def applyRechargeCoupon(self, couponCode, totalAmount, userId):
    """
    Parameters:
     - couponCode
     - totalAmount
     - userId
    """
    pass

  def trackCouponUsage(self, couponCode, transactionId, userId, amount, isDigital):
    """
    Parameters:
     - couponCode
     - transactionId
     - userId
     - amount
     - isDigital
    """
    pass

  def getCouponUsageCountByUser(self, couponCode, userId):
    """
    Parameters:
     - couponCode
     - userId
    """
    pass

  def getActiveCodes(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    pass

  def deleteCoupon(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    pass

  def getAllCouponsByPromotionId(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    pass

  def getActiveCoupons(self, ):
    """
    Returns a list of active coupons
    """
    pass

  def createCoupon(self, promotionId, couponCategory, couponCode, arguments, isCod, prefix):
    """
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.

    Parameters:
     - promotionId
     - couponCategory
     - couponCode
     - arguments
     - isCod
     - prefix
    """
    pass

  def getSuccessfulPaymentCountForCoupon(self, couponCode):
    """
    Returns the count of successful payments done using a given coupon

    Parameters:
     - couponCode
    """
    pass

  def getRuleDocString(self, ruleName):
    """
    Returns the doc string of the rule module

    Parameters:
     - ruleName
    """
    pass

  def getItemDiscountMap(self, itemIds):
    """
    Parameters:
     - itemIds
    """
    pass

  def getDiscountsForEntity(self, entityId):
    """
    Parameters:
     - entityId
    """
    pass

  def addVoucher(self, voucher):
    """
    Parameters:
     - voucher
    """
    pass

  def assignVoucher(self, userId, userEmail, voucherType, amount):
    """
    Parameters:
     - userId
     - userEmail
     - voucherType
     - amount
    """
    pass

  def markVoucherAsRedeemed(self, voucherCode, redeemedOn):
    """
    Parameters:
     - voucherCode
     - redeemedOn
    """
    pass


class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
  """
  Promotion Service
  """
  def __init__(self, iprot, oprot=None):
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)

  def createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
    """
    Parameters:
     - name
     - ruleExecutionSrc
     - startOn
     - endOn
    """
    self.send_createPromotion(name, ruleExecutionSrc, startOn, endOn)
    self.recv_createPromotion()

  def send_createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
    self._oprot.writeMessageBegin('createPromotion', TMessageType.CALL, self._seqid)
    args = createPromotion_args()
    args.name = name
    args.ruleExecutionSrc = ruleExecutionSrc
    args.startOn = startOn
    args.endOn = endOn
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_createPromotion(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = createPromotion_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.pex is not None:
      raise result.pex
    return

  def removeAllCouponsByPromotionId(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    self.send_removeAllCouponsByPromotionId(promotionId)
    return self.recv_removeAllCouponsByPromotionId()

  def send_removeAllCouponsByPromotionId(self, promotionId):
    self._oprot.writeMessageBegin('removeAllCouponsByPromotionId', TMessageType.CALL, self._seqid)
    args = removeAllCouponsByPromotionId_args()
    args.promotionId = promotionId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_removeAllCouponsByPromotionId(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = removeAllCouponsByPromotionId_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "removeAllCouponsByPromotionId failed: unknown result");

  def getCoupon(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    self.send_getCoupon(couponCode)
    return self.recv_getCoupon()

  def send_getCoupon(self, couponCode):
    self._oprot.writeMessageBegin('getCoupon', TMessageType.CALL, self._seqid)
    args = getCoupon_args()
    args.couponCode = couponCode
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getCoupon failed: unknown result");

  def isGiftVoucher(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    self.send_isGiftVoucher(couponCode)
    return self.recv_isGiftVoucher()

  def send_isGiftVoucher(self, couponCode):
    self._oprot.writeMessageBegin('isGiftVoucher', TMessageType.CALL, self._seqid)
    args = isGiftVoucher_args()
    args.couponCode = couponCode
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_isGiftVoucher(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = isGiftVoucher_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");

  def isCodApplicable(self, cart):
    """
    Parameters:
     - cart
    """
    self.send_isCodApplicable(cart)
    return self.recv_isCodApplicable()

  def send_isCodApplicable(self, cart):
    self._oprot.writeMessageBegin('isCodApplicable', TMessageType.CALL, self._seqid)
    args = isCodApplicable_args()
    args.cart = cart
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_isCodApplicable(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = isCodApplicable_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isCodApplicable failed: unknown result");

  def getAllPromotions(self, ):
    self.send_getAllPromotions()
    return self.recv_getAllPromotions()

  def send_getAllPromotions(self, ):
    self._oprot.writeMessageBegin('getAllPromotions', TMessageType.CALL, self._seqid)
    args = getAllPromotions_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getAllPromotions(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getAllPromotions_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllPromotions failed: unknown result");

  def getPromotionById(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    self.send_getPromotionById(promotionId)
    return self.recv_getPromotionById()

  def send_getPromotionById(self, promotionId):
    self._oprot.writeMessageBegin('getPromotionById', TMessageType.CALL, self._seqid)
    args = getPromotionById_args()
    args.promotionId = promotionId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getPromotionById(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getPromotionById_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPromotionById failed: unknown result");

  def generateCouponsForPromotion(self, promotionId, couponCode):
    """
    Parameters:
     - promotionId
     - couponCode
    """
    self.send_generateCouponsForPromotion(promotionId, couponCode)
    self.recv_generateCouponsForPromotion()

  def send_generateCouponsForPromotion(self, promotionId, couponCode):
    self._oprot.writeMessageBegin('generateCouponsForPromotion', TMessageType.CALL, self._seqid)
    args = generateCouponsForPromotion_args()
    args.promotionId = promotionId
    args.couponCode = couponCode
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_generateCouponsForPromotion(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = generateCouponsForPromotion_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.pex is not None:
      raise result.pex
    return

  def applyCoupon(self, couponCode, cartId):
    """
    Parameters:
     - couponCode
     - cartId
    """
    self.send_applyCoupon(couponCode, cartId)
    return self.recv_applyCoupon()

  def send_applyCoupon(self, couponCode, cartId):
    self._oprot.writeMessageBegin('applyCoupon', TMessageType.CALL, self._seqid)
    args = applyCoupon_args()
    args.couponCode = couponCode
    args.cartId = cartId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_applyCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = applyCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "applyCoupon failed: unknown result");

  def getEmiDiscount(self, cartId):
    """
    Parameters:
     - cartId
    """
    self.send_getEmiDiscount(cartId)
    return self.recv_getEmiDiscount()

  def send_getEmiDiscount(self, cartId):
    self._oprot.writeMessageBegin('getEmiDiscount', TMessageType.CALL, self._seqid)
    args = getEmiDiscount_args()
    args.cartId = cartId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getEmiDiscount(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getEmiDiscount_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getEmiDiscount failed: unknown result");

  def applyRechargeCoupon(self, couponCode, totalAmount, userId):
    """
    Parameters:
     - couponCode
     - totalAmount
     - userId
    """
    self.send_applyRechargeCoupon(couponCode, totalAmount, userId)
    return self.recv_applyRechargeCoupon()

  def send_applyRechargeCoupon(self, couponCode, totalAmount, userId):
    self._oprot.writeMessageBegin('applyRechargeCoupon', TMessageType.CALL, self._seqid)
    args = applyRechargeCoupon_args()
    args.couponCode = couponCode
    args.totalAmount = totalAmount
    args.userId = userId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_applyRechargeCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = applyRechargeCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "applyRechargeCoupon failed: unknown result");

  def trackCouponUsage(self, couponCode, transactionId, userId, amount, isDigital):
    """
    Parameters:
     - couponCode
     - transactionId
     - userId
     - amount
     - isDigital
    """
    self.send_trackCouponUsage(couponCode, transactionId, userId, amount, isDigital)
    self.recv_trackCouponUsage()

  def send_trackCouponUsage(self, couponCode, transactionId, userId, amount, isDigital):
    self._oprot.writeMessageBegin('trackCouponUsage', TMessageType.CALL, self._seqid)
    args = trackCouponUsage_args()
    args.couponCode = couponCode
    args.transactionId = transactionId
    args.userId = userId
    args.amount = amount
    args.isDigital = isDigital
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_trackCouponUsage(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = trackCouponUsage_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.pex is not None:
      raise result.pex
    return

  def getCouponUsageCountByUser(self, couponCode, userId):
    """
    Parameters:
     - couponCode
     - userId
    """
    self.send_getCouponUsageCountByUser(couponCode, userId)
    return self.recv_getCouponUsageCountByUser()

  def send_getCouponUsageCountByUser(self, couponCode, userId):
    self._oprot.writeMessageBegin('getCouponUsageCountByUser', TMessageType.CALL, self._seqid)
    args = getCouponUsageCountByUser_args()
    args.couponCode = couponCode
    args.userId = userId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getCouponUsageCountByUser(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getCouponUsageCountByUser_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");

  def getActiveCodes(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    self.send_getActiveCodes(promotionId)
    return self.recv_getActiveCodes()

  def send_getActiveCodes(self, promotionId):
    self._oprot.writeMessageBegin('getActiveCodes', TMessageType.CALL, self._seqid)
    args = getActiveCodes_args()
    args.promotionId = promotionId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getActiveCodes(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getActiveCodes_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCodes failed: unknown result");

  def deleteCoupon(self, couponCode):
    """
    Parameters:
     - couponCode
    """
    self.send_deleteCoupon(couponCode)
    self.recv_deleteCoupon()

  def send_deleteCoupon(self, couponCode):
    self._oprot.writeMessageBegin('deleteCoupon', TMessageType.CALL, self._seqid)
    args = deleteCoupon_args()
    args.couponCode = couponCode
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_deleteCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = deleteCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.pex is not None:
      raise result.pex
    return

  def getAllCouponsByPromotionId(self, promotionId):
    """
    Parameters:
     - promotionId
    """
    self.send_getAllCouponsByPromotionId(promotionId)
    return self.recv_getAllCouponsByPromotionId()

  def send_getAllCouponsByPromotionId(self, promotionId):
    self._oprot.writeMessageBegin('getAllCouponsByPromotionId', TMessageType.CALL, self._seqid)
    args = getAllCouponsByPromotionId_args()
    args.promotionId = promotionId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getAllCouponsByPromotionId(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getAllCouponsByPromotionId_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllCouponsByPromotionId failed: unknown result");

  def getActiveCoupons(self, ):
    """
    Returns a list of active coupons
    """
    self.send_getActiveCoupons()
    return self.recv_getActiveCoupons()

  def send_getActiveCoupons(self, ):
    self._oprot.writeMessageBegin('getActiveCoupons', TMessageType.CALL, self._seqid)
    args = getActiveCoupons_args()
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getActiveCoupons(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getActiveCoupons_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");

  def createCoupon(self, promotionId, couponCategory, couponCode, arguments, isCod, prefix):
    """
    Creates a coupon with prefix (optional, pass null)and returns couponcode if successfully created.

    Parameters:
     - promotionId
     - couponCategory
     - couponCode
     - arguments
     - isCod
     - prefix
    """
    self.send_createCoupon(promotionId, couponCategory, couponCode, arguments, isCod, prefix)
    return self.recv_createCoupon()

  def send_createCoupon(self, promotionId, couponCategory, couponCode, arguments, isCod, prefix):
    self._oprot.writeMessageBegin('createCoupon', TMessageType.CALL, self._seqid)
    args = createCoupon_args()
    args.promotionId = promotionId
    args.couponCategory = couponCategory
    args.couponCode = couponCode
    args.arguments = arguments
    args.isCod = isCod
    args.prefix = prefix
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_createCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = createCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createCoupon failed: unknown result");

  def getSuccessfulPaymentCountForCoupon(self, couponCode):
    """
    Returns the count of successful payments done using a given coupon

    Parameters:
     - couponCode
    """
    self.send_getSuccessfulPaymentCountForCoupon(couponCode)
    return self.recv_getSuccessfulPaymentCountForCoupon()

  def send_getSuccessfulPaymentCountForCoupon(self, couponCode):
    self._oprot.writeMessageBegin('getSuccessfulPaymentCountForCoupon', TMessageType.CALL, self._seqid)
    args = getSuccessfulPaymentCountForCoupon_args()
    args.couponCode = couponCode
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getSuccessfulPaymentCountForCoupon(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getSuccessfulPaymentCountForCoupon_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getSuccessfulPaymentCountForCoupon failed: unknown result");

  def getRuleDocString(self, ruleName):
    """
    Returns the doc string of the rule module

    Parameters:
     - ruleName
    """
    self.send_getRuleDocString(ruleName)
    return self.recv_getRuleDocString()

  def send_getRuleDocString(self, ruleName):
    self._oprot.writeMessageBegin('getRuleDocString', TMessageType.CALL, self._seqid)
    args = getRuleDocString_args()
    args.ruleName = ruleName
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getRuleDocString(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getRuleDocString_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getRuleDocString failed: unknown result");

  def getItemDiscountMap(self, itemIds):
    """
    Parameters:
     - itemIds
    """
    self.send_getItemDiscountMap(itemIds)
    return self.recv_getItemDiscountMap()

  def send_getItemDiscountMap(self, itemIds):
    self._oprot.writeMessageBegin('getItemDiscountMap', TMessageType.CALL, self._seqid)
    args = getItemDiscountMap_args()
    args.itemIds = itemIds
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getItemDiscountMap(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getItemDiscountMap_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.pex is not None:
      raise result.pex
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getItemDiscountMap failed: unknown result");

  def getDiscountsForEntity(self, entityId):
    """
    Parameters:
     - entityId
    """
    self.send_getDiscountsForEntity(entityId)
    return self.recv_getDiscountsForEntity()

  def send_getDiscountsForEntity(self, entityId):
    self._oprot.writeMessageBegin('getDiscountsForEntity', TMessageType.CALL, self._seqid)
    args = getDiscountsForEntity_args()
    args.entityId = entityId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_getDiscountsForEntity(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = getDiscountsForEntity_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getDiscountsForEntity failed: unknown result");

  def addVoucher(self, voucher):
    """
    Parameters:
     - voucher
    """
    self.send_addVoucher(voucher)
    self.recv_addVoucher()

  def send_addVoucher(self, voucher):
    self._oprot.writeMessageBegin('addVoucher', TMessageType.CALL, self._seqid)
    args = addVoucher_args()
    args.voucher = voucher
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

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

  def assignVoucher(self, userId, userEmail, voucherType, amount):
    """
    Parameters:
     - userId
     - userEmail
     - voucherType
     - amount
    """
    self.send_assignVoucher(userId, userEmail, voucherType, amount)
    return self.recv_assignVoucher()

  def send_assignVoucher(self, userId, userEmail, voucherType, amount):
    self._oprot.writeMessageBegin('assignVoucher', TMessageType.CALL, self._seqid)
    args = assignVoucher_args()
    args.userId = userId
    args.userEmail = userEmail
    args.voucherType = voucherType
    args.amount = amount
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_assignVoucher(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = assignVoucher_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "assignVoucher failed: unknown result");

  def markVoucherAsRedeemed(self, voucherCode, redeemedOn):
    """
    Parameters:
     - voucherCode
     - redeemedOn
    """
    self.send_markVoucherAsRedeemed(voucherCode, redeemedOn)
    return self.recv_markVoucherAsRedeemed()

  def send_markVoucherAsRedeemed(self, voucherCode, redeemedOn):
    self._oprot.writeMessageBegin('markVoucherAsRedeemed', TMessageType.CALL, self._seqid)
    args = markVoucherAsRedeemed_args()
    args.voucherCode = voucherCode
    args.redeemedOn = redeemedOn
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_markVoucherAsRedeemed(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = markVoucherAsRedeemed_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "markVoucherAsRedeemed failed: unknown result");


class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
  def __init__(self, handler):
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
    self._processMap["createPromotion"] = Processor.process_createPromotion
    self._processMap["removeAllCouponsByPromotionId"] = Processor.process_removeAllCouponsByPromotionId
    self._processMap["getCoupon"] = Processor.process_getCoupon
    self._processMap["isGiftVoucher"] = Processor.process_isGiftVoucher
    self._processMap["isCodApplicable"] = Processor.process_isCodApplicable
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
    self._processMap["getEmiDiscount"] = Processor.process_getEmiDiscount
    self._processMap["applyRechargeCoupon"] = Processor.process_applyRechargeCoupon
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
    self._processMap["getActiveCodes"] = Processor.process_getActiveCodes
    self._processMap["deleteCoupon"] = Processor.process_deleteCoupon
    self._processMap["getAllCouponsByPromotionId"] = Processor.process_getAllCouponsByPromotionId
    self._processMap["getActiveCoupons"] = Processor.process_getActiveCoupons
    self._processMap["createCoupon"] = Processor.process_createCoupon
    self._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCoupon
    self._processMap["getRuleDocString"] = Processor.process_getRuleDocString
    self._processMap["getItemDiscountMap"] = Processor.process_getItemDiscountMap
    self._processMap["getDiscountsForEntity"] = Processor.process_getDiscountsForEntity
    self._processMap["addVoucher"] = Processor.process_addVoucher
    self._processMap["assignVoucher"] = Processor.process_assignVoucher
    self._processMap["markVoucherAsRedeemed"] = Processor.process_markVoucherAsRedeemed

  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_createPromotion(self, seqid, iprot, oprot):
    args = createPromotion_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = createPromotion_result()
    try:
      self._handler.createPromotion(args.name, args.ruleExecutionSrc, args.startOn, args.endOn)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("createPromotion", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_removeAllCouponsByPromotionId(self, seqid, iprot, oprot):
    args = removeAllCouponsByPromotionId_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = removeAllCouponsByPromotionId_result()
    try:
      result.success = self._handler.removeAllCouponsByPromotionId(args.promotionId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("removeAllCouponsByPromotionId", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getCoupon(self, seqid, iprot, oprot):
    args = getCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getCoupon_result()
    try:
      result.success = self._handler.getCoupon(args.couponCode)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_isGiftVoucher(self, seqid, iprot, oprot):
    args = isGiftVoucher_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = isGiftVoucher_result()
    try:
      result.success = self._handler.isGiftVoucher(args.couponCode)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("isGiftVoucher", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_isCodApplicable(self, seqid, iprot, oprot):
    args = isCodApplicable_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = isCodApplicable_result()
    try:
      result.success = self._handler.isCodApplicable(args.cart)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("isCodApplicable", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getAllPromotions(self, seqid, iprot, oprot):
    args = getAllPromotions_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getAllPromotions_result()
    try:
      result.success = self._handler.getAllPromotions()
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getAllPromotions", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getPromotionById(self, seqid, iprot, oprot):
    args = getPromotionById_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getPromotionById_result()
    try:
      result.success = self._handler.getPromotionById(args.promotionId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getPromotionById", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_generateCouponsForPromotion(self, seqid, iprot, oprot):
    args = generateCouponsForPromotion_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = generateCouponsForPromotion_result()
    try:
      self._handler.generateCouponsForPromotion(args.promotionId, args.couponCode)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("generateCouponsForPromotion", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_applyCoupon(self, seqid, iprot, oprot):
    args = applyCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = applyCoupon_result()
    try:
      result.success = self._handler.applyCoupon(args.couponCode, args.cartId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("applyCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getEmiDiscount(self, seqid, iprot, oprot):
    args = getEmiDiscount_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getEmiDiscount_result()
    try:
      result.success = self._handler.getEmiDiscount(args.cartId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getEmiDiscount", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_applyRechargeCoupon(self, seqid, iprot, oprot):
    args = applyRechargeCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = applyRechargeCoupon_result()
    try:
      result.success = self._handler.applyRechargeCoupon(args.couponCode, args.totalAmount, args.userId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("applyRechargeCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_trackCouponUsage(self, seqid, iprot, oprot):
    args = trackCouponUsage_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = trackCouponUsage_result()
    try:
      self._handler.trackCouponUsage(args.couponCode, args.transactionId, args.userId, args.amount, args.isDigital)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("trackCouponUsage", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getCouponUsageCountByUser(self, seqid, iprot, oprot):
    args = getCouponUsageCountByUser_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getCouponUsageCountByUser_result()
    try:
      result.success = self._handler.getCouponUsageCountByUser(args.couponCode, args.userId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getCouponUsageCountByUser", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getActiveCodes(self, seqid, iprot, oprot):
    args = getActiveCodes_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getActiveCodes_result()
    try:
      result.success = self._handler.getActiveCodes(args.promotionId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getActiveCodes", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_deleteCoupon(self, seqid, iprot, oprot):
    args = deleteCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = deleteCoupon_result()
    try:
      self._handler.deleteCoupon(args.couponCode)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("deleteCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getAllCouponsByPromotionId(self, seqid, iprot, oprot):
    args = getAllCouponsByPromotionId_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getAllCouponsByPromotionId_result()
    try:
      result.success = self._handler.getAllCouponsByPromotionId(args.promotionId)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getAllCouponsByPromotionId", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getActiveCoupons(self, seqid, iprot, oprot):
    args = getActiveCoupons_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getActiveCoupons_result()
    try:
      result.success = self._handler.getActiveCoupons()
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getActiveCoupons", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_createCoupon(self, seqid, iprot, oprot):
    args = createCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = createCoupon_result()
    try:
      result.success = self._handler.createCoupon(args.promotionId, args.couponCategory, args.couponCode, args.arguments, args.isCod, args.prefix)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("createCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getSuccessfulPaymentCountForCoupon(self, seqid, iprot, oprot):
    args = getSuccessfulPaymentCountForCoupon_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getSuccessfulPaymentCountForCoupon_result()
    try:
      result.success = self._handler.getSuccessfulPaymentCountForCoupon(args.couponCode)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getSuccessfulPaymentCountForCoupon", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getRuleDocString(self, seqid, iprot, oprot):
    args = getRuleDocString_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getRuleDocString_result()
    result.success = self._handler.getRuleDocString(args.ruleName)
    oprot.writeMessageBegin("getRuleDocString", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getItemDiscountMap(self, seqid, iprot, oprot):
    args = getItemDiscountMap_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getItemDiscountMap_result()
    try:
      result.success = self._handler.getItemDiscountMap(args.itemIds)
    except PromotionException, pex:
      result.pex = pex
    oprot.writeMessageBegin("getItemDiscountMap", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_getDiscountsForEntity(self, seqid, iprot, oprot):
    args = getDiscountsForEntity_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = getDiscountsForEntity_result()
    result.success = self._handler.getDiscountsForEntity(args.entityId)
    oprot.writeMessageBegin("getDiscountsForEntity", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_addVoucher(self, seqid, iprot, oprot):
    args = addVoucher_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = addVoucher_result()
    self._handler.addVoucher(args.voucher)
    oprot.writeMessageBegin("addVoucher", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_assignVoucher(self, seqid, iprot, oprot):
    args = assignVoucher_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = assignVoucher_result()
    result.success = self._handler.assignVoucher(args.userId, args.userEmail, args.voucherType, args.amount)
    oprot.writeMessageBegin("assignVoucher", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_markVoucherAsRedeemed(self, seqid, iprot, oprot):
    args = markVoucherAsRedeemed_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = markVoucherAsRedeemed_result()
    result.success = self._handler.markVoucherAsRedeemed(args.voucherCode, args.redeemedOn)
    oprot.writeMessageBegin("markVoucherAsRedeemed", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class createPromotion_args:
  """
  Attributes:
   - name
   - ruleExecutionSrc
   - startOn
   - endOn
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'name', None, None, ), # 1
    (2, TType.STRING, 'ruleExecutionSrc', None, None, ), # 2
    (3, TType.I64, 'startOn', None, None, ), # 3
    (4, TType.I64, 'endOn', None, None, ), # 4
  )

  def __init__(self, name=None, ruleExecutionSrc=None, startOn=None, endOn=None,):
    self.name = name
    self.ruleExecutionSrc = ruleExecutionSrc
    self.startOn = startOn
    self.endOn = endOn

  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.ruleExecutionSrc = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.startOn = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.endOn = 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('createPromotion_args')
    if self.name is not None:
      oprot.writeFieldBegin('name', TType.STRING, 1)
      oprot.writeString(self.name)
      oprot.writeFieldEnd()
    if self.ruleExecutionSrc is not None:
      oprot.writeFieldBegin('ruleExecutionSrc', TType.STRING, 2)
      oprot.writeString(self.ruleExecutionSrc)
      oprot.writeFieldEnd()
    if self.startOn is not None:
      oprot.writeFieldBegin('startOn', TType.I64, 3)
      oprot.writeI64(self.startOn)
      oprot.writeFieldEnd()
    if self.endOn is not None:
      oprot.writeFieldBegin('endOn', TType.I64, 4)
      oprot.writeI64(self.endOn)
      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 createPromotion_result:
  """
  Attributes:
   - pex
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.pex = PromotionException()
          self.pex.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('createPromotion_result')
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 removeAllCouponsByPromotionId_args:
  """
  Attributes:
   - promotionId
  """

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

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

  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.promotionId = 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('removeAllCouponsByPromotionId_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      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 removeAllCouponsByPromotionId_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.I64, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.pex = PromotionException()
          self.pex.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('removeAllCouponsByPromotionId_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.I64, 0)
      oprot.writeI64(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getCoupon_args:
  """
  Attributes:
   - couponCode
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
  )

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

  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.couponCode = 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('getCoupon_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      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 getCoupon_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (Coupon, Coupon.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = Coupon()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getCoupon_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 isGiftVoucher_args:
  """
  Attributes:
   - couponCode
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
  )

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

  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.couponCode = 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('isGiftVoucher_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      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 isGiftVoucher_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.pex = PromotionException()
          self.pex.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('isGiftVoucher_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 isCodApplicable_args:
  """
  Attributes:
   - cart
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'cart', (Cart, Cart.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.cart = Cart()
          self.cart.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('isCodApplicable_args')
    if self.cart is not None:
      oprot.writeFieldBegin('cart', TType.STRUCT, 1)
      self.cart.write(oprot)
      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 isCodApplicable_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.pex = PromotionException()
          self.pex.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('isCodApplicable_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getAllPromotions_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('getAllPromotions_args')
    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 getAllPromotions_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Promotion, Promotion.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = Promotion()
            _elem33.read(iprot)
            self.success.append(_elem33)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getAllPromotions_result')
    if self.success is not 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.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getPromotionById_args:
  """
  Attributes:
   - promotionId
  """

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

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

  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.promotionId = 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('getPromotionById_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      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 getPromotionById_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (Promotion, Promotion.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = Promotion()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getPromotionById_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 generateCouponsForPromotion_args:
  """
  Attributes:
   - promotionId
   - couponCode
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'promotionId', None, None, ), # 1
    (2, TType.STRING, 'couponCode', None, None, ), # 2
  )

  def __init__(self, promotionId=None, couponCode=None,):
    self.promotionId = promotionId
    self.couponCode = couponCode

  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.promotionId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.STRING:
          self.couponCode = 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('generateCouponsForPromotion_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      oprot.writeFieldEnd()
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 2)
      oprot.writeString(self.couponCode)
      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 generateCouponsForPromotion_result:
  """
  Attributes:
   - pex
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.pex = PromotionException()
          self.pex.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('generateCouponsForPromotion_result')
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 applyCoupon_args:
  """
  Attributes:
   - couponCode
   - cartId
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
    (2, TType.I64, 'cartId', None, None, ), # 2
  )

  def __init__(self, couponCode=None, cartId=None,):
    self.couponCode = couponCode
    self.cartId = cartId

  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.couponCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.cartId = 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('applyCoupon_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      oprot.writeFieldEnd()
    if self.cartId is not None:
      oprot.writeFieldBegin('cartId', TType.I64, 2)
      oprot.writeI64(self.cartId)
      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 applyCoupon_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (Cart, Cart.thrift_spec), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = Cart()
          self.success.read(iprot)
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('applyCoupon_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getEmiDiscount_args:
  """
  Attributes:
   - cartId
  """

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

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

  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.cartId = 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('getEmiDiscount_args')
    if self.cartId is not None:
      oprot.writeFieldBegin('cartId', TType.I64, 1)
      oprot.writeI64(self.cartId)
      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 getEmiDiscount_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.MAP, 'success', (TType.I64,None,TType.DOUBLE,None), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.MAP:
          self.success = {}
          (_ktype36, _vtype37, _size35 ) = iprot.readMapBegin() 
          for _i39 in xrange(_size35):
            _key40 = iprot.readI64();
            _val41 = iprot.readDouble();
            self.success[_key40] = _val41
          iprot.readMapEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getEmiDiscount_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.MAP, 0)
      oprot.writeMapBegin(TType.I64, TType.DOUBLE, len(self.success))
      for kiter42,viter43 in self.success.items():
        oprot.writeI64(kiter42)
        oprot.writeDouble(viter43)
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 applyRechargeCoupon_args:
  """
  Attributes:
   - couponCode
   - totalAmount
   - userId
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
    (2, TType.I64, 'totalAmount', None, None, ), # 2
    (3, TType.I64, 'userId', None, None, ), # 3
  )

  def __init__(self, couponCode=None, totalAmount=None, userId=None,):
    self.couponCode = couponCode
    self.totalAmount = totalAmount
    self.userId = userId

  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.couponCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.totalAmount = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.userId = 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('applyRechargeCoupon_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      oprot.writeFieldEnd()
    if self.totalAmount is not None:
      oprot.writeFieldBegin('totalAmount', TType.I64, 2)
      oprot.writeI64(self.totalAmount)
      oprot.writeFieldEnd()
    if self.userId is not None:
      oprot.writeFieldBegin('userId', TType.I64, 3)
      oprot.writeI64(self.userId)
      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 applyRechargeCoupon_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.MAP, 'success', (TType.I64,None,TType.STRING,None), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.MAP:
          self.success = {}
          (_ktype45, _vtype46, _size44 ) = iprot.readMapBegin() 
          for _i48 in xrange(_size44):
            _key49 = iprot.readI64();
            _val50 = iprot.readString();
            self.success[_key49] = _val50
          iprot.readMapEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('applyRechargeCoupon_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.MAP, 0)
      oprot.writeMapBegin(TType.I64, TType.STRING, len(self.success))
      for kiter51,viter52 in self.success.items():
        oprot.writeI64(kiter51)
        oprot.writeString(viter52)
      oprot.writeMapEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 trackCouponUsage_args:
  """
  Attributes:
   - couponCode
   - transactionId
   - userId
   - amount
   - isDigital
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
    (2, TType.I64, 'transactionId', None, None, ), # 2
    (3, TType.I64, 'userId', None, None, ), # 3
    (4, TType.I64, 'amount', None, None, ), # 4
    (5, TType.BOOL, 'isDigital', None, None, ), # 5
  )

  def __init__(self, couponCode=None, transactionId=None, userId=None, amount=None, isDigital=None,):
    self.couponCode = couponCode
    self.transactionId = transactionId
    self.userId = userId
    self.amount = amount
    self.isDigital = isDigital

  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.couponCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.transactionId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I64:
          self.userId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.amount = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.isDigital = iprot.readBool();
        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('trackCouponUsage_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      oprot.writeFieldEnd()
    if self.transactionId is not None:
      oprot.writeFieldBegin('transactionId', TType.I64, 2)
      oprot.writeI64(self.transactionId)
      oprot.writeFieldEnd()
    if self.userId is not None:
      oprot.writeFieldBegin('userId', TType.I64, 3)
      oprot.writeI64(self.userId)
      oprot.writeFieldEnd()
    if self.amount is not None:
      oprot.writeFieldBegin('amount', TType.I64, 4)
      oprot.writeI64(self.amount)
      oprot.writeFieldEnd()
    if self.isDigital is not None:
      oprot.writeFieldBegin('isDigital', TType.BOOL, 5)
      oprot.writeBool(self.isDigital)
      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 trackCouponUsage_result:
  """
  Attributes:
   - pex
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.pex = PromotionException()
          self.pex.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('trackCouponUsage_result')
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getCouponUsageCountByUser_args:
  """
  Attributes:
   - couponCode
   - userId
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
    (2, TType.I64, 'userId', None, None, ), # 2
  )

  def __init__(self, couponCode=None, userId=None,):
    self.couponCode = couponCode
    self.userId = userId

  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.couponCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.userId = 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('getCouponUsageCountByUser_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      oprot.writeFieldEnd()
    if self.userId is not None:
      oprot.writeFieldBegin('userId', TType.I64, 2)
      oprot.writeI64(self.userId)
      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 getCouponUsageCountByUser_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.I64, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.pex = PromotionException()
          self.pex.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('getCouponUsageCountByUser_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.I64, 0)
      oprot.writeI64(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getActiveCodes_args:
  """
  Attributes:
   - promotionId
  """

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

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

  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.promotionId = 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('getActiveCodes_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      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 getActiveCodes_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Coupon, Coupon.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = []
          (_etype56, _size53) = iprot.readListBegin()
          for _i57 in xrange(_size53):
            _elem58 = Coupon()
            _elem58.read(iprot)
            self.success.append(_elem58)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getActiveCodes_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter59 in self.success:
        iter59.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 deleteCoupon_args:
  """
  Attributes:
   - couponCode
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
  )

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

  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.couponCode = 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('deleteCoupon_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      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 deleteCoupon_result:
  """
  Attributes:
   - pex
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.pex = PromotionException()
          self.pex.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('deleteCoupon_result')
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getAllCouponsByPromotionId_args:
  """
  Attributes:
   - promotionId
  """

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

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

  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.promotionId = 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('getAllCouponsByPromotionId_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      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 getAllCouponsByPromotionId_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Coupon, Coupon.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = []
          (_etype63, _size60) = iprot.readListBegin()
          for _i64 in xrange(_size60):
            _elem65 = Coupon()
            _elem65.read(iprot)
            self.success.append(_elem65)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getAllCouponsByPromotionId_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter66 in self.success:
        iter66.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getActiveCoupons_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('getActiveCoupons_args')
    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 getActiveCoupons_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(Coupon, Coupon.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = []
          (_etype70, _size67) = iprot.readListBegin()
          for _i71 in xrange(_size67):
            _elem72 = Coupon()
            _elem72.read(iprot)
            self.success.append(_elem72)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getActiveCoupons_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter73 in self.success:
        iter73.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 createCoupon_args:
  """
  Attributes:
   - promotionId
   - couponCategory
   - couponCode
   - arguments
   - isCod
   - prefix
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'promotionId', None, None, ), # 1
    (2, TType.I64, 'couponCategory', None, None, ), # 2
    (3, TType.STRING, 'couponCode', None, None, ), # 3
    (4, TType.STRING, 'arguments', None, None, ), # 4
    (5, TType.BOOL, 'isCod', None, None, ), # 5
    (6, TType.STRING, 'prefix', None, None, ), # 6
  )

  def __init__(self, promotionId=None, couponCategory=None, couponCode=None, arguments=None, isCod=None, prefix=None,):
    self.promotionId = promotionId
    self.couponCategory = couponCategory
    self.couponCode = couponCode
    self.arguments = arguments
    self.isCod = isCod
    self.prefix = prefix

  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.promotionId = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.couponCategory = iprot.readI64();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.STRING:
          self.couponCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.STRING:
          self.arguments = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 5:
        if ftype == TType.BOOL:
          self.isCod = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 6:
        if ftype == TType.STRING:
          self.prefix = 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('createCoupon_args')
    if self.promotionId is not None:
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
      oprot.writeI64(self.promotionId)
      oprot.writeFieldEnd()
    if self.couponCategory is not None:
      oprot.writeFieldBegin('couponCategory', TType.I64, 2)
      oprot.writeI64(self.couponCategory)
      oprot.writeFieldEnd()
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 3)
      oprot.writeString(self.couponCode)
      oprot.writeFieldEnd()
    if self.arguments is not None:
      oprot.writeFieldBegin('arguments', TType.STRING, 4)
      oprot.writeString(self.arguments)
      oprot.writeFieldEnd()
    if self.isCod is not None:
      oprot.writeFieldBegin('isCod', TType.BOOL, 5)
      oprot.writeBool(self.isCod)
      oprot.writeFieldEnd()
    if self.prefix is not None:
      oprot.writeFieldBegin('prefix', TType.STRING, 6)
      oprot.writeString(self.prefix)
      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 createCoupon_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.STRING, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.STRING:
          self.success = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('createCoupon_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRING, 0)
      oprot.writeString(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getSuccessfulPaymentCountForCoupon_args:
  """
  Attributes:
   - couponCode
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'couponCode', None, None, ), # 1
  )

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

  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.couponCode = 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('getSuccessfulPaymentCountForCoupon_args')
    if self.couponCode is not None:
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
      oprot.writeString(self.couponCode)
      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 getSuccessfulPaymentCountForCoupon_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.I64, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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.pex = PromotionException()
          self.pex.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('getSuccessfulPaymentCountForCoupon_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.I64, 0)
      oprot.writeI64(self.success)
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getRuleDocString_args:
  """
  Attributes:
   - ruleName
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'ruleName', None, None, ), # 1
  )

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

  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.ruleName = 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('getRuleDocString_args')
    if self.ruleName is not None:
      oprot.writeFieldBegin('ruleName', TType.STRING, 1)
      oprot.writeString(self.ruleName)
      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 getRuleDocString_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.STRING, 'success', 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.STRING:
          self.success = 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('getRuleDocString_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRING, 0)
      oprot.writeString(self.success)
      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 getItemDiscountMap_args:
  """
  Attributes:
   - itemIds
  """

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

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

  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.LIST:
          self.itemIds = []
          (_etype77, _size74) = iprot.readListBegin()
          for _i78 in xrange(_size74):
            _elem79 = iprot.readI64();
            self.itemIds.append(_elem79)
          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('getItemDiscountMap_args')
    if self.itemIds is not None:
      oprot.writeFieldBegin('itemIds', TType.LIST, 1)
      oprot.writeListBegin(TType.I64, len(self.itemIds))
      for iter80 in self.itemIds:
        oprot.writeI64(iter80)
      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 getItemDiscountMap_result:
  """
  Attributes:
   - success
   - pex
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.STRUCT,(ItemCouponDiscount, ItemCouponDiscount.thrift_spec)), None, ), # 0
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
  )

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

  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 = []
          (_etype84, _size81) = iprot.readListBegin()
          for _i85 in xrange(_size81):
            _elem86 = ItemCouponDiscount()
            _elem86.read(iprot)
            self.success.append(_elem86)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.pex = PromotionException()
          self.pex.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('getItemDiscountMap_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.STRUCT, len(self.success))
      for iter87 in self.success:
        iter87.write(oprot)
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.pex is not None:
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
      self.pex.write(oprot)
      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 getDiscountsForEntity_args:
  """
  Attributes:
   - entityId
  """

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

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

  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.entityId = 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('getDiscountsForEntity_args')
    if self.entityId is not None:
      oprot.writeFieldBegin('entityId', TType.I64, 1)
      oprot.writeI64(self.entityId)
      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 getDiscountsForEntity_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.MAP, 'success', (TType.STRING,None,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.MAP:
          self.success = {}
          (_ktype89, _vtype90, _size88 ) = iprot.readMapBegin() 
          for _i92 in xrange(_size88):
            _key93 = iprot.readString();
            _val94 = iprot.readDouble();
            self.success[_key93] = _val94
          iprot.readMapEnd()
        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('getDiscountsForEntity_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.MAP, 0)
      oprot.writeMapBegin(TType.STRING, TType.DOUBLE, len(self.success))
      for kiter95,viter96 in self.success.items():
        oprot.writeString(kiter95)
        oprot.writeDouble(viter96)
      oprot.writeMapEnd()
      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 addVoucher_args:
  """
  Attributes:
   - voucher
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRUCT, 'voucher', (Voucher, Voucher.thrift_spec), None, ), # 1
  )

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

  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.STRUCT:
          self.voucher = Voucher()
          self.voucher.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('addVoucher_args')
    if self.voucher is not None:
      oprot.writeFieldBegin('voucher', TType.STRUCT, 1)
      self.voucher.write(oprot)
      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 addVoucher_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('addVoucher_result')
    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 assignVoucher_args:
  """
  Attributes:
   - userId
   - userEmail
   - voucherType
   - amount
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'userId', None, None, ), # 1
    (2, TType.STRING, 'userEmail', None, None, ), # 2
    (3, TType.I32, 'voucherType', None, None, ), # 3
    (4, TType.I64, 'amount', None, None, ), # 4
  )

  def __init__(self, userId=None, userEmail=None, voucherType=None, amount=None,):
    self.userId = userId
    self.userEmail = userEmail
    self.voucherType = voucherType
    self.amount = amount

  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.STRING:
          self.userEmail = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I32:
          self.voucherType = iprot.readI32();
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I64:
          self.amount = 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('assignVoucher_args')
    if self.userId is not None:
      oprot.writeFieldBegin('userId', TType.I64, 1)
      oprot.writeI64(self.userId)
      oprot.writeFieldEnd()
    if self.userEmail is not None:
      oprot.writeFieldBegin('userEmail', TType.STRING, 2)
      oprot.writeString(self.userEmail)
      oprot.writeFieldEnd()
    if self.voucherType is not None:
      oprot.writeFieldBegin('voucherType', TType.I32, 3)
      oprot.writeI32(self.voucherType)
      oprot.writeFieldEnd()
    if self.amount is not None:
      oprot.writeFieldBegin('amount', TType.I64, 4)
      oprot.writeI64(self.amount)
      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 assignVoucher_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.STRUCT, 'success', (Voucher, Voucher.thrift_spec), 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.STRUCT:
          self.success = Voucher()
          self.success.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('assignVoucher_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
      self.success.write(oprot)
      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 markVoucherAsRedeemed_args:
  """
  Attributes:
   - voucherCode
   - redeemedOn
  """

  thrift_spec = (
    None, # 0
    (1, TType.STRING, 'voucherCode', None, None, ), # 1
    (2, TType.I64, 'redeemedOn', None, None, ), # 2
  )

  def __init__(self, voucherCode=None, redeemedOn=None,):
    self.voucherCode = voucherCode
    self.redeemedOn = redeemedOn

  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.voucherCode = iprot.readString();
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.I64:
          self.redeemedOn = 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('markVoucherAsRedeemed_args')
    if self.voucherCode is not None:
      oprot.writeFieldBegin('voucherCode', TType.STRING, 1)
      oprot.writeString(self.voucherCode)
      oprot.writeFieldEnd()
    if self.redeemedOn is not None:
      oprot.writeFieldBegin('redeemedOn', TType.I64, 2)
      oprot.writeI64(self.redeemedOn)
      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 markVoucherAsRedeemed_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', 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.BOOL:
          self.success = iprot.readBool();
        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('markVoucherAsRedeemed_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      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)