Subversion Repositories SmartDukaan

Rev

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

Rev 669 Rev 675
Line 23... Line 23...
23
    Parameters:
23
    Parameters:
24
     - providerId
24
     - providerId
25
    """
25
    """
26
    pass
26
    pass
27
 
27
 
-
 
28
  def getAllProviders(self, ):
-
 
29
    """
-
 
30
    Returns a list containing all the providers.
-
 
31
    """
-
 
32
    pass
-
 
33
 
28
  def getLogisticsEstimation(self, itemId, destination_pin):
34
  def getLogisticsEstimation(self, itemId, destination_pin):
29
    """
35
    """
30
    Returns a LogisticsInfo structure w/o an airway bill number. Use this method during the estimation phase.
36
    Returns a LogisticsInfo structure w/o an airway bill number. Use this method during the estimation phase.
31
    Raises an exception if this pincode is not allocated to any warehouse zone or provider. Also, if the pincode
37
    Raises an exception if this pincode is not allocated to any warehouse zone or provider. Also, if the pincode
32
    is allocated to a warehouse zone but there are no actual warehouses in that zone, an exception is raised.
38
    is allocated to a warehouse zone but there are no actual warehouses in that zone, an exception is raised.
Line 106... Line 112...
106
      return result.success
112
      return result.success
107
    if result.lse != None:
113
    if result.lse != None:
108
      raise result.lse
114
      raise result.lse
109
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getProvider failed: unknown result");
115
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getProvider failed: unknown result");
110
 
116
 
-
 
117
  def getAllProviders(self, ):
-
 
118
    """
-
 
119
    Returns a list containing all the providers.
-
 
120
    """
-
 
121
    self.send_getAllProviders()
-
 
122
    return self.recv_getAllProviders()
-
 
123
 
-
 
124
  def send_getAllProviders(self, ):
-
 
125
    self._oprot.writeMessageBegin('getAllProviders', TMessageType.CALL, self._seqid)
-
 
126
    args = getAllProviders_args()
-
 
127
    args.write(self._oprot)
-
 
128
    self._oprot.writeMessageEnd()
-
 
129
    self._oprot.trans.flush()
-
 
130
 
-
 
131
  def recv_getAllProviders(self, ):
-
 
132
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
133
    if mtype == TMessageType.EXCEPTION:
-
 
134
      x = TApplicationException()
-
 
135
      x.read(self._iprot)
-
 
136
      self._iprot.readMessageEnd()
-
 
137
      raise x
-
 
138
    result = getAllProviders_result()
-
 
139
    result.read(self._iprot)
-
 
140
    self._iprot.readMessageEnd()
-
 
141
    if result.success != None:
-
 
142
      return result.success
-
 
143
    if result.lse != None:
-
 
144
      raise result.lse
-
 
145
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllProviders failed: unknown result");
-
 
146
 
111
  def getLogisticsEstimation(self, itemId, destination_pin):
147
  def getLogisticsEstimation(self, itemId, destination_pin):
112
    """
148
    """
113
    Returns a LogisticsInfo structure w/o an airway bill number. Use this method during the estimation phase.
149
    Returns a LogisticsInfo structure w/o an airway bill number. Use this method during the estimation phase.
114
    Raises an exception if this pincode is not allocated to any warehouse zone or provider. Also, if the pincode
150
    Raises an exception if this pincode is not allocated to any warehouse zone or provider. Also, if the pincode
115
    is allocated to a warehouse zone but there are no actual warehouses in that zone, an exception is raised.
151
    is allocated to a warehouse zone but there are no actual warehouses in that zone, an exception is raised.
Line 256... Line 292...
256
class Processor(Iface, TProcessor):
292
class Processor(Iface, TProcessor):
257
  def __init__(self, handler):
293
  def __init__(self, handler):
258
    self._handler = handler
294
    self._handler = handler
259
    self._processMap = {}
295
    self._processMap = {}
260
    self._processMap["getProvider"] = Processor.process_getProvider
296
    self._processMap["getProvider"] = Processor.process_getProvider
-
 
297
    self._processMap["getAllProviders"] = Processor.process_getAllProviders
261
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
298
    self._processMap["getLogisticsEstimation"] = Processor.process_getLogisticsEstimation
262
    self._processMap["getLogisticsInfo"] = Processor.process_getLogisticsInfo
299
    self._processMap["getLogisticsInfo"] = Processor.process_getLogisticsInfo
