Subversion Repositories SmartDukaan

Rev

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

Rev 3554 Rev 3557
Line 366... Line 366...
366
     - cartId
366
     - cartId
367
     - status
367
     - status
368
    """
368
    """
369
    pass
369
    pass
370
 
370
 
371
  def addItemToCart(self, cartId, itemId, quantity):
371
  def addItemToCart(self, cartId, itemId, quantity, sourceId):
372
    """
372
    """
373
    Parameters:
373
    Parameters:
374
     - cartId
374
     - cartId
375
     - itemId
375
     - itemId
376
     - quantity
376
     - quantity
-
 
377
     - sourceId
377
    """
378
    """
378
    pass
379
    pass
379
 
380
 
380
  def deleteItemFromCart(self, cartId, itemId):
381
  def deleteItemFromCart(self, cartId, itemId):
381
    """
382
    """
Line 455... Line 456...
455
     - sessionSource
456
     - sessionSource
456
     - sessionStartTime
457
     - sessionStartTime
457
    """
458
    """
458
    pass
459
    pass
459
 
460
 
460
  def validateCart(self, cartId):
461
  def validateCart(self, cartId, sourceId):
461
    """
462
    """
462
    Validates that:
463
    Validates that:
463
    1. The checkout timestamp is greater than the updatedOn timestamp.
464
    1. The checkout timestamp is greater than the updatedOn timestamp.
464
    2. All of the lines in the cart are active items.
465
    2. All of the lines in the cart are active items.
465
    3. The estimate for any of the lines in cart doesn't change.
466
    3. The estimate for any of the lines in cart doesn't change.
466
    If all three are true, returns empty string; else returns appropriate message.
467
    If all three are true, returns empty string; else returns appropriate message.
467
 
468
 
468
    Parameters:
469
    Parameters:
469
     - cartId
470
     - cartId
-
 
471
     - sourceId
470
    """
472
    """
471
    pass
473
    pass
472
 
474
 
473
  def mergeCart(self, fromCartId, toCartId):
475
  def mergeCart(self, fromCartId, toCartId):
474
    """
476
    """
Line 2145... Line 2147...
2145
    self._iprot.readMessageEnd()
2147
    self._iprot.readMessageEnd()
2146
    if result.scx is not None:
2148
    if result.scx is not None:
2147
      raise result.scx
2149
      raise result.scx
2148
    return
2150
    return
2149
 
2151
 
2150
  def addItemToCart(self, cartId, itemId, quantity):
2152
  def addItemToCart(self, cartId, itemId, quantity, sourceId):
2151
    """
2153
    """
2152
    Parameters:
2154
    Parameters:
2153
     - cartId
2155
     - cartId
2154
     - itemId
2156
     - itemId
2155
     - quantity
2157
     - quantity
-
 
2158
     - sourceId
2156
    """
2159
    """
2157
    self.send_addItemToCart(cartId, itemId, quantity)
2160
    self.send_addItemToCart(cartId, itemId, quantity, sourceId)
2158
    return self.recv_addItemToCart()
2161
    return self.recv_addItemToCart()
2159
 
2162
 
2160
  def send_addItemToCart(self, cartId, itemId, quantity):
2163
  def send_addItemToCart(self, cartId, itemId, quantity, sourceId):
2161
    self._oprot.writeMessageBegin('addItemToCart', TMessageType.CALL, self._seqid)
2164
    self._oprot.writeMessageBegin('addItemToCart', TMessageType.CALL, self._seqid)
2162
    args = addItemToCart_args()
2165
    args = addItemToCart_args()
2163
    args.cartId = cartId
2166
    args.cartId = cartId
2164
    args.itemId = itemId
2167
    args.itemId = itemId
2165
    args.quantity = quantity
2168
    args.quantity = quantity
-
 
2169
    args.sourceId = sourceId
2166
    args.write(self._oprot)
2170
    args.write(self._oprot)
