Subversion Repositories SmartDukaan

Rev

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

Rev 6301 Rev 6356
Line 42... Line 42...
42
    Parameters:
42
    Parameters:
43
     - couponCode
43
     - couponCode
44
    """
44
    """
45
    pass
45
    pass
46
 
46
 
-
 
47
  def isCodApplicable(self, couponCode):
-
 
48
    """
-
 
49
    Parameters:
-
 
50
     - couponCode
-
 
51
    """
-
 
52
    pass
-
 
53
 
47
  def getAllPromotions(self, ):
54
  def getAllPromotions(self, ):
48
    pass
55
    pass
49
 
56
 
50
  def getPromotionById(self, promotionId):
57
  def getPromotionById(self, promotionId):
51
    """
58
    """
Line 91... Line 98...
91
    """
98
    """
92
    Returns a list of active coupons
99
    Returns a list of active coupons
93
    """
100
    """
94
    pass
101
    pass
95
 
102
 
96
  def createCoupon(self, promotionId, endOn, email, amount, usage):
103
  def createCoupon(self, promotionId, endOn, email, amount, isCod, usage):
97
    """
104
    """
98
    Creates a coupon and returns couponcode if successfully created
105
    Creates a coupon and returns couponcode if successfully created
99
 
106
 
100
    Parameters:
107
    Parameters:
101
     - promotionId
108
     - promotionId
102
     - endOn
109
     - endOn
103
     - email
110
     - email
104
     - amount
111
     - amount
-
 
112
     - isCod
105
     - usage
113
     - usage
106
    """
114
    """
107
    pass
115
    pass
108
 
116
 
109
  def getSuccessfulPaymentCountForCoupon(self, couponCode):
117
  def getSuccessfulPaymentCountForCoupon(self, couponCode):
Line 269... Line 277...
269
      return result.success
277
      return result.success
270
    if result.pex is not None:
278
    if result.pex is not None:
271
      raise result.pex
279
      raise result.pex
272
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
280
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isGiftVoucher failed: unknown result");
273
 
281
 
-
 
282
  def isCodApplicable(self, couponCode):
-
 
283
    """
-
 
284
    Parameters:
-
 
285
     - couponCode
-
 
286
    """
-
 
287
    self.send_isCodApplicable(couponCode)
-
 
288
    return self.recv_isCodApplicable()
-
 
289
 
-
 
290
  def send_isCodApplicable(self, couponCode):
-
 
291
    self._oprot.writeMessageBegin('isCodApplicable', TMessageType.CALL, self._seqid)
-
 
292
    args = isCodApplicable_args()
-
 
293
    args.couponCode = couponCode
-
 
294
    args.write(self._oprot)
-
 
295
    self._oprot.writeMessageEnd()
-
 
296
    self._oprot.trans.flush()
-
 
297
 
-
 
298
  def recv_isCodApplicable(self, ):
-
 
299
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
300
    if mtype == TMessageType.EXCEPTION:
-
 
301
      x = TApplicationException()
-
 
302
      x.read(self._iprot)
-
 
303
      self._iprot.readMessageEnd()
-
 
304
      raise x
-
 
305
    result = isCodApplicable_result()
-
 
306
    result.read(self._iprot)
-
 
307
    self._iprot.readMessageEnd()
-
 
308
    if result.success is not None:
-
 
309
      return result.success
-
 
310
    if result.pex is not None:
-
 
311
      raise result.pex
-
 
312
    raise TApplicationException(TApplicationException.MISSING_RESULT, "isCodApplicable failed: unknown result");
-
 
313
 
274
  def getAllPromotions(self, ):
314
  def getAllPromotions(self, ):
275
    self.send_getAllPromotions()
315
    self.send_getAllPromotions()
276
    return self.recv_getAllPromotions()
316
    return self.recv_getAllPromotions()
277
 
317
 
278
  def send_getAllPromotions(self, ):