263
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
300
    self._processMap["getEmptyAWB"] = Processor.process_getEmptyAWB
264
    self._processMap["getShipmentInfo"] = Processor.process_getShipmentInfo
301
    self._processMap["getShipmentInfo"] = Processor.process_getShipmentInfo
265
 
302
 
Line 290... Line 327...
290
    oprot.writeMessageBegin("getProvider", TMessageType.REPLY, seqid)
327
    oprot.writeMessageBegin("getProvider", TMessageType.REPLY, seqid)
291
    result.write(oprot)
328
    result.write(oprot)
292
    oprot.writeMessageEnd()
329
    oprot.writeMessageEnd()
293
    oprot.trans.flush()
330
    oprot.trans.flush()
294
 
331
 
-
 
332
  def process_getAllProviders(self, seqid, iprot, oprot):
-
 
333
    args = getAllProviders_args()
-
 
334
    args.read(iprot)
-
 
335
    iprot.readMessageEnd()
-
 
336
    result = getAllProviders_result()
-
 
337
    try:
-
 
338
      result.success = self._handler.getAllProviders()
-
 
339
    except LogisticsServiceException, lse:
-
 
340
      result.lse = lse
-
 
341
    oprot.writeMessageBegin("getAllProviders", TMessageType.REPLY, seqid)
-
 
342
    result.write(oprot)
-
 
343
    oprot.writeMessageEnd()
-
 
344
    oprot.trans.flush()
-
 
345
 
295
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
346
  def process_getLogisticsEstimation(self, seqid, iprot, oprot):
296
    args = getLogisticsEstimation_args()
347
    args = getLogisticsEstimation_args()
297
    args.read(iprot)
348
    args.read(iprot)
298
    iprot.readMessageEnd()
349
    iprot.readMessageEnd()
299
    result = getLogisticsEstimation_result()
350
    result = getLogisticsEstimation_result()
Line 474... Line 525...
474
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
525
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
475
 
526
 
476
  def __ne__(self, other):
527
  def __ne__(self, other):
477
    return not (self == other)
528
    return not (self == other)
478
 
529
 
-
 
530
class getAllProviders_args:
-
 
531
 
-
 
532
  thrift_spec = (
-
 
533
  )
-
 
534
 
-
 
535
  def read(self, iprot):
-
 
536
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
537
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
538
      return
-
 
539
    iprot.readStructBegin()
-
 
540
    while True:
-
 
541
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
542
      if ftype == TType.STOP:
-
 
543
        break
-
 
544
      else:
-
 
545
        iprot.skip(ftype)
-
 
546
      iprot.readFieldEnd()
-
 
547
    iprot.readStructEnd()
-
 
548
 
-
 
549
  def write(self, oprot):
-
 
550
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
551
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
552
      return
-
 
553
    oprot.writeStructBegin('getAllProviders_args')
-
 
554
    oprot.writeFieldStop()
-
 
555
    oprot.writeStructEnd()
-
 
556
 
-
 
557
  def __repr__(self):
-
 
558
    L = ['%s=%r' % (key, value)
-
 
559
      for key, value in self.__dict__.iteritems()]
-
 
560
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
561
 
-
 
562
  def __eq__(self, other):
-
 
563
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
564
 
-
 
565
  def __ne__(self, other):
-
 
566
    return not (self == other)
-
 
567
 
-
 
568
class getAllProviders_result:
-
 
569
  """
-
 
570
  Attributes:
-
 
571
   - success
-
 
572
   - lse
-
 
573
  """
-
 
574
 
-
 
575
  thrift_spec = (
-
 
576
    (0, TType.LIST, 'success', (TType.STRUCT,(Provider, Provider.thrift_spec)), None, ), # 0
-
 
577
    (1, TType.STRUCT, 'lse', (LogisticsServiceException, LogisticsServiceException.thrift_spec), None, ), # 1
-
 
578
  )
-
 
579
 
-
 
580
  def __init__(self, success=None, lse=None,):
-
 
581
    self.success = success
-
 
582
    self.lse = lse
-
 
583
 
-
 
584
  def read(self, iprot):
-
 
585
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
586
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
587
      return
-
 
588
    iprot.readStructBegin()
-
 
589
    while True:
-
 
590
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
591
      if ftype == TType.STOP:
-
 
592
        break
-
 
593
      if fid == 0:
-
 
594
        if ftype == TType.LIST:
-
 
595
          self.success = []
-
 
596
          (_etype3, _size0) = iprot.readListBegin()