2167
    self._oprot.writeMessageEnd()
2171
    self._oprot.writeMessageEnd()
2168
    self._oprot.trans.flush()
2172
    self._oprot.trans.flush()
2169
 
2173
 
2170
  def recv_addItemToCart(self, ):
2174
  def recv_addItemToCart(self, ):
Line 2481... Line 2485...
2481
      return result.success
2485
      return result.success
2482
    if result.scx is not None:
2486
    if result.scx is not None:
2483
      raise result.scx
2487
      raise result.scx
2484
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createOrders failed: unknown result");
2488
    raise TApplicationException(TApplicationException.MISSING_RESULT, "createOrders failed: unknown result");
2485
 
2489
 
2486
  def validateCart(self, cartId):
2490
  def validateCart(self, cartId, sourceId):
2487
    """
2491
    """
2488
    Validates that:
2492
    Validates that:
2489
    1. The checkout timestamp is greater than the updatedOn timestamp.
2493
    1. The checkout timestamp is greater than the updatedOn timestamp.
2490
    2. All of the lines in the cart are active items.
2494
    2. All of the lines in the cart are active items.
2491
    3. The estimate for any of the lines in cart doesn't change.
2495
    3. The estimate for any of the lines in cart doesn't change.
2492
    If all three are true, returns empty string; else returns appropriate message.
2496
    If all three are true, returns empty string; else returns appropriate message.
2493
 
2497
 
2494
    Parameters:
2498
    Parameters:
2495
     - cartId
2499
     - cartId
-
 
2500
     - sourceId
2496
    """
2501
    """
2497
    self.send_validateCart(cartId)
2502
    self.send_validateCart(cartId, sourceId)
2498
    return self.recv_validateCart()
2503
    return self.recv_validateCart()
2499
 
2504
 
2500
  def send_validateCart(self, cartId):
2505
  def send_validateCart(self, cartId, sourceId):
2501
    self._oprot.writeMessageBegin('validateCart', TMessageType.CALL, self._seqid)
2506
    self._oprot.writeMessageBegin('validateCart', TMessageType.CALL, self._seqid)
2502
    args = validateCart_args()
2507
    args = validateCart_args()
2503
    args.cartId = cartId
2508
    args.cartId = cartId
-
 
2509
    args.sourceId = sourceId
2504
    args.write(self._oprot)
2510
    args.write(self._oprot)
2505
    self._oprot.writeMessageEnd()
2511
    self._oprot.writeMessageEnd()
2506
    self._oprot.trans.flush()
2512
    self._oprot.trans.flush()
2507
 
2513
 
2508
  def recv_validateCart(self, ):
2514
  def recv_validateCart(self, ):
Line 3723... Line 3729...
3723
    args = addItemToCart_args()
3729
    args = addItemToCart_args()
3724
    args.read(iprot)
3730
    args.read(iprot)
3725
    iprot.readMessageEnd()
3731
    iprot.readMessageEnd()
3726
    result = addItemToCart_result()
3732
    result = addItemToCart_result()
3727
    try:
3733
    try:
3728
      result.success = self._handler.addItemToCart(args.cartId, args.itemId, args.quantity)
3734
      result.success = self._handler.addItemToCart(args.cartId, args.itemId, args.quantity, args.sourceId)
3729
    except ShoppingCartException, scx:
3735
    except ShoppingCartException, scx:
3730
      result.scx = scx
3736
      result.scx = scx
3731
    oprot.writeMessageBegin("addItemToCart", TMessageType.REPLY, seqid)
3737
    oprot.writeMessageBegin("addItemToCart", TMessageType.REPLY, seqid)
3732
    result.write(oprot)
3738
    result.write(oprot)
3733
    oprot.writeMessageEnd()
3739
    oprot.writeMessageEnd()
Line 3863... Line 3869...
3863
    args = validateCart_args()
3869
    args = validateCart_args()
