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.GenericServicefrom ttypes import *from thrift.Thrift import TProcessorfrom thrift.transport import TTransportfrom thrift.protocol import TBinaryProtocol, TProtocoltry:from thrift.protocol import fastbinaryexcept:fastbinary = Noneclass Iface(shop2020.thriftpy.generic.GenericService.Iface):"""Promotion Service"""def createPromotion(self, name, ruleExecutionSrc, startOn, endOn):"""Parameters:- name- ruleExecutionSrc- startOn- endOn"""passdef removeAllCouponsByPromotionId(self, promotionId):"""Parameters:- promotionId"""passdef getCoupon(self, couponCode):"""Parameters:- couponCode"""passdef isGiftVoucher(self, couponCode):"""Parameters:- couponCode"""passdef isCodApplicable(self, cart):"""Parameters:- cart"""passdef getAllPromotions(self, ):passdef getPromotionById(self, promotionId):"""Parameters:- promotionId"""passdef generateCouponsForPromotion(self, promotionId, couponCode):"""Parameters:- promotionId- couponCode"""passdef applyCoupon(self, couponCode, cartId):"""Parameters:- couponCode- cartId"""passdef getEmiDiscount(self, cartId):"""Parameters:- cartId"""passdef applyRechargeCoupon(self, couponCode, totalAmount, userId):"""Parameters:- couponCode- totalAmount- userId"""passdef trackCouponUsage(self, couponCode, transactionId, userId, amount, isDigital):"""Parameters:- couponCode- transactionId- userId- amount- isDigital"""passdef getCouponUsageCountByUser(self, couponCode, userId):"""Parameters:- couponCode- userId"""passdef getActiveCodes(self, promotionId):"""Parameters:- promotionId"""passdef deleteCoupon(self, couponCode):"""Parameters:- couponCode"""passdef getAllCouponsByPromotionId(self, promotionId):"""Parameters:- promotionId"""passdef getActiveCoupons(self, ):"""Returns a list of active coupons"""passdef 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"""passdef getSuccessfulPaymentCountForCoupon(self, couponCode):"""Returns the count of successful payments done using a given couponParameters:- couponCode"""passdef getRuleDocString(self, ruleName):"""Returns the doc string of the rule moduleParameters:- ruleName"""passdef getItemDiscountMap(self, itemIds):"""Parameters:- itemIds"""passdef getDiscountsForEntity(self, entityId):"""Parameters:- entityId"""passdef addVoucher(self, voucher):"""Parameters:- voucher"""passdef assignVoucher(self, userId, userEmail, voucherType, amount):"""Parameters:- userId- userEmail- voucherType- amount"""passdef markVoucherAsRedeemed(self, voucherCode, redeemedOn):"""Parameters:- voucherCode- redeemedOn"""passclass 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 = nameargs.ruleExecutionSrc = ruleExecutionSrcargs.startOn = startOnargs.endOn = endOnargs.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 xresult = createPromotion_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex is not None:raise result.pexreturndef 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 = promotionIdargs.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 xresult = removeAllCouponsByPromotionId_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = couponCodeargs.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 xresult = getCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = couponCodeargs.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 xresult = isGiftVoucher_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = cartargs.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 xresult = isCodApplicable_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 xresult = getAllPromotions_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = promotionIdargs.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 xresult = getPromotionById_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = promotionIdargs.couponCode = couponCodeargs.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 xresult = generateCouponsForPromotion_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex is not None:raise result.pexreturndef 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 = couponCodeargs.cartId = cartIdargs.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 xresult = applyCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = cartIdargs.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 xresult = getEmiDiscount_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = couponCodeargs.totalAmount = totalAmountargs.userId = userIdargs.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 xresult = applyRechargeCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = couponCodeargs.transactionId = transactionIdargs.userId = userIdargs.amount = amountargs.isDigital = isDigitalargs.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 xresult = trackCouponUsage_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex is not None:raise result.pexreturndef 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 = couponCodeargs.userId = userIdargs.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 xresult = getCouponUsageCountByUser_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = promotionIdargs.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 xresult = getActiveCodes_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = couponCodeargs.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 xresult = deleteCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex is not None:raise result.pexreturndef 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 = promotionIdargs.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 xresult = getAllCouponsByPromotionId_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 xresult = getActiveCoupons_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = promotionIdargs.couponCategory = couponCategoryargs.couponCode = couponCodeargs.arguments = argumentsargs.isCod = isCodargs.prefix = prefixargs.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 xresult = createCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "createCoupon failed: unknown result");def getSuccessfulPaymentCountForCoupon(self, couponCode):"""Returns the count of successful payments done using a given couponParameters:- 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 = couponCodeargs.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 xresult = getSuccessfulPaymentCountForCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "getSuccessfulPaymentCountForCoupon failed: unknown result");def getRuleDocString(self, ruleName):"""Returns the doc string of the rule moduleParameters:- 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 = ruleNameargs.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 xresult = getRuleDocString_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successraise 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 = itemIdsargs.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 xresult = getItemDiscountMap_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successif result.pex is not None:raise result.pexraise 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 = entityIdargs.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 xresult = getDiscountsForEntity_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successraise 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 = voucherargs.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 xresult = addVoucher_result()result.read(self._iprot)self._iprot.readMessageEnd()returndef 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 = userIdargs.userEmail = userEmailargs.voucherType = voucherTypeargs.amount = amountargs.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 xresult = assignVoucher_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successraise 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 = voucherCodeargs.redeemedOn = redeemedOnargs.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 xresult = markVoucherAsRedeemed_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success is not None:return result.successraise 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_createPromotionself._processMap["removeAllCouponsByPromotionId"] = Processor.process_removeAllCouponsByPromotionIdself._processMap["getCoupon"] = Processor.process_getCouponself._processMap["isGiftVoucher"] = Processor.process_isGiftVoucherself._processMap["isCodApplicable"] = Processor.process_isCodApplicableself._processMap["getAllPromotions"] = Processor.process_getAllPromotionsself._processMap["getPromotionById"] = Processor.process_getPromotionByIdself._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotionself._processMap["applyCoupon"] = Processor.process_applyCouponself._processMap["getEmiDiscount"] = Processor.process_getEmiDiscountself._processMap["applyRechargeCoupon"] = Processor.process_applyRechargeCouponself._processMap["trackCouponUsage"] = Processor.process_trackCouponUsageself._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUserself._processMap["getActiveCodes"] = Processor.process_getActiveCodesself._processMap["deleteCoupon"] = Processor.process_deleteCouponself._processMap["getAllCouponsByPromotionId"] = Processor.process_getAllCouponsByPromotionIdself._processMap["getActiveCoupons"] = Processor.process_getActiveCouponsself._processMap["createCoupon"] = Processor.process_createCouponself._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCouponself._processMap["getRuleDocString"] = Processor.process_getRuleDocStringself._processMap["getItemDiscountMap"] = Processor.process_getItemDiscountMapself._processMap["getDiscountsForEntity"] = Processor.process_getDiscountsForEntityself._processMap["addVoucher"] = Processor.process_addVoucherself._processMap["assignVoucher"] = Processor.process_assignVoucherself._processMap["markVoucherAsRedeemed"] = Processor.process_markVoucherAsRedeemeddef 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()returnelse:self._processMap[name](self, seqid, iprot, oprot)return Truedef 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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 = pexoprot.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 STRUCTURESclass 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 = nameself.ruleExecutionSrc = ruleExecutionSrcself.startOn = startOnself.endOn = endOndef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = cartdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse: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)))returnoprot.writeStructBegin('getAllPromotions_args')oprot.writeFieldStop()oprot.writeStructEnd()def validate(self):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIdself.couponCode = couponCodedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodeself.cartId = cartIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = cartIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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] = _val41iprot.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)))returnoprot.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):returndef __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 = couponCodeself.totalAmount = totalAmountself.userId = userIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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] = _val50iprot.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)))returnoprot.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):returndef __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 = couponCodeself.transactionId = transactionIdself.userId = userIdself.amount = amountself.isDigital = isDigitaldef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodeself.userId = userIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse: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)))returnoprot.writeStructBegin('getActiveCoupons_args')oprot.writeFieldStop()oprot.writeStructEnd()def validate(self):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = promotionIdself.couponCategory = couponCategoryself.couponCode = couponCodeself.arguments = argumentsself.isCod = isCodself.prefix = prefixdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = couponCodedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = ruleNamedef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = itemIdsdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successself.pex = pexdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = entityIddef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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] = _val94iprot.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)))returnoprot.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):returndef __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 = voucherdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse: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)))returnoprot.writeStructBegin('addVoucher_result')oprot.writeFieldStop()oprot.writeStructEnd()def validate(self):returndef __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 = userIdself.userEmail = userEmailself.voucherType = voucherTypeself.amount = amountdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = voucherCodeself.redeemedOn = redeemedOndef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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 = successdef 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))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif 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)))returnoprot.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):returndef __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)