Subversion Repositories SmartDukaan

Rev

Rev 3554 | Rev 4494 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3554 Rev 4189
Line 95... Line 95...
95
    Parameters:
95
    Parameters:
96
     - ruleName
96
     - ruleName
97
    """
97
    """
98
    pass
98
    pass
99
 
99
 
-
 
100
  def getItemDiscountMap(self, itemIds):
-
 
101
    """
-
 
102
    Parameters:
-
 
103
     - itemIds
-
 
104
    """
-
 
105
    pass
-
 
106
 
100
 
107
 
101
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
108
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
102
  """
109
  """
103
  Promotion Service
110
  Promotion Service
104
  """
111
  """
Line 428... Line 435...
428
    self._iprot.readMessageEnd()
435
    self._iprot.readMessageEnd()
429
    if result.success is not None:
436
    if result.success is not None:
430
      return result.success
437
      return result.success
431
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getRuleDocString failed: unknown result");
438
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getRuleDocString failed: unknown result");
432
 
439
 
-
 
440
  def getItemDiscountMap(self, itemIds):
-
 
441
    """
-
 
442
    Parameters:
-
 
443
     - itemIds
-
 
444
    """
-
 
445
    self.send_getItemDiscountMap(itemIds)
-
 
446
    return self.recv_getItemDiscountMap()
-
 
447
 
-
 
448
  def send_getItemDiscountMap(self, itemIds):
-
 
449
    self._oprot.writeMessageBegin('getItemDiscountMap', TMessageType.CALL, self._seqid)
-
 
450
    args = getItemDiscountMap_args()
-
 
451
    args.itemIds = itemIds
-
 
452
    args.write(self._oprot)
-
 
453
    self._oprot.writeMessageEnd()
-
 
454
    self._oprot.trans.flush()
-
 
455
 
-
 
456
  def recv_getItemDiscountMap(self, ):
-
 
457
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
458
    if mtype == TMessageType.EXCEPTION:
-
 
459
      x = TApplicationException()
-
 
460
      x.read(self._iprot)
-
 
461
      self._iprot.readMessageEnd()
-
 
462
      raise x
-
 
463
    result = getItemDiscountMap_result()
-
 
464
    result.read(self._iprot)
-
 
465
    self._iprot.readMessageEnd()
-
 
466
    if result.success is not None:
-
 
467
      return result.success
-
 
468
    if result.pex is not None:
-
 
469
      raise result.pex
-
 
470
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getItemDiscountMap failed: unknown result");
-
 
471
 
433
 
472
 
434
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
473
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
435
  def __init__(self, handler):
474
  def __init__(self, handler):
436
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
475
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
437
    self._processMap["createPromotion"] = Processor.process_createPromotion
476
    self._processMap["createPromotion"] = Processor.process_createPromotion
Line 442... Line 481...
442
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
481
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
443
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
482
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
444
    self._processMap["getActiveCoupons"] = Processor.process_getActiveCoupons
483
    self._processMap["getActiveCoupons"] = Processor.process_getActiveCoupons
445
    self._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCoupon
484
    self._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCoupon
446
    self._processMap["getRuleDocString"] = Processor.process_getRuleDocString
485
    self._processMap["getRuleDocString"] = Processor.process_getRuleDocString
-
 
486
    self._processMap["getItemDiscountMap"] = Processor.process_getItemDiscountMap
447
 
487
 
448
  def process(self, iprot, oprot):
488
  def process(self, iprot, oprot):
449
    (name, type, seqid) = iprot.readMessageBegin()
489
    (name, type, seqid) = iprot.readMessageBegin()
450
    if name not in self._processMap:
490
    if name not in self._processMap:
451
      iprot.skip(TType.STRUCT)
491
      iprot.skip(TType.STRUCT)
Line 595... Line 635...
595
    oprot.writeMessageBegin("getRuleDocString", TMessageType.REPLY, seqid)
635
    oprot.writeMessageBegin("getRuleDocString", TMessageType.REPLY, seqid)