3864
    args.read(iprot)
3870
    args.read(iprot)
3865
    iprot.readMessageEnd()
3871
    iprot.readMessageEnd()
3866
    result = validateCart_result()
3872
    result = validateCart_result()
3867
    try:
3873
    try:
3868
      result.success = self._handler.validateCart(args.cartId)
3874
      result.success = self._handler.validateCart(args.cartId, args.sourceId)
3869
    except ShoppingCartException, scex:
3875
    except ShoppingCartException, scex:
3870
      result.scex = scex
3876
      result.scex = scex
3871
    oprot.writeMessageBegin("validateCart", TMessageType.REPLY, seqid)
3877
    oprot.writeMessageBegin("validateCart", TMessageType.REPLY, seqid)
3872
    result.write(oprot)
3878
    result.write(oprot)
3873
    oprot.writeMessageEnd()
3879
    oprot.writeMessageEnd()
Line 10603... Line 10609...
10603
  """
10609
  """
10604
  Attributes:
10610
  Attributes:
10605
   - cartId
10611
   - cartId
10606
   - itemId
10612
   - itemId
10607
   - quantity
10613
   - quantity
-
 
10614
   - sourceId
10608
  """
10615
  """
10609
 
10616
 
10610
  thrift_spec = (
10617
  thrift_spec = (
10611
    None, # 0
10618
    None, # 0
10612
    (1, TType.I64, 'cartId', None, None, ), # 1
10619
    (1, TType.I64, 'cartId', None, None, ), # 1
10613
    (2, TType.I64, 'itemId', None, None, ), # 2
10620
    (2, TType.I64, 'itemId', None, None, ), # 2
10614
    (3, TType.I64, 'quantity', None, None, ), # 3
10621
    (3, TType.I64, 'quantity', None, None, ), # 3
-
 
10622
    (4, TType.I64, 'sourceId', None, None, ), # 4
10615
  )
10623
  )
10616
 
10624
 
10617
  def __init__(self, cartId=None, itemId=None, quantity=None,):
10625
  def __init__(self, cartId=None, itemId=None, quantity=None, sourceId=None,):
10618
    self.cartId = cartId
10626
    self.cartId = cartId
10619
    self.itemId = itemId
10627
    self.itemId = itemId
10620
    self.quantity = quantity
10628
    self.quantity = quantity
-
 
10629
    self.sourceId = sourceId
10621
 
10630
 
10622
  def read(self, iprot):
10631
  def read(self, iprot):
10623
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
10632
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
10624
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
10633
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
10625
      return
10634
      return
Line 10641... Line 10650...
10641
      elif fid == 3:
10650
      elif fid == 3:
10642
        if ftype == TType.I64:
10651
        if ftype == TType.I64:
10643
          self.quantity = iprot.readI64();
10652
          self.quantity = iprot.readI64();
10644
        else:
10653
        else:
10645
          iprot.skip(ftype)
10654
          iprot.skip(ftype)
-
 
10655
      elif fid == 4:
-
 
10656
        if ftype == TType.I64:
-
 
10657
          self.sourceId = iprot.readI64();
-
 
10658
        else:
-
 
10659
          iprot.skip(ftype)
10646
      else:
10660
      else:
10647
        iprot.skip(ftype)
10661
        iprot.skip(ftype)
10648
      iprot.readFieldEnd()
10662
      iprot.readFieldEnd()
10649
    iprot.readStructEnd()
10663
    iprot.readStructEnd()
10650
 
10664
 
Line 10663... Line 10677...
10663
      oprot.writeFieldEnd()
10677
      oprot.writeFieldEnd()
10664
    if self.quantity is not None:
10678
    if self.quantity is not None:
10665
      oprot.writeFieldBegin('quantity', TType.I64, 3)
10679
      oprot.writeFieldBegin('quantity', TType.I64, 3)
10666
      oprot.writeI64(self.quantity)
