Subversion Repositories SmartDukaan

Rev

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

Rev 6250 Rev 6301
Line 28... Line 28...
28
     - startOn
28
     - startOn
29
     - endOn
29
     - endOn
30
    """
30
    """
31
    pass
31
    pass
32
 
32
 
-
 
33
  def getCoupon(self, couponCode):
-
 
34
    """
-
 
35
    Parameters:
-
 
36
     - couponCode
-
 
37
    """
-
 
38
    pass
-
 
39
 
-
 
40
  def isGiftVoucher(self, couponCode):
-
 
41
    """
-
 
42
    Parameters:
-
 
43
     - couponCode
-
 
44
    """
-
 
45
    pass
-
 
46
 
33
  def getAllPromotions(self, ):
47
  def getAllPromotions(self, ):
34
    pass
48
    pass
35
 
49
 
36
  def getPromotionById(self, promotionId):
50
  def getPromotionById(self, promotionId):
37
    """
51
    """
Line 191... Line 205...
191
    self._iprot.readMessageEnd()
205
    self._iprot.readMessageEnd()
192
    if result.pex is not None:
206
    if result.pex is not None:
193
      raise result.pex
207
      raise result.pex
194
    return
208
    return
195
 
209
 
-
 
210
  def getCoupon(self, couponCode):
-
 
211
    """
-
 
212
    Parameters:
-
 
213
     - couponCode
-
 
214
    """
-
 
215
    self.send_getCoupon(couponCode)
-
 
216
    return self.recv_getCoupon()
-
 
217
 
-
 
218
  def send_getCoupon(self, couponCode):
-
 
219
    self._oprot.writeMessageBegin('getCoupon', TMessageType.CALL, self._seqid)
-
 
220
    args = getCoupon_args()
-
 
221
    args.couponCode = couponCode
-
 
222
    args.write(self._oprot)
-
 
223
    self._oprot.writeMessageEnd()
-
 
224
    self._oprot.trans.flush()
-
 
225
 
-
 
226
  def recv_getCoupon(self, ):
-
 
227
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
228
    if mtype == TMessageType.EXCEPTION:
-
 
229
      x = TApplicationException()
-
 
230
      x.read(self._iprot)
-
 
231
      self._iprot.readMessageEnd()
-
 
232
      raise x
-
 
233
    result = getCoupon_result()
-
 
234
    result.read(self._iprot)
-
 
235
    self._iprot.readMessageEnd()
-
 
236
    if result.success is not None:
-
 
237
      return result.success
-
 
238
    if result.pex is not None:
-
 
239
      raise result.pex
-
 
240
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getCoupon failed: unknown result");
-
 
241
 
-
 
242
  def isGiftVoucher(self, couponCode):
-
 
243
    """
-
 
244
    Parameters:
-
 
245
     - couponCode
-
 
246
    """
-
 
247
    self.send_isGiftVoucher(couponCode)
-
 
248
    return self.recv_isGiftVoucher()
-
 
249
 
-
 
250
  def send_isGiftVoucher(self, couponCode):
-
 
251
    self._oprot.writeMessageBegin('isGiftVoucher', TMessageType.CALL, self._seqid)
-
 
252
    args = isGiftVoucher_args()
-
 
253
    args.couponCode = couponCode
-
 
254
    args.write(self._oprot)
-
 
255
    self._oprot.writeMessageEnd()
-
 
256
    self._oprot.trans.flush()
-
 
257
 
-
 
258
  def recv_isGiftVoucher(self, ):
-
 
259
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
260
    if mtype == TMessageType.EXCEPTION:
-
 
261
      x = TApplicationException()
-
 
262
      x.read(self._iprot)
-
 
263
      self._iprot.readMessageEnd()
-
 
264
      raise x
-
 
265
    result = isGiftVoucher_result()
-
 
266
    result.read(self._iprot)
-
 
267
    self._iprot.readMessageEnd()
-
 
268
    if result.success is not None:
-
 
269
      return result.success
-
 
270
    if result.pex is not None:
-
 
271
      raise result.pex
-
 
272
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
-
 
273
 
196
  def getAllPromotions(self, ):
274
  def getAllPromotions(self, ):
197
    self.send_getAllPromotions()
275
    self.send_getAllPromotions()
198
    return self.recv_getAllPromotions()
276
    return self.recv_getAllPromotions()
199
 
277
 
200
  def send_getAllPromotions(self, ):
278
  def send_getAllPromotions(self, ):
Line 685... Line 763...
685
 