318
  def send_getAllPromotions(self, ):
Line 492... Line 532...
492
      return result.success
532
      return result.success
493
    if result.pex is not None:
533
    if result.pex is not None:
494
      raise result.pex
534
      raise result.pex
495
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");
535
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getActiveCoupons failed: unknown result");
496
 
536
 
497
  def createCoupon(self, promotionId, endOn, email, amount, usage):
537
  def createCoupon(self, promotionId, endOn, email, amount, isCod, usage):
498
    """
538
    """
499
    Creates a coupon and returns couponcode if successfully created
539
    Creates a coupon and returns couponcode if successfully created
500
 
540
 
501
    Parameters:
541
    Parameters:
502
     - promotionId
542
     - promotionId
503
     - endOn
543
     - endOn
504
     - email
544
     - email
505
     - amount
545
     - amount
-
 
546
     - isCod
506
     - usage
547
     - usage
507
    """
548
    """
508
    self.send_createCoupon(promotionId, endOn, email, amount, usage)
549
    self.send_createCoupon(promotionId, endOn, email, amount, isCod, usage)
509
    return self.recv_createCoupon()
550
    return self.recv_createCoupon()
510
 
551
 
511
  def send_createCoupon(self, promotionId, endOn, email, amount, usage):
552
  def send_createCoupon(self, promotionId, endOn, email, amount, isCod, usage):
512
    self._oprot.writeMessageBegin('createCoupon', TMessageType.CALL, self._seqid)
553
    self._oprot.writeMessageBegin('createCoupon', TMessageType.CALL, self._seqid)
513
    args = createCoupon_args()
554
    args = createCoupon_args()
514
    args.promotionId = promotionId
555
    args.promotionId = promotionId
515
    args.endOn = endOn
556
    args.endOn = endOn
516
    args.email = email
557
    args.email = email
517
    args.amount = amount
558
    args.amount = amount
-
 
559
    args.isCod = isCod
518
    args.usage = usage
560
    args.usage = usage
519
    args.write(self._oprot)
561
    args.write(self._oprot)
520
    self._oprot.writeMessageEnd()
562
    self._oprot.writeMessageEnd()
521
    self._oprot.trans.flush()
563
    self._oprot.trans.flush()
522
 
564
 
Line 765... Line 807...
765
  def __init__(self, handler):
807
  def __init__(self, handler):
766
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
808
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
767
    self._processMap["createPromotion"] = Processor.process_createPromotion
809
    self._processMap["createPromotion"] = Processor.process_createPromotion
768
    self._processMap["getCoupon"] = Processor.process_getCoupon
810
    self._processMap["getCoupon"] = Processor.process_getCoupon
769
    self._processMap["isGiftVoucher"] = Processor.process_isGiftVoucher
811
    self._processMap["isGiftVoucher"] = Processor.process_isGiftVoucher
-
 
812
    self._processMap["isCodApplicable"] = Processor.process_isCodApplicable
770
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
813
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
771
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
814
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
772
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
815
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
773
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
816
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
774
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
817
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
Line 838... Line 881...
838
    oprot.writeMessageBegin("isGiftVoucher", TMessageType.REPLY, seqid)
881
    oprot.writeMessageBegin("isGiftVoucher", TMessageType.REPLY, seqid)
839
    result.write(oprot)
882
    result.write(oprot)
840
    oprot.writeMessageEnd()
883
    oprot.writeMessageEnd()
841
    oprot.trans.flush()
884
    oprot.trans.flush()
842
 
885
 
-
 
886
  def process_isCodApplicable(self, seqid, iprot, oprot):
-
 
887
    args = isCodApplicable_args()
-
 
888
    args.read(iprot)
-
 
889
    iprot.readMessageEnd()
-
 
890
    result = isCodApplicable_result()
-
 
891
    try:
-
 
892
      result.success = self._handler.isCodApplicable(args.couponCode)
-
 
893
    except PromotionException, pex:
-
 
894
      result.pex = pex
-
 
895
    oprot.writeMessageBegin("isCodApplicable", TMessageType.REPLY, seqid)
-
 
896
    result.write(oprot)
-
 
897
    oprot.writeMessageEnd()
-
 
898
    oprot.trans.flush()
-
 
899
 
843
  def process_getAllPromotions(self, seqid, iprot, oprot):
900
  def process_getAllPromotions(self, seqid, iprot, oprot):
844
    args = getAllPromotions_args()
901
    args = getAllPromotions_args()
845
    args.read(iprot)
902
    args.read(iprot)
846
    iprot.readMessageEnd()
903
    iprot.readMessageEnd()
847
    result = getAllPromotions_result()
904
    result = getAllPromotions_result()
Line 942... Line 999...
942
    args = createCoupon_args()
999
    args = createCoupon_args()
943
    args.read(iprot)
1000
    args.read(iprot)
944
    iprot.readMessageEnd()
1001
    iprot.readMessageEnd()
945
    result = createCoupon_result()
1002
    result = createCoupon_result()
946
    try:
1003
    try:
947
      result.success = self._handler.createCoupon(args.promotionId, args.endOn, args.email, args.amount, args.usage)
1004
      result.success = self._handler.createCoupon(args.promotionId, args.endOn, args.email, args.amount, args.isCod, args.usage)
948
    except PromotionException, pex:
1005
    except PromotionException, pex:
949
      result.pex = pex
1006
      result.pex = pex
950
    oprot.writeMessageBegin("createCoupon", TMessageType.REPLY, seqid)
1007
    oprot.writeMessageBegin("createCoupon", TMessageType.REPLY, seqid)
951
    result.write(oprot)
1008
    result.write(oprot)
952
    oprot.writeMessageEnd()
1009
    oprot.writeMessageEnd()
Line 1458... Line 1515...
1458
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1515
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1459
 
1516
 
1460
  def __ne__(self, other):
1517
  def __ne__(self, other):
1461
    return not (self == other)
1518
    return not (self == other)
1462
 
1519
 
-
 
1520
class isCodApplicable_args:
-
 
1521
  """
-
 
1522
  Attributes:
-
 
1523
   - couponCode
-
 
1524
  """
-
 
1525
 
-
 
1526
  thrift_spec = (
-
 
1527
    None, # 0
-
 
1528
    (1, TType.STRING, 'couponCode', None, None, ), # 1
-
 
1529
  )
-
 
1530
 
-
 
1531
  def __init__(self, couponCode=None,):
-
 
1532
    self.couponCode = couponCode
-
 
1533
 
-
 
1534
  def read(self, iprot):
-
 
1535
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1536
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1537
      return
-
 
1538
    iprot.readStructBegin()
-
 
1539
    while True:
-
 
1540
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1541
      if ftype == TType.STOP:
-
 
1542
        break
-
 
1543
      if fid == 1:
-
 
1544
        if ftype == TType.STRING:
-
 
1545
          self.couponCode = iprot.readString();
-
 
1546
        else:
-
 
1547
          iprot.skip(ftype)
-
 
1548
      else:
-
 
1549
        iprot.skip(ftype)
-
 
1550
      iprot.readFieldEnd()
-
 
1551
    iprot.readStructEnd()
-
 
1552
 
-
 
1553
  def write(self, oprot):
-
 
1554
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1555
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1556
      return
-
 
1557
    oprot.writeStructBegin('isCodApplicable_args')
-
 
1558
    if self.couponCode is not None:
-
 
1559
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
-
 
1560
      oprot.writeString(self.couponCode)
-
 
1561
      oprot.writeFieldEnd()
-
 
1562
    oprot.writeFieldStop()
-
 
1563
    oprot.writeStructEnd()
-
 
1564
 
-
 
1565
  def validate(self):
-
 
1566
    return
-
 
1567
 
-
 
1568
 