-
 
597
          for _i4 in xrange(_size0):
-
 
598
            _elem5 = Provider()
-
 
599
            _elem5.read(iprot)
-
 
600
            self.success.append(_elem5)
-
 
601
          iprot.readListEnd()
-
 
602
        else:
-
 
603
          iprot.skip(ftype)
-
 
604
      elif fid == 1:
-
 
605
        if ftype == TType.STRUCT:
-
 
606
          self.lse = LogisticsServiceException()
-
 
607
          self.lse.read(iprot)
-
 
608
        else:
-
 
609
          iprot.skip(ftype)
-
 
610
      else:
-
 
611
        iprot.skip(ftype)
-
 
612
      iprot.readFieldEnd()
-
 
613
    iprot.readStructEnd()
-
 
614
 
-
 
615
  def write(self, oprot):
-
 
616
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
617
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
618
      return
-
 
619
    oprot.writeStructBegin('getAllProviders_result')
-
 
620
    if self.success != None:
-
 
621
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
622
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
623
      for iter6 in self.success:
-
 
624
        iter6.write(oprot)
-
 
625
      oprot.writeListEnd()
-
 
626
      oprot.writeFieldEnd()
-
 
627
    if self.lse != None:
-
 
628
      oprot.writeFieldBegin('lse', TType.STRUCT, 1)
-
 
629
      self.lse.write(oprot)
-
 
630
      oprot.writeFieldEnd()
-
 
631
    oprot.writeFieldStop()
-
 
632
    oprot.writeStructEnd()
-
 
633
 
-
 
634
  def __repr__(self):
-
 
635
    L = ['%s=%r' % (key, value)
-
 
636
      for key, value in self.__dict__.iteritems()]
-
 
637
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
638
 
-
 
639
  def __eq__(self, other):
-
 
640
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
641
 
-
 
642
  def __ne__(self, other):
-
 
643
    return not (self == other)
-
 
644
 
479
class getLogisticsEstimation_args:
645
class getLogisticsEstimation_args:
480
  """
646
  """
481
  Attributes:
647
  Attributes:
482
   - itemId
648
   - itemId
483
   - destination_pin
649
   - destination_pin
Line 968... Line 1134...
968
      if ftype == TType.STOP:
1134
      if ftype == TType.STOP:
969
        break
1135
        break
970
      if fid == 0:
1136
      if fid == 0:
971
        if ftype == TType.LIST:
1137
        if ftype == TType.LIST:
972
          self.success = []
1138
          self.success = []
973
          (_etype3, _size0) = iprot.readListBegin()
1139
          (_etype10, _size7) = iprot.readListBegin()
974
          for _i4 in xrange(_size0):
1140
          for _i11 in xrange(_size7):
975
            _elem5 = AwbUpdate()
1141
            _elem12 = AwbUpdate()
976
            _elem5.read(iprot)
1142
            _elem12.read(iprot)
977
            self.success.append(_elem5)
1143
            self.success.append(_elem12)
978
          iprot.readListEnd()
1144
          iprot.readListEnd()
979
        else:
1145
        else:
980
          iprot.skip(ftype)
1146
          iprot.skip(ftype)
981
      elif fid == 1:
1147
      elif fid == 1:
982
        if ftype == TType.STRUCT:
1148
        if ftype == TType.STRUCT:
Line 995... Line 1161...
995
      return
1161
      return
996
    oprot.writeStructBegin('getShipmentInfo_result')
1162
    oprot.writeStructBegin('getShipmentInfo_result')
997
    if self.success != None:
1163
    if self.success != None:
998
      oprot.writeFieldBegin('success', TType.LIST, 0)
1164
      oprot.writeFieldBegin('success', TType.LIST, 0)
999
      oprot.writeListBegin(TType.STRUCT, len(self.success))
1165
      oprot.writeListBegin(TType.STRUCT, len(self.success))
1000
      for iter6 in self.success:
1166
      for iter13 in self.success:
1001
        iter6.write(oprot)
1167
        iter13.write(oprot)
1002
      oprot.writeListEnd()
1168
      oprot.writeListEnd()
1003
      oprot.writeFieldEnd()
1169
      oprot.writeFieldEnd()
1004
    if self.se != None:
1170
    if self.se != None:
1005
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
1171
      oprot.writeFieldBegin('se', TType.STRUCT, 1)
1006
      self.se.write(oprot)
1172
      self.se.write(oprot)