Subversion Repositories SmartDukaan

Rev

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

Rev 1408 Rev 1528
Line 160... Line 160...
160
    Parameters:
160
    Parameters:
161
     - orderId
161
     - orderId
162
    """
162
    """
163
    pass
163
    pass
164
 
164
 
165
  def getOrdersForTransaction(self, transactionId):
165
  def getOrdersForTransaction(self, transactionId, customerId):
166
    """
166
    """
-
 
167
    Returns list of orders for given transaction Id. Also filters based on customer Id so that
-
 
168
    only user who owns the transaction can view its order details.
-
 
169
    
167
    Parameters:
170
    Parameters:
168
     - transactionId
171
     - transactionId
-
 
172
     - customerId
169
    """
173
    """
170
    pass
174
    pass
171
 
175
 
172
  def getOrdersForCustomer(self, customerId, from_date, to_date, status):
176
  def getOrdersForCustomer(self, customerId, from_date, to_date, status):
173
    """
177
    """
Line 198... Line 202...
198
    Parameters:
202
    Parameters:
199
     - orderId
203
     - orderId
200
    """
204
    """
201
    pass
205
    pass
202
 
206
 
-
 
207
  def getOrderForCustomer(self, orderId, customerId):
-
 
208
    """
-
 
209
    Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
-
 
210
    Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
-
 
211
    
-
 
212
    Parameters:
-
 
213
     - orderId
-
 
214
     - customerId
-
 
215
    """
-
 
216
    pass
-
 
217
 
203
  def batchOrders(self, warehouseId):
218
  def batchOrders(self, warehouseId):
204
    """
219
    """
205
    Create a batch of all the pending orders for the given warehouse.
220
    Create a batch of all the pending orders for the given warehouse.
206
    The returned list is orderd by created_timestamp.
221
    The returned list is orderd by created_timestamp.
207
    If there are no pending orders, an empty list is returned.
222
    If there are no pending orders, an empty list is returned.
Line 896... Line 911...
896
      return result.success
911
      return result.success
897
    if result.ex != None:
912
    if result.ex != None:
898
      raise result.ex
913
      raise result.ex
899
    raise TApplicationException(TApplicationException.MISSING_RESULT, "billOrder failed: unknown result");
914
    raise TApplicationException(TApplicationException.MISSING_RESULT, "billOrder failed: unknown result");
900
 
915
 
901
  def getOrdersForTransaction(self, transactionId):
916
  def getOrdersForTransaction(self, transactionId, customerId):
902
    """
917
    """
-
 
918
    Returns list of orders for given transaction Id. Also filters based on customer Id so that
-
 
919
    only user who owns the transaction can view its order details.
-
 
920
    
903
    Parameters:
921
    Parameters:
904
     - transactionId
922
     - transactionId
-
 
923
     - customerId
905
    """
924
    """
906
    self.send_getOrdersForTransaction(transactionId)
925
    self.send_getOrdersForTransaction(transactionId, customerId)
907
    return self.recv_getOrdersForTransaction()
926
    return self.recv_getOrdersForTransaction()
908
 
927
 
909
  def send_getOrdersForTransaction(self, transactionId):
928
  def send_getOrdersForTransaction(self, transactionId, customerId):
910
    self._oprot.writeMessageBegin('getOrdersForTransaction', TMessageType.CALL, self._seqid)
929
    self._oprot.writeMessageBegin('getOrdersForTransaction', TMessageType.CALL, self._seqid)
911
    args = getOrdersForTransaction_args()
930
    args = getOrdersForTransaction_args()
912
    args.transactionId = transactionId
931
    args.transactionId = transactionId
-
 
932
    args.customerId = customerId
913
    args.write(self._oprot)
933
    args.write(self._oprot)
914
    self._oprot.writeMessageEnd()
934
    self._oprot.writeMessageEnd()
915
    self._oprot.trans.flush()
935
    self._oprot.trans.flush()
916
 
936
 
917
  def recv_getOrdersForTransaction(self, ):
937
  def recv_getOrdersForTransaction(self, ):
Line 1062... Line 1082...
1062
      return result.success
1082
      return result.success
1063
    if result.ex != None:
1083
    if result.ex != None:
1064
      raise result.ex
1084
      raise result.ex