-
 
1569
  def __repr__(self):
-
 
1570
    L = ['%s=%r' % (key, value)
-
 
1571
      for key, value in self.__dict__.iteritems()]
-
 
1572
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1573
 
-
 
1574
  def __eq__(self, other):
-
 
1575
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1576
 
-
 
1577
  def __ne__(self, other):
-
 
1578
    return not (self == other)
-
 
1579
 
-
 
1580
class isCodApplicable_result:
-
 
1581
  """
-
 
1582
  Attributes:
-
 
1583
   - success
-
 
1584
   - pex
-
 
1585
  """
-
 
1586
 
-
 
1587
  thrift_spec = (
-
 
1588
    (0, TType.BOOL, 'success', None, None, ), # 0
-
 
1589
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
-
 
1590
  )
-
 
1591
 
-
 
1592
  def __init__(self, success=None, pex=None,):
-
 
1593
    self.success = success
-
 
1594
    self.pex = pex
-
 
1595
 
-
 
1596
  def read(self, iprot):
-
 
1597
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1598
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1599
      return
-
 
1600
    iprot.readStructBegin()
-
 
1601
    while True:
-
 
1602
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1603
      if ftype == TType.STOP:
-
 
1604
        break
-
 
1605
      if fid == 0:
-
 
1606
        if ftype == TType.BOOL:
-
 
1607
          self.success = iprot.readBool();
-
 
1608
        else:
-
 
1609
          iprot.skip(ftype)
-
 
1610
      elif fid == 1:
-
 
1611
        if ftype == TType.STRUCT:
-
 
1612
          self.pex = PromotionException()
-
 
1613
          self.pex.read(iprot)
-
 
1614
        else:
-
 
1615
          iprot.skip(ftype)
-
 
1616
      else:
-
 
1617
        iprot.skip(ftype)
-
 
1618
      iprot.readFieldEnd()
-
 
1619
    iprot.readStructEnd()
-
 
1620
 
-
 
1621
  def write(self, oprot):
-
 
1622
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
1623
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
1624
      return
-
 
1625
    oprot.writeStructBegin('isCodApplicable_result')
-
 
1626
    if self.success is not None:
-
 
1627
      oprot.writeFieldBegin('success', TType.BOOL, 0)
-
 
1628
      oprot.writeBool(self.success)
-
 
1629
      oprot.writeFieldEnd()
-
 
1630
    if self.pex is not None:
-
 
1631
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
-
 
1632
      self.pex.write(oprot)
-
 
1633
      oprot.writeFieldEnd()
-
 
1634
    oprot.writeFieldStop()
-
 
1635
    oprot.writeStructEnd()
-
 
1636
 
-
 
1637
  def validate(self):
-
 
1638
    return
-
 
1639
 
-
 
1640
 
-
 
1641
  def __repr__(self):
-
 
1642
    L = ['%s=%r' % (key, value)
-
 
1643
      for key, value in self.__dict__.iteritems()]
-
 
1644
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1645
 
-
 
1646
  def __eq__(self, other):
-
 
1647
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1648
 
-
 
1649
  def __ne__(self, other):
-
 
1650
    return not (self == other)
-
 
1651
 
1463
class getAllPromotions_args:
1652
class getAllPromotions_args:
1464
 
1653
 
1465
  thrift_spec = (
1654
  thrift_spec = (
1466
  )
1655
  )
1467
 
1656
 
Line 2411... Line 2600...
2411
  Attributes:
2600
  Attributes:
2412
   - promotionId
2601
   - promotionId
2413
   - endOn
2602
   - endOn
2414
   - email
2603
   - email
2415
   - amount
2604
   - amount
-
 
2605
   - isCod
2416
   - usage
2606
   - usage
2417
  """
2607
  """
2418
 
2608
 