10680
      oprot.writeI64(self.quantity)
10667
      oprot.writeFieldEnd()
10681
      oprot.writeFieldEnd()
-
 
10682
    if self.sourceId is not None:
-
 
10683
      oprot.writeFieldBegin('sourceId', TType.I64, 4)
-
 
10684
      oprot.writeI64(self.sourceId)
-
 
10685
      oprot.writeFieldEnd()
10668
    oprot.writeFieldStop()
10686
    oprot.writeFieldStop()
10669
    oprot.writeStructEnd()
10687
    oprot.writeStructEnd()
10670
 
10688
 
10671
  def validate(self):
10689
  def validate(self):
10672
    return
10690
    return
Line 11998... Line 12016...
11998
 
12016
 
11999
class validateCart_args:
12017
class validateCart_args:
12000
  """
12018
  """
12001
  Attributes:
12019
  Attributes:
12002
   - cartId
12020
   - cartId
-
 
12021
   - sourceId
12003
  """
12022
  """
12004
 
12023
 
12005
  thrift_spec = (
12024
  thrift_spec = (
12006
    None, # 0
12025
    None, # 0
12007
    (1, TType.I64, 'cartId', None, None, ), # 1
12026
    (1, TType.I64, 'cartId', None, None, ), # 1
-
 
12027
    (2, TType.I64, 'sourceId', None, None, ), # 2
12008
  )
12028
  )
12009
 
12029
 
12010
  def __init__(self, cartId=None,):
12030
  def __init__(self, cartId=None, sourceId=None,):
12011
    self.cartId = cartId
12031
    self.cartId = cartId
-
 
12032
    self.sourceId = sourceId
12012
 
12033
 
12013
  def read(self, iprot):
12034
  def read(self, iprot):
12014
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
12035
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
12015
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
12036
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
12016
      return
12037
      return
Line 12022... Line 12043...
12022
      if fid == 1:
12043
      if fid == 1:
12023
        if ftype == TType.I64:
12044
        if ftype == TType.I64:
12024
          self.cartId = iprot.readI64();
12045
          self.cartId = iprot.readI64();
12025
        else:
12046
        else:
12026
          iprot.skip(ftype)
12047
          iprot.skip(ftype)
-
 
12048
      elif fid == 2:
-
 
12049
        if ftype == TType.I64:
-
 
12050
          self.sourceId = iprot.readI64();
-
 
12051
        else:
-
 
12052
          iprot.skip(ftype)
12027
      else:
12053
      else:
12028
        iprot.skip(ftype)
12054
        iprot.skip(ftype)
12029
      iprot.readFieldEnd()
12055
      iprot.readFieldEnd()
12030
    iprot.readStructEnd()
12056
    iprot.readStructEnd()
12031
 
12057
 
Line 12036... Line 12062...
12036
    oprot.writeStructBegin('validateCart_args')
12062
    oprot.writeStructBegin('validateCart_args')
12037
    if self.cartId is not None:
12063
    if self.cartId is not None:
12038
      oprot.writeFieldBegin('cartId', TType.I64, 1)
12064
      oprot.writeFieldBegin('cartId', TType.I64, 1)
12039
      oprot.writeI64(self.cartId)
12065
      oprot.writeI64(self.cartId)
12040
      oprot.writeFieldEnd()
12066
      oprot.writeFieldEnd()
-
 
12067
    if self.sourceId is not None:
-
 
12068
      oprot.writeFieldBegin('sourceId', TType.I64, 2)
-
 
12069
      oprot.writeI64(self.sourceId)
-
 
12070
      oprot.writeFieldEnd()
12041
    oprot.writeFieldStop()
12071
    oprot.writeFieldStop()
12042
    oprot.writeStructEnd()
12072
    oprot.writeStructEnd()
12043
 
12073
 
12044
  def validate(self):
12074
  def validate(self):
12045
    return
12075
    return