1065
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLineItemsForOrder failed: unknown result");
1085
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLineItemsForOrder failed: unknown result");
1066
 
1086
 
-
 
1087
  def getOrderForCustomer(self, orderId, customerId):
-
 
1088
    """
-
 
1089
    Returns an order for the order Id. Also checks if the order belongs to the customer whose Id is passed.
-
 
1090
    Throws exception if either order Id is invalid or order does not below to the customer whose Id is passed.
-
 
1091
    
-
 
1092
    Parameters:
-
 
1093
     - orderId
-
 
1094
     - customerId
-
 
1095
    """
-
 
1096
    self.send_getOrderForCustomer(orderId, customerId)
-
 
1097
    return self.recv_getOrderForCustomer()
-
 
1098
 
-
 
1099
  def send_getOrderForCustomer(self, orderId, customerId):
-
 
1100
    self._oprot.writeMessageBegin('getOrderForCustomer', TMessageType.CALL, self._seqid)
-
 
1101
    args = getOrderForCustomer_args()
-
 
1102
    args.orderId = orderId
-
 
1103
    args.customerId = customerId
-
 
1104
    args.write(self._oprot)
-
 
1105
    self._oprot.writeMessageEnd()
-
 
1106
    self._oprot.trans.flush()
-
 
1107
 
-
 
1108
  def recv_getOrderForCustomer(self, ):
-
 
1109
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
1110
    if mtype == TMessageType.EXCEPTION:
-
 
1111
      x = TApplicationException()
-
 
1112
      x.read(self._iprot)
-
 
1113
      self._iprot.readMessageEnd()
-
 
1114
      raise x
-
 
1115
    result = getOrderForCustomer_result()
-
 
1116
    result.read(self._iprot)
-
 
1117
    self._iprot.readMessageEnd()
-
 
1118
    if result.success != None:
-
 
1119
      return result.success
-
 
1120
    if result.ex != None:
-
 
1121
      raise result.ex
-
 
1122
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getOrderForCustomer failed: unknown result");
-
 
1123
 
1067
  def batchOrders(self, warehouseId):
1124
  def batchOrders(self, warehouseId):
1068
    """
1125
    """
1069
    Create a batch of all the pending orders for the given warehouse.
1126
    Create a batch of all the pending orders for the given warehouse.
1070
    The returned list is orderd by created_timestamp.
1127
    The returned list is orderd by created_timestamp.
1071
    If there are no pending orders, an empty list is returned.
1128
    If there are no pending orders, an empty list is returned.
Line 1441... Line 1498...
1441
    self._processMap["getOrdersForTransaction"] = Processor.process_getOrdersForTransaction
1498
    self._processMap["getOrdersForTransaction"] = Processor.process_getOrdersForTransaction
1442
    self._processMap["getOrdersForCustomer"] = Processor.process_getOrdersForCustomer
1499
    self._processMap["getOrdersForCustomer"] = Processor.process_getOrdersForCustomer
1443
    self._processMap["createOrder"] = Processor.process_createOrder
1500
    self._processMap["createOrder"] = Processor.process_createOrder
1444
    self._processMap["getOrder"] = Processor.process_getOrder
1501
    self._processMap["getOrder"] = Processor.process_getOrder
1445
    self._processMap["getLineItemsForOrder"] = Processor.process_getLineItemsForOrder
1502
    self._processMap["getLineItemsForOrder"] = Processor.process_getLineItemsForOrder
-
 
1503
    self._processMap["getOrderForCustomer"] = Processor.process_getOrderForCustomer
1446
    self._processMap["batchOrders"] = Processor.process_batchOrders
1504
    self._processMap["batchOrders"] = Processor.process_batchOrders
1447
    self._processMap["markOrderAsOutOfStock"] = Processor.process_markOrderAsOutOfStock
1505
    self._processMap["markOrderAsOutOfStock"] = Processor.process_markOrderAsOutOfStock
1448
    self._processMap["markOrdersAsManifested"] = Processor.process_markOrdersAsManifested
1506
    self._processMap["markOrdersAsManifested"] = Processor.process_markOrdersAsManifested
1449
    self._processMap["markOrdersAsPickedUp"] = Processor.process_markOrdersAsPickedUp
1507
    self._processMap["markOrdersAsPickedUp"] = Processor.process_markOrdersAsPickedUp