763
 
686
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
764
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
687
  def __init__(self, handler):
765
  def __init__(self, handler):
688
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
766
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
689
    self._processMap["createPromotion"] = Processor.process_createPromotion
767
    self._processMap["createPromotion"] = Processor.process_createPromotion
-
 
768
    self._processMap["getCoupon"] = Processor.process_getCoupon
-
 
769
    self._processMap["isGiftVoucher"] = Processor.process_isGiftVoucher
690
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
770
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
691
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
771
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
692
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
772
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
693
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
773
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
694
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
774
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
Line 730... Line 810...
730
    oprot.writeMessageBegin("createPromotion", TMessageType.REPLY, seqid)
810
    oprot.writeMessageBegin("createPromotion", TMessageType.REPLY, seqid)
731
    result.write(oprot)
811
    result.write(oprot)
732
    oprot.writeMessageEnd()
812
    oprot.writeMessageEnd()
733
    oprot.trans.flush()
813
    oprot.trans.flush()
734
 
814
 
-
 
815
  def process_getCoupon(self, seqid, iprot, oprot):
-
 
816
    args = getCoupon_args()
-
 
817
    args.read(iprot)
-
 
818
    iprot.readMessageEnd()
-
 
819
    result = getCoupon_result()
-
 
820
    try:
-
 
821
      result.success = self._handler.getCoupon(args.couponCode)
-
 
822
    except PromotionException, pex:
-
 
823
      result.pex = pex
-
 
824
    oprot.writeMessageBegin("getCoupon", TMessageType.REPLY, seqid)
-
 
825
    result.write(oprot)
-
 
826
    oprot.writeMessageEnd()
-
 
827
    oprot.trans.flush()
-
 
828
 
-
 
829
  def process_isGiftVoucher(self, seqid, iprot, oprot):
-
 
830
    args = isGiftVoucher_args()
-
 
831
    args.read(iprot)
-
 
832
    iprot.readMessageEnd()
-
 
833
    result = isGiftVoucher_result()
-
 
834
    try:
-
 
835
      result.success = self._handler.isGiftVoucher(args.couponCode)
-
 
836
    except PromotionException, pex:
-
 
837
      result.pex = pex
-
 
838
    oprot.writeMessageBegin("isGiftVoucher", TMessageType.REPLY, seqid)
-
 
839
    result.write(oprot)
-
 
840
    oprot.writeMessageEnd()
-
 
841
    oprot.trans.flush()
-
 
842
 
735
  def process_getAllPromotions(self, seqid, iprot, oprot):
843
  def process_getAllPromotions(self, seqid, iprot, oprot):
736
    args = getAllPromotions_args()
844
    args = getAllPromotions_args()
737
    args.read(iprot)
845
    args.read(iprot)
738
    iprot.readMessageEnd()
846
    iprot.readMessageEnd()
739
    result = getAllPromotions_result()
847
    result = getAllPromotions_result()
Line 1068... Line 1176...
1068
    if self.pex is not None:
1176
    if self.pex is not None:
1069
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1177
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1070
      self.pex.write(oprot)
1178
      self.pex.write(oprot)
1071
      oprot.writeFieldEnd()
1179
      oprot.writeFieldEnd()
1072
    oprot.writeFieldStop()
1180
    oprot.writeFieldStop()
-
 
1181
    oprot.writeStructEnd()
-
 
1182
 
-
 
1183
  def validate(self):
-
 
1184
    return
-
 
1185
 
-
 
1186
 
-
 
1187
  def __repr__(self):
-
 
1188
    L = ['%s=%r' % (key, value)
-
 
1189
      for key, value in self.__dict__.iteritems()]
-
 
1190
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1191
 
-
 
1192
  def __eq__(self, other):
-
 
1193
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1194
 
-
 
1195
  def __ne__(self, other):
-
 
1196
    return not (self == other)
-
 
1197
 
-
 
1198
class getCoupon_args:
-
 
1199
  """
-
 
1200
  Attributes:
-
 
1201
   - couponCode
-
 
1202
  """
-
 
1203
 
-
 
1204
  thrift_spec = (
-
 
1205
    None, # 0
-
 
1206
    (1, TType.STRING, 'couponCode', None, None, ), # 1
-
 
1207
  )
-
 
1208
 
-
 
1209
  def __init__(self, couponCode=None,):
-
 
1210
    self.couponCode = couponCode
-
 
1211
 
-
 
1212
  def read(self, iprot):
-
 
1213
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1214
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1215
      return