596
    result.write(oprot)
636
    result.write(oprot)
597
    oprot.writeMessageEnd()
637
    oprot.writeMessageEnd()
598
    oprot.trans.flush()
638
    oprot.trans.flush()
599
 
639
 
-
 
640
  def process_getItemDiscountMap(self, seqid, iprot, oprot):
-
 
641
    args = getItemDiscountMap_args()
-
 
642
    args.read(iprot)
-
 
643
    iprot.readMessageEnd()
-
 
644
    result = getItemDiscountMap_result()
-
 
645
    try:
-
 
646
      result.success = self._handler.getItemDiscountMap(args.itemIds)
-
 
647
    except PromotionException, pex:
-
 
648
      result.pex = pex
-
 
649
    oprot.writeMessageBegin("getItemDiscountMap", TMessageType.REPLY, seqid)
-
 
650
    result.write(oprot)
-
 
651
    oprot.writeMessageEnd()
-
 
652
    oprot.trans.flush()
-
 
653
 
600
 
654
 
601
# HELPER FUNCTIONS AND STRUCTURES
655
# HELPER FUNCTIONS AND STRUCTURES
602
 
656
 
603
class createPromotion_args:
657
class createPromotion_args:
604
  """
658
  """
Line 1938... Line 1992...
1938
      oprot.writeFieldEnd()
1992
      oprot.writeFieldEnd()
1939
    oprot.writeFieldStop()
1993
    oprot.writeFieldStop()
1940
    oprot.writeStructEnd()
1994
    oprot.writeStructEnd()
1941
 
1995
 
1942
  def validate(self):
1996
  def validate(self):
-
 
1997
    return
-
 
1998
 
-
 
1999
 
-
 
2000
  def __repr__(self):
-
 
2001
    L = ['%s=%r' % (key, value)
-
 
2002
      for key, value in self.__dict__.iteritems()]
-
 
2003
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2004
 
-
 
2005
  def __eq__(self, other):
-
 
2006
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2007
 
-
 
2008
  def __ne__(self, other):
-
 
2009
    return not (self == other)
-
 
2010
 
-
 
2011
class getItemDiscountMap_args:
-
 
2012
  """
-
 
2013
  Attributes:
-
 
2014
   - itemIds
-
 
2015
  """
-
 
2016
 
-
 
2017
  thrift_spec = (
-
 
2018
    None, # 0
-
 
2019
    (1, TType.LIST, 'itemIds', (TType.I64,None), None, ), # 1
-
 
2020
  )
-
 
2021
 
-
 
2022
  def __init__(self, itemIds=None,):
-
 
2023
    self.itemIds = itemIds
-
 
2024
 
-
 
2025
  def read(self, iprot):
-
 
2026
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2027
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2028
      return
-
 
2029
    iprot.readStructBegin()
-
 
2030
    while True:
-
 
2031
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2032
      if ftype == TType.STOP:
-
 
2033
        break
-
 
2034
      if fid == 1:
-
 
2035
        if ftype == TType.LIST:
-
 
2036
          self.itemIds = []
-
 
2037
          (_etype45, _size42) = iprot.readListBegin()
-
 
2038
          for _i46 in xrange(_size42):
-
 
2039
            _elem47 = iprot.readI64();
-
 
2040
            self.itemIds.append(_elem47)
-
 
2041
          iprot.readListEnd()
-
 
2042
        else:
-
 
2043
          iprot.skip(ftype)
-
 
2044
      else:
-
 
2045
        iprot.skip(ftype)
-
 
2046
      iprot.readFieldEnd()
-
 
2047
    iprot.readStructEnd()
-
 
2048
 
-
 
2049
  def write(self, oprot):
-
 
2050
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2051
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2052
      return
-
 
2053
    oprot.writeStructBegin('getItemDiscountMap_args')
-
 
2054
    if self.itemIds is not None:
-
 
2055
      oprot.writeFieldBegin('itemIds', TType.LIST, 1)