1450
    self._processMap["markOrdersAsDelivered"] = Processor.process_markOrdersAsDelivered
1508
    self._processMap["markOrdersAsDelivered"] = Processor.process_markOrdersAsDelivered
Line 1708... Line 1766...
1708
    args = getOrdersForTransaction_args()
1766
    args = getOrdersForTransaction_args()
1709
    args.read(iprot)
1767
    args.read(iprot)
1710
    iprot.readMessageEnd()
1768
    iprot.readMessageEnd()
1711
    result = getOrdersForTransaction_result()
1769
    result = getOrdersForTransaction_result()
1712
    try:
1770
    try:
1713
      result.success = self._handler.getOrdersForTransaction(args.transactionId)
1771
      result.success = self._handler.getOrdersForTransaction(args.transactionId, args.customerId)
1714
    except TransactionServiceException, ex:
1772
    except TransactionServiceException, ex:
1715
      result.ex = ex
1773
      result.ex = ex
1716
    oprot.writeMessageBegin("getOrdersForTransaction", TMessageType.REPLY, seqid)
1774
    oprot.writeMessageBegin("getOrdersForTransaction", TMessageType.REPLY, seqid)
1717
    result.write(oprot)
1775
    result.write(oprot)
1718
    oprot.writeMessageEnd()
1776
    oprot.writeMessageEnd()
Line 1772... Line 1830...
1772
    oprot.writeMessageBegin("getLineItemsForOrder", TMessageType.REPLY, seqid)
1830
    oprot.writeMessageBegin("getLineItemsForOrder", TMessageType.REPLY, seqid)
1773
    result.write(oprot)
1831
    result.write(oprot)
1774
    oprot.writeMessageEnd()
1832
    oprot.writeMessageEnd()
1775
    oprot.trans.flush()
1833
    oprot.trans.flush()
1776
 
1834
 
-
 
1835
  def process_getOrderForCustomer(self, seqid, iprot, oprot):
-
 
1836
    args = getOrderForCustomer_args()
-
 
1837
    args.read(iprot)
-
 
1838
    iprot.readMessageEnd()
-
 
1839
    result = getOrderForCustomer_result()
-
 
1840
    try:
-
 
1841
      result.success = self._handler.getOrderForCustomer(args.orderId, args.customerId)
-
 
1842
    except TransactionServiceException, ex:
-
 
1843
      result.ex = ex
-
 
1844
    oprot.writeMessageBegin("getOrderForCustomer", TMessageType.REPLY, seqid)
-
 
1845
    result.write(oprot)
-
 
1846
    oprot.writeMessageEnd()
-
 
1847
    oprot.trans.flush()
-
 
1848
 
1777
  def process_batchOrders(self, seqid, iprot, oprot):
1849
  def process_batchOrders(self, seqid, iprot, oprot):
1778
    args = batchOrders_args()
1850
    args = batchOrders_args()
1779
    args.read(iprot)
1851
    args.read(iprot)
1780
    iprot.readMessageEnd()
1852
    iprot.readMessageEnd()
1781
    result = batchOrders_result()
1853
    result = batchOrders_result()
Line 4240... Line 4312...
4240
 
4312
 
4241
class getOrdersForTransaction_args:
4313
class getOrdersForTransaction_args:
4242
  """
4314
  """
4243
  Attributes:
4315
  Attributes:
4244
   - transactionId
4316
   - transactionId
-
 
4317
   - customerId
4245
  """
4318
  """
4246
 
4319
 
4247
  thrift_spec = (
4320
  thrift_spec = (
4248
    None, # 0
4321
    None, # 0
4249
    (1, TType.I64, 'transactionId', None, None, ), # 1
4322
    (1, TType.I64, 'transactionId', None, None, ), # 1
-
 
4323
    (2, TType.I64, 'customerId', None, None, ), # 2
4250
  )
4324
  )
4251
 
4325
 
4252
  def __init__(self, transactionId=None,):
4326
  def __init__(self, transactionId=None, customerId=None,):
4253
    self.transactionId = transactionId
4327
    self.transactionId = transactionId
-
 
4328
    self.customerId = customerId
4254
 
4329
 
4255
  def read(self, iprot):
4330
  def read(self, iprot):
4256
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
4331
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
4257
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
4332
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
4258
      return
4333
      return