-
 
1216
    iprot.readStructBegin()
-
 
1217
    while True:
-
 
1218
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1219
      if ftype == TType.STOP:
-
 
1220
        break
-
 
1221
      if fid == 1:
-
 
1222
        if ftype == TType.STRING:
-
 
1223
          self.couponCode = iprot.readString();
-
 
1224
        else:
-
 
1225
          iprot.skip(ftype)
-
 
1226
      else:
-
 
1227
        iprot.skip(ftype)
-
 
1228
      iprot.readFieldEnd()
-
 
1229
    iprot.readStructEnd()
-
 
1230
 
-
 
1231
  def write(self, oprot):
-
 
1232
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1233
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1234
      return
-
 
1235
    oprot.writeStructBegin('getCoupon_args')
-
 
1236
    if self.couponCode is not None:
-
 
1237
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
-
 
1238
      oprot.writeString(self.couponCode)
-
 
1239
      oprot.writeFieldEnd()
-
 
1240
    oprot.writeFieldStop()
-
 
1241
    oprot.writeStructEnd()
-
 
1242
 
-
 
1243
  def validate(self):
-
 
1244
    return
-
 
1245
 
-
 
1246
 
-
 
1247
  def __repr__(self):
-
 
1248
    L = ['%s=%r' % (key, value)
-
 
1249
      for key, value in self.__dict__.iteritems()]
-
 
1250
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1251
 
-
 
1252
  def __eq__(self, other):
-
 
1253
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1254
 
-
 
1255
  def __ne__(self, other):
-
 
1256
    return not (self == other)
-
 
1257
 
-
 
1258
class getCoupon_result:
-
 
1259
  """
-
 
1260
  Attributes:
-
 
1261
   - success
-
 
1262
   - pex
-
 
1263
  """
-
 
1264
 
-
 
1265
  thrift_spec = (
-
 
1266
    (0, TType.STRUCT, 'success', (Coupon, Coupon.thrift_spec), None, ), # 0
-
 
1267
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
-
 
1268
  )
-
 
1269
 
-
 
1270
  def __init__(self, success=None, pex=None,):
-
 
1271
    self.success = success
-
 
1272
    self.pex = pex
-
 
1273
 
-
 
1274
  def read(self, iprot):
-
 
1275
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1276
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1277
      return
-
 
1278
    iprot.readStructBegin()
-
 
1279
    while True:
-
 
1280
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1281
      if ftype == TType.STOP:
-
 
1282
        break
-
 
1283
      if fid == 0:
-
 
1284
        if ftype == TType.STRUCT:
-
 
1285
          self.success = Coupon()
-
 
1286
          self.success.read(iprot)
-
 
1287
        else:
-
 
1288
          iprot.skip(ftype)
-
 
1289
      elif fid == 1:
-
 
1290
        if ftype == TType.STRUCT:
-
 
1291
          self.pex = PromotionException()
-
 
1292
          self.pex.read(iprot)
-
 
1293
        else:
-
 
1294
          iprot.skip(ftype)
-
 
1295
      else:
-
 
1296
        iprot.skip(ftype)
-
 
1297
      iprot.readFieldEnd()
-
 
1298
    iprot.readStructEnd()
-
 
1299
 
-
 
1300
  def write(self, oprot):
-
 
1301
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1302
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1303
      return
-
 
1304
    oprot.writeStructBegin('getCoupon_result')
-
 
1305
    if self.success is not None:
-
 
1306
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
1307
      self.success.write(oprot)
-
 
1308
      oprot.writeFieldEnd()
-
 
1309
    if self.pex is not None:
-
 
1310
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
-
 
1311
      self.pex.write(oprot)
-
 
1312
      oprot.writeFieldEnd()
-
 
1313
    oprot.writeFieldStop()
-
 
1314
    oprot.writeStructEnd()
-
 
1315
 
-
 
1316
  def validate(self):
-
 
1317
    return
-
 
1318
 
-
 
1319
 
-
 
1320
  def __repr__(self):
-
 
1321
    L = ['%s=%r' % (key, value)
-
 
1322
      for key, value in self.__dict__.iteritems()]
-
 
1323
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1324
 
-
 
1325
  def __eq__(self, other):
-
 
1326
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1327
 
-
 
1328
  def __ne__(self, other):
-
 
1329
    return not (self == other)
-
 
1330
 
-
 
1331
class isGiftVoucher_args:
-
 
1332
  """
-
 
1333
  Attributes:
-
 
1334
   - couponCode
-
 
1335
  """