-
 
2056
      oprot.writeListBegin(TType.I64, len(self.itemIds))
-
 
2057
      for iter48 in self.itemIds:
-
 
2058
        oprot.writeI64(iter48)
-
 
2059
      oprot.writeListEnd()
-
 
2060
      oprot.writeFieldEnd()
-
 
2061
    oprot.writeFieldStop()
-
 
2062
    oprot.writeStructEnd()
-
 
2063
 
-
 
2064
  def validate(self):
-
 
2065
    return
-
 
2066
 
-
 
2067
 
-
 
2068
  def __repr__(self):
-
 
2069
    L = ['%s=%r' % (key, value)
-
 
2070
      for key, value in self.__dict__.iteritems()]
-
 
2071
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2072
 
-
 
2073
  def __eq__(self, other):
-
 
2074
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2075
 
-
 
2076
  def __ne__(self, other):
-
 
2077
    return not (self == other)
-
 
2078
 
-
 
2079
class getItemDiscountMap_result:
-
 
2080
  """
-
 
2081
  Attributes:
-
 
2082
   - success
-
 
2083
   - pex
-
 
2084
  """
-
 
2085
 
-
 
2086
  thrift_spec = (
-
 
2087
    (0, TType.LIST, 'success', (TType.STRUCT,(ItemCouponDiscount, ItemCouponDiscount.thrift_spec)), None, ), # 0
-
 
2088
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
-
 
2089
  )
-
 
2090
 
-
 
2091
  def __init__(self, success=None, pex=None,):
-
 
2092
    self.success = success
-
 
2093
    self.pex = pex
-
 
2094
 
-
 
2095
  def read(self, iprot):
-
 
2096
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2097
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2098
      return
-
 
2099
    iprot.readStructBegin()
-
 
2100
    while True:
-
 
2101
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2102
      if ftype == TType.STOP:
-
 
2103
        break
-
 
2104
      if fid == 0:
-
 
2105
        if ftype == TType.LIST:
-
 
2106
          self.success = []
-
 
2107
          (_etype52, _size49) = iprot.readListBegin()
-
 
2108
          for _i53 in xrange(_size49):
-
 
2109
            _elem54 = ItemCouponDiscount()
-
 
2110
            _elem54.read(iprot)
-
 
2111
            self.success.append(_elem54)
-
 
2112
          iprot.readListEnd()
-
 
2113
        else:
-
 
2114
          iprot.skip(ftype)
-
 
2115
      elif fid == 1:
-
 
2116
        if ftype == TType.STRUCT:
-
 
2117
          self.pex = PromotionException()
-
 
2118
          self.pex.read(iprot)
-
 
2119
        else:
-
 
2120
          iprot.skip(ftype)
-
 
2121
      else:
-
 
2122
        iprot.skip(ftype)
-
 
2123
      iprot.readFieldEnd()
-
 
2124
    iprot.readStructEnd()
-
 
2125
 
-
 
2126
  def write(self, oprot):
-
 
2127
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2128
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2129
      return
-
 
2130
    oprot.writeStructBegin('getItemDiscountMap_result')
-
 
2131
    if self.success is not None:
-
 
2132
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
2133
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
2134
      for iter55 in self.success:
-
 
2135
        iter55.write(oprot)
-
 
2136
      oprot.writeListEnd()
-
 
2137
      oprot.writeFieldEnd()
-
 
2138
    if self.pex is not None:
-
 
2139
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
-
 
2140
      self.pex.write(oprot)
-
 
2141
      oprot.writeFieldEnd()
-
 
2142
    oprot.writeFieldStop()
-
 
2143
    oprot.writeStructEnd()
-
 
2144
 
-
 
2145
  def validate(self):
1943
    return
2146
    return
1944
 
2147
 
1945
 
2148
 
1946
  def __repr__(self):
2149
  def __repr__(self):
1947
    L = ['%s=%r' % (key, value)
2150
    L = ['%s=%r' % (key, value)