Line 4264... Line 4339...
4264
      if fid == 1:
4339
      if fid == 1:
4265
        if ftype == TType.I64:
4340
        if ftype == TType.I64:
4266
          self.transactionId = iprot.readI64();
4341
          self.transactionId = iprot.readI64();
4267
        else:
4342
        else:
4268
          iprot.skip(ftype)
4343
          iprot.skip(ftype)
-
 
4344
      elif fid == 2:
-
 
4345
        if ftype == TType.I64:
-
 
4346
          self.customerId = iprot.readI64();
-
 
4347
        else:
-
 
4348
          iprot.skip(ftype)
4269
      else:
4349
      else:
4270
        iprot.skip(ftype)
4350
        iprot.skip(ftype)
4271
      iprot.readFieldEnd()
4351
      iprot.readFieldEnd()
4272
    iprot.readStructEnd()
4352
    iprot.readStructEnd()
4273
 
4353
 
Line 4278... Line 4358...
4278
    oprot.writeStructBegin('getOrdersForTransaction_args')
4358
    oprot.writeStructBegin('getOrdersForTransaction_args')
4279
    if self.transactionId != None:
4359
    if self.transactionId != None:
4280
      oprot.writeFieldBegin('transactionId', TType.I64, 1)
4360
      oprot.writeFieldBegin('transactionId', TType.I64, 1)
4281
      oprot.writeI64(self.transactionId)
4361
      oprot.writeI64(self.transactionId)
4282
      oprot.writeFieldEnd()
4362
      oprot.writeFieldEnd()
-
 
4363
    if self.customerId != None:
-
 
4364
      oprot.writeFieldBegin('customerId', TType.I64, 2)
-
 
4365
      oprot.writeI64(self.customerId)
-
 
4366
      oprot.writeFieldEnd()
4283
    oprot.writeFieldStop()
4367
    oprot.writeFieldStop()
4284
    oprot.writeStructEnd()
4368
    oprot.writeStructEnd()
4285
 
4369
 
4286
  def __repr__(self):
4370
  def __repr__(self):