-
 
1336
 
-
 
1337
  thrift_spec = (
-
 
1338
    None, # 0
-
 
1339
    (1, TType.STRING, 'couponCode', None, None, ), # 1
-
 
1340
  )
-
 
1341
 
-
 
1342
  def __init__(self, couponCode=None,):
-
 
1343
    self.couponCode = couponCode
-
 
1344
 
-
 
1345
  def read(self, iprot):
-
 
1346
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1347
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1348
      return
-
 
1349
    iprot.readStructBegin()
-
 
1350
    while True:
-
 
1351
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1352
      if ftype == TType.STOP:
-
 
1353
        break
-
 
1354
      if fid == 1:
-
 
1355
        if ftype == TType.STRING:
-
 
1356
          self.couponCode = iprot.readString();
-
 
1357
        else:
-
 
1358
          iprot.skip(ftype)
-
 
1359
      else:
-
 
1360
        iprot.skip(ftype)
-
 
1361
      iprot.readFieldEnd()
-
 
1362
    iprot.readStructEnd()
-
 
1363
 
-
 
1364
  def write(self, oprot):
-
 
1365
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1366
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1367
      return
-
 
1368
    oprot.writeStructBegin('isGiftVoucher_args')
-
 
1369
    if self.couponCode is not None:
-
 
1370
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
-
 
1371
      oprot.writeString(self.couponCode)
-
 
1372
      oprot.writeFieldEnd()
-
 
1373
    oprot.writeFieldStop()
-
 
1374
    oprot.writeStructEnd()
-
 
1375
 
-
 
1376
  def validate(self):
-
 
1377
    return
-
 
1378
 
-
 
1379
 
-
 
1380
  def __repr__(self):
-
 
1381
    L = ['%s=%r' % (key, value)
-
 
1382
      for key, value in self.__dict__.iteritems()]
-
 
1383
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1384
 
-
 
1385
  def __eq__(self, other):
-
 
1386
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1387
 
-
 
1388
  def __ne__(self, other):
-
 
1389
    return not (self == other)
-
 
1390
 
-
 
1391
class isGiftVoucher_result:
-
 
1392
  """
-
 
1393
  Attributes:
-
 
1394
   - success
-
 
1395
   - pex
-
 
1396
  """
-
 
1397
 
-
 
1398
  thrift_spec = (
-
 
1399
    (0, TType.BOOL, 'success', None, None, ), # 0
-
 
1400
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
-
 
1401
  )
-
 
1402
 
-
 
1403
  def __init__(self, success=None, pex=None,):
-
 
1404
    self.success = success
-
 
1405
    self.pex = pex
-
 
1406
 
-
 
1407
  def read(self, iprot):
-
 
1408
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1409
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1410
      return
-
 
1411
    iprot.readStructBegin()
-
 
1412
    while True:
-
 
1413
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1414
      if ftype == TType.STOP:
-
 
1415
        break
-
 
1416
      if fid == 0:
-
 
1417
        if ftype == TType.BOOL:
-
 
1418
          self.success = iprot.readBool();
-
 
1419
        else:
-
 
1420
          iprot.skip(ftype)
-
 
1421
      elif fid == 1:
-
 
1422
        if ftype == TType.STRUCT:
-
 
1423
          self.pex = PromotionException()
-
 
1424
          self.pex.read(iprot)
-
 
1425
        else:
-
 
1426
          iprot.skip(ftype)
-
 
1427
      else:
-
 
1428
        iprot.skip(ftype)
-
 
1429
      iprot.readFieldEnd()
-
 
1430
    iprot.readStructEnd()
-
 
1431
 
-
 
1432
  def write(self, oprot):
-
 
1433
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1434
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1435
      return
-
 
1436
    oprot.writeStructBegin('isGiftVoucher_result')
-
 
1437
    if self.success is not None:
-
 
1438
      oprot.writeFieldBegin('success', TType.BOOL, 0)
-
 
1439
      oprot.writeBool(self.success)
-
 
1440
      oprot.writeFieldEnd()
-
 
1441
    if self.pex is not None:
-
 
1442
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
-
 
1443
      self.pex.write(oprot)
-
 
1444
      oprot.writeFieldEnd()
-
 
1445
    oprot.writeFieldStop()
1073
    oprot.writeStructEnd()
1446
    oprot.writeStructEnd()
1074
 
1447
 
1075
  def validate(self):
1448
  def validate(self):
1076
    return
1449
    return
1077
 
1450