2419
  thrift_spec = (
2609
  thrift_spec = (
2420
    None, # 0
2610
    None, # 0
2421
    (1, TType.I64, 'promotionId', None, None, ), # 1
2611
    (1, TType.I64, 'promotionId', None, None, ), # 1
2422
    (2, TType.I64, 'endOn', None, None, ), # 2
2612
    (2, TType.I64, 'endOn', None, None, ), # 2
2423
    (3, TType.STRING, 'email', None, None, ), # 3
2613
    (3, TType.STRING, 'email', None, None, ), # 3
2424
    (4, TType.I64, 'amount', None, None, ), # 4
2614
    (4, TType.I64, 'amount', None, None, ), # 4
-
 
2615
    (5, TType.BOOL, 'isCod', None, None, ), # 5
2425
    (5, TType.I64, 'usage', None, None, ), # 5
2616
    (6, TType.I64, 'usage', None, None, ), # 6
2426
  )
2617
  )
2427
 
2618
 
2428
  def __init__(self, promotionId=None, endOn=None, email=None, amount=None, usage=None,):
2619
  def __init__(self, promotionId=None, endOn=None, email=None, amount=None, isCod=None, usage=None,):
2429
    self.promotionId = promotionId
2620
    self.promotionId = promotionId
2430
    self.endOn = endOn
2621
    self.endOn = endOn
2431
    self.email = email
2622
    self.email = email
2432
    self.amount = amount
2623
    self.amount = amount
-
 
2624
    self.isCod = isCod
2433
    self.usage = usage
2625
    self.usage = usage
2434
 
2626
 
2435
  def read(self, iprot):
2627
  def read(self, iprot):
2436
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
2628
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
2437
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
2629
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
Line 2460... Line 2652...
2460
        if ftype == TType.I64:
2652
        if ftype == TType.I64:
2461
          self.amount = iprot.readI64();
2653
          self.amount = iprot.readI64();
2462
        else:
2654
        else:
2463
          iprot.skip(ftype)
2655
          iprot.skip(ftype)
2464
      elif fid == 5:
2656
      elif fid == 5:
-
 
2657
        if ftype == TType.BOOL:
-
 
2658
          self.isCod = iprot.readBool();
-
 
2659
        else:
-
 
2660
          iprot.skip(ftype)
-
 
2661
      elif fid == 6:
2465
        if ftype == TType.I64:
2662
        if ftype == TType.I64:
2466
          self.usage = iprot.readI64();
2663
          self.usage = iprot.readI64();
2467
        else:
2664
        else:
2468
          iprot.skip(ftype)
2665
          iprot.skip(ftype)
2469
      else:
2666
      else:
Line 2490... Line 2687...
2490
      oprot.writeFieldEnd()
2687
      oprot.writeFieldEnd()
2491
    if self.amount is not None:
2688
    if self.amount is not None:
2492
      oprot.writeFieldBegin('amount', TType.I64, 4)
2689
      oprot.writeFieldBegin('amount', TType.I64, 4)
2493
      oprot.writeI64(self.amount)
2690
      oprot.writeI64(self.amount)
2494
      oprot.writeFieldEnd()
2691
      oprot.writeFieldEnd()
-
 
2692
    if self.isCod is not None:
-
 
2693
      oprot.writeFieldBegin('isCod', TType.BOOL, 5)
-
 
2694
      oprot.writeBool(self.isCod)
-
 
2695
      oprot.writeFieldEnd()
2495
    if self.usage is not None:
2696
    if self.usage is not None:
2496
      oprot.writeFieldBegin('usage', TType.I64, 5)
2697
      oprot.writeFieldBegin('usage', TType.I64, 6)
2497
      oprot.writeI64(self.usage)
2698
      oprot.writeI64(self.usage)
2498
      oprot.writeFieldEnd()
2699
      oprot.writeFieldEnd()
2499
    oprot.writeFieldStop()
2700
    oprot.writeFieldStop()
2500
    oprot.writeStructEnd()
2701
    oprot.writeStructEnd()
2501
 
2702