4287
    L = ['%s=%r' % (key, value)
4371
    L = ['%s=%r' % (key, value)
Line 4907... Line 4991...
4907
      oprot.writeFieldEnd()
4991
      oprot.writeFieldEnd()
4908
    if self.ex != None:
4992
    if self.ex != None:
4909
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
4993
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
4910
      self.ex.write(oprot)
4994
      self.ex.write(oprot)
4911
      oprot.writeFieldEnd()
4995
      oprot.writeFieldEnd()
-
 
4996
    oprot.writeFieldStop()
-
 
4997
    oprot.writeStructEnd()
-
 
4998
 
-
 
4999
  def __repr__(self):
-
 
5000
    L = ['%s=%r' % (key, value)
-
 
5001
      for key, value in self.__dict__.iteritems()]
-
 
5002
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
5003
 
-
 
5004
  def __eq__(self, other):
-
 
5005
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
5006
 
-
 
5007
  def __ne__(self, other):
-
 
5008
    return not (self == other)
-
 
5009
 
-
 
5010
class getOrderForCustomer_args:
-
 
5011
  """
-
 
5012
  Attributes:
-
 
5013
   - orderId
-
 
5014
   - customerId
-
 
5015
  """
-
 
5016
 
-
 
5017
  thrift_spec = (
-
 
5018
    None, # 0
-
 
5019
    (1, TType.I64, 'orderId', None, None, ), # 1
-
 
5020
    (2, TType.I64, 'customerId', None, None, ), # 2
-
 
5021
  )
-
 
5022
 
-
 
5023
  def __init__(self, orderId=None, customerId=None,):
-
 
5024
    self.orderId = orderId
-
 
5025
    self.customerId = customerId
-
 
5026
 
-
 
5027
  def read(self, iprot):
-
 
5028
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
5029
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
5030
      return
-
 
5031
    iprot.readStructBegin()
-
 
5032
    while True:
-
 
5033
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
5034
      if ftype == TType.STOP:
-
 
5035
        break
-
 
5036
      if fid == 1:
-
 
5037
        if ftype == TType.I64:
-
 
5038
          self.orderId = iprot.readI64();
-
 
5039
        else:
-
 
5040
          iprot.skip(ftype)
-
 
5041
      elif fid == 2:
-
 
5042
        if ftype == TType.I64:
-
 
5043
          self.customerId = iprot.readI64();
-
 
5044
        else:
-
 
5045
          iprot.skip(ftype)
-
 
5046
      else:
-
 
5047
        iprot.skip(ftype)
-
 
5048
      iprot.readFieldEnd()
-
 
5049
    iprot.readStructEnd()
-
 
5050
 
-
 
5051
  def write(self, oprot):
-
 
5052
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
5053
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
5054
      return
-
 
5055
    oprot.writeStructBegin('getOrderForCustomer_args')
-
 
5056
    if self.orderId != None:
-
 
5057
      oprot.writeFieldBegin('orderId', TType.I64, 1)
-
 
5058
      oprot.writeI64(self.orderId)
-
 
5059
      oprot.writeFieldEnd()
-
 
5060
    if self.customerId != None:
-
 
5061
      oprot.writeFieldBegin('customerId', TType.I64, 2)
-
 
5062
      oprot.writeI64(self.customerId)
-
 
5063
      oprot.writeFieldEnd()
-
 
5064
    oprot.writeFieldStop()
-
 
5065
    oprot.writeStructEnd()
-
 
5066
 
-
 
5067
  def __repr__(self):
-
 
5068
    L = ['%s=%r' % (key, value)
-
 
5069
      for key, value in self.__dict__.iteritems()]
-
 
5070
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
5071
 
-
 
5072
  def __eq__(self, other):
-
 
5073
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
5074
 
-
 
5075
  def __ne__(self, other):
-
 
5076
    return not (self == other)
-
 
5077
 
-
 
5078
class getOrderForCustomer_result:
-
 
5079
  """
-
 
5080
  Attributes:
-
 
5081
   - success
-
 
5082
   - ex
-
 
5083
  """
-
 
5084
 
-
 
5085
  thrift_spec = (
-
 
5086
    (0, TType.STRUCT, 'success', (Order, Order.thrift_spec), None, ), # 0
-
 
5087
    (1, TType.STRUCT, 'ex', (TransactionServiceException, TransactionServiceException.thrift_spec), None, ), # 1
-
 
5088
  )
-
 
5089
 
-
 
5090
  def __init__(self, success=None, ex=None,):
-
 
5091
    self.success = success
-
 
5092
    self.ex = ex
-
 
5093
 
-
 
5094
  def read(self, iprot):
-
 
5095
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
5096
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
5097
      return
-
 
5098
    iprot.readStructBegin()
-
 
5099
    while True:
-
 
5100
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
5101
      if ftype == TType.STOP:
-
 
5102
        break
-
 
5103
      if fid == 0:
-
 
5104
        if ftype == TType.STRUCT:
-
 
5105
          self.success = Order()
-
 
5106
          self.success.read(iprot)
-
 
5107
        else:
-
 
5108
          iprot.skip(ftype)
-
 
5109
      elif fid == 1:
-
 
5110
        if ftype == TType.STRUCT:
-
 
5111
          self.ex = TransactionServiceException()
-
 
5112
          self.ex.read(iprot)
-
 
5113
        else:
-
 
5114
          iprot.skip(ftype)
-
 
5115
      else:
-
 
5116
        iprot.skip(ftype)
-
 
5117
      iprot.readFieldEnd()
-
 
5118
    iprot.readStructEnd()
-
 
5119
 
-
 
5120
  def write(self, oprot):
-
 
5121
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
5122
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
5123
      return
-
 
5124
    oprot.writeStructBegin('getOrderForCustomer_result')
-
 
5125
    if self.success != None:
-
 
5126
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
5127
      self.success.write(oprot)
-
 
5128
      oprot.writeFieldEnd()
-
 
5129
    if self.ex != None:
-
 
5130
      oprot.writeFieldBegin('ex', TType.STRUCT, 1)
-
 
5131
      self.ex.write(oprot)
-
 
5132
      oprot.writeFieldEnd()
4912
    oprot.writeFieldStop()
5133
    oprot.writeFieldStop()
4913
    oprot.writeStructEnd()
5134
    oprot.writeStructEnd()
4914
 
5135
 
4915
  def __repr__(self):
5136
  def __repr__(self):
4916
    L = ['%s=%r' % (key, value)
5137
    L = ['%s=%r' % (